[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property inc/class.boXport.inc.php inc/class.bo...
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] property inc/class.boXport.inc.php inc/class.bo... |
Date: |
Fri, 03 Feb 2006 12:05:50 +0000 |
CVSROOT: /sources/phpgroupware
Module name: property
Branch:
Changes by: Sigurd Nes <address@hidden> 06/02/03 12:05:49
Modified files:
inc : class.boXport.inc.php class.boactor.inc.php
class.boadmin.inc.php
class.boadmin_location.inc.php
class.boagreement.inc.php class.boalarm.inc.php
class.boasync.inc.php class.bob_account.inc.php
class.bocategory.inc.php class.bocommon.inc.php
class.bocustom.inc.php class.bodocument.inc.php
class.boentity.inc.php class.bogab.inc.php
class.boinvestment.inc.php
class.boinvoice.inc.php
class.bolocation.inc.php class.bolookup.inc.php
class.bometer.inc.php class.bop_of_town.inc.php
class.bopricebook.inc.php
class.boproject.inc.php class.borequest.inc.php
class.bos_agreement.inc.php
class.bostandard_2.inc.php
class.bostandard_3.inc.php
class.bostandard_entity.inc.php
class.botemplate.inc.php
class.botenant_claim.inc.php
class.botts.inc.php class.bowo_hour.inc.php
class.boworkorder.inc.php
class.custom_functions.inc.php
class.excel.inc.php class.historylog.inc.php
class.menu.inc.php class.pdf.inc.php
class.soXport.inc.php class.sogab.inc.php
class.uiXport.inc.php class.uiactor.inc.php
class.uiadmin.inc.php
class.uiadmin_entity.inc.php
class.uiadmin_location.inc.php
class.uiagreement.inc.php class.uialarm.inc.php
class.uiasync.inc.php class.uib_account.inc.php
class.uicategory.inc.php class.uicustom.inc.php
class.uidocument.inc.php class.uientity.inc.php
class.uigab.inc.php class.uiinvestment.inc.php
class.uilocation.inc.php class.uilookup.inc.php
class.uimeter.inc.php class.uip_of_town.inc.php
class.uipricebook.inc.php
class.uiproject.inc.php class.uirequest.inc.php
class.uis_agreement.inc.php
class.uistandard_2.inc.php
class.uistandard_3.inc.php
class.uistandard_entity.inc.php
class.uitemplate.inc.php
class.uitenant_claim.inc.php
class.uitts.inc.php class.uiwo_hour.inc.php
class.uiworkorder.inc.php hook_admin.inc.php
hook_help.inc.php hook_home.inc.php
hook_manual.inc.php hook_preferences.inc.php
hook_settings.inc.php
inc/custom : cron.php
inc/export : Agresso
setup : setup.inc.php
templates/base : admin_entity.xsl invoice.xsl
templates/default: admin_entity.xsl invoice.xsl
Log message:
dos2unix
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boXport.inc.php.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boactor.inc.php.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boadmin.inc.php.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boadmin_location.inc.php.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boagreement.inc.php.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boalarm.inc.php.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boasync.inc.php.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bob_account.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bocategory.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bocommon.inc.php.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bocustom.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bodocument.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boentity.inc.php.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bogab.inc.php.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boinvestment.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boinvoice.inc.php.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bolocation.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bolookup.inc.php.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bometer.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bop_of_town.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bopricebook.inc.php.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boproject.inc.php.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.borequest.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bos_agreement.inc.php.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bostandard_2.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bostandard_3.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bostandard_entity.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.botemplate.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.botenant_claim.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.botts.inc.php.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bowo_hour.inc.php.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boworkorder.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.custom_functions.inc.php.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.excel.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.historylog.inc.php.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.menu.inc.php.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.pdf.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.soXport.inc.php.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sogab.inc.php.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiXport.inc.php.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiactor.inc.php.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiadmin.inc.php.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiadmin_entity.inc.php.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiadmin_location.inc.php.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiagreement.inc.php.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uialarm.inc.php.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiasync.inc.php.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uib_account.inc.php.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uicategory.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uicustom.inc.php.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uidocument.inc.php.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uientity.inc.php.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uigab.inc.php.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiinvestment.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uilocation.inc.php.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uilookup.inc.php.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uimeter.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uip_of_town.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uipricebook.inc.php.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiproject.inc.php.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uirequest.inc.php.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uis_agreement.inc.php.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uistandard_2.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uistandard_3.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uistandard_entity.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uitemplate.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uitenant_claim.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uitts.inc.php.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiwo_hour.inc.php.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiworkorder.inc.php.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/hook_admin.inc.php.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/hook_help.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/hook_home.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/hook_manual.inc.php.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/hook_preferences.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/hook_settings.inc.php.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/custom/cron.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/export/Agresso.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/setup.inc.php.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/admin_entity.xsl.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/invoice.xsl.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/default/admin_entity.xsl.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/default/invoice.xsl.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
Patches:
Index: property/inc/class.boXport.inc.php
diff -u property/inc/class.boXport.inc.php:1.11
property/inc/class.boXport.inc.php:1.12
--- property/inc/class.boXport.inc.php:1.11 Fri Jan 27 14:05:42 2006
+++ property/inc/class.boXport.inc.php Fri Feb 3 12:05:49 2006
@@ -1,282 +1,282 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.boXport.inc.php,v 1.11 2006/01/27 14:05:42
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boXport
- {
- var $public_functions = array(
- 'import' => True,
- 'export' => True
- );
-
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $cat_id;
-
- var $use_session = False;
-
- function boXport ($session=False)
- {
-
- $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
-
- $this->config =
CreateObject('phpgwapi.config',$this->currentapp);
-
- if($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
-
- if($start || $start == 0) { $this->start = $start; }
- if($query) { $this->query = $query; }
- if($sort) { $this->sort = $sort; }
- if($order) { $this->order = $order; }
- if($filter) { $this->filter = $filter; }
- $this->cat_id = $cat_id;
- }
-
- function save_sessiondata()
- {
-
- if ($this->use_session)
- {
- $data = array(
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id
- );
- if($this->debug) { echo '<br>Save:';
_debug_array($data); }
-
$GLOBALS['phpgw']->session->appsession('session_data','export',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','export');
- if($this->debug) { echo '<br>Read:';
_debug_array($data); }
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->filter = $data['filter'];
- $this->cat_id = $data['cat_id'];
- }
-
- function select_import_conv($selected='')
- {
- $dir_handle = @opendir(PHPGW_APP_INC . SEP . 'import');
- $i=0; $myfilearray = '';
- while ($file = readdir($dir_handle))
- {
- if ((substr($file, 0, 1) != '.') &&
is_file(PHPGW_APP_INC . SEP . 'import' . SEP . $file) )
- {
- $myfilearray[$i] = $file;
- $i++;
- }
- }
- closedir($dir_handle);
- sort($myfilearray);
-
- for ($i=0;$i<count($myfilearray);$i++)
- {
- $fname = ereg_replace('_',' ',$myfilearray[$i]);
- $sel_file = '';
- if ($myfilearray[$i]==$selected)
- {
- $sel_file = 'selected';
- }
-
- $conv_list[] = array
- (
- 'id' => $myfilearray[$i],
- 'name' => $fname,
- 'selected' => $sel_file
- );
- }
-
- for ($i=0;$i<count($conv_list);$i++)
- {
- if ($conv_list[$i]['selected'] != 'selected')
- {
- unset($conv_list[$i]['selected']);
- }
- }
-
- return $conv_list;
-
- }
-
- function select_export_conv($selected='')
- {
- $dir_handle = @opendir(PHPGW_APP_INC . SEP . 'export');
- $i=0; $myfilearray = '';
- while ($file = readdir($dir_handle))
- {
- if ((substr($file, 0, 1) != '.') &&
is_file(PHPGW_APP_INC . SEP . 'export' . SEP . $file) )
- {
- $myfilearray[$i] = $file;
- $i++;
- }
- }
- closedir($dir_handle);
- sort($myfilearray);
-
- for ($i=0;$i<count($myfilearray);$i++)
- {
- $fname = ereg_replace('_',' ',$myfilearray[$i]);
- $sel_file = '';
- if ($myfilearray[$i]==$selected)
- {
- $sel_file = 'selected';
- }
-
- $conv_list[] = array
- (
- 'id' => $myfilearray[$i],
- 'name' => $fname,
- 'selected' => $sel_file
- );
- }
-
- for ($i=0;$i<count($conv_list);$i++)
- {
- if ($conv_list[$i]['selected'] != 'selected')
- {
- unset($conv_list[$i]['selected']);
- }
- }
-
- return $conv_list;
-
- }
-
- function select_rollback_file($selected='')
- {
- $this->config->read_repository();
- $file_catalog =
$this->config->config_data['export_path'];
-
- $dir_handle = @opendir($file_catalog);
- $i=0; $myfilearray = '';
- while ($file = readdir($dir_handle))
- {
- if ((substr($file, 0, 1) != '.') &&
is_file($file_catalog . SEP . $file) )
- {
- $myfilearray[$i] = $file;
- $i++;
- }
- }
- closedir($dir_handle);
- @sort($myfilearray);
-
- for ($i=0;$i<count($myfilearray);$i++)
- {
- $fname = ereg_replace('_',' ',$myfilearray[$i]);
- $sel_file = '';
- if ($myfilearray[$i]==$selected)
- {
- $sel_file = 'selected';
- }
-
- $rollback_list[] = array
- (
- 'id' => $myfilearray[$i],
- 'name' => $fname,
- 'selected' => $sel_file
- );
- }
-
- for ($i=0;$i<count($rollback_list);$i++)
- {
- if ($rollback_list[$i]['selected'] !=
'selected')
- {
- unset($rollback_list[$i]['selected']);
- }
- }
-
- return $rollback_list;
-
- }
-
- function import($invoice_common,$download)
- {
- include (PHPGW_APP_INC . '/import/' .
$invoice_common['conv_type']);
- $invoice = new import_conv;
-
- $buffer = $invoice->import($invoice_common,$download);
- if ($download)
- {
- $header = $invoice->header;
- $import = $invoice->import;
- $buffer= array(
- 'table' => $buffer,
- 'header' => $header,
- 'import' => $import
- );
- }
- return $buffer;
- }
-
- function export($data)
- {
- $conv_type = $data['conv_type'];
- $download = $data['download'];
- $pre_transfer = $data['pre_transfer'];
- $force_period_year = $data['force_period_year'];
-
- include(PHPGW_SERVER_ROOT.'/'.'property'.'/inc/export/'
. $conv_type);
- $invoice = new export_conv;
-
- $buffer =
$invoice->overfor($download,$pre_transfer,$force_period_year);
-
- return $buffer;
- }
-
- function rollback($conv_type,$role_back_date,$rollback_file)
- {
- include (PHPGW_APP_INC . '/export/' . $conv_type);
- $invoice = new export_conv;
- $buffer =
$invoice->RullTilbake($role_back_date,$rollback_file);
- return $buffer;
-
- }
-
- function export_cron($data)
- {
- if($data['enabled']==1)
- {
- $this->export($data);
- }
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.boXport.inc.php,v 1.12 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boXport
+ {
+ var $public_functions = array(
+ 'import' => True,
+ 'export' => True
+ );
+
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $cat_id;
+
+ var $use_session = False;
+
+ function boXport ($session=False)
+ {
+
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+
+ $this->config =
CreateObject('phpgwapi.config',$this->currentapp);
+
+ if($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+
+ if($start || $start == 0) { $this->start = $start; }
+ if($query) { $this->query = $query; }
+ if($sort) { $this->sort = $sort; }
+ if($order) { $this->order = $order; }
+ if($filter) { $this->filter = $filter; }
+ $this->cat_id = $cat_id;
+ }
+
+ function save_sessiondata()
+ {
+
+ if ($this->use_session)
+ {
+ $data = array(
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id
+ );
+ if($this->debug) { echo '<br>Save:';
_debug_array($data); }
+
$GLOBALS['phpgw']->session->appsession('session_data','export',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','export');
+ if($this->debug) { echo '<br>Read:';
_debug_array($data); }
+
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
+ $this->filter = $data['filter'];
+ $this->cat_id = $data['cat_id'];
+ }
+
+ function select_import_conv($selected='')
+ {
+ $dir_handle = @opendir(PHPGW_APP_INC . SEP . 'import');
+ $i=0; $myfilearray = '';
+ while ($file = readdir($dir_handle))
+ {
+ if ((substr($file, 0, 1) != '.') &&
is_file(PHPGW_APP_INC . SEP . 'import' . SEP . $file) )
+ {
+ $myfilearray[$i] = $file;
+ $i++;
+ }
+ }
+ closedir($dir_handle);
+ sort($myfilearray);
+
+ for ($i=0;$i<count($myfilearray);$i++)
+ {
+ $fname = ereg_replace('_',' ',$myfilearray[$i]);
+ $sel_file = '';
+ if ($myfilearray[$i]==$selected)
+ {
+ $sel_file = 'selected';
+ }
+
+ $conv_list[] = array
+ (
+ 'id' => $myfilearray[$i],
+ 'name' => $fname,
+ 'selected' => $sel_file
+ );
+ }
+
+ for ($i=0;$i<count($conv_list);$i++)
+ {
+ if ($conv_list[$i]['selected'] != 'selected')
+ {
+ unset($conv_list[$i]['selected']);
+ }
+ }
+
+ return $conv_list;
+
+ }
+
+ function select_export_conv($selected='')
+ {
+ $dir_handle = @opendir(PHPGW_APP_INC . SEP . 'export');
+ $i=0; $myfilearray = '';
+ while ($file = readdir($dir_handle))
+ {
+ if ((substr($file, 0, 1) != '.') &&
is_file(PHPGW_APP_INC . SEP . 'export' . SEP . $file) )
+ {
+ $myfilearray[$i] = $file;
+ $i++;
+ }
+ }
+ closedir($dir_handle);
+ sort($myfilearray);
+
+ for ($i=0;$i<count($myfilearray);$i++)
+ {
+ $fname = ereg_replace('_',' ',$myfilearray[$i]);
+ $sel_file = '';
+ if ($myfilearray[$i]==$selected)
+ {
+ $sel_file = 'selected';
+ }
+
+ $conv_list[] = array
+ (
+ 'id' => $myfilearray[$i],
+ 'name' => $fname,
+ 'selected' => $sel_file
+ );
+ }
+
+ for ($i=0;$i<count($conv_list);$i++)
+ {
+ if ($conv_list[$i]['selected'] != 'selected')
+ {
+ unset($conv_list[$i]['selected']);
+ }
+ }
+
+ return $conv_list;
+
+ }
+
+ function select_rollback_file($selected='')
+ {
+ $this->config->read_repository();
+ $file_catalog =
$this->config->config_data['export_path'];
+
+ $dir_handle = @opendir($file_catalog);
+ $i=0; $myfilearray = '';
+ while ($file = readdir($dir_handle))
+ {
+ if ((substr($file, 0, 1) != '.') &&
is_file($file_catalog . SEP . $file) )
+ {
+ $myfilearray[$i] = $file;
+ $i++;
+ }
+ }
+ closedir($dir_handle);
+ @sort($myfilearray);
+
+ for ($i=0;$i<count($myfilearray);$i++)
+ {
+ $fname = ereg_replace('_',' ',$myfilearray[$i]);
+ $sel_file = '';
+ if ($myfilearray[$i]==$selected)
+ {
+ $sel_file = 'selected';
+ }
+
+ $rollback_list[] = array
+ (
+ 'id' => $myfilearray[$i],
+ 'name' => $fname,
+ 'selected' => $sel_file
+ );
+ }
+
+ for ($i=0;$i<count($rollback_list);$i++)
+ {
+ if ($rollback_list[$i]['selected'] !=
'selected')
+ {
+ unset($rollback_list[$i]['selected']);
+ }
+ }
+
+ return $rollback_list;
+
+ }
+
+ function import($invoice_common,$download)
+ {
+ include (PHPGW_APP_INC . '/import/' .
$invoice_common['conv_type']);
+ $invoice = new import_conv;
+
+ $buffer = $invoice->import($invoice_common,$download);
+ if ($download)
+ {
+ $header = $invoice->header;
+ $import = $invoice->import;
+ $buffer= array(
+ 'table' => $buffer,
+ 'header' => $header,
+ 'import' => $import
+ );
+ }
+ return $buffer;
+ }
+
+ function export($data)
+ {
+ $conv_type = $data['conv_type'];
+ $download = $data['download'];
+ $pre_transfer = $data['pre_transfer'];
+ $force_period_year = $data['force_period_year'];
+
+ include(PHPGW_SERVER_ROOT.'/'.'property'.'/inc/export/'
. $conv_type);
+ $invoice = new export_conv;
+
+ $buffer =
$invoice->overfor($download,$pre_transfer,$force_period_year);
+
+ return $buffer;
+ }
+
+ function rollback($conv_type,$role_back_date,$rollback_file)
+ {
+ include (PHPGW_APP_INC . '/export/' . $conv_type);
+ $invoice = new export_conv;
+ $buffer =
$invoice->RullTilbake($role_back_date,$rollback_file);
+ return $buffer;
+
+ }
+
+ function export_cron($data)
+ {
+ if($data['enabled']==1)
+ {
+ $this->export($data);
+ }
+ }
+
+ }
+?>
Index: property/inc/class.boactor.inc.php
diff -u property/inc/class.boactor.inc.php:1.7
property/inc/class.boactor.inc.php:1.8
--- property/inc/class.boactor.inc.php:1.7 Fri Jan 27 14:05:42 2006
+++ property/inc/class.boactor.inc.php Fri Feb 3 12:05:49 2006
@@ -1,416 +1,416 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.boactor.inc.php,v 1.7 2006/01/27 14:05:42
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boactor
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
- var $role;
- var $member_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function boactor($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so = CreateObject($this->currentapp.'.soactor');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
- $role = get_var('role',array('POST','GET'));
- $member_id =
get_var('member_id',array('POST','GET'));
-
-
- $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
- {
- unset($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);
- }
- }
-
- 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 select_category_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->select_category_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function read()
- {
- $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));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
-
- for ($i=0; $i<count($actor); $i++)
- {
- $actor[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($actor[$i]['date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
- return $actor;
- }
-
- function read_single($data)
- {
- $contacts =
CreateObject('phpgwapi.contacts');
-
- $vendor = CreateObject($this->currentapp.'.soactor');
- $vendor->role = 'vendor';
-
-
- $actor = $this->so->read_single($data);
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $input_type_array = array(
- 'R' => 'radio',
- 'CH' => 'checkbox',
- 'LB' => 'listbox'
- );
-
- $sep = '/';
- $dlarr[strpos($dateformat,'Y')] = 'Y';
- $dlarr[strpos($dateformat,'m')] = 'm';
- $dlarr[strpos($dateformat,'d')] = 'd';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- $m=0;
- for ($i=0;$i<count($actor['attributes']);$i++)
- {
- if($actor['attributes'][$i]['datatype']=='D' &&
$actor['attributes'][$i]['value'])
- {
- $timestamp_date=
mktime(0,0,0,date(m,strtotime($actor['attributes'][$i]['value'])),date(d,strtotime($actor['attributes'][$i]['value'])),date(y,strtotime($actor['attributes'][$i]['value'])));
- $actor['attributes'][$i]['value']
= $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
- }
- if($actor['attributes'][$i]['datatype']=='AB')
- {
- if($actor['attributes'][$i]['value'])
- {
- $contact_data =
$contacts->read_single_entry($actor['attributes'][$i]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-
$actor['attributes'][$i]['contact_name'] = $contact_data[0]['n_family']
. ', ' . $contact_data[0]['n_given'];
- }
-
- $insert_record_actor[] =
$actor['attributes'][$i]['name'];
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $actor['attributes'][$i]['name']);
-
- $lookup_functions[$m]['name'] =
'lookup_'. $actor['attributes'][$i]['name'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
-
if($actor['attributes'][$i]['datatype']=='VENDOR')
- {
- if($actor['attributes'][$i]['value'])
- {
- $vendor_data =
$vendor->read_single(array('actor_id'=>$actor['attributes'][$i]['value']));
-
- for
($n=0;$n<count($vendor_data['attributes']);$n++)
- {
-
if($vendor_data['attributes'][$n]['name'] == 'org_name')
- {
-
$actor['attributes'][$i]['vendor_name']=
$vendor_data['attributes'][$n]['value'];
- $n
=count($vendor_data['attributes']);
- }
- }
- }
-
- $insert_record_actor[] =
$actor['attributes'][$i]['name'];
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $actor['attributes'][$i]['name']);
-
- $lookup_functions[$m]['name'] =
'lookup_'. $actor['attributes'][$i]['name'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
- if($actor['attributes'][$i]['datatype']=='R' ||
$actor['attributes'][$i]['datatype']=='CH' ||
$actor['attributes'][$i]['datatype']=='LB')
- {
- $actor['attributes'][$i]['choice']
= $this->so->read_attrib_choice($actor['attributes'][$i]['attrib_id']);
-
$input_type=$input_type_array[$actor['attributes'][$i]['datatype']];
-
-
if($actor['attributes'][$i]['datatype']=='CH')
- {
-
$actor['attributes'][$i]['value']=unserialize($actor['attributes'][$i]['value']);
-
$actor['attributes'][$i]['choice'] =
$this->bocommon->select_multi_list_2($actor['attributes'][$i]['value'],$actor['attributes'][$i]['choice'],$input_type);
-
- }
- else
- {
- for
($j=0;$j<count($actor['attributes'][$i]['choice']);$j++)
- {
-
$actor['attributes'][$i]['choice'][$j]['input_type']=$input_type;
-
if($actor['attributes'][$i]['choice'][$j]['id']==$actor['attributes'][$i]['value'])
- {
-
$actor['attributes'][$i]['choice'][$j]['checked']='checked';
- }
- }
- }
- }
-
- $actor['attributes'][$i]['datatype_text'] =
$this->bocommon->translate_datatype($actor['attributes'][$i]['datatype']);
- $actor['attributes'][$i]['counter'] = $i;
- $actor['attributes'][$i]['type_id'] =
$data['type_id'];
- }
-
- for ($j=0;$j<count($lookup_functions);$j++)
- {
- $actor['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
- $actor['lookup_functions'] .= '{'."\r\n";
- $actor['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
- $actor['lookup_functions'] .= '}'."\r\n";
- }
-
-
$GLOBALS['phpgw']->session->appsession('insert_record_actor',$this->currentapp,$insert_record_actor);
-
-//html_print_r($actor);
- return $actor;
- }
-
- function save($actor,$values_attribute='')
- {
-
- for ($i=0;$i<count($values_attribute);$i++)
- {
- if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
- }
- if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
- }
-
- if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
- }
-
- if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
- }
- }
-
- 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='',$id='',$attrib='')
- {
- if ($attrib)
- {
- $this->so->delete_attrib($id);
- }
- else
- {
- $this->so->delete($actor_id);
- }
- }
-
- function read_attrib($type_id='')
- {
- $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'allrows'=>$this->allrows));
-
- for ($i=0; $i<count($attrib); $i++)
- {
- $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
- }
-
- $this->total_records = $this->so->total_records;
-
- return $attrib;
- }
-
- function read_single_attrib($id)
- {
- return $this->so->read_single_attrib($id);
- }
-
- function resort_attrib($data)
- {
- $this->so->resort_attrib($data);
- }
-
- function save_attrib($attrib,$action='')
- {
- if ($action=='edit')
- {
- if ($attrib['id'] != '')
- {
-
- $receipt =
$this->so->edit_attrib($attrib);
- }
- }
- else
- {
- $receipt = $this->so->add_attrib($attrib);
- }
- return $receipt;
- }
-
- function column_list($selected='',$allrows='')
- {
- if(!$selected)
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]["actor_columns_"
. $this->role];
- }
-
- $columns =
$this->so->read_attrib(array('allrows'=>$allrows,'column_list'=>True));
-
-
$column_list=$this->bocommon->select_multi_list($selected,$columns);
-
- return $column_list;
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.boactor.inc.php,v 1.8 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boactor
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+ var $role;
+ var $member_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function boactor($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so = CreateObject($this->currentapp.'.soactor');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+ $role = get_var('role',array('POST','GET'));
+ $member_id =
get_var('member_id',array('POST','GET'));
+
+
+ $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
+ {
+ unset($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);
+ }
+ }
+
+ 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 select_category_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->select_category_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function read()
+ {
+ $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));
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+
+ for ($i=0; $i<count($actor); $i++)
+ {
+ $actor[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($actor[$i]['date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+ return $actor;
+ }
+
+ function read_single($data)
+ {
+ $contacts =
CreateObject('phpgwapi.contacts');
+
+ $vendor = CreateObject($this->currentapp.'.soactor');
+ $vendor->role = 'vendor';
+
+
+ $actor = $this->so->read_single($data);
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ $input_type_array = array(
+ 'R' => 'radio',
+ 'CH' => 'checkbox',
+ 'LB' => 'listbox'
+ );
+
+ $sep = '/';
+ $dlarr[strpos($dateformat,'Y')] = 'Y';
+ $dlarr[strpos($dateformat,'m')] = 'm';
+ $dlarr[strpos($dateformat,'d')] = 'd';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ $m=0;
+ for ($i=0;$i<count($actor['attributes']);$i++)
+ {
+ if($actor['attributes'][$i]['datatype']=='D' &&
$actor['attributes'][$i]['value'])
+ {
+ $timestamp_date=
mktime(0,0,0,date(m,strtotime($actor['attributes'][$i]['value'])),date(d,strtotime($actor['attributes'][$i]['value'])),date(y,strtotime($actor['attributes'][$i]['value'])));
+ $actor['attributes'][$i]['value']
= $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
+ }
+ if($actor['attributes'][$i]['datatype']=='AB')
+ {
+ if($actor['attributes'][$i]['value'])
+ {
+ $contact_data =
$contacts->read_single_entry($actor['attributes'][$i]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
+
$actor['attributes'][$i]['contact_name'] = $contact_data[0]['n_family']
. ', ' . $contact_data[0]['n_given'];
+ }
+
+ $insert_record_actor[] =
$actor['attributes'][$i]['name'];
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $actor['attributes'][$i]['name']);
+
+ $lookup_functions[$m]['name'] =
'lookup_'. $actor['attributes'][$i]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+
if($actor['attributes'][$i]['datatype']=='VENDOR')
+ {
+ if($actor['attributes'][$i]['value'])
+ {
+ $vendor_data =
$vendor->read_single(array('actor_id'=>$actor['attributes'][$i]['value']));
+
+ for
($n=0;$n<count($vendor_data['attributes']);$n++)
+ {
+
if($vendor_data['attributes'][$n]['name'] == 'org_name')
+ {
+
$actor['attributes'][$i]['vendor_name']=
$vendor_data['attributes'][$n]['value'];
+ $n
=count($vendor_data['attributes']);
+ }
+ }
+ }
+
+ $insert_record_actor[] =
$actor['attributes'][$i]['name'];
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $actor['attributes'][$i]['name']);
+
+ $lookup_functions[$m]['name'] =
'lookup_'. $actor['attributes'][$i]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+ if($actor['attributes'][$i]['datatype']=='R' ||
$actor['attributes'][$i]['datatype']=='CH' ||
$actor['attributes'][$i]['datatype']=='LB')
+ {
+ $actor['attributes'][$i]['choice']
= $this->so->read_attrib_choice($actor['attributes'][$i]['attrib_id']);
+
$input_type=$input_type_array[$actor['attributes'][$i]['datatype']];
+
+
if($actor['attributes'][$i]['datatype']=='CH')
+ {
+
$actor['attributes'][$i]['value']=unserialize($actor['attributes'][$i]['value']);
+
$actor['attributes'][$i]['choice'] =
$this->bocommon->select_multi_list_2($actor['attributes'][$i]['value'],$actor['attributes'][$i]['choice'],$input_type);
+
+ }
+ else
+ {
+ for
($j=0;$j<count($actor['attributes'][$i]['choice']);$j++)
+ {
+
$actor['attributes'][$i]['choice'][$j]['input_type']=$input_type;
+
if($actor['attributes'][$i]['choice'][$j]['id']==$actor['attributes'][$i]['value'])
+ {
+
$actor['attributes'][$i]['choice'][$j]['checked']='checked';
+ }
+ }
+ }
+ }
+
+ $actor['attributes'][$i]['datatype_text'] =
$this->bocommon->translate_datatype($actor['attributes'][$i]['datatype']);
+ $actor['attributes'][$i]['counter'] = $i;
+ $actor['attributes'][$i]['type_id'] =
$data['type_id'];
+ }
+
+ for ($j=0;$j<count($lookup_functions);$j++)
+ {
+ $actor['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
+ $actor['lookup_functions'] .= '{'."\r\n";
+ $actor['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
+ $actor['lookup_functions'] .= '}'."\r\n";
+ }
+
+
$GLOBALS['phpgw']->session->appsession('insert_record_actor',$this->currentapp,$insert_record_actor);
+
+//html_print_r($actor);
+ return $actor;
+ }
+
+ function save($actor,$values_attribute='')
+ {
+
+ for ($i=0;$i<count($values_attribute);$i++)
+ {
+ if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
+ }
+ if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
+ }
+
+ if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
+ }
+
+ if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
+ }
+ }
+
+ 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='',$id='',$attrib='')
+ {
+ if ($attrib)
+ {
+ $this->so->delete_attrib($id);
+ }
+ else
+ {
+ $this->so->delete($actor_id);
+ }
+ }
+
+ function read_attrib($type_id='')
+ {
+ $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'allrows'=>$this->allrows));
+
+ for ($i=0; $i<count($attrib); $i++)
+ {
+ $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
+ }
+
+ $this->total_records = $this->so->total_records;
+
+ return $attrib;
+ }
+
+ function read_single_attrib($id)
+ {
+ return $this->so->read_single_attrib($id);
+ }
+
+ function resort_attrib($data)
+ {
+ $this->so->resort_attrib($data);
+ }
+
+ function save_attrib($attrib,$action='')
+ {
+ if ($action=='edit')
+ {
+ if ($attrib['id'] != '')
+ {
+
+ $receipt =
$this->so->edit_attrib($attrib);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add_attrib($attrib);
+ }
+ return $receipt;
+ }
+
+ function column_list($selected='',$allrows='')
+ {
+ if(!$selected)
+ {
+
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]["actor_columns_"
. $this->role];
+ }
+
+ $columns =
$this->so->read_attrib(array('allrows'=>$allrows,'column_list'=>True));
+
+
$column_list=$this->bocommon->select_multi_list($selected,$columns);
+
+ return $column_list;
+ }
+ }
+?>
Index: property/inc/class.boadmin.inc.php
diff -u property/inc/class.boadmin.inc.php:1.7
property/inc/class.boadmin.inc.php:1.8
--- property/inc/class.boadmin.inc.php:1.7 Fri Jan 27 14:05:43 2006
+++ property/inc/class.boadmin.inc.php Fri Feb 3 12:05:49 2006
@@ -1,508 +1,508 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.boadmin.inc.php,v 1.7 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boadmin
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- function boadmin($session='')
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.soadmin');
- $this->acl2 =
CreateObject($this->currentapp.'.acl2','##DEFAULT##','##DEFAULT##');
- $this->right = array(1,2,4,8,16,32,64,128);
- $this->app_id
=$GLOBALS['phpgw']->applications->data[$GLOBALS['phpgw_info']['flags']['currentapp']]['id'];
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $permission =
get_var('permission',array('POST','GET'));
- // $location =
get_var('location',array('POST','GET')); // don't work for some reason...
- $module = get_var('module',array('POST','GET'));
- $granting_group =
get_var('granting_group',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(isset($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($module))
- {
- $this->location = $module;
- }
- if(isset($granting_group))
- {
- $this->granting_group = $granting_group;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
-
- if ($this->allrows)
- {
- $this->start = -1;
- $this->offset = -1;
- }
- }
-
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','fm_admin');
-
- $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->location = $data['location'];
- $this->granting_group = $data['granting_group'];
- $this->allrows = $data['allrows'];
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','fm_admin',$data);
- }
- }
-
-
-
- function select_location($format='',$selected='',$grant='')
- {
-
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('select_location'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_location'));
- break;
- }
-
- $locations= $this->so->select_location($grant);
-
- while (is_array($locations) && list(,$loc) =
each($locations))
- {
- $sel_loc = '';
- if ($loc['id']==$selected)
- {
- $sel_loc = 'selected';
- }
-
- $location_list[] = array
- (
- 'id' => $loc['id'],
- 'descr' => $loc['id'] . ' [' .
$loc['descr'] . ']',
- 'selected' => $sel_loc
- );
- }
-
- for ($i=0;$i<count($location_list);$i++)
- {
- if ($location_list[$i]['selected'] !=
'selected')
- {
- unset($location_list[$i]['selected']);
- }
- }
-
- return $location_list;
- }
-
- function select_category_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
-
- $categories[0]['id'] = 'groups';
- $categories[0]['name'] = lang('Groups');
- $categories[1]['id'] = 'accounts';
- $categories[1]['name'] = lang('Users');
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function set_permission2($values,$r_processed,$type)
- {
- @reset($values);
- $totalacl = array();
- while(list($rowinfo,$perm) = each($values))
- {
- list($user_id,$rights) = split('_',$rowinfo);
- $totalacl[$user_id] += $rights;
- }
- @reset($totalacl);
- while(list($user_id,$rights) = @each($totalacl))
- {
- $user_checked[]=$user_id;
-
-
$this->acl2->set($this->location,$rights,$user_id,$type);
- }
-
- if(is_array($r_processed) && is_array($user_checked))
- {
- $user_delete = array_diff($r_processed,
$user_checked);
- }
- else
- {
- $user_delete = $r_processed;
- }
- if(is_array($user_delete) && count($user_delete)>0)
- {
- $user_delete= explode("_",implode("_",
$user_delete));
-
- $this->remove_permission($user_delete,$type);
- }
- }
-
- function set_permission($values,$r_processed,$initials)
- {
- if($initials)
- {
- $this->so->set_initials($initials);
- }
-
- $r_processed=explode("_",$r_processed);
-
- if(!$values['right'])
- {
- $values['right'] = array();
- }
- if(!$values['mask'])
- {
- $values['mask'] = array();
- }
-
- $this->set_permission2($values['right'],$r_processed,0);
- $this->set_permission2($values['mask'],$r_processed,1);
-
-// $this->acl2->check('.invoice.test', $rights,$user_id);
-// echo 'rights_cache:<pre>'; print_r($this->acl2->rights_cache); echo
'</pre>';
-
- $receipt['message'][] = array('msg' =>
lang('permissions are updated!'));
- return $receipt;
- }
-
- function set_grant2($values,$r_processed,$type)
- {
- @reset($values);
- $totalacl = array();
- while(list($rowinfo,$perm) = each($values))
- {
- list($user_id,$rights) = split('_',$rowinfo);
- $totalacl[$user_id] += $rights;
- }
- @reset($totalacl);
- while(list($user_id,$rights) = @each($totalacl))
- {
- $user_checked[]=$user_id;
-
-
$this->acl2->set_grant($this->location,$rights,$user_id,$type,$this->granting_group);
- }
-
- if(is_array($r_processed) && is_array($user_checked))
- {
- $user_delete = array_diff($r_processed,
$user_checked);
- }
- else
- {
- $user_delete = $r_processed;
- }
- if(is_array($user_delete) && count($user_delete)>0)
- {
- $user_delete= explode("_",implode("_",
$user_delete));
-
- $this->remove_grant($user_delete,$type);
- }
-
- }
-
- function set_grant($values,$r_processed)
- {
- $r_processed=explode("_",$r_processed);
-
- if(!$values['right'])
- {
- $values['right'] = array();
- }
- if(!$values['mask'])
- {
- $values['mask'] = array();
- }
-
- $this->set_grant2($values['right'],$r_processed,0);
- $this->set_grant2($values['mask'],$r_processed,1);
-
- $receipt['message'][] = array('msg' =>
lang('permissions are updated!'));
- return $receipt;
- }
-
- function remove_permission($user_delete,$type)
- {
-
- $right=$this->right;
-
- for ($i=0;$i<count($user_delete);$i++)
- {
- for ($j=0;$j<count($right);$j++)
- {
-
$this->acl2->remove($this->location,$right[$j],$user_delete[$i],$type);
- }
- }
- }
-
- function remove_grant($user_delete,$type)
- {
-
- $right=$this->right;
-
- for ($i=0;$i<count($user_delete);$i++)
- {
- for ($j=0;$j<count($right);$j++)
- {
-
$this->acl2->remove_grant($this->location,$right[$j],$user_delete[$i],$type,$this->granting_group);
- }
- }
- }
-
- function get_user_list($type='',$app_id='')
- {
- if($this->granting_group)
- {
- $owner = $this->granting_group;
- }
- else
- {
- $owner =
$GLOBALS['phpgw_info']['user']['account_id'];
- }
-
- $right=$this->right;
-
- $GLOBALS['phpgw']->accounts->account_id = $owner;
-
- $allusers =
$GLOBALS['phpgw']->accounts->get_list($type, $this->start,$this->sort,
$this->order, $this->query, $this->offset);
-
- if (isSet($allusers) AND is_array($allusers))
- {
- $j=0;
- foreach($allusers as $account)
- {
-
if($account['account_id']!=$GLOBALS['phpgw_info']['user']['account_id'] ||
$this->granting_group)
- {
- $user_list[$j]['account_id']
= $account['account_id'];
- $user_list[$j]['account_lid']
= $account['account_lid'];
-
$user_list[$j]['account_firstname'] = $account['account_firstname'];
-
$user_list[$j]['account_lastname'] = $account['account_lastname'];
- $user_list[$j]['initials']
= $this->so->get_initials($account['account_id']);
-
- $count_right=count($right);
- for ($i=0;$i<$count_right;$i++)
- {
-
if($this->acl2->check_grant($owner,$this->location,
$right[$i],$account['account_id'],$app_id,True,0,True))
- {
-
$user_list[$j]['right'][$right[$i]] = 'checked';
- }
-
if($this->acl2->check_grant($owner,$this->location,
$right[$i],$account['account_id'],$this->app_id,True,1,True))
- {
-
$user_list[$j]['mask'][$right[$i]] = 'checked';
- }
- }
-
- if
(isSet($user_list[$j]['mask']) AND is_array($user_list[$j]['mask']))
- {
- $result_temp =
@array_diff(array_keys($user_list[$j]['right']),
array_keys($user_list[$j]['mask']));
- if (isSet($result_temp)
AND is_array($result_temp))
- {
-
foreach($result_temp as $temp)
- {
-
$user_list[$j]['result'][$temp] = 'checked';
- }
- }
- }
- else
- {
-
$user_list[$j]['result'] = $user_list[$j]['right'];
- }
-
- $user_list[$j]['right']['type']
= 'right';
- $user_list[$j]['mask']['type']
= 'mask';
-
$user_list[$j]['result']['type'] = 'result';
-
- $j++;
- }
- }
- }
-
- $this->total_records =
$GLOBALS['phpgw']->accounts->total;
-
-//_debug_array($user_list);
-
- return $user_list;
- }
-
-
- function get_user_list2($type='',$app_id='')
- {
- $right=$this->right;
-
- $allusers =
$GLOBALS['phpgw']->accounts->get_list($type, $this->start,$this->sort,
$this->order, $this->query, $this->offset);
-
- if (isSet($allusers) AND is_array($allusers))
- {
- $j=0;
- foreach($allusers as $account)
- {
- $user_list[$j]['account_id']
= $account['account_id'];
- $user_list[$j]['account_lid']
= $account['account_lid'];
- $user_list[$j]['account_firstname'] =
$account['account_firstname'];
- $user_list[$j]['account_lastname']
= $account['account_lastname'];
- $user_list[$j]['initials']
= $this->so->get_initials($account['account_id']);
-
- $count_right=count($right);
- for ($i=0;$i<$count_right;$i++)
- {
-
if($this->acl2->check($this->location,
$right[$i],$account['account_id'],$this->app_id,True,0,True))
- {
-
$user_list[$j]['right'][$right[$i]] = 'checked';
- }
-
if($this->acl2->check($this->location,
$right[$i],$account['account_id'],$this->app_id,True,1,True))
- {
-
$user_list[$j]['mask'][$right[$i]] = 'checked';
- }
- }
-
- if (isSet($user_list[$j]['mask']) AND
is_array($user_list[$j]['mask']))
- {
- $result_temp =
@array_diff(array_keys($user_list[$j]['right']),
array_keys($user_list[$j]['mask']));
- if (isSet($result_temp) AND
is_array($result_temp))
- {
- foreach($result_temp as
$temp)
- {
-
$user_list[$j]['result'][$temp] = 'checked';
- }
- }
- }
- else
- {
- $user_list[$j]['result'] =
$user_list[$j]['right'];
- }
-
- $user_list[$j]['right']['type'] =
'right';
- $user_list[$j]['mask']['type'] = 'mask';
- $user_list[$j]['result']['type'] =
'result';
-
- $j++;
- }
- }
-
- $this->total_records =
$GLOBALS['phpgw']->accounts->total;
-
- return $user_list;
- }
-
- function read_fm_id()
- {
-
- $fm_ids = $this->so->read_fm_id();
- return $fm_ids;
-
- }
- function edit_id($values='')
- {
- return $this->so->edit_id($values);
-
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.boadmin.inc.php,v 1.8 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boadmin
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ function boadmin($session='')
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.soadmin');
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2','##DEFAULT##','##DEFAULT##');
+ $this->right = array(1,2,4,8,16,32,64,128);
+ $this->app_id
=$GLOBALS['phpgw']->applications->data[$GLOBALS['phpgw_info']['flags']['currentapp']]['id'];
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $permission =
get_var('permission',array('POST','GET'));
+ // $location =
get_var('location',array('POST','GET')); // don't work for some reason...
+ $module = get_var('module',array('POST','GET'));
+ $granting_group =
get_var('granting_group',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(isset($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($module))
+ {
+ $this->location = $module;
+ }
+ if(isset($granting_group))
+ {
+ $this->granting_group = $granting_group;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+
+ if ($this->allrows)
+ {
+ $this->start = -1;
+ $this->offset = -1;
+ }
+ }
+
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','fm_admin');
+
+ $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->location = $data['location'];
+ $this->granting_group = $data['granting_group'];
+ $this->allrows = $data['allrows'];
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','fm_admin',$data);
+ }
+ }
+
+
+
+ function select_location($format='',$selected='',$grant='')
+ {
+
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('select_location'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_location'));
+ break;
+ }
+
+ $locations= $this->so->select_location($grant);
+
+ while (is_array($locations) && list(,$loc) =
each($locations))
+ {
+ $sel_loc = '';
+ if ($loc['id']==$selected)
+ {
+ $sel_loc = 'selected';
+ }
+
+ $location_list[] = array
+ (
+ 'id' => $loc['id'],
+ 'descr' => $loc['id'] . ' [' .
$loc['descr'] . ']',
+ 'selected' => $sel_loc
+ );
+ }
+
+ for ($i=0;$i<count($location_list);$i++)
+ {
+ if ($location_list[$i]['selected'] !=
'selected')
+ {
+ unset($location_list[$i]['selected']);
+ }
+ }
+
+ return $location_list;
+ }
+
+ function select_category_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+
+ $categories[0]['id'] = 'groups';
+ $categories[0]['name'] = lang('Groups');
+ $categories[1]['id'] = 'accounts';
+ $categories[1]['name'] = lang('Users');
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function set_permission2($values,$r_processed,$type)
+ {
+ @reset($values);
+ $totalacl = array();
+ while(list($rowinfo,$perm) = each($values))
+ {
+ list($user_id,$rights) = split('_',$rowinfo);
+ $totalacl[$user_id] += $rights;
+ }
+ @reset($totalacl);
+ while(list($user_id,$rights) = @each($totalacl))
+ {
+ $user_checked[]=$user_id;
+
+
$this->acl2->set($this->location,$rights,$user_id,$type);
+ }
+
+ if(is_array($r_processed) && is_array($user_checked))
+ {
+ $user_delete = array_diff($r_processed,
$user_checked);
+ }
+ else
+ {
+ $user_delete = $r_processed;
+ }
+ if(is_array($user_delete) && count($user_delete)>0)
+ {
+ $user_delete= explode("_",implode("_",
$user_delete));
+
+ $this->remove_permission($user_delete,$type);
+ }
+ }
+
+ function set_permission($values,$r_processed,$initials)
+ {
+ if($initials)
+ {
+ $this->so->set_initials($initials);
+ }
+
+ $r_processed=explode("_",$r_processed);
+
+ if(!$values['right'])
+ {
+ $values['right'] = array();
+ }
+ if(!$values['mask'])
+ {
+ $values['mask'] = array();
+ }
+
+ $this->set_permission2($values['right'],$r_processed,0);
+ $this->set_permission2($values['mask'],$r_processed,1);
+
+// $this->acl2->check('.invoice.test', $rights,$user_id);
+// echo 'rights_cache:<pre>'; print_r($this->acl2->rights_cache); echo
'</pre>';
+
+ $receipt['message'][] = array('msg' =>
lang('permissions are updated!'));
+ return $receipt;
+ }
+
+ function set_grant2($values,$r_processed,$type)
+ {
+ @reset($values);
+ $totalacl = array();
+ while(list($rowinfo,$perm) = each($values))
+ {
+ list($user_id,$rights) = split('_',$rowinfo);
+ $totalacl[$user_id] += $rights;
+ }
+ @reset($totalacl);
+ while(list($user_id,$rights) = @each($totalacl))
+ {
+ $user_checked[]=$user_id;
+
+
$this->acl2->set_grant($this->location,$rights,$user_id,$type,$this->granting_group);
+ }
+
+ if(is_array($r_processed) && is_array($user_checked))
+ {
+ $user_delete = array_diff($r_processed,
$user_checked);
+ }
+ else
+ {
+ $user_delete = $r_processed;
+ }
+ if(is_array($user_delete) && count($user_delete)>0)
+ {
+ $user_delete= explode("_",implode("_",
$user_delete));
+
+ $this->remove_grant($user_delete,$type);
+ }
+
+ }
+
+ function set_grant($values,$r_processed)
+ {
+ $r_processed=explode("_",$r_processed);
+
+ if(!$values['right'])
+ {
+ $values['right'] = array();
+ }
+ if(!$values['mask'])
+ {
+ $values['mask'] = array();
+ }
+
+ $this->set_grant2($values['right'],$r_processed,0);
+ $this->set_grant2($values['mask'],$r_processed,1);
+
+ $receipt['message'][] = array('msg' =>
lang('permissions are updated!'));
+ return $receipt;
+ }
+
+ function remove_permission($user_delete,$type)
+ {
+
+ $right=$this->right;
+
+ for ($i=0;$i<count($user_delete);$i++)
+ {
+ for ($j=0;$j<count($right);$j++)
+ {
+
$this->acl2->remove($this->location,$right[$j],$user_delete[$i],$type);
+ }
+ }
+ }
+
+ function remove_grant($user_delete,$type)
+ {
+
+ $right=$this->right;
+
+ for ($i=0;$i<count($user_delete);$i++)
+ {
+ for ($j=0;$j<count($right);$j++)
+ {
+
$this->acl2->remove_grant($this->location,$right[$j],$user_delete[$i],$type,$this->granting_group);
+ }
+ }
+ }
+
+ function get_user_list($type='',$app_id='')
+ {
+ if($this->granting_group)
+ {
+ $owner = $this->granting_group;
+ }
+ else
+ {
+ $owner =
$GLOBALS['phpgw_info']['user']['account_id'];
+ }
+
+ $right=$this->right;
+
+ $GLOBALS['phpgw']->accounts->account_id = $owner;
+
+ $allusers =
$GLOBALS['phpgw']->accounts->get_list($type, $this->start,$this->sort,
$this->order, $this->query, $this->offset);
+
+ if (isSet($allusers) AND is_array($allusers))
+ {
+ $j=0;
+ foreach($allusers as $account)
+ {
+
if($account['account_id']!=$GLOBALS['phpgw_info']['user']['account_id'] ||
$this->granting_group)
+ {
+ $user_list[$j]['account_id']
= $account['account_id'];
+ $user_list[$j]['account_lid']
= $account['account_lid'];
+
$user_list[$j]['account_firstname'] = $account['account_firstname'];
+
$user_list[$j]['account_lastname'] = $account['account_lastname'];
+ $user_list[$j]['initials']
= $this->so->get_initials($account['account_id']);
+
+ $count_right=count($right);
+ for ($i=0;$i<$count_right;$i++)
+ {
+
if($this->acl2->check_grant($owner,$this->location,
$right[$i],$account['account_id'],$app_id,True,0,True))
+ {
+
$user_list[$j]['right'][$right[$i]] = 'checked';
+ }
+
if($this->acl2->check_grant($owner,$this->location,
$right[$i],$account['account_id'],$this->app_id,True,1,True))
+ {
+
$user_list[$j]['mask'][$right[$i]] = 'checked';
+ }
+ }
+
+ if
(isSet($user_list[$j]['mask']) AND is_array($user_list[$j]['mask']))
+ {
+ $result_temp =
@array_diff(array_keys($user_list[$j]['right']),
array_keys($user_list[$j]['mask']));
+ if (isSet($result_temp)
AND is_array($result_temp))
+ {
+
foreach($result_temp as $temp)
+ {
+
$user_list[$j]['result'][$temp] = 'checked';
+ }
+ }
+ }
+ else
+ {
+
$user_list[$j]['result'] = $user_list[$j]['right'];
+ }
+
+ $user_list[$j]['right']['type']
= 'right';
+ $user_list[$j]['mask']['type']
= 'mask';
+
$user_list[$j]['result']['type'] = 'result';
+
+ $j++;
+ }
+ }
+ }
+
+ $this->total_records =
$GLOBALS['phpgw']->accounts->total;
+
+//_debug_array($user_list);
+
+ return $user_list;
+ }
+
+
+ function get_user_list2($type='',$app_id='')
+ {
+ $right=$this->right;
+
+ $allusers =
$GLOBALS['phpgw']->accounts->get_list($type, $this->start,$this->sort,
$this->order, $this->query, $this->offset);
+
+ if (isSet($allusers) AND is_array($allusers))
+ {
+ $j=0;
+ foreach($allusers as $account)
+ {
+ $user_list[$j]['account_id']
= $account['account_id'];
+ $user_list[$j]['account_lid']
= $account['account_lid'];
+ $user_list[$j]['account_firstname'] =
$account['account_firstname'];
+ $user_list[$j]['account_lastname']
= $account['account_lastname'];
+ $user_list[$j]['initials']
= $this->so->get_initials($account['account_id']);
+
+ $count_right=count($right);
+ for ($i=0;$i<$count_right;$i++)
+ {
+
if($this->acl2->check($this->location,
$right[$i],$account['account_id'],$this->app_id,True,0,True))
+ {
+
$user_list[$j]['right'][$right[$i]] = 'checked';
+ }
+
if($this->acl2->check($this->location,
$right[$i],$account['account_id'],$this->app_id,True,1,True))
+ {
+
$user_list[$j]['mask'][$right[$i]] = 'checked';
+ }
+ }
+
+ if (isSet($user_list[$j]['mask']) AND
is_array($user_list[$j]['mask']))
+ {
+ $result_temp =
@array_diff(array_keys($user_list[$j]['right']),
array_keys($user_list[$j]['mask']));
+ if (isSet($result_temp) AND
is_array($result_temp))
+ {
+ foreach($result_temp as
$temp)
+ {
+
$user_list[$j]['result'][$temp] = 'checked';
+ }
+ }
+ }
+ else
+ {
+ $user_list[$j]['result'] =
$user_list[$j]['right'];
+ }
+
+ $user_list[$j]['right']['type'] =
'right';
+ $user_list[$j]['mask']['type'] = 'mask';
+ $user_list[$j]['result']['type'] =
'result';
+
+ $j++;
+ }
+ }
+
+ $this->total_records =
$GLOBALS['phpgw']->accounts->total;
+
+ return $user_list;
+ }
+
+ function read_fm_id()
+ {
+
+ $fm_ids = $this->so->read_fm_id();
+ return $fm_ids;
+
+ }
+ function edit_id($values='')
+ {
+ return $this->so->edit_id($values);
+
+ }
+ }
+?>
Index: property/inc/class.boadmin_location.inc.php
diff -u property/inc/class.boadmin_location.inc.php:1.8
property/inc/class.boadmin_location.inc.php:1.9
--- property/inc/class.boadmin_location.inc.php:1.8 Mon Jan 30 22:14:19 2006
+++ property/inc/class.boadmin_location.inc.php Fri Feb 3 12:05:49 2006
@@ -1,304 +1,304 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.boadmin_location.inc.php,v 1.8 2006/01/30
22:14:19 sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boadmin_location
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 boadmin_location($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.soadmin_location');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','standard_e',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_e');
-
-
- $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'];
- }
-
- function reset_fm_cache()
- {
- $this->so->reset_fm_cache();
- }
-
-
- function read()
- {
- $standard = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
-
- $this->total_records = $this->so->total_records;
-
-
- return $standard;
- }
-
- function read_config()
- {
- $standard = $this->so->read_config(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
-
- $this->total_records = $this->so->total_records;
-
-
- return $standard;
- }
-
- function read_config_single($column_name)
- {
- return $this->so->read_config_single($column_name);
- }
-
- function read_single($id)
- {
- return $this->so->read_single($id);
- }
-
- function save($standard,$action='')
- {
- if ($action=='edit')
- {
- if ($standard['id'] != '')
- {
-
- $receipt = $this->so->edit($standard);
- }
- }
- else
- {
- $receipt = $this->so->add($standard);
- }
- return $receipt;
-
- }
-
- function delete($type_id,$id,$attrib)
- {
- $this->so->delete($type_id,$id,$attrib);
- }
-
- function read_attrib($type_id='')
- {
- $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'type_id' => $type_id,'allrows'=>$this->allrows));
-
- for ($i=0; $i<count($attrib); $i++)
- {
- $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
- }
-
- $this->total_records = $this->so->total_records;
-
- return $attrib;
- }
-
- function read_single_attrib($type_id,$id)
- {
- return $this->so->read_single_attrib($type_id,$id);
- }
-
- function resort_attrib($data)
- {
- $this->so->resort_attrib($data);
- }
-
- function save_attrib($attrib,$action='')
- {
- if ($action=='edit')
- {
- if ($attrib['id'] != '')
- {
-
- $receipt =
$this->so->edit_attrib($attrib);
- }
- }
- else
- {
- $receipt = $this->so->add_attrib($attrib);
- }
- return $receipt;
- }
-
- function save_config($values='',$column_name='')
- {
- return
$this->so->save_config($values,$column_name);
- }
-
- function select_location_type($selected='')
- {
- $location_types= $this->so->select_location_type();
-
- while (is_array($location_types) && list(,$type) =
each($location_types))
- {
- $sel_type = '';
- if ($type['id']==$selected)
- {
- $sel_type = 'selected';
- }
-
- $location_type_list[] = array
- (
- 'id' => $type['id'],
- 'name' => $type['name'],
- 'selected' => $sel_type
- );
- }
-
- for ($i=0;$i<count($location_type_list);$i++)
- {
- if ($location_type_list[$i]['selected'] !=
'selected')
- {
-
unset($location_type_list[$i]['selected']);
- }
- }
-
-//_debug_array($location_type_list);
- return $location_type_list;
- }
-
- function select_nullable($selected='')
- {
- $nullable[0]['id']= 'True';
- $nullable[0]['name']= lang('True');
- $nullable[1]['id']= 'False';
- $nullable[1]['name']= lang('False');
-
- while (is_array($nullable) && list(,$type) =
each($nullable))
- {
- $sel_type = '';
- if ($type['id']==$selected)
- {
- $sel_type = 'selected';
- }
-
- $nullable_list[] = array
- (
- 'id' => $type['id'],
- 'name' => $type['name'],
- 'selected' => $sel_type
- );
- }
-
- for ($i=0;$i<count($nullable_list);$i++)
- {
- if ($nullable_list[$i]['selected'] !=
'selected')
- {
- unset($nullable_list[$i]['selected']);
- }
- }
- return $nullable_list;
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.boadmin_location.inc.php,v 1.9 2006/02/03
12:05:49 sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boadmin_location
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 boadmin_location($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.soadmin_location');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','standard_e',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_e');
+
+
+ $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'];
+ }
+
+ function reset_fm_cache()
+ {
+ $this->so->reset_fm_cache();
+ }
+
+
+ function read()
+ {
+ $standard = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
+
+ $this->total_records = $this->so->total_records;
+
+
+ return $standard;
+ }
+
+ function read_config()
+ {
+ $standard = $this->so->read_config(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
+
+ $this->total_records = $this->so->total_records;
+
+
+ return $standard;
+ }
+
+ function read_config_single($column_name)
+ {
+ return $this->so->read_config_single($column_name);
+ }
+
+ function read_single($id)
+ {
+ return $this->so->read_single($id);
+ }
+
+ function save($standard,$action='')
+ {
+ if ($action=='edit')
+ {
+ if ($standard['id'] != '')
+ {
+
+ $receipt = $this->so->edit($standard);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($standard);
+ }
+ return $receipt;
+
+ }
+
+ function delete($type_id,$id,$attrib)
+ {
+ $this->so->delete($type_id,$id,$attrib);
+ }
+
+ function read_attrib($type_id='')
+ {
+ $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'type_id' => $type_id,'allrows'=>$this->allrows));
+
+ for ($i=0; $i<count($attrib); $i++)
+ {
+ $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
+ }
+
+ $this->total_records = $this->so->total_records;
+
+ return $attrib;
+ }
+
+ function read_single_attrib($type_id,$id)
+ {
+ return $this->so->read_single_attrib($type_id,$id);
+ }
+
+ function resort_attrib($data)
+ {
+ $this->so->resort_attrib($data);
+ }
+
+ function save_attrib($attrib,$action='')
+ {
+ if ($action=='edit')
+ {
+ if ($attrib['id'] != '')
+ {
+
+ $receipt =
$this->so->edit_attrib($attrib);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add_attrib($attrib);
+ }
+ return $receipt;
+ }
+
+ function save_config($values='',$column_name='')
+ {
+ return
$this->so->save_config($values,$column_name);
+ }
+
+ function select_location_type($selected='')
+ {
+ $location_types= $this->so->select_location_type();
+
+ while (is_array($location_types) && list(,$type) =
each($location_types))
+ {
+ $sel_type = '';
+ if ($type['id']==$selected)
+ {
+ $sel_type = 'selected';
+ }
+
+ $location_type_list[] = array
+ (
+ 'id' => $type['id'],
+ 'name' => $type['name'],
+ 'selected' => $sel_type
+ );
+ }
+
+ for ($i=0;$i<count($location_type_list);$i++)
+ {
+ if ($location_type_list[$i]['selected'] !=
'selected')
+ {
+
unset($location_type_list[$i]['selected']);
+ }
+ }
+
+//_debug_array($location_type_list);
+ return $location_type_list;
+ }
+
+ function select_nullable($selected='')
+ {
+ $nullable[0]['id']= 'True';
+ $nullable[0]['name']= lang('True');
+ $nullable[1]['id']= 'False';
+ $nullable[1]['name']= lang('False');
+
+ while (is_array($nullable) && list(,$type) =
each($nullable))
+ {
+ $sel_type = '';
+ if ($type['id']==$selected)
+ {
+ $sel_type = 'selected';
+ }
+
+ $nullable_list[] = array
+ (
+ 'id' => $type['id'],
+ 'name' => $type['name'],
+ 'selected' => $sel_type
+ );
+ }
+
+ for ($i=0;$i<count($nullable_list);$i++)
+ {
+ if ($nullable_list[$i]['selected'] !=
'selected')
+ {
+ unset($nullable_list[$i]['selected']);
+ }
+ }
+ return $nullable_list;
+ }
+ }
+?>
Index: property/inc/class.boagreement.inc.php
diff -u property/inc/class.boagreement.inc.php:1.7
property/inc/class.boagreement.inc.php:1.8
--- property/inc/class.boagreement.inc.php:1.7 Fri Jan 27 14:05:43 2006
+++ property/inc/class.boagreement.inc.php Fri Feb 3 12:05:49 2006
@@ -1,767 +1,767 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 agreement
- * @version $Id: class.boagreement.inc.php,v 1.7 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boagreement
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
- var $role;
- var $member_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function boagreement($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.soagreement');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->vfs =
CreateObject('phpgwapi.vfs');
- $this->rootdir = $this->vfs->basedir;
- $this->fakebase = $this->vfs->fakebase;
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $vendor_id =
get_var('vendor_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
- $role = get_var('role',array('POST','GET'));
- $member_id =
get_var('member_id',array('POST','GET'));
-
-
- $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
- {
- unset($this->cat_id);
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- if(isset($member_id))
- {
- $this->member_id = $member_id;
- }
- if(isset($vendor_id))
- {
- $this->vendor_id = $vendor_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','agreement',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','agreement');
-
- //_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->vendor_id= $data['vendor_id'];
- $this->member_id= $data['member_id'];
- $this->allrows = $data['allrows'];
- }
-
- function check_perms($has, $needed)
- {
- return (!!($has & $needed) == True);
- }
-
-
- function select_category_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->select_category_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function select_vendor_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('select_vendor'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_vendor'));
- break;
- }
-
- $input_list= $this->so->select_vendor_list();
- $vendor_list=
$this->bocommon->select_list($selected,$input_list);
-
- return $vendor_list;
- }
-
- function read()
- {
- $agreement = $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,
-
'vendor_id'=>$this->vendor_id));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
-
- for ($i=0; $i<count($agreement); $i++)
- {
- if($agreement[$i]['start_date'])
- {
- $agreement[$i]['start_date'] =
$GLOBALS['phpgw']->common->show_date($agreement[$i]['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
- if($agreement[$i]['end_date'])
- {
- $agreement[$i]['end_date'] =
$GLOBALS['phpgw']->common->show_date($agreement[$i]['end_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
-
- $agreement[$i]['status'] =
lang($agreement[$i]['status']);
-
- }
- return $agreement;
- }
-
- function read_details($id)
- {
- $list = $this->so->read_details(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,
-
'agreement_id'=>$id));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
-
- return $list;
- }
-
- function read_prizing($data)
- {
- $list = $this->so->read_prizing($data);
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
-
- for ($i=0; $i<count($list); $i++)
- {
- $list[$i]['index_date'] =
$GLOBALS['phpgw']->common->show_date($list[$i]['index_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
-
- return $list;
- }
-
- function read_event($data)
- {
- $boalarm =
CreateObject($this->currentapp.'.boalarm');
- $event = $this->so->read_single($data);
- $event['alarm_date']=$event['termination_date'];
- $event['alarm'] =
$boalarm->read_alarms($type='agreement',$data['agreement_id']);
- return $event;
- }
-
- function read_single($data)
- {
- $agreement = $this->so->read_single($data);
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $agreement['start_date'] =
$GLOBALS['phpgw']->common->show_date($agreement['start_date'],$dateformat);
- $agreement['end_date'] =
$GLOBALS['phpgw']->common->show_date($agreement['end_date'],$dateformat);
- if($agreement['termination_date'])
- {
- $agreement['termination_date']=
$GLOBALS['phpgw']->common->show_date($agreement['termination_date'],$dateformat);
- }
-
- $agreement = $this->convert_attribute($agreement);
-
- $this->vfs->override_acl = 1;
-
- $agreement['files'] = $this->vfs->ls (array(
- 'string' => $this->fakebase. '/' . 'agreement' .
'/' . $data['agreement_id'],
- 'relatives' => array(RELATIVE_NONE)));
-
- $this->vfs->override_acl = 0;
-
- if(!$agreement['files'][0]['file_id'])
- {
- unset($agreement['files']);
- }
-
- return $agreement;
-
- }
-
- function read_single_item($data)
- {
- $item = $this->so->read_single_item($data);
-//_debug_array($item);
- $item = $this->convert_attribute($item,True);
- return $item;
- }
-
- function convert_attribute($list,$detail='')
- {
- if($detail)
- {
- $this->so->role = 'detail';
- }
- $contacts =
CreateObject('phpgwapi.contacts');
-
- $vendor = CreateObject($this->currentapp.'.soactor');
- $vendor->role = 'vendor';
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $input_type_array = array(
- 'R' => 'radio',
- 'CH' => 'checkbox',
- 'LB' => 'listbox'
- );
-
- $sep = '/';
- $dlarr[strpos($dateformat,'Y')] = 'Y';
- $dlarr[strpos($dateformat,'m')] = 'm';
- $dlarr[strpos($dateformat,'d')] = 'd';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
-//html_print_r($list);
- $m=0;
- for ($i=0;$i<count($list['attributes']);$i++)
- {
- if($list['attributes'][$i]['datatype']=='D' &&
$list['attributes'][$i]['value'])
- {
- $timestamp_date=
mktime(0,0,0,date(m,strtotime($list['attributes'][$i]['value'])),date(d,strtotime($list['attributes'][$i]['value'])),date(y,strtotime($list['attributes'][$i]['value'])));
- $list['attributes'][$i]['value']
= $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
- }
- if($list['attributes'][$i]['datatype']=='AB')
- {
- if($list['attributes'][$i]['value'])
- {
- $contact_data =
$contacts->read_single_entry($list['attributes'][$i]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-
$list['attributes'][$i]['contact_name'] = $contact_data[0]['n_family'] . ', ' .
$contact_data[0]['n_given'];
- }
-
- $insert_record_list[] =
$list['attributes'][$i]['name'];
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $list['attributes'][$i]['name']);
-
- $lookup_functions[$m]['name'] =
'lookup_'. $list['attributes'][$i]['name'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
-
if($list['attributes'][$i]['datatype']=='VENDOR')
- {
- if($list['attributes'][$i]['value'])
- {
- $vendor_data =
$vendor->read_single(array('actor_id'=>$list['attributes'][$i]['value']));
-
- for
($n=0;$n<count($vendor_data['attributes']);$n++)
- {
-
if($vendor_data['attributes'][$n]['name'] == 'org_name')
- {
-
$list['attributes'][$i]['vendor_name']= $vendor_data['attributes'][$n]['value'];
- $n
=count($vendor_data['attributes']);
- }
- }
- }
-
- $insert_record_list[] =
$list['attributes'][$i]['name'];
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $list['attributes'][$i]['name']);
-
- $lookup_functions[$m]['name'] =
'lookup_'. $list['attributes'][$i]['name'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
-
- if($list['attributes'][$i]['datatype']=='R' ||
$list['attributes'][$i]['datatype']=='CH' ||
$list['attributes'][$i]['datatype']=='LB')
- {
- $list['attributes'][$i]['choice']
= $this->so->read_attrib_choice($list['attributes'][$i]['attrib_id']);
-
$input_type=$input_type_array[$list['attributes'][$i]['datatype']];
-
-
if($list['attributes'][$i]['datatype']=='CH')
- {
-
$list['attributes'][$i]['value']=unserialize($list['attributes'][$i]['value']);
-
$list['attributes'][$i]['choice'] =
$this->bocommon->select_multi_list_2($list['attributes'][$i]['value'],$list['attributes'][$i]['choice'],$input_type);
-
- }
- else
- {
- for
($j=0;$j<count($list['attributes'][$i]['choice']);$j++)
- {
-
$list['attributes'][$i]['choice'][$j]['input_type']=$input_type;
-
if($list['attributes'][$i]['choice'][$j]['id']==$list['attributes'][$i]['value'])
- {
-
$list['attributes'][$i]['choice'][$j]['checked']='checked';
- }
- }
- }
- }
-
- $list['attributes'][$i]['datatype_text'] =
$this->bocommon->translate_datatype($list['attributes'][$i]['datatype']);
- $list['attributes'][$i]['counter'] = $i;
- $list['attributes'][$i]['type_id'] =
$data['type_id'];
- }
-
- for ($j=0;$j<count($lookup_functions);$j++)
- {
- $list['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
- $list['lookup_functions'] .= '{'."\r\n";
- $list['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
- $list['lookup_functions'] .= '}'."\r\n";
- }
-
-
$GLOBALS['phpgw']->session->appsession('insert_record_agreement' .
!!$detail,$this->currentapp,$insert_record_list);
-
-//html_print_r($list);
- return $list;
-
- }
-
- function convert_attribute_save($values_attribute='')
- {
-
- for ($i=0;$i<count($values_attribute);$i++)
- {
- if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
- }
- if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
- }
-
- if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
- }
-
- if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
- }
- }
-
- return $values_attribute;
- }
-
- function save($values,$values_attribute='',$action='')
- {
-
- $values['start_date'] =
$this->bocommon->date_to_timestamp($values['start_date']);
- $values['end_date'] =
$this->bocommon->date_to_timestamp($values['end_date']);
- $values['termination_date'] =
$this->bocommon->date_to_timestamp($values['termination_date']);
-
- $values_attribute =
$this->convert_attribute_save($values_attribute);
-
- if ($action=='edit')
-// if ($values['agreement_id'])
- {
- if ($values['agreement_id'] != 0)
- {
-
$receipt=$this->so->edit($values,$values_attribute);
-
- if($values['delete_file'])
- {
- for
($i=0;$i<count($values['delete_file']);$i++)
- {
- $file =
$this->fakebase. SEP . 'agreement' . SEP . $values['agreement_id'] . SEP .
$values['delete_file'][$i];
-
-
if($this->vfs->file_exists(array(
-
'string' => $file,
-
'relatives' => Array(RELATIVE_NONE)
- )))
- {
-
$this->vfs->override_acl = 1;
-
-
if(!$this->vfs->rm (array(
-
'string' => $file,
-
'relatives' => array(
-
RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . 'agreement'. SEP . $values['agreement_id'] . SEP
.$values['delete_file'][$i]);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . 'agreement'. SEP . $values['id'] . SEP .
$values['delete_file'][$i]);
- }
-
$this->vfs->override_acl = 0;
- }
- }
- }
- }
- }
- else
- {
- $receipt =
$this->so->add($values,$values_attribute);
- }
- return $receipt;
- }
-
- function save_item($values,$values_attribute='')
- {
-//_debug_array($values);
- $values['m_cost'] =
str_replace(",",".",$values['m_cost']);
- $values['w_cost'] =
str_replace(",",".",$values['w_cost']);
- $values['total_cost'] = $values['m_cost'] +
$values['w_cost'];
-
- if ($values['index_count'] > 0)
- {
- if ($values['id'] != 0)
- {
- $receipt=$this->so->edit_item($values);
- }
- }
- else
- {
- $receipt = $this->so->add_item($values);
- }
- return $receipt;
- }
-
-
- function update($values)
- {
- $values['date'] =
$this->bocommon->date_to_timestamp($values['date']);
-
- return $this->so->update($values);
- }
-
- function delete_last_index($agreement_id,$id)
- {
- $this->so->delete_last_index($agreement_id,$id);
- }
-
-
- function delete_item($agreement_id,$activity_id)
- {
- $this->so->delete_item($agreement_id,$activity_id);
- }
-
- function delete($agreement_id='',$id='',$attrib='')
- {
- if ($attrib)
- {
- $this->so->delete_attrib($id);
- }
- else
- {
- $this->so->delete($agreement_id);
- }
- }
-
- function read_attrib($type_id='')
- {
- $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'allrows'=>$this->allrows));
-
- for ($i=0; $i<count($attrib); $i++)
- {
- $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
- }
-
- $this->total_records = $this->so->total_records;
-
- return $attrib;
- }
-
- function read_single_attrib($id)
- {
- return $this->so->read_single_attrib($id);
- }
-
- function resort_attrib($data)
- {
- $this->so->resort_attrib($data);
- }
-
- function save_attrib($attrib,$action='')
- {
- if ($action=='edit')
- {
- if ($attrib['id'] != '')
- {
-
- $receipt =
$this->so->edit_attrib($attrib);
- }
- }
- else
- {
- $receipt = $this->so->add_attrib($attrib);
- }
- return $receipt;
- }
-
- function column_list($selected='',$allrows='')
- {
- if(!$selected)
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]["agreement_columns"];
- }
-
- $columns =
$this->so->read_attrib(array('allrows'=>$allrows,'column_list'=>True));
-
-
$column_list=$this->bocommon->select_multi_list($selected,$columns);
-
- return $column_list;
- }
-
- function request_next_id()
- {
- return $this->so->request_next_id();
- }
-
- function create_home_dir($receipt='')
- {
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
'agreement',
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
-
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
'agreement',
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'agreement');
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'agreement');
- }
- $this->vfs->override_acl = 0;
- }
-
- return $receipt;
- }
-
- function create_document_dir($id='')
- {
-
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
'agreement' . SEP . $id,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
'agreement' . SEP . $id,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'agreement' . SEP . $id);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'agreement' . SEP . $id);
- }
- $this->vfs->override_acl = 0;
- }
-
-//_debug_array($receipt);
- return $receipt;
- }
-
- function get_agreement_group_list($selected='')
- {
- $agreement_groups=
$this->so->get_agreement_group_list();
-
- while (is_array($agreement_groups) &&
list(,$agreement_group_entry) = each($agreement_groups))
- {
- $sel_agreement_group_entry = '';
- if ($agreement_group_entry['id']==$selected)
- {
- $sel_agreement_group_entry = 'selected';
- }
-
- $agreement_group_list[] = array
- (
- 'id' => $agreement_group_entry['id'],
- 'name' =>
$agreement_group_entry['name'],
- 'selected' =>
$sel_agreement_group_entry
- );
- }
-
- for ($i=0;$i<count($agreement_group_list);$i++)
- {
- if ($agreement_group_list[$i]['selected'] !=
'selected')
- {
-
unset($agreement_group_list[$i]['selected']);
- }
- }
-
- return $agreement_group_list;
- }
-
- function read_group_activity($group_id='',$agreement_id='')
- {
- $activity_list =
$this->so->read_group_activity($group_id,$agreement_id);
- $this->uicols = $this->so->uicols;
- return $activity_list;
- }
-
- function add_activity($values='',$agreement_id='')
- {
- return $this->so->add_activity($values,$agreement_id);
- }
-
- function select_status_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
- break;
- }
-
- $status_entries= $this->so->select_status_list();
-
- while (is_array($status_entries) && list(,$status) =
each($status_entries))
- {
- $sel_status = '';
- if ($status['id']==$selected)
- {
- $sel_status = 'selected';
- }
-
- $status_list[] = array
- (
- 'id' => $status['id'],
- 'name' => $status['name'],
- 'selected' => $sel_status
- );
- }
-
- for ($i=0;$i<count($status_list);$i++)
- {
- if ($status_list[$i]['selected'] != 'selected')
- {
- unset($status_list[$i]['selected']);
- }
- }
-
- return $status_list;
- }
-
- function get_activity_descr($id)
- {
- return $this->so->get_activity_descr($id);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 agreement
+ * @version $Id: class.boagreement.inc.php,v 1.8 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boagreement
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+ var $role;
+ var $member_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function boagreement($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.soagreement');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->vfs =
CreateObject('phpgwapi.vfs');
+ $this->rootdir = $this->vfs->basedir;
+ $this->fakebase = $this->vfs->fakebase;
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $vendor_id =
get_var('vendor_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+ $role = get_var('role',array('POST','GET'));
+ $member_id =
get_var('member_id',array('POST','GET'));
+
+
+ $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
+ {
+ unset($this->cat_id);
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ if(isset($member_id))
+ {
+ $this->member_id = $member_id;
+ }
+ if(isset($vendor_id))
+ {
+ $this->vendor_id = $vendor_id;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','agreement',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','agreement');
+
+ //_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->vendor_id= $data['vendor_id'];
+ $this->member_id= $data['member_id'];
+ $this->allrows = $data['allrows'];
+ }
+
+ function check_perms($has, $needed)
+ {
+ return (!!($has & $needed) == True);
+ }
+
+
+ function select_category_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->select_category_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function select_vendor_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('select_vendor'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_vendor'));
+ break;
+ }
+
+ $input_list= $this->so->select_vendor_list();
+ $vendor_list=
$this->bocommon->select_list($selected,$input_list);
+
+ return $vendor_list;
+ }
+
+ function read()
+ {
+ $agreement = $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,
+
'vendor_id'=>$this->vendor_id));
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+
+ for ($i=0; $i<count($agreement); $i++)
+ {
+ if($agreement[$i]['start_date'])
+ {
+ $agreement[$i]['start_date'] =
$GLOBALS['phpgw']->common->show_date($agreement[$i]['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+ if($agreement[$i]['end_date'])
+ {
+ $agreement[$i]['end_date'] =
$GLOBALS['phpgw']->common->show_date($agreement[$i]['end_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+
+ $agreement[$i]['status'] =
lang($agreement[$i]['status']);
+
+ }
+ return $agreement;
+ }
+
+ function read_details($id)
+ {
+ $list = $this->so->read_details(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,
+
'agreement_id'=>$id));
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+
+ return $list;
+ }
+
+ function read_prizing($data)
+ {
+ $list = $this->so->read_prizing($data);
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+
+ for ($i=0; $i<count($list); $i++)
+ {
+ $list[$i]['index_date'] =
$GLOBALS['phpgw']->common->show_date($list[$i]['index_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+
+ return $list;
+ }
+
+ function read_event($data)
+ {
+ $boalarm =
CreateObject($this->currentapp.'.boalarm');
+ $event = $this->so->read_single($data);
+ $event['alarm_date']=$event['termination_date'];
+ $event['alarm'] =
$boalarm->read_alarms($type='agreement',$data['agreement_id']);
+ return $event;
+ }
+
+ function read_single($data)
+ {
+ $agreement = $this->so->read_single($data);
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $agreement['start_date'] =
$GLOBALS['phpgw']->common->show_date($agreement['start_date'],$dateformat);
+ $agreement['end_date'] =
$GLOBALS['phpgw']->common->show_date($agreement['end_date'],$dateformat);
+ if($agreement['termination_date'])
+ {
+ $agreement['termination_date']=
$GLOBALS['phpgw']->common->show_date($agreement['termination_date'],$dateformat);
+ }
+
+ $agreement = $this->convert_attribute($agreement);
+
+ $this->vfs->override_acl = 1;
+
+ $agreement['files'] = $this->vfs->ls (array(
+ 'string' => $this->fakebase. '/' . 'agreement' .
'/' . $data['agreement_id'],
+ 'relatives' => array(RELATIVE_NONE)));
+
+ $this->vfs->override_acl = 0;
+
+ if(!$agreement['files'][0]['file_id'])
+ {
+ unset($agreement['files']);
+ }
+
+ return $agreement;
+
+ }
+
+ function read_single_item($data)
+ {
+ $item = $this->so->read_single_item($data);
+//_debug_array($item);
+ $item = $this->convert_attribute($item,True);
+ return $item;
+ }
+
+ function convert_attribute($list,$detail='')
+ {
+ if($detail)
+ {
+ $this->so->role = 'detail';
+ }
+ $contacts =
CreateObject('phpgwapi.contacts');
+
+ $vendor = CreateObject($this->currentapp.'.soactor');
+ $vendor->role = 'vendor';
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ $input_type_array = array(
+ 'R' => 'radio',
+ 'CH' => 'checkbox',
+ 'LB' => 'listbox'
+ );
+
+ $sep = '/';
+ $dlarr[strpos($dateformat,'Y')] = 'Y';
+ $dlarr[strpos($dateformat,'m')] = 'm';
+ $dlarr[strpos($dateformat,'d')] = 'd';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+//html_print_r($list);
+ $m=0;
+ for ($i=0;$i<count($list['attributes']);$i++)
+ {
+ if($list['attributes'][$i]['datatype']=='D' &&
$list['attributes'][$i]['value'])
+ {
+ $timestamp_date=
mktime(0,0,0,date(m,strtotime($list['attributes'][$i]['value'])),date(d,strtotime($list['attributes'][$i]['value'])),date(y,strtotime($list['attributes'][$i]['value'])));
+ $list['attributes'][$i]['value']
= $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
+ }
+ if($list['attributes'][$i]['datatype']=='AB')
+ {
+ if($list['attributes'][$i]['value'])
+ {
+ $contact_data =
$contacts->read_single_entry($list['attributes'][$i]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
+
$list['attributes'][$i]['contact_name'] = $contact_data[0]['n_family'] . ', ' .
$contact_data[0]['n_given'];
+ }
+
+ $insert_record_list[] =
$list['attributes'][$i]['name'];
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $list['attributes'][$i]['name']);
+
+ $lookup_functions[$m]['name'] =
'lookup_'. $list['attributes'][$i]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+
if($list['attributes'][$i]['datatype']=='VENDOR')
+ {
+ if($list['attributes'][$i]['value'])
+ {
+ $vendor_data =
$vendor->read_single(array('actor_id'=>$list['attributes'][$i]['value']));
+
+ for
($n=0;$n<count($vendor_data['attributes']);$n++)
+ {
+
if($vendor_data['attributes'][$n]['name'] == 'org_name')
+ {
+
$list['attributes'][$i]['vendor_name']= $vendor_data['attributes'][$n]['value'];
+ $n
=count($vendor_data['attributes']);
+ }
+ }
+ }
+
+ $insert_record_list[] =
$list['attributes'][$i]['name'];
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $list['attributes'][$i]['name']);
+
+ $lookup_functions[$m]['name'] =
'lookup_'. $list['attributes'][$i]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+
+ if($list['attributes'][$i]['datatype']=='R' ||
$list['attributes'][$i]['datatype']=='CH' ||
$list['attributes'][$i]['datatype']=='LB')
+ {
+ $list['attributes'][$i]['choice']
= $this->so->read_attrib_choice($list['attributes'][$i]['attrib_id']);
+
$input_type=$input_type_array[$list['attributes'][$i]['datatype']];
+
+
if($list['attributes'][$i]['datatype']=='CH')
+ {
+
$list['attributes'][$i]['value']=unserialize($list['attributes'][$i]['value']);
+
$list['attributes'][$i]['choice'] =
$this->bocommon->select_multi_list_2($list['attributes'][$i]['value'],$list['attributes'][$i]['choice'],$input_type);
+
+ }
+ else
+ {
+ for
($j=0;$j<count($list['attributes'][$i]['choice']);$j++)
+ {
+
$list['attributes'][$i]['choice'][$j]['input_type']=$input_type;
+
if($list['attributes'][$i]['choice'][$j]['id']==$list['attributes'][$i]['value'])
+ {
+
$list['attributes'][$i]['choice'][$j]['checked']='checked';
+ }
+ }
+ }
+ }
+
+ $list['attributes'][$i]['datatype_text'] =
$this->bocommon->translate_datatype($list['attributes'][$i]['datatype']);
+ $list['attributes'][$i]['counter'] = $i;
+ $list['attributes'][$i]['type_id'] =
$data['type_id'];
+ }
+
+ for ($j=0;$j<count($lookup_functions);$j++)
+ {
+ $list['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
+ $list['lookup_functions'] .= '{'."\r\n";
+ $list['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
+ $list['lookup_functions'] .= '}'."\r\n";
+ }
+
+
$GLOBALS['phpgw']->session->appsession('insert_record_agreement' .
!!$detail,$this->currentapp,$insert_record_list);
+
+//html_print_r($list);
+ return $list;
+
+ }
+
+ function convert_attribute_save($values_attribute='')
+ {
+
+ for ($i=0;$i<count($values_attribute);$i++)
+ {
+ if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
+ }
+ if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
+ }
+
+ if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
+ }
+
+ if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
+ }
+ }
+
+ return $values_attribute;
+ }
+
+ function save($values,$values_attribute='',$action='')
+ {
+
+ $values['start_date'] =
$this->bocommon->date_to_timestamp($values['start_date']);
+ $values['end_date'] =
$this->bocommon->date_to_timestamp($values['end_date']);
+ $values['termination_date'] =
$this->bocommon->date_to_timestamp($values['termination_date']);
+
+ $values_attribute =
$this->convert_attribute_save($values_attribute);
+
+ if ($action=='edit')
+// if ($values['agreement_id'])
+ {
+ if ($values['agreement_id'] != 0)
+ {
+
$receipt=$this->so->edit($values,$values_attribute);
+
+ if($values['delete_file'])
+ {
+ for
($i=0;$i<count($values['delete_file']);$i++)
+ {
+ $file =
$this->fakebase. SEP . 'agreement' . SEP . $values['agreement_id'] . SEP .
$values['delete_file'][$i];
+
+
if($this->vfs->file_exists(array(
+
'string' => $file,
+
'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+
$this->vfs->override_acl = 1;
+
+
if(!$this->vfs->rm (array(
+
'string' => $file,
+
'relatives' => array(
+
RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . 'agreement'. SEP . $values['agreement_id'] . SEP
.$values['delete_file'][$i]);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . 'agreement'. SEP . $values['id'] . SEP .
$values['delete_file'][$i]);
+ }
+
$this->vfs->override_acl = 0;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ $receipt =
$this->so->add($values,$values_attribute);
+ }
+ return $receipt;
+ }
+
+ function save_item($values,$values_attribute='')
+ {
+//_debug_array($values);
+ $values['m_cost'] =
str_replace(",",".",$values['m_cost']);
+ $values['w_cost'] =
str_replace(",",".",$values['w_cost']);
+ $values['total_cost'] = $values['m_cost'] +
$values['w_cost'];
+
+ if ($values['index_count'] > 0)
+ {
+ if ($values['id'] != 0)
+ {
+ $receipt=$this->so->edit_item($values);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add_item($values);
+ }
+ return $receipt;
+ }
+
+
+ function update($values)
+ {
+ $values['date'] =
$this->bocommon->date_to_timestamp($values['date']);
+
+ return $this->so->update($values);
+ }
+
+ function delete_last_index($agreement_id,$id)
+ {
+ $this->so->delete_last_index($agreement_id,$id);
+ }
+
+
+ function delete_item($agreement_id,$activity_id)
+ {
+ $this->so->delete_item($agreement_id,$activity_id);
+ }
+
+ function delete($agreement_id='',$id='',$attrib='')
+ {
+ if ($attrib)
+ {
+ $this->so->delete_attrib($id);
+ }
+ else
+ {
+ $this->so->delete($agreement_id);
+ }
+ }
+
+ function read_attrib($type_id='')
+ {
+ $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'allrows'=>$this->allrows));
+
+ for ($i=0; $i<count($attrib); $i++)
+ {
+ $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
+ }
+
+ $this->total_records = $this->so->total_records;
+
+ return $attrib;
+ }
+
+ function read_single_attrib($id)
+ {
+ return $this->so->read_single_attrib($id);
+ }
+
+ function resort_attrib($data)
+ {
+ $this->so->resort_attrib($data);
+ }
+
+ function save_attrib($attrib,$action='')
+ {
+ if ($action=='edit')
+ {
+ if ($attrib['id'] != '')
+ {
+
+ $receipt =
$this->so->edit_attrib($attrib);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add_attrib($attrib);
+ }
+ return $receipt;
+ }
+
+ function column_list($selected='',$allrows='')
+ {
+ if(!$selected)
+ {
+
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]["agreement_columns"];
+ }
+
+ $columns =
$this->so->read_attrib(array('allrows'=>$allrows,'column_list'=>True));
+
+
$column_list=$this->bocommon->select_multi_list($selected,$columns);
+
+ return $column_list;
+ }
+
+ function request_next_id()
+ {
+ return $this->so->request_next_id();
+ }
+
+ function create_home_dir($receipt='')
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'agreement',
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'agreement',
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'agreement');
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'agreement');
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+ return $receipt;
+ }
+
+ function create_document_dir($id='')
+ {
+
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'agreement' . SEP . $id,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'agreement' . SEP . $id,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'agreement' . SEP . $id);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'agreement' . SEP . $id);
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+//_debug_array($receipt);
+ return $receipt;
+ }
+
+ function get_agreement_group_list($selected='')
+ {
+ $agreement_groups=
$this->so->get_agreement_group_list();
+
+ while (is_array($agreement_groups) &&
list(,$agreement_group_entry) = each($agreement_groups))
+ {
+ $sel_agreement_group_entry = '';
+ if ($agreement_group_entry['id']==$selected)
+ {
+ $sel_agreement_group_entry = 'selected';
+ }
+
+ $agreement_group_list[] = array
+ (
+ 'id' => $agreement_group_entry['id'],
+ 'name' =>
$agreement_group_entry['name'],
+ 'selected' =>
$sel_agreement_group_entry
+ );
+ }
+
+ for ($i=0;$i<count($agreement_group_list);$i++)
+ {
+ if ($agreement_group_list[$i]['selected'] !=
'selected')
+ {
+
unset($agreement_group_list[$i]['selected']);
+ }
+ }
+
+ return $agreement_group_list;
+ }
+
+ function read_group_activity($group_id='',$agreement_id='')
+ {
+ $activity_list =
$this->so->read_group_activity($group_id,$agreement_id);
+ $this->uicols = $this->so->uicols;
+ return $activity_list;
+ }
+
+ function add_activity($values='',$agreement_id='')
+ {
+ return $this->so->add_activity($values,$agreement_id);
+ }
+
+ function select_status_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
+ break;
+ }
+
+ $status_entries= $this->so->select_status_list();
+
+ while (is_array($status_entries) && list(,$status) =
each($status_entries))
+ {
+ $sel_status = '';
+ if ($status['id']==$selected)
+ {
+ $sel_status = 'selected';
+ }
+
+ $status_list[] = array
+ (
+ 'id' => $status['id'],
+ 'name' => $status['name'],
+ 'selected' => $sel_status
+ );
+ }
+
+ for ($i=0;$i<count($status_list);$i++)
+ {
+ if ($status_list[$i]['selected'] != 'selected')
+ {
+ unset($status_list[$i]['selected']);
+ }
+ }
+
+ return $status_list;
+ }
+
+ function get_activity_descr($id)
+ {
+ return $this->so->get_activity_descr($id);
+ }
+ }
+?>
Index: property/inc/class.boalarm.inc.php
diff -u property/inc/class.boalarm.inc.php:1.11
property/inc/class.boalarm.inc.php:1.12
--- property/inc/class.boalarm.inc.php:1.11 Fri Jan 27 14:05:43 2006
+++ property/inc/class.boalarm.inc.php Fri Feb 3 12:05:49 2006
@@ -1,481 +1,481 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.boalarm.inc.php,v 1.11 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boalarm
- {
-
- var $public_functions = array
- (
- 'send_alarm' => True
- );
-
- function boalarm()
- {
-
- $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- if (!is_object($GLOBALS['phpgw']->asyncservice))
- {
- $GLOBALS['phpgw']->asyncservice =
CreateObject('phpgwapi.asyncservice');
- }
- $this->async = &$GLOBALS['phpgw']->asyncservice;
- $this->so =
CreateObject($this->currentapp.'.soalarm');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $method_id =
get_var('method_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- 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
- {
- unset($this->cat_id);
- }
- if(isset($method_id) && !empty($method_id))
- {
- $this->method_id = $method_id;
- }
- else
- {
- unset($this->method_id);
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','owner',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','owner');
-
- $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->method_id = $data['method_id'];
- }
-
-
- function select_method_list($selected='')
- {
- $list = $this->so->select_method_list();
- $list = $this->bocommon->select_list($selected,$list);
- return $list;
- }
-
- function read_single_method($id)
- {
- return $this->so->read_single_method($id);
- }
-
- function read()
- {
- $jobs = $this->so->read(array(id=>'%','start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'allrows'=>$this->allrows));
- $this->total_records = $this->so->total_records;
- return $jobs;
- }
-
- /*!
- @function read_alarms
- @abstract read the alarms of a calendar-event specified by
$cal_id
- @returns array of alarms with alarm-id as key
- @note the alarm-id is a string of 'cal:'.$cal_id.':'.$alarm_nr,
it is used as the job-id too
- */
- function read_alarms($type='',$input_id,$text='')
- {
- $alarms = array();
-
- if ($jobs = $this->async->read($type .
':'.intval($input_id).':%'))
- {
- foreach($jobs as $id => $job)
- {
- $alarm =
$job['data']; // text, enabled
- $alarm['alarm_id'] = $id;
- $alarm['time'] =
$GLOBALS['phpgw']->common->show_date($job['next']);
- $alarm['user'] =
$GLOBALS['phpgw']->accounts->id2name($alarm['owner']);
- $alarm['text'] = $text;
-
- $alarms[] = $alarm;
- }
- }
- return $alarms;
- }
-
- /*!
- @function read_alarm
- @abstract read a single alarm specified by it's $id
- @returns array with data of the alarm
- @note the alarm-id is a string of 'cal:'.$cal_id.':'.$alarm_nr,
it is used as the job-id too
- */
- function read_alarm($alarm_type,$id)
- {
- if (!($jobs = $this->async->read($id)))
- {
- return False;
- }
-
- $alarm = $jobs[$id]['data']; // text, enabled
- $alarm['id'] = $id;
- $alarm['time'] = $jobs[$id]['next'];
- $alarm['times'] = $jobs[$id]['times'];
-
-// echo "<p>read_alarm('$id')="; print_r($alarm); echo
"</p>\n";
- return $alarm;
- }
-
-
-
- /*!
- @function enable
- @abstract enable or disable one or more alarms identified by
its ids
- @syntax enable($ids,$enable=True)
- @param $ids array with alarm ids as keys (!)
- @returns the number of alarms enabled or -1 for insuficent
permission to do so
- @note Not found alarms or insuficent perms stop the enableing
of multiple alarms
- */
- function enable_alarm($alarm_type,$alarms,$enable=True)
- {
- $enabled = 0;
- foreach ($alarms as $id => $field)
- {
- $temp = explode(':',$id);
- $alarm_type = $temp[0];
-
- if (!($alarm =
$this->read_alarm($alarm_type,$id)))
- {
- return 0; // alarm not found
- }
- if (!$alarm['enabled'] == !$enable)
- {
- continue; // nothing to do
- }
-/* if ($enable &&
!$this->check_perms(PHPGW_ACL_SETALARM,$alarm['owner']) ||
- !$enable &&
!$this->check_perms(PHPGW_ACL_DELETEALARM,$alarm['owner']))
- {
- return -1;
- }
-*/
- $alarm['enabled'] = intval(!$alarm['enabled']);
-
- if
($this->save_alarm($alarm_type,$alarm['event_id'],$alarm))
- {
- ++$enabled;
- }
- }
- return $enabled;
- }
-
-
- /*!
- @function save_alarm
- @abstract saves a new or updated alarm
- @syntax save_alarm($cal_id,$alarm,$id=False)
- @param $cal_id Id of the calendar-entry
- @param $alarm array with fields: text, owner, enabled, ..
- */
- function save_alarm($alarm_type,$event_id,$alarm,$method='')
- {
- if(!$method)
- {
- $method = $this->currentapp
.'.boalarm.send_alarm';
- }
-// echo "<p>save_alarm(event_id=$event_id, alarm=";
print_r($alarm); echo ")</p>\n";
-
- if (!$alarm['id'])
- {
- $alarms =
$this->read_alarms($alarm_type,$event_id); // find a free alarm#
- $n = count($alarms);
- do
- {
- $id = $alarm_type
.':'.intval($event_id).':'.$n;
- ++$n;
- }
- while (@isset($alarms[$id]));
-
- $alarm[$alarm_type.'_id'] = $event_id;
// we need the back-reference
-
- $alarm['id'] = $id;
-
- if
(!$this->async->set_timer($alarm['times'],$id,$method,$alarm))
- {
- return False;
- }
- return $id;
- }
- else
- {
- $this->async->cancel_timer($alarm['id']);
-
$this->async->set_timer($alarm['times'],$alarm['id'],$method,$alarm);
- return $alarm['id'];
- }
- }
-
- /*!
- @function add_alarm
- @abstract adds a new alarm to an event
- @syntax add(&$event,$time,$login_id)
- @param &$event event to add the alarm too
- @param $time for the alarm in sec before the starttime of the
event
- @param $login_id user to alarm
- @returns the alarm or False
- */
- function add_alarm($alarm_type,&$event,$time,$owner)
- {
-/* if (!$this->check_perms(PHPGW_ACL_SETALARM,$owner) ||
!($cal_id = $event['id']))
- {
- return False;
- }
-*/
- if(!$owner>0)
- {
- $receipt['error'][]=array('msg'=>lang('No user
selected'));
- return $receipt;
- }
-
- $alarm = Array(
- 'time' => ($event['alarm_date'] - $time),
//($etime=$this->bo->maketime($event['start'])) - $time,
- 'offset' => $time,
- 'owner' => $owner,
- 'enabled' => 1,
- 'event_id' => $event['id'],
- 'event_name' => $event['name']
- );
-
- $alarm['times'] = $alarm['time'];
- $alarm['id'] =
$this->save_alarm($alarm_type,$event['id'],$alarm);
-
- $event['alarm'][$alarm['id']] = $alarm;
-
- return $alarm;
- }
-
-
- /*!
- @function delete
- @abstract delete one or more alarms identified by its ids
- @syntax delete($ids)
- @param $ids array with alarm ids as keys (!)
- @returns the number of alarms deleted or -1 for insuficent
permission to do so
- @note Not found alarms or insuficent perms stop the deleting of
multiple alarms
- */
- function delete_alarm($alarm_type,$alarms)
- {
- $deleted = 0;
- foreach ($alarms as $id => $field)
- {
- if (!($alarm =
$this->read_alarm($alarm_type,$id)))
- {
- return 0; // alarm not found
- }
-/* if
(!$this->check_perms(PHPGW_ACL_DELETEALARM,$alarm['owner']))
- {
- return -1;
- }
-*/
- if ($this->async->cancel_timer($id))
- {
- ++$deleted;
- }
- }
- return $deleted;
- }
-
-
- function test_cron()
- {
- $this->async->check_run('crontab');
- }
-
-
- function send_alarm($alarm)
- {
-
- // echo "<p>boalarm::send_alarm("; print_r($alarm); echo
")</p>\n";
- $GLOBALS['phpgw_info']['user']['account_id'] =
$this->owner = $alarm['owner'];
-
- if (!$alarm['enabled'] || !$alarm['owner'])
- {
- return False; // event not found
- }
-
- $this->config =
CreateObject('phpgwapi.config');
- $this->config->read_repository();
- $this->send =
CreateObject('phpgwapi.send');
-
- $members = array();
-
- // build subject
- $subject = lang('Alarm').': '.$alarm['event_name'];
-
- $prefs_user =
$this->bocommon->create_preferences($this->currentapp,$alarm['owner']);
-
- $from_address=$prefs_user['email'];
-
- //-----------from--------
-
-
-
$current_user_id=$GLOBALS['phpgw_info']['user']['account_id'];
-
- $current_user_firstname = 'FM';
-
- $current_user_lastname = 'System';
-
- $current_user_name= $user_firstname . " "
.$user_lastname ;
-
- $current_prefs_user =
$this->bocommon->create_preferences($this->currentapp,$alarm['owner']);
- $current_user_address=$current_prefs_user['email'];
-
- $headers = "Return-Path: <". $current_user_address
.">\r\n";
- $headers .= "From: " . $current_user_name . "<" .
$current_user_address .">\r\n";
-// $headers .= "Bcc: " . $current_user_name . "<" .
$current_user_address .">\r\n";
- $headers .= "Content-type: text/html;
charset=iso-8859-1\r\n";
- $headers .= "MIME-Version: 1.0\r\n";
-
- //-----------from--------
- // build body
- $body = '';
- $body .= lang('Alarm').' #'.$alarm['event_id']."\n";
- $body .= lang('Name').': '.$alarm['event_name']."\n";
- if(!is_array($alarm['time']))
- {
- $body .= lang('Deadline').': '.
$GLOBALS['phpgw']->common->show_date(($alarm['time']+$alarm['offset'])) ."\n";
- }
- $body .= lang('Assigned To').':
'.$GLOBALS['phpgw']->accounts->id2name($alarm['owner'])."\n";
-
- // add assigned to recipients
- $members[] = array('account_id' => $alarm['owner'],
'account_name' => $GLOBALS['phpgw']->accounts->id2name($alarm['owner']));
-
- $error = Array();
- $toarray = Array();
- $i=0;
- for ($i=0;$i<count($members);$i++)
- {
- if ($members[$i]['account_id'])
- {
- $prefs =
$this->bocommon->create_preferences($this->currentapp,$members[$i]['account_id']);
- if (strlen($prefs['email'])>
(strlen($members[$i]['account_name'])+1))
- {
- $toarray[$prefs['email']] =
$prefs['email'];
- }
- else
- {
- $receipt['error'][] =
array('msg'=> lang('Your message could not be sent!'));
- $receipt['error'][] =
array('msg'=>lang('This user has not defined an email address !') . ' : ' .
$members[$i]['account_name']);
- }
- }
- }
-
- if(count($toarray) > 1)
- {
- $to = implode(',',$toarray);
- }
- else
- {
- $to = current($toarray);
- }
-
- $mail_method=
$this->config->config_data['fmwrkorder_mail'];
-// echo 'mail_method: '.$mail_method .'<BR>';
-
- if ($mail_method=='smtp'):
- {
- $rc = $this->send->msg('email', $to, $subject,
stripslashes($body), '', $cc,
$bcc,$current_user_address,$current_user_name,'txt');
- }
- elseif ($mail_method=='sendmail'):
- {
- $rc= @mail($to,$subject,stripslashes($body),
$headers);
- }
- else:
- {
- $receipt['error'][] = array('msg'=>
lang('Mailing method is not chosen! (admin section)'));
- }
- endif;
-
- // $rc=1;
- if (!$rc)
- {
- $receipt['error'][] = array('msg'=> lang('Your
message could not be sent by mail!'));
- $receipt['error'][] = array('msg'=> lang('The
mail server returned'));
- $receipt['error'][] = array('msg'=> 'From :' .
$current_user_name . '<' . $current_user_address .'>');
- $receipt['error'][] = array('msg'=> 'to: '.$to);
- $receipt['error'][] = array('msg'=> 'subject:
'.$subject);
- $receipt['error'][] = array('msg'=> $body );
- // $receipt['error'][] = array('msg'=> 'cc: ' .
$cc);
- // $receipt['error'][] = array('msg'=> 'bcc:
'.$bcc);
- $receipt['error'][] = array('msg'=> 'group:
'.$group_name);
- $receipt['error'][] = array('msg'=> 'err_code:
'.$this->send->err['code']);
- $receipt['error'][] = array('msg'=> 'err_msg:
'. htmlspecialchars($this->send->err['msg']));
- $receipt['error'][] = array('msg'=> 'err_desc:
'. $GLOBALS['phpgw']->err['desc']);
- }
-
-//_debug_array($receipt);
-// return $receipt;
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.boalarm.inc.php,v 1.12 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boalarm
+ {
+
+ var $public_functions = array
+ (
+ 'send_alarm' => True
+ );
+
+ function boalarm()
+ {
+
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ if (!is_object($GLOBALS['phpgw']->asyncservice))
+ {
+ $GLOBALS['phpgw']->asyncservice =
CreateObject('phpgwapi.asyncservice');
+ }
+ $this->async = &$GLOBALS['phpgw']->asyncservice;
+ $this->so =
CreateObject($this->currentapp.'.soalarm');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $method_id =
get_var('method_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ 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
+ {
+ unset($this->cat_id);
+ }
+ if(isset($method_id) && !empty($method_id))
+ {
+ $this->method_id = $method_id;
+ }
+ else
+ {
+ unset($this->method_id);
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','owner',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','owner');
+
+ $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->method_id = $data['method_id'];
+ }
+
+
+ function select_method_list($selected='')
+ {
+ $list = $this->so->select_method_list();
+ $list = $this->bocommon->select_list($selected,$list);
+ return $list;
+ }
+
+ function read_single_method($id)
+ {
+ return $this->so->read_single_method($id);
+ }
+
+ function read()
+ {
+ $jobs = $this->so->read(array(id=>'%','start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'allrows'=>$this->allrows));
+ $this->total_records = $this->so->total_records;
+ return $jobs;
+ }
+
+ /*!
+ @function read_alarms
+ @abstract read the alarms of a calendar-event specified by
$cal_id
+ @returns array of alarms with alarm-id as key
+ @note the alarm-id is a string of 'cal:'.$cal_id.':'.$alarm_nr,
it is used as the job-id too
+ */
+ function read_alarms($type='',$input_id,$text='')
+ {
+ $alarms = array();
+
+ if ($jobs = $this->async->read($type .
':'.intval($input_id).':%'))
+ {
+ foreach($jobs as $id => $job)
+ {
+ $alarm =
$job['data']; // text, enabled
+ $alarm['alarm_id'] = $id;
+ $alarm['time'] =
$GLOBALS['phpgw']->common->show_date($job['next']);
+ $alarm['user'] =
$GLOBALS['phpgw']->accounts->id2name($alarm['owner']);
+ $alarm['text'] = $text;
+
+ $alarms[] = $alarm;
+ }
+ }
+ return $alarms;
+ }
+
+ /*!
+ @function read_alarm
+ @abstract read a single alarm specified by it's $id
+ @returns array with data of the alarm
+ @note the alarm-id is a string of 'cal:'.$cal_id.':'.$alarm_nr,
it is used as the job-id too
+ */
+ function read_alarm($alarm_type,$id)
+ {
+ if (!($jobs = $this->async->read($id)))
+ {
+ return False;
+ }
+
+ $alarm = $jobs[$id]['data']; // text, enabled
+ $alarm['id'] = $id;
+ $alarm['time'] = $jobs[$id]['next'];
+ $alarm['times'] = $jobs[$id]['times'];
+
+// echo "<p>read_alarm('$id')="; print_r($alarm); echo
"</p>\n";
+ return $alarm;
+ }
+
+
+
+ /*!
+ @function enable
+ @abstract enable or disable one or more alarms identified by
its ids
+ @syntax enable($ids,$enable=True)
+ @param $ids array with alarm ids as keys (!)
+ @returns the number of alarms enabled or -1 for insuficent
permission to do so
+ @note Not found alarms or insuficent perms stop the enableing
of multiple alarms
+ */
+ function enable_alarm($alarm_type,$alarms,$enable=True)
+ {
+ $enabled = 0;
+ foreach ($alarms as $id => $field)
+ {
+ $temp = explode(':',$id);
+ $alarm_type = $temp[0];
+
+ if (!($alarm =
$this->read_alarm($alarm_type,$id)))
+ {
+ return 0; // alarm not found
+ }
+ if (!$alarm['enabled'] == !$enable)
+ {
+ continue; // nothing to do
+ }
+/* if ($enable &&
!$this->check_perms(PHPGW_ACL_SETALARM,$alarm['owner']) ||
+ !$enable &&
!$this->check_perms(PHPGW_ACL_DELETEALARM,$alarm['owner']))
+ {
+ return -1;
+ }
+*/
+ $alarm['enabled'] = intval(!$alarm['enabled']);
+
+ if
($this->save_alarm($alarm_type,$alarm['event_id'],$alarm))
+ {
+ ++$enabled;
+ }
+ }
+ return $enabled;
+ }
+
+
+ /*!
+ @function save_alarm
+ @abstract saves a new or updated alarm
+ @syntax save_alarm($cal_id,$alarm,$id=False)
+ @param $cal_id Id of the calendar-entry
+ @param $alarm array with fields: text, owner, enabled, ..
+ */
+ function save_alarm($alarm_type,$event_id,$alarm,$method='')
+ {
+ if(!$method)
+ {
+ $method = $this->currentapp
.'.boalarm.send_alarm';
+ }
+// echo "<p>save_alarm(event_id=$event_id, alarm=";
print_r($alarm); echo ")</p>\n";
+
+ if (!$alarm['id'])
+ {
+ $alarms =
$this->read_alarms($alarm_type,$event_id); // find a free alarm#
+ $n = count($alarms);
+ do
+ {
+ $id = $alarm_type
.':'.intval($event_id).':'.$n;
+ ++$n;
+ }
+ while (@isset($alarms[$id]));
+
+ $alarm[$alarm_type.'_id'] = $event_id;
// we need the back-reference
+
+ $alarm['id'] = $id;
+
+ if
(!$this->async->set_timer($alarm['times'],$id,$method,$alarm))
+ {
+ return False;
+ }
+ return $id;
+ }
+ else
+ {
+ $this->async->cancel_timer($alarm['id']);
+
$this->async->set_timer($alarm['times'],$alarm['id'],$method,$alarm);
+ return $alarm['id'];
+ }
+ }
+
+ /*!
+ @function add_alarm
+ @abstract adds a new alarm to an event
+ @syntax add(&$event,$time,$login_id)
+ @param &$event event to add the alarm too
+ @param $time for the alarm in sec before the starttime of the
event
+ @param $login_id user to alarm
+ @returns the alarm or False
+ */
+ function add_alarm($alarm_type,&$event,$time,$owner)
+ {
+/* if (!$this->check_perms(PHPGW_ACL_SETALARM,$owner) ||
!($cal_id = $event['id']))
+ {
+ return False;
+ }
+*/
+ if(!$owner>0)
+ {
+ $receipt['error'][]=array('msg'=>lang('No user
selected'));
+ return $receipt;
+ }
+
+ $alarm = Array(
+ 'time' => ($event['alarm_date'] - $time),
//($etime=$this->bo->maketime($event['start'])) - $time,
+ 'offset' => $time,
+ 'owner' => $owner,
+ 'enabled' => 1,
+ 'event_id' => $event['id'],
+ 'event_name' => $event['name']
+ );
+
+ $alarm['times'] = $alarm['time'];
+ $alarm['id'] =
$this->save_alarm($alarm_type,$event['id'],$alarm);
+
+ $event['alarm'][$alarm['id']] = $alarm;
+
+ return $alarm;
+ }
+
+
+ /*!
+ @function delete
+ @abstract delete one or more alarms identified by its ids
+ @syntax delete($ids)
+ @param $ids array with alarm ids as keys (!)
+ @returns the number of alarms deleted or -1 for insuficent
permission to do so
+ @note Not found alarms or insuficent perms stop the deleting of
multiple alarms
+ */
+ function delete_alarm($alarm_type,$alarms)
+ {
+ $deleted = 0;
+ foreach ($alarms as $id => $field)
+ {
+ if (!($alarm =
$this->read_alarm($alarm_type,$id)))
+ {
+ return 0; // alarm not found
+ }
+/* if
(!$this->check_perms(PHPGW_ACL_DELETEALARM,$alarm['owner']))
+ {
+ return -1;
+ }
+*/
+ if ($this->async->cancel_timer($id))
+ {
+ ++$deleted;
+ }
+ }
+ return $deleted;
+ }
+
+
+ function test_cron()
+ {
+ $this->async->check_run('crontab');
+ }
+
+
+ function send_alarm($alarm)
+ {
+
+ // echo "<p>boalarm::send_alarm("; print_r($alarm); echo
")</p>\n";
+ $GLOBALS['phpgw_info']['user']['account_id'] =
$this->owner = $alarm['owner'];
+
+ if (!$alarm['enabled'] || !$alarm['owner'])
+ {
+ return False; // event not found
+ }
+
+ $this->config =
CreateObject('phpgwapi.config');
+ $this->config->read_repository();
+ $this->send =
CreateObject('phpgwapi.send');
+
+ $members = array();
+
+ // build subject
+ $subject = lang('Alarm').': '.$alarm['event_name'];
+
+ $prefs_user =
$this->bocommon->create_preferences($this->currentapp,$alarm['owner']);
+
+ $from_address=$prefs_user['email'];
+
+ //-----------from--------
+
+
+
$current_user_id=$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $current_user_firstname = 'FM';
+
+ $current_user_lastname = 'System';
+
+ $current_user_name= $user_firstname . " "
.$user_lastname ;
+
+ $current_prefs_user =
$this->bocommon->create_preferences($this->currentapp,$alarm['owner']);
+ $current_user_address=$current_prefs_user['email'];
+
+ $headers = "Return-Path: <". $current_user_address
.">\r\n";
+ $headers .= "From: " . $current_user_name . "<" .
$current_user_address .">\r\n";
+// $headers .= "Bcc: " . $current_user_name . "<" .
$current_user_address .">\r\n";
+ $headers .= "Content-type: text/html;
charset=iso-8859-1\r\n";
+ $headers .= "MIME-Version: 1.0\r\n";
+
+ //-----------from--------
+ // build body
+ $body = '';
+ $body .= lang('Alarm').' #'.$alarm['event_id']."\n";
+ $body .= lang('Name').': '.$alarm['event_name']."\n";
+ if(!is_array($alarm['time']))
+ {
+ $body .= lang('Deadline').': '.
$GLOBALS['phpgw']->common->show_date(($alarm['time']+$alarm['offset'])) ."\n";
+ }
+ $body .= lang('Assigned To').':
'.$GLOBALS['phpgw']->accounts->id2name($alarm['owner'])."\n";
+
+ // add assigned to recipients
+ $members[] = array('account_id' => $alarm['owner'],
'account_name' => $GLOBALS['phpgw']->accounts->id2name($alarm['owner']));
+
+ $error = Array();
+ $toarray = Array();
+ $i=0;
+ for ($i=0;$i<count($members);$i++)
+ {
+ if ($members[$i]['account_id'])
+ {
+ $prefs =
$this->bocommon->create_preferences($this->currentapp,$members[$i]['account_id']);
+ if (strlen($prefs['email'])>
(strlen($members[$i]['account_name'])+1))
+ {
+ $toarray[$prefs['email']] =
$prefs['email'];
+ }
+ else
+ {
+ $receipt['error'][] =
array('msg'=> lang('Your message could not be sent!'));
+ $receipt['error'][] =
array('msg'=>lang('This user has not defined an email address !') . ' : ' .
$members[$i]['account_name']);
+ }
+ }
+ }
+
+ if(count($toarray) > 1)
+ {
+ $to = implode(',',$toarray);
+ }
+ else
+ {
+ $to = current($toarray);
+ }
+
+ $mail_method=
$this->config->config_data['fmwrkorder_mail'];
+// echo 'mail_method: '.$mail_method .'<BR>';
+
+ if ($mail_method=='smtp'):
+ {
+ $rc = $this->send->msg('email', $to, $subject,
stripslashes($body), '', $cc,
$bcc,$current_user_address,$current_user_name,'txt');
+ }
+ elseif ($mail_method=='sendmail'):
+ {
+ $rc= @mail($to,$subject,stripslashes($body),
$headers);
+ }
+ else:
+ {
+ $receipt['error'][] = array('msg'=>
lang('Mailing method is not chosen! (admin section)'));
+ }
+ endif;
+
+ // $rc=1;
+ if (!$rc)
+ {
+ $receipt['error'][] = array('msg'=> lang('Your
message could not be sent by mail!'));
+ $receipt['error'][] = array('msg'=> lang('The
mail server returned'));
+ $receipt['error'][] = array('msg'=> 'From :' .
$current_user_name . '<' . $current_user_address .'>');
+ $receipt['error'][] = array('msg'=> 'to: '.$to);
+ $receipt['error'][] = array('msg'=> 'subject:
'.$subject);
+ $receipt['error'][] = array('msg'=> $body );
+ // $receipt['error'][] = array('msg'=> 'cc: ' .
$cc);
+ // $receipt['error'][] = array('msg'=> 'bcc:
'.$bcc);
+ $receipt['error'][] = array('msg'=> 'group:
'.$group_name);
+ $receipt['error'][] = array('msg'=> 'err_code:
'.$this->send->err['code']);
+ $receipt['error'][] = array('msg'=> 'err_msg:
'. htmlspecialchars($this->send->err['msg']));
+ $receipt['error'][] = array('msg'=> 'err_desc:
'. $GLOBALS['phpgw']->err['desc']);
+ }
+
+//_debug_array($receipt);
+// return $receipt;
+ }
+
+ }
+?>
Index: property/inc/class.boasync.inc.php
diff -u property/inc/class.boasync.inc.php:1.5
property/inc/class.boasync.inc.php:1.6
--- property/inc/class.boasync.inc.php:1.5 Fri Jan 27 14:05:43 2006
+++ property/inc/class.boasync.inc.php Fri Feb 3 12:05:49 2006
@@ -1,164 +1,164 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.boasync.inc.php,v 1.5 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boasync
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 boasync($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.soasync');
- $this->socommon =
CreateObject($this->currentapp.'.socommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','async',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','async');
-
- $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'];
- }
-
-
- function read()
- {
- $method = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
-
- $this->total_records = $this->so->total_records;
-
- return $method;
- }
-
- function read_single($id)
- {
- return $this->so->read_single($id);
- }
-
- function save($method,$action='')
- {
- if ($action=='edit')
- {
- if ($method['id'] != '')
- {
-
- $receipt = $this->so->edit($method);
- }
- }
- else
- {
- $receipt = $this->so->add($method);
- }
- return $receipt;
-
- }
-
- function delete($id)
- {
- $this->so->delete($id);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.boasync.inc.php,v 1.6 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boasync
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 boasync($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.soasync');
+ $this->socommon =
CreateObject($this->currentapp.'.socommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','async',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','async');
+
+ $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'];
+ }
+
+
+ function read()
+ {
+ $method = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order));
+
+ $this->total_records = $this->so->total_records;
+
+ return $method;
+ }
+
+ function read_single($id)
+ {
+ return $this->so->read_single($id);
+ }
+
+ function save($method,$action='')
+ {
+ if ($action=='edit')
+ {
+ if ($method['id'] != '')
+ {
+
+ $receipt = $this->so->edit($method);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($method);
+ }
+ return $receipt;
+
+ }
+
+ function delete($id)
+ {
+ $this->so->delete($id);
+ }
+ }
+?>
Index: property/inc/class.bob_account.inc.php
diff -u property/inc/class.bob_account.inc.php:1.6
property/inc/class.bob_account.inc.php:1.7
--- property/inc/class.bob_account.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bob_account.inc.php Fri Feb 3 12:05:49 2006
@@ -1,179 +1,179 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.bob_account.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bob_account
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 bob_account($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sob_account');
- $this->socommon =
CreateObject($this->currentapp.'.socommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows= get_var('allrows',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','b_account',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','b_account');
-
- //_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'];
- }
-
-
- function read()
- {
- $b_account = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'allrows'=>$this->allrows));
-
- $this->total_records = $this->so->total_records;
-
- return $b_account;
- }
-
- function read_single($id)
- {
- return $this->so->read_single($id);
- }
-
- function select_part_of_town($part_of_town_id)
- {
- return
$this->socommon->select_part_of_town($part_of_town_id);
- }
-
- function save($b_account,$action='')
- {
- if ($action=='edit')
- {
- if ($b_account['id'] != '')
- {
-
- $receipt = $this->so->edit($b_account);
- }
- }
- else
- {
- $receipt = $this->so->add($b_account);
- }
-
- return $receipt;
- }
-
- function delete($id)
- {
- $this->so->delete($id);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.bob_account.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bob_account
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 bob_account($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sob_account');
+ $this->socommon =
CreateObject($this->currentapp.'.socommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows= get_var('allrows',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','b_account',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','b_account');
+
+ //_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'];
+ }
+
+
+ function read()
+ {
+ $b_account = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'allrows'=>$this->allrows));
+
+ $this->total_records = $this->so->total_records;
+
+ return $b_account;
+ }
+
+ function read_single($id)
+ {
+ return $this->so->read_single($id);
+ }
+
+ function select_part_of_town($part_of_town_id)
+ {
+ return
$this->socommon->select_part_of_town($part_of_town_id);
+ }
+
+ function save($b_account,$action='')
+ {
+ if ($action=='edit')
+ {
+ if ($b_account['id'] != '')
+ {
+
+ $receipt = $this->so->edit($b_account);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($b_account);
+ }
+
+ return $receipt;
+ }
+
+ function delete($id)
+ {
+ $this->so->delete($id);
+ }
+ }
+?>
Index: property/inc/class.bocategory.inc.php
diff -u property/inc/class.bocategory.inc.php:1.6
property/inc/class.bocategory.inc.php:1.7
--- property/inc/class.bocategory.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bocategory.inc.php Fri Feb 3 12:05:49 2006
@@ -1,179 +1,179 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.bocategory.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bocategory
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 bocategory($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.socategory');
- $this->socommon =
CreateObject($this->currentapp.'.socommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows= get_var('allrows',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','category',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','category');
-
- //_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'];
- }
-
-
- function read($type='',$type_id='')
- {
- $category = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'type' => $type,type_id=>$type_id,'allrows'=>$this->allrows));
-
- $this->total_records = $this->so->total_records;
-
- return $category;
- }
-
- function read_single($id,$type,$type_id)
- {
- return $this->so->read_single($id,$type,$type_id);
- }
-
- function select_part_of_town($part_of_town_id)
- {
- return
$this->socommon->select_part_of_town($part_of_town_id);
- }
-
- function save($category,$action='',$type ='',$type_id)
- {
- if ($action=='edit')
- {
- if ($category['id'] != '')
- {
-
- $receipt =
$this->so->edit($category,$type,$type_id);
- }
- }
- else
- {
- $receipt =
$this->so->add($category,$type,$type_id);
- }
-
- return $receipt;
- }
-
- function delete($id,$type,$type_id)
- {
- $this->so->delete($id,$type,$type_id);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.bocategory.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bocategory
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 bocategory($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.socategory');
+ $this->socommon =
CreateObject($this->currentapp.'.socommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows= get_var('allrows',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','category',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','category');
+
+ //_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'];
+ }
+
+
+ function read($type='',$type_id='')
+ {
+ $category = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'type' => $type,type_id=>$type_id,'allrows'=>$this->allrows));
+
+ $this->total_records = $this->so->total_records;
+
+ return $category;
+ }
+
+ function read_single($id,$type,$type_id)
+ {
+ return $this->so->read_single($id,$type,$type_id);
+ }
+
+ function select_part_of_town($part_of_town_id)
+ {
+ return
$this->socommon->select_part_of_town($part_of_town_id);
+ }
+
+ function save($category,$action='',$type ='',$type_id)
+ {
+ if ($action=='edit')
+ {
+ if ($category['id'] != '')
+ {
+
+ $receipt =
$this->so->edit($category,$type,$type_id);
+ }
+ }
+ else
+ {
+ $receipt =
$this->so->add($category,$type,$type_id);
+ }
+
+ return $receipt;
+ }
+
+ function delete($id,$type,$type_id)
+ {
+ $this->so->delete($id,$type,$type_id);
+ }
+ }
+?>
Index: property/inc/class.bocommon.inc.php
diff -u property/inc/class.bocommon.inc.php:1.20
property/inc/class.bocommon.inc.php:1.21
--- property/inc/class.bocommon.inc.php:1.20 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bocommon.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1384 +1,1384 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 core
- * @version $Id: class.bocommon.inc.php,v 1.20 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bocommon
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
- var $district_id;
-
-
- var $public_functions = array
- (
- 'select_part_of_town' => True,
- 'menu' => True,
- );
-
- 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 bocommon()
- {
-
- $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->socommon =
CreateObject($this->currentapp.'.socommon');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- if (!is_object($GLOBALS['phpgw']->asyncservice))
- {
- $GLOBALS['phpgw']->asyncservice =
CreateObject('phpgwapi.asyncservice');
- }
- $this->async = &$GLOBALS['phpgw']->asyncservice;
-
- $this->join = $this->socommon->join;
- $this->left_join = $this->socommon->left_join;
- $this->like = $this->socommon->like;
-
- switch($GLOBALS['phpgw_info']['server']['db_type'])
- {
- case 'mssql':
- $this->dateformat = "M d
Y";
- $this->datetimeformat = "M d Y g:iA";
- break;
- case 'mysql':
- $this->dateformat =
"Y-m-d";
- $this->datetimeformat = "Y-m-d G:i:s";
- break;
- case 'pgsql':
- $this->dateformat =
"Y-m-d";
- $this->datetimeformat = "Y-m-d G:i:s";
-// $this->dateformat = "F j,
Y";
-// $this->datetimeformat = "F j, Y g:iA";
- break;
- }
-
- /* if
($GLOBALS['phpgw_info']['server']['db_type']=='mssql')
- {
- $this->dateformat = "M d Y";
- $this->datetimeformat = "M d Y g:iA";
- }
- else
- {
- $this->dateformat = "Y-m-d";
- $this->datetimeformat = "Y-m-d G:i:s";
- }
-
-
- if(!$GLOBALS['phpgw_info']['flags']['css'])
- {
- $GLOBALS['phpgw_info']['flags']['css'] .=
"-->\n</style>\n"
- . '<link rel="stylesheet"
type="text/css" media="all" href="'
- .
$GLOBALS['phpgw_info']['server']['webserver_url'].'/' . $this->currentapp .
'/templates/'
- .
$GLOBALS['phpgw_info']['server']['template_set']
- .
'/css/'.$GLOBALS['phpgw_info']['server']['template_set'].'.css"
title="'.$GLOBALS['phpgw_info']['server']['template_set'].'" />'
- . "\n<style type=\"text/css\">\n<!--\n";
- }
-*/
- }
-
- function jscalendar()
- {
- $phpgw_js_url =
$GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/js';
-// $img =
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default').'/cal.png';
- $img =
$GLOBALS['phpgw_info']['server']['webserver_url'] .
'/phpgwapi/templates/default/images/cal.png';
-
-// $img = $phpgw_js_url.'/jscalendar/img.gif';
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $jsDateFormat = str_replace(array('d', 'm', 'M', 'Y'),
array('%d', '%m', '%b', '%Y'), $dateformat);
-
- $GLOBALS['phpgw_info']['flags']['java_script']
.='</script>
- <link rel="stylesheet" type="text/css" media="all"
href="'.$phpgw_js_url.'/jscalendar/calendar-win2k-cold-1.css"
title="win2k-cold-1" >
- <script type="text/javascript"
src="'.$phpgw_js_url.'/jscalendar/calendar.js"></script>
- <script type="text/javascript"
src="'.$phpgw_js_url.'/jscalendar/calendar-setup.js"></script>
- <script type="text/javascript"
src="'.$phpgw_js_url.'/jscalendar/lang/calendar-'.substr($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],0,2)
.'.js"></script>
- ';
-
-
-// <script type="text/javascript"
src="'.ereg_replace('[?&]*click_history=[0-9a-f]*','',$GLOBALS['phpgw']->link('/phpgwapi/js/jscalendar/jscalendar-setup.php')).'"></script>
-
- $cal_info=array(
-// 'stylesheet'
=> $phpgw_js_url.'/jscalendar/calendar-win2k-cold-1.css',
-// 'calendar_source'
=> $phpgw_js_url.'/jscalendar/calendar.js',
-// 'calendar_setup_source' =>
$phpgw_js_url.'/jscalendar/calendar-setup.js',
-// 'calendar_lang'
=>
$phpgw_js_url.'/jscalendar/lang/calendar-'.substr($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],0,2)
.'.js',
- 'jsDateFormat'
=> $jsDateFormat,
- 'img'
=> $img,
- );
- return $cal_info;
- }
-
- function check_perms($rights, $required)
- {
- // return (!!($rights & $required) == True);
- return ($rights & $required);
- }
-
- function create_preferences($app='',$user_id='')
- {
- return
$this->socommon->create_preferences($app,$user_id);
- }
-
- function get_lookup_entity($location='')
- {
- return $this->socommon->get_lookup_entity($location);
- }
-
- function get_start_entity($location='')
- {
- return $this->socommon->get_start_entity($location);
- }
-
- function msgbox_data($receipt)
- {
- $msgbox_data_error=array();
- if (isSet($receipt['error']) AND
is_array($receipt['error']))
- {
- foreach($receipt['error'] as $errors)
- {
- $msgbox_data_error +=
array($errors['msg']=> False);
- }
- }
-
- $msgbox_data_message=array();
-
- if (isSet($receipt['message']) AND
is_array($receipt['message']))
- {
- foreach($receipt['message'] as $messages)
- {
- $msgbox_data_message +=
array($messages['msg']=> True);
- }
- }
-
- $msgbox_data = $msgbox_data_error +
$msgbox_data_message;
-
- return $msgbox_data;
- }
-
- function moneyformat($amount)
- {
- if
($GLOBALS['phpgw_info']['server']['db_type']=='mssql')
- {
- $moneyformat =
"CONVERT(MONEY,"."'$amount'".",0)";
- }
- else
- {
- $moneyformat = "'" . $amount . "'";
- }
-
- return $moneyformat;
- }
-
-
- function date_array($date)
- {
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $dateformat = str_replace(".","",$dateformat);
- $dateformat = str_replace("-","",$dateformat);
- $dateformat = str_replace("/","",$dateformat);
- $y=strpos($dateformat,'y');
- $d=strpos($dateformat,'d');
- $m=strpos($dateformat,'m');
-
- $dateparts = explode('/', $date);
- $date_array['day'] = $dateparts[$d];
- $date_array['month'] = $dateparts[$m];
- $date_array['year'] = $dateparts[$y];
-
- return $date_array;
- }
-
- function date_to_timestamp($date)
- {
- if($date)
- {
- $date_array = $this->date_array($date);
- $date = mktime
(8,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
- }
- return $date;
- }
-
-
- function
column_list($selected='',$entity_type='',$cat_id,$allrows='')
- {
- $bostandard_entity =
CreateObject($this->currentapp.'.bostandard_entity',True);
-
- if(!$selected)
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp][$entity_type.'_columns_'.$cat_id];
- }
-
- $columns =
$bostandard_entity->read_attrib($entity_type,$cat_id,$allrows);
-//_debug_array($columns);
-
-
$column_list=$this->select_multi_list($selected,$columns);
-
- return $column_list;
-
- }
-
- function select_multi_list($selected='',$input_list)
- {
- $j=0;
- if (isset($input_list) AND is_array($input_list))
- {
- foreach($input_list as $entry)
- {
- $output_list[$j]['id'] = $entry['id'];
- $output_list[$j]['name'] =
$entry['name'];
-
- for ($i=0;$i<count($selected);$i++)
- {
- if($selected[$i] ==
$entry['id'])
- {
-
$output_list[$j]['selected'] = 'selected';
- }
- }
- $j++;
- }
- }
-
- for ($i=0;$i<count($output_list);$i++)
- {
- if ($output_list[$i]['selected'] != 'selected')
- {
- unset($output_list[$i]['selected']);
- }
- }
-
- return $output_list;
- }
-
-
-
- function select_list($selected='',$input_list='')
- {
- if (isset($input_list) AND is_array($input_list))
- {
- foreach($input_list as $entry)
- {
- $sel_entry = '';
- if ($entry['id']==$selected)
- {
- $sel_entry = 'selected';
- }
- $entry_list[] = array
- (
- 'id' => $entry['id'],
- 'name' =>
$entry['name'],
- 'selected' => $sel_entry
- );
- }
- for ($i=0;$i<count($entry_list);$i++)
- {
- if ($entry_list[$i]['selected'] !=
'selected')
- {
-
unset($entry_list[$i]['selected']);
- }
- }
- }
- return $entry_list;
- }
-
-
- function
get_user_list($format='',$selected='',$extra='',$default='',$start='',
$sort='', $order='', $query='',$offset='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_filter'));
- break;
- }
-
- if(!$selected && $default)
- {
- $selected = $default;
- }
-
- if (is_array($extra))
- {
- foreach($extra as $extra_user)
- {
- $users_extra[]=array
- (
- 'account_id' => $extra_user,
- 'account_firstname' =>
lang($extra_user)
- );
- }
- }
-
- $accounts = CreateObject('phpgwapi.accounts');
- $users = $accounts->get_list('accounts', $start, $sort,
$order, $query,$offset);
- unset($accounts);
- if (is_array($users_extra) && is_array($users))
- {
- $users = $users_extra + $users;
- }
-
- if (isSet($users) AND is_array($users))
- {
- foreach($users as $user)
- {
- $sel_user = '';
- if ($user['account_id']==$selected)
- {
- $sel_user = 'selected';
- }
-
- $user_list[] = array
- (
- 'user_id' =>
$user['account_id'],
- 'name' =>
$user['account_lastname'].' '.$user['account_firstname'],
- 'selected' => $sel_user
- );
- }
- }
-
- $user_count= count($user_list);
- for ($i=0;$i<$user_count;$i++)
- {
- if ($user_list[$i]['selected'] != 'selected')
- {
- unset($user_list[$i]['selected']);
- }
- }
-
-//_debug_array($user_list);
- return $user_list;
- }
-
- function get_group_list($format='',$selected='',$start='',
$sort='', $order='', $query='',$offset='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('group_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('group_filter'));
- break;
- }
-
- $accounts = CreateObject('phpgwapi.accounts');
- $users = $accounts->get_list('groups', $start, $sort,
$order, $query,$offset);
- unset($accounts);
- if (isSet($users) AND is_array($users))
- {
- foreach($users as $user)
- {
- $sel_user = '';
- if ($user['account_id']==$selected)
- {
- $sel_user = 'selected';
- }
-
- $user_list[] = array
- (
- 'id' => $user['account_id'],
- 'name' =>
$user['account_firstname'],
- 'selected' => $sel_user
- );
- }
- }
-
- $user_count= count($user_list);
- for ($i=0;$i<$user_count;$i++)
- {
- if ($user_list[$i]['selected'] != 'selected')
- {
- unset($user_list[$i]['selected']);
- }
- }
-
-//_debug_array($user_list);
- return $user_list;
- }
-
-
- function
get_user_list_right($right='',$selected='',$acl_location='')
- {
-
$employees=$this->socommon->get_user_list_right($right,$acl_location);
- while (is_array($employees) && list(,$user) =
each($employees))
- {
- $sel_user = '';
- if ($user['account_lid']==$selected)
- {
- $sel_user = 'selected';
- }
-
- $user_list[] = array
- (
- 'lid' =>
$user['account_lid'],
- 'firstname' =>
$user['account_firstname'],
- 'lastname' =>
$user['account_lastname'],
- 'selected' => $sel_user
- );
- }
-
- for ($i=0;$i<count($user_list);$i++)
- {
- if ($user_list[$i]['selected'] != 'selected')
- {
- unset($user_list[$i]['selected']);
- }
- }
-
- return $user_list;
- }
-
- function
get_user_list_right2($format='',$right='',$selected='',$acl_location='',$extra='',$default='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_filter'));
- break;
- }
-
- if(!$selected && $default)
- {
- $selected = $default;
- }
-
- if (isset($extra) AND is_array($extra))
- {
- foreach($extra as $extra_user)
- {
- $users_extra[]=array
- (
- 'account_id' => $extra_user,
- 'account_firstname' =>
lang($extra_user)
- );
- }
- }
-
-
$users=$this->socommon->get_user_list_right($right,$acl_location);
-
- if (is_array($users_extra) && is_array($users))
- {
- foreach($users as $users_entry)
- {
- array_push($users_extra,$users_entry);
- }
- $users=$users_extra;
- }
-
- while (is_array($users) && list(,$user) = each($users))
- {
- $sel_user = '';
- if ($user['account_id']==$selected)
- {
- $sel_user = 'selected';
- }
-
- $user_list[] = array
- (
- 'user_id' =>
$user['account_id'],
- 'name' =>
$user['account_lastname'].' '.$user['account_firstname'],
- 'selected' => $sel_user
- );
- }
-
- for ($i=0;$i<count($user_list);$i++)
- {
- if ($user_list[$i]['selected'] != 'selected')
- {
- unset($user_list[$i]['selected']);
- }
- }
-
- return $user_list;
- }
-
-
- function initiate_ui_vendorlookup($data)
- {
-//_debug_array($data);
-
- $contacts =
CreateObject($this->currentapp.'.soactor');
- $contacts->role='vendor';
-
- if($data['type']=='view')
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('vendor_view'));
- }
- else
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('vendor_form'));
- }
-
- $vendor['value_vendor_id']
= $data['vendor_id'];
- $vendor['value_vendor_name'] =
$data['vendor_name'];
-
- if($data['vendor_id'] && !$data['vendor_name'])
- {
- $vendor_data
= $contacts->read_single(array('actor_id'=>$data['vendor_id']));
- if(is_array($vendor_data))
- {
- foreach($vendor_data['attributes'] as
$attribute)
- {
-
if($attribute['name']=='org_name')
- {
-
$vendor['value_vendor_name']=$attribute['value'];
- break;
- }
- }
- }
- }
-
- $vendor['vendor_link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor');
- $vendor['lang_vendor']
= lang('Vendor');
- $vendor['lang_select_vendor_help'] =
lang('Klick this link to select vendor');
- $vendor['lang_vendor_name']
= lang('Vendor Name');
-
- unset($contacts);
-//_debug_array($vendor);
- return $vendor;
- }
-
-
- function initiate_ui_budget_account_lookup($data)
- {
- if($data['type']=='view')
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('b_account_view'));
- }
- else
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('b_account_form'));
- }
-
- $b_account['value_b_account_id']
= $data['b_account_id'];
- $b_account['value_b_account_name']
= $data['b_account_name'];
- $b_account['b_account_link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.b_account');
- $b_account['lang_b_account']
= lang('b_account');
- $b_account['lang_select_b_account_help'] =
lang('Klick this link to select budget account');
- $b_account['lang_b_account']
= lang('Budget account');
- if($data['b_account_id'] && !$data['b_account_name'])
- {
- $b_account_object =
CreateObject($this->currentapp.'.sob_account');
- $b_account_data =
$b_account_object->read_single($data['b_account_id']);
- $b_account['value_b_account_name'] =
$b_account_data['descr'];
- }
-
-//_debug_array($b_account);
- return $b_account;
- }
-
-
- function initiate_ui_alarm($data)
- {
- $boalarm =
CreateObject($this->currentapp.'.boalarm');
-
- if($data['type']=='view')
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('alarm_view'));
- }
- else
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('alarm_form'));
- }
-
- $alarm['header'][] = array
- (
- 'lang_time' => lang('Time'),
- 'lang_text' => lang('Text'),
- 'lang_user' => lang('User'),
- 'lang_enabled' => lang('Enabled'),
- 'lang_select' => lang('Select')
- );
-
- $alarm['values'] =
$boalarm->read_alarms($data['alarm_type'],$data['id'],$data['text']);
- if(!count($alarm['values'])>0)
- {
- unset($alarm['values']);
- }
-
- if($data['type']=='form')
- {
- $alarm['alter_alarm'][] = array
- (
- 'lang_enable' =>
lang('Enable'),
- 'lang_disable' =>
lang('Disable'),
- 'lang_delete' =>
lang('Delete')
- );
-
- for ($i=1; $i<=31; $i++)
- {
-
$alarm['add_alarm']['day_list'][($i-1)][id] = $i;
- }
- $alarm['add_alarm']['lang_day']
= lang('Day');
- $alarm['add_alarm']['lang_day_statustext']
= lang('Day');
-
- for ($i=1; $i<=24; $i++)
- {
-
$alarm['add_alarm']['hour_list'][($i-1)][id] = $i;
- }
- $alarm['add_alarm']['lang_hour']
= lang('Hour');
- $alarm['add_alarm']['lang_hour_statustext']
= lang('Hour');
-
- for ($i=1; $i<=60; $i++)
- {
-
$alarm['add_alarm']['minute_list'][($i-1)][id] = $i;
- }
- $alarm['add_alarm']['lang_minute']
= lang('Minutes before the event');
- $alarm['add_alarm']['lang_minute_statustext']
= lang('Minutes before the event');
-
- $alarm['add_alarm']['user_list'] =
$this->get_user_list_right2('select',4,False,$data['acl_location'],False,$default=$this->account);
-
- $alarm['add_alarm']['lang_user']
= lang('User');
- $alarm['add_alarm']['lang_user_statustext']
= lang('Select the user the alarm belongs to.');
- $alarm['add_alarm']['lang_no_user']
= lang('No user');
- $alarm['add_alarm']['lang_add']
= lang('Add');
- $alarm['add_alarm']['lang_add_alarm']
= lang('Add alarm');
- $alarm['add_alarm']['lang_add_statustext']
= lang('Add alarm for selected user');
-
- }
-
-//_debug_array($alarm['values']);
- return $alarm;
- }
-
-
- function
select_multi_list_2($selected='',$input_list,$input_type='')
- {
- $j=0;
- if (isset($input_list) AND is_array($input_list))
- {
- foreach($input_list as $entry)
- {
- $output_list[$j]['id'] = $entry['id'];
- $output_list[$j]['value'] =
$entry['value'];
- $output_list[$j]['input_type'] =
$input_type;
-
- for ($i=0;$i<count($selected);$i++)
- {
- if($selected[$i] ==
$entry['id'])
- {
-
$output_list[$j]['checked'] = 'checked';
- }
- }
- $j++;
- }
- }
-
- for ($i=0;$i<count($output_list);$i++)
- {
- if ($output_list[$i]['checked'] != 'checked')
- {
- unset($output_list[$i]['checked']);
- }
- }
-
- return $output_list;
- }
-
- function translate_datatype($datatype)
- {
- $datatype_text = array(
- 'V' => 'Varchar',
- 'I' => 'Integer',
- 'C' => 'char',
- 'N' => 'Float',
- 'D' => 'Date',
- 'T' => 'Memo',
- 'R' => 'Muliple radio',
- 'CH' => 'Muliple checkbox',
- 'LB' => 'Listbox',
- 'AB' => 'Contact',
- 'VENDOR' => 'Vendor',
- 'email' => 'Email'
- );
-
- $datatype = lang($datatype_text[$datatype]);
-
- return $datatype;
- }
-
- function translate_datatype_insert($datatype)
- {
- $datatype_text = array(
- 'V' => 'varchar',
- 'I' => 'int',
- 'C' => 'char',
- 'N' => 'decimal',
- 'D' => 'timestamp',
- 'T' => 'text',
- 'R' => 'int',
- 'CH' => 'text',
- 'LB' => 'int',
- 'AB' => 'int',
- 'VENDOR' => 'int',
- 'email' => 'varchar'
- );
-
- return $datatype_text[$datatype];
- }
-
- function translate_datatype_precision($datatype)
- {
- $datatype_precision = array(
- 'R' => 4,
- 'LB' => 4,
- 'AB' => 4,
- 'VENDOR' => 4,
- 'email' => 64
- );
-
- return $datatype_precision[$datatype];
- }
-
- function save_attributes($values_attribute,$type)
- {
-
- for ($i=0;$i<count($values_attribute);$i++)
- {
- if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
- }
- if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
- }
-
- if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
- }
-
- if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
- {
- $dateformat=
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $dateformat =
str_replace(".","",$dateformat);
- $dateformat =
str_replace("-","",$dateformat);
- $dateformat =
str_replace("/","",$dateformat);
- $y=strpos($dateformat,'Y');
- $d=strpos($dateformat,'d');
- $m=strpos($dateformat,'m');
-
- $dateparts = explode('/',
$values_attribute[$i]['value']);
- $day = $dateparts[$d];
- $month = $dateparts[$m];
- $year = $dateparts[$y];
- $values_attribute[$i]['value'] =
date($this->dateformat,mktime(2,0,0,$month,$day,$year));
- }
- }
-
-
$this->socommon->save_attributes($values_attribute,$type);
- }
-
- function list_methods($_type='xmlrpc')
- {
- /*
- This handles introspection or discovery by the logged
in client,
- in which case the input might be an array. The
server always calls
- this function to fill the server dispatch map using a
string.
- */
- if (is_array($_type))
- {
- $_type = $_type['type'] ? $_type['type'] :
$_type[0];
- }
- switch($_type)
- {
- case 'xmlrpc':
- $xml_functions = array(
- 'read' => array(
- 'function' => 'read',
- 'signature' =>
array(array(xmlrpcInt,xmlrpcStruct)),
- 'docstring' =>
lang('Read a single entry by passing the id and fieldlist.')
- ),
- 'save' => array(
- 'function' => 'save',
- 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
- 'docstring' =>
lang('Update a single entry by passing the fields.')
- ),
- 'delete' => array(
- 'function' => 'delete',
- 'signature' =>
array(array(xmlrpcBoolean,xmlrpcInt)),
- 'docstring' =>
lang('Delete a single entry by passing the id.')
- ),
- 'list' => array(
- 'function' => '_list',
- 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
- 'docstring' =>
lang('Read a list of entries.')
- ),
- 'list_methods' => array(
- 'function' =>
'list_methods',
- 'signature' =>
array(array(xmlrpcStruct,xmlrpcString)),
- 'docstring' =>
lang('Read this list of methods.')
- )
- );
- return $xml_functions;
- break;
- case 'soap':
- return $this->soap_functions;
- break;
- default:
- return array();
- break;
- }
- }
-
- function add_leading_zero($num)
- {
-
- if ($id_type == "hex")
- {
- $num = hexdec($num);
- $num++;
- $num = dechex($num);
- }
- else
- {
- $num++;
- }
-
- if (strlen($num) == 4)
- $return = $num;
- if (strlen($num) == 3)
- $return = "0$num";
- if (strlen($num) == 2)
- $return = "00$num";
- if (strlen($num) == 1)
- $return = "000$num";
- if (strlen($num) == 0)
- $return = "0001";
-
- return strtoupper($return);
- }
-
-
- function read_location_data($location_code)
- {
- $soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
-
- $location_types =
$soadmin_location->select_location_type();
- unset($soadmin_location);
-
- return
$this->socommon->read_location_data($location_code,$location_types);
- }
-
- function read_single_tenant($tenant_id)
- {
- return $this->socommon->read_single_tenant($tenant_id);
- }
-
- function check_location($location_code='',$type_id='')
- {
- return
$this->socommon->check_location($location_code,$type_id);
- }
-
- function generate_sql($data)
- {
-//_debug_array($data);
-
- $cols =
(isset($data['cols'])?$data['cols']:'');
- $entity_table =
(isset($data['entity_table'])?$data['entity_table']:'');
- $cols_return =
(isset($data['cols_return'])?$data['cols_return']:'');
- $uicols =
(isset($data['uicols'])?$data['uicols']:'');
- $joinmethod =
(isset($data['joinmethod'])?$data['joinmethod']:'');
- $paranthesis =
(isset($data['paranthesis'])?$data['paranthesis']:'');
- $lookup =
(isset($data['lookup'])?$data['lookup']:'');
- $location_level =
(isset($data['location_level'])?$data['location_level']:'');
- $no_address =
(isset($data['no_address'])?$data['no_address']:'');
-
- $this->join = $this->socommon->join;
-
- $joinmethod .= " $this->join fm_location1 ON
($entity_table.loc1 = fm_location1.loc1))";
- $paranthesis .='(';
- $joinmethod .= " $this->join fm_part_of_town ON
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id))";
- $paranthesis .='(';
- $joinmethod .= " $this->join fm_owner ON
(fm_location1.owner_id = fm_owner.id))";
- $paranthesis .='(';
-
- $soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
- $location_types =
$soadmin_location->select_location_type();
- $config = $soadmin_location->read_config('');
-
- if($location_level)
- {
- $type_id=$location_level;
- }
- else
- {
- $type_id = count($location_types);
- }
- $this->type_id = $type_id;
-
- for ($i=0; $i<$type_id; $i++)
- {
-
- $uicols['input_type'][] = 'text';
- $uicols['name'][] = 'loc'
. $location_types[$i]['id'];
- $uicols['descr'][] =
$location_types[$i]['name'];
- $uicols['statustext'][] =
$location_types[$i]['descr'];
- }
-/*
- $fm_location_cols =
$soadmin_location->read_attrib(array('type_id'=>$type_id,'lookup_type'=>$type_id));
- $location_cols_count = count($fm_location_cols);
-
- for ($i=0;$i<$location_cols_count;$i++)
- {
- if($fm_location_cols[$i]['list']==1)
- {
- $cols_extra[]
= $fm_location_cols[$i]['column_name']; // only for lookup
- $cols_return[]
= $fm_location_cols[$i]['column_name'];
- $uicols['input_type'][] =
'text';
- $uicols['name'][]
= $fm_location_cols[$i]['column_name'];
- $uicols['descr'][]
= $fm_location_cols[$i]['input_text'];
- $uicols['statustext'][] =
$fm_location_cols[$i]['statustext'];
- }
- }
-
-*/
- unset($soadmin_location);
-
- for ($i=0; $i< $this->type_id; $i++)
- {
- $cols_return[] = 'loc' .
$location_types[$i]['id'];
- }
-
- if($lookup)
- {
- $cols_return[] =
'loc1_name';
- $cols_extra[] =
'loc1_name';
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
'loc1_name';
- $uicols['descr'][] =
lang('Property Name');
- $uicols['statustext'][] =
lang('Property Name');
-
- for ($i=2;$i<($type_id+1);$i++)
- {
- $cols_return_lookup[] = 'loc'
. $i . '_name';
- $uicols['input_type'][] =
'hidden';
- $uicols['name'][]
= 'loc' . $i . '_name';
- $uicols['descr'][]
= '';
- $uicols['statustext'][] = '';
- }
- }
-
- if(!$no_address)
- {
- $cols.= ",$entity_table.address";
- $cols_return[] =
'address';
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
'address';
- $uicols['descr'][] =
lang('address');
- $uicols['statustext'][] =
lang('address');
- }
-
-
- $config_count = count($config);
- for ($i=0;$i<$config_count;$i++)
- {
-
- if (($config[$i]['location_type'] <= $type_id)
&& ($config[$i]['query_value'] ==1))
- {
-
-
if($config[$i]['column_name']=='street_id')
- {
-
- $cols_return[]
= 'street_name';
- $uicols['input_type'][]
= 'hidden';
- $uicols['name'][]
= 'street_name';
- $uicols['descr'][]
= lang('street name');
- $uicols['statustext'][]
= lang('street name');
-
- $cols_return[]
= 'street_number';
- $uicols['input_type'][]
= 'hidden';
- $uicols['name'][]
= 'street_number';
- $uicols['descr'][]
= lang('street number');
- $uicols['statustext'][]
= lang('street number');
-
- $cols_return[]
= $config[$i]['column_name'];
- $uicols['input_type'][]
= 'hidden';
- $uicols['name'][]
= $config[$i]['column_name'];
- $uicols['descr'][]
= lang($config[$i]['input_text']);
- $uicols['statustext'][]
= lang($config[$i]['input_text']);
- if($lookup)
- {
- $cols_extra[]
= 'street_name';
- $cols_extra[]
= 'street_number';
- $cols_extra[]
= $config[$i]['column_name'];
- }
-
- }
- else
- {
- $cols_return[]
= $config[$i]['column_name'];
- $uicols['input_type'][]
= 'text';
- $uicols['name'][]
= $config[$i]['column_name'];
- $uicols['descr'][]
= $config[$i]['input_text'];
- $uicols['statustext'][]
= $config[$i]['input_text'];
-
- if($lookup)
- {
- $cols_extra[]
= $config[$i]['column_name'];
- }
- }
- }
- }
-
- $this->uicols = $uicols;
- $this->cols_return = $cols_return;
- $this->cols_extra = $cols_extra;
- $this->cols_return_lookup = $cols_return_lookup;
-
- $from .= " FROM $paranthesis $entity_table ";
-
- $sql = "SELECT $cols $from $joinmethod";
-
- return $sql;
-
- }
-
- function select_part_of_town($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('select_part_of_town'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_part_of_town'));
- break;
- }
-
- $parts= $this->socommon->select_part_of_town();
-
- while (is_array($parts) && list(,$part) = each($parts))
- {
- $sel_part = '';
- if ($part['id']==$selected)
- {
- $sel_part = 'selected';
- }
-
- $part_of_town_list[] = array
- (
- 'id' => $part['id'],
- 'name' => $part['name'],
- 'selected' => $sel_part
- );
- }
-
- for ($i=0;$i<count($part_of_town_list);$i++)
- {
- if ($part_of_town_list[$i]['selected'] !=
'selected')
- {
-
unset($part_of_town_list[$i]['selected']);
- }
- }
-
- return $part_of_town_list;
- }
-
- function select_category_property_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories=
$this->socommon->select_category_property_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function select_district_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('select_district'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_district'));
- break;
- }
-
- $districts= $this->socommon->select_district_list();
-
- while (is_array($districts) && list(,$district) =
each($districts))
- {
- $sel_district = '';
- if ($district['id']==$selected)
- {
- $sel_district = 'selected';
- }
-
- $district_list[] = array
- (
- 'id' => $district['id'],
- 'name' => $district['name'],
- 'selected' => $sel_district
- );
- }
-
- for ($i=0;$i<count($district_list);$i++)
- {
- if ($district_list[$i]['selected'] !=
'selected')
- {
- unset($district_list[$i]['selected']);
- }
- }
-
- return $district_list;
- }
-
-
- function validate_db_insert($values)
- {
- foreach($values as $value)
- {
- if($value || $value === 0)
- {
- $insert_value[] = "'".$value."'";
- }
- else
- {
- $insert_value[] = 'NULL';
- }
- }
-
- $values = implode(",", $insert_value);
- return $values;
- }
-
- function validate_db_update($value_set)
- {
- while (is_array($value_set) && list($field,$value) =
each($value_set))
- {
- if($value || $value === 0)
- {
- $value_entry[]= "$field='$value'";
- }
- else
- {
- $value_entry[]= "$field=NULL";
- }
- }
-
- $value_set = implode(",", $value_entry);
- return $value_set;
- }
-
- function fm_cache($name='',$value='')
- {
- return $this->socommon->fm_cache($name,$value);
- }
-
- function next_id($table,$key='')
- {
- return $this->socommon->next_id($table,$key);
- }
-
- function select_datatype($selected='')
- {
- $datatypes[0]['id']= 'V';
- $datatypes[0]['name']= lang('varchar');
- $datatypes[1]['id']= 'C';
- $datatypes[1]['name']= lang('Character');
- $datatypes[2]['id']= 'I';
- $datatypes[2]['name']= lang('Integer');
- $datatypes[3]['id']= 'N';
- $datatypes[3]['name']= lang('Decimal');
- $datatypes[4]['id']= 'D';
- $datatypes[4]['name']= lang('Date');
- $datatypes[5]['id']= 'T';
- $datatypes[5]['name']= lang('Memo');
- $datatypes[6]['id']= 'R';
- $datatypes[6]['name']= lang('Multiple radio');
- $datatypes[7]['id']= 'CH';
- $datatypes[7]['name']= lang('Multiple Checkbox');
- $datatypes[8]['id']= 'LB';
- $datatypes[8]['name']= lang('ListBox');
- $datatypes[9]['id']= 'AB';
- $datatypes[9]['name']= lang('Contact');
- $datatypes[10]['id']= 'VENDOR';
- $datatypes[10]['name']= lang('Vendor');
- $datatypes[11]['id']= 'email';
- $datatypes[11]['name']= lang('Email');
-
- return $this->select_list($selected,$datatypes);
-
- }
-
- function select_nullable($selected='')
- {
- $nullable[0]['id']= 'True';
- $nullable[0]['name']= lang('True');
- $nullable[1]['id']= 'False';
- $nullable[1]['name']= lang('False');
-
- return $this->select_list($selected,$nullable);
- }
-
-
- function excel($list,$name,$descr,$input_type='')
- {
- $GLOBALS['phpgw_info']['flags'][noheader] = True;
- $GLOBALS['phpgw_info']['flags'][nofooter] = True;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
-
- $filename=
$GLOBALS['phpgw_info']['user']['account_lid'].'.xls';
-
- $workbook =
CreateObject($this->currentapp.'.excel',"-");
- $browser = CreateObject('phpgwapi.browser');
-
$browser->content_header($filename,'application/vnd.ms-excel');
-
- $count_uicols_name=count($name);
-
- $worksheet1 =& $workbook->add_worksheet('First One');
-
- $j=0;
- if (isset($list) AND is_array($list))
- {
- foreach($list as $entry)
- {
- $m=0;
- for ($k=0;$k<$count_uicols_name;$k++)
- {
- if($input_type[$k]!='hidden')
- {
- $content[$j][$m]
= str_replace("\r\n"," ",$entry[$name[$k]]);
-
$worksheet1->write_string(0, $m, $descr[$k]);
- $m++;
- }
- }
- $j++;
- }
-
- foreach($content as $row)
- {
- $line++;
- for ($i=0; $i<count($row); $i++)
- {
-
$worksheet1->write($line,$i,$row[$i]);
- }
- }
- }
- $workbook->close();
-
- }
-
- function increment_id($name)
- {
- return $this->socommon->increment_id($name);
- }
-
- function get_origin_link($type)
- {
- if($type=='tts'):
- {
- $link = '.uitts.view';
- }
- elseif($type=='request'):
- {
- $link = '.uirequest.view';
- }
- elseif($type=='project'):
- {
- $link = '.uiproject.view';
- }
- elseif(substr($type,0,6)=='entity'):
- {
-
- $type = explode("_",$type);
- $entity_id = $type[1];
- $cat_id = $type[2];
- $link =
".uientity.view&entity_id=$entity_id&cat_id=$cat_id";
- }
- endif;
-
- return $link;
- }
-
- function select_wo_hours_category_list($selected='')
- {
- $category_list=
$this->socommon->select_wo_hours_category_list();
- if($selected)
- {
- $category_list =
$this->select_list($selected,$category_list);
- }
-
- return $category_list;
- }
-
- function new_db()
- {
return $this->socommon->new_db();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 core
+ * @version $Id: class.bocommon.inc.php,v 1.21 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bocommon
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+ var $district_id;
+
+
+ var $public_functions = array
+ (
+ 'select_part_of_town' => True,
+ 'menu' => True,
+ );
+
+ 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 bocommon()
+ {
+
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->socommon =
CreateObject($this->currentapp.'.socommon');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ if (!is_object($GLOBALS['phpgw']->asyncservice))
+ {
+ $GLOBALS['phpgw']->asyncservice =
CreateObject('phpgwapi.asyncservice');
+ }
+ $this->async = &$GLOBALS['phpgw']->asyncservice;
+
+ $this->join = $this->socommon->join;
+ $this->left_join = $this->socommon->left_join;
+ $this->like = $this->socommon->like;
+
+ switch($GLOBALS['phpgw_info']['server']['db_type'])
+ {
+ case 'mssql':
+ $this->dateformat = "M d
Y";
+ $this->datetimeformat = "M d Y g:iA";
+ break;
+ case 'mysql':
+ $this->dateformat =
"Y-m-d";
+ $this->datetimeformat = "Y-m-d G:i:s";
+ break;
+ case 'pgsql':
+ $this->dateformat =
"Y-m-d";
+ $this->datetimeformat = "Y-m-d G:i:s";
+// $this->dateformat = "F j,
Y";
+// $this->datetimeformat = "F j, Y g:iA";
+ break;
+ }
+
+ /* if
($GLOBALS['phpgw_info']['server']['db_type']=='mssql')
+ {
+ $this->dateformat = "M d Y";
+ $this->datetimeformat = "M d Y g:iA";
+ }
+ else
+ {
+ $this->dateformat = "Y-m-d";
+ $this->datetimeformat = "Y-m-d G:i:s";
+ }
+
+
+ if(!$GLOBALS['phpgw_info']['flags']['css'])
+ {
+ $GLOBALS['phpgw_info']['flags']['css'] .=
"-->\n</style>\n"
+ . '<link rel="stylesheet"
type="text/css" media="all" href="'
+ .
$GLOBALS['phpgw_info']['server']['webserver_url'].'/' . $this->currentapp .
'/templates/'
+ .
$GLOBALS['phpgw_info']['server']['template_set']
+ .
'/css/'.$GLOBALS['phpgw_info']['server']['template_set'].'.css"
title="'.$GLOBALS['phpgw_info']['server']['template_set'].'" />'
+ . "\n<style type=\"text/css\">\n<!--\n";
+ }
+*/
+ }
+
+ function jscalendar()
+ {
+ $phpgw_js_url =
$GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/js';
+// $img =
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default').'/cal.png';
+ $img =
$GLOBALS['phpgw_info']['server']['webserver_url'] .
'/phpgwapi/templates/default/images/cal.png';
+
+// $img = $phpgw_js_url.'/jscalendar/img.gif';
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $jsDateFormat = str_replace(array('d', 'm', 'M', 'Y'),
array('%d', '%m', '%b', '%Y'), $dateformat);
+
+ $GLOBALS['phpgw_info']['flags']['java_script']
.='</script>
+ <link rel="stylesheet" type="text/css" media="all"
href="'.$phpgw_js_url.'/jscalendar/calendar-win2k-cold-1.css"
title="win2k-cold-1" >
+ <script type="text/javascript"
src="'.$phpgw_js_url.'/jscalendar/calendar.js"></script>
+ <script type="text/javascript"
src="'.$phpgw_js_url.'/jscalendar/calendar-setup.js"></script>
+ <script type="text/javascript"
src="'.$phpgw_js_url.'/jscalendar/lang/calendar-'.substr($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],0,2)
.'.js"></script>
+ ';
+
+
+// <script type="text/javascript"
src="'.ereg_replace('[?&]*click_history=[0-9a-f]*','',$GLOBALS['phpgw']->link('/phpgwapi/js/jscalendar/jscalendar-setup.php')).'"></script>
+
+ $cal_info=array(
+// 'stylesheet'
=> $phpgw_js_url.'/jscalendar/calendar-win2k-cold-1.css',
+// 'calendar_source'
=> $phpgw_js_url.'/jscalendar/calendar.js',
+// 'calendar_setup_source' =>
$phpgw_js_url.'/jscalendar/calendar-setup.js',
+// 'calendar_lang'
=>
$phpgw_js_url.'/jscalendar/lang/calendar-'.substr($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],0,2)
.'.js',
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'img'
=> $img,
+ );
+ return $cal_info;
+ }
+
+ function check_perms($rights, $required)
+ {
+ // return (!!($rights & $required) == True);
+ return ($rights & $required);
+ }
+
+ function create_preferences($app='',$user_id='')
+ {
+ return
$this->socommon->create_preferences($app,$user_id);
+ }
+
+ function get_lookup_entity($location='')
+ {
+ return $this->socommon->get_lookup_entity($location);
+ }
+
+ function get_start_entity($location='')
+ {
+ return $this->socommon->get_start_entity($location);
+ }
+
+ function msgbox_data($receipt)
+ {
+ $msgbox_data_error=array();
+ if (isSet($receipt['error']) AND
is_array($receipt['error']))
+ {
+ foreach($receipt['error'] as $errors)
+ {
+ $msgbox_data_error +=
array($errors['msg']=> False);
+ }
+ }
+
+ $msgbox_data_message=array();
+
+ if (isSet($receipt['message']) AND
is_array($receipt['message']))
+ {
+ foreach($receipt['message'] as $messages)
+ {
+ $msgbox_data_message +=
array($messages['msg']=> True);
+ }
+ }
+
+ $msgbox_data = $msgbox_data_error +
$msgbox_data_message;
+
+ return $msgbox_data;
+ }
+
+ function moneyformat($amount)
+ {
+ if
($GLOBALS['phpgw_info']['server']['db_type']=='mssql')
+ {
+ $moneyformat =
"CONVERT(MONEY,"."'$amount'".",0)";
+ }
+ else
+ {
+ $moneyformat = "'" . $amount . "'";
+ }
+
+ return $moneyformat;
+ }
+
+
+ function date_array($date)
+ {
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $dateformat = str_replace(".","",$dateformat);
+ $dateformat = str_replace("-","",$dateformat);
+ $dateformat = str_replace("/","",$dateformat);
+ $y=strpos($dateformat,'y');
+ $d=strpos($dateformat,'d');
+ $m=strpos($dateformat,'m');
+
+ $dateparts = explode('/', $date);
+ $date_array['day'] = $dateparts[$d];
+ $date_array['month'] = $dateparts[$m];
+ $date_array['year'] = $dateparts[$y];
+
+ return $date_array;
+ }
+
+ function date_to_timestamp($date)
+ {
+ if($date)
+ {
+ $date_array = $this->date_array($date);
+ $date = mktime
(8,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
+ }
+ return $date;
+ }
+
+
+ function
column_list($selected='',$entity_type='',$cat_id,$allrows='')
+ {
+ $bostandard_entity =
CreateObject($this->currentapp.'.bostandard_entity',True);
+
+ if(!$selected)
+ {
+
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp][$entity_type.'_columns_'.$cat_id];
+ }
+
+ $columns =
$bostandard_entity->read_attrib($entity_type,$cat_id,$allrows);
+//_debug_array($columns);
+
+
$column_list=$this->select_multi_list($selected,$columns);
+
+ return $column_list;
+
+ }
+
+ function select_multi_list($selected='',$input_list)
+ {
+ $j=0;
+ if (isset($input_list) AND is_array($input_list))
+ {
+ foreach($input_list as $entry)
+ {
+ $output_list[$j]['id'] = $entry['id'];
+ $output_list[$j]['name'] =
$entry['name'];
+
+ for ($i=0;$i<count($selected);$i++)
+ {
+ if($selected[$i] ==
$entry['id'])
+ {
+
$output_list[$j]['selected'] = 'selected';
+ }
+ }
+ $j++;
+ }
+ }
+
+ for ($i=0;$i<count($output_list);$i++)
+ {
+ if ($output_list[$i]['selected'] != 'selected')
+ {
+ unset($output_list[$i]['selected']);
+ }
+ }
+
+ return $output_list;
+ }
+
+
+
+ function select_list($selected='',$input_list='')
+ {
+ if (isset($input_list) AND is_array($input_list))
+ {
+ foreach($input_list as $entry)
+ {
+ $sel_entry = '';
+ if ($entry['id']==$selected)
+ {
+ $sel_entry = 'selected';
+ }
+ $entry_list[] = array
+ (
+ 'id' => $entry['id'],
+ 'name' =>
$entry['name'],
+ 'selected' => $sel_entry
+ );
+ }
+ for ($i=0;$i<count($entry_list);$i++)
+ {
+ if ($entry_list[$i]['selected'] !=
'selected')
+ {
+
unset($entry_list[$i]['selected']);
+ }
+ }
+ }
+ return $entry_list;
+ }
+
+
+ function
get_user_list($format='',$selected='',$extra='',$default='',$start='',
$sort='', $order='', $query='',$offset='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_filter'));
+ break;
+ }
+
+ if(!$selected && $default)
+ {
+ $selected = $default;
+ }
+
+ if (is_array($extra))
+ {
+ foreach($extra as $extra_user)
+ {
+ $users_extra[]=array
+ (
+ 'account_id' => $extra_user,
+ 'account_firstname' =>
lang($extra_user)
+ );
+ }
+ }
+
+ $accounts = CreateObject('phpgwapi.accounts');
+ $users = $accounts->get_list('accounts', $start, $sort,
$order, $query,$offset);
+ unset($accounts);
+ if (is_array($users_extra) && is_array($users))
+ {
+ $users = $users_extra + $users;
+ }
+
+ if (isSet($users) AND is_array($users))
+ {
+ foreach($users as $user)
+ {
+ $sel_user = '';
+ if ($user['account_id']==$selected)
+ {
+ $sel_user = 'selected';
+ }
+
+ $user_list[] = array
+ (
+ 'user_id' =>
$user['account_id'],
+ 'name' =>
$user['account_lastname'].' '.$user['account_firstname'],
+ 'selected' => $sel_user
+ );
+ }
+ }
+
+ $user_count= count($user_list);
+ for ($i=0;$i<$user_count;$i++)
+ {
+ if ($user_list[$i]['selected'] != 'selected')
+ {
+ unset($user_list[$i]['selected']);
+ }
+ }
+
+//_debug_array($user_list);
+ return $user_list;
+ }
+
+ function get_group_list($format='',$selected='',$start='',
$sort='', $order='', $query='',$offset='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('group_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('group_filter'));
+ break;
+ }
+
+ $accounts = CreateObject('phpgwapi.accounts');
+ $users = $accounts->get_list('groups', $start, $sort,
$order, $query,$offset);
+ unset($accounts);
+ if (isSet($users) AND is_array($users))
+ {
+ foreach($users as $user)
+ {
+ $sel_user = '';
+ if ($user['account_id']==$selected)
+ {
+ $sel_user = 'selected';
+ }
+
+ $user_list[] = array
+ (
+ 'id' => $user['account_id'],
+ 'name' =>
$user['account_firstname'],
+ 'selected' => $sel_user
+ );
+ }
+ }
+
+ $user_count= count($user_list);
+ for ($i=0;$i<$user_count;$i++)
+ {
+ if ($user_list[$i]['selected'] != 'selected')
+ {
+ unset($user_list[$i]['selected']);
+ }
+ }
+
+//_debug_array($user_list);
+ return $user_list;
+ }
+
+
+ function
get_user_list_right($right='',$selected='',$acl_location='')
+ {
+
$employees=$this->socommon->get_user_list_right($right,$acl_location);
+ while (is_array($employees) && list(,$user) =
each($employees))
+ {
+ $sel_user = '';
+ if ($user['account_lid']==$selected)
+ {
+ $sel_user = 'selected';
+ }
+
+ $user_list[] = array
+ (
+ 'lid' =>
$user['account_lid'],
+ 'firstname' =>
$user['account_firstname'],
+ 'lastname' =>
$user['account_lastname'],
+ 'selected' => $sel_user
+ );
+ }
+
+ for ($i=0;$i<count($user_list);$i++)
+ {
+ if ($user_list[$i]['selected'] != 'selected')
+ {
+ unset($user_list[$i]['selected']);
+ }
+ }
+
+ return $user_list;
+ }
+
+ function
get_user_list_right2($format='',$right='',$selected='',$acl_location='',$extra='',$default='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_filter'));
+ break;
+ }
+
+ if(!$selected && $default)
+ {
+ $selected = $default;
+ }
+
+ if (isset($extra) AND is_array($extra))
+ {
+ foreach($extra as $extra_user)
+ {
+ $users_extra[]=array
+ (
+ 'account_id' => $extra_user,
+ 'account_firstname' =>
lang($extra_user)
+ );
+ }
+ }
+
+
$users=$this->socommon->get_user_list_right($right,$acl_location);
+
+ if (is_array($users_extra) && is_array($users))
+ {
+ foreach($users as $users_entry)
+ {
+ array_push($users_extra,$users_entry);
+ }
+ $users=$users_extra;
+ }
+
+ while (is_array($users) && list(,$user) = each($users))
+ {
+ $sel_user = '';
+ if ($user['account_id']==$selected)
+ {
+ $sel_user = 'selected';
+ }
+
+ $user_list[] = array
+ (
+ 'user_id' =>
$user['account_id'],
+ 'name' =>
$user['account_lastname'].' '.$user['account_firstname'],
+ 'selected' => $sel_user
+ );
+ }
+
+ for ($i=0;$i<count($user_list);$i++)
+ {
+ if ($user_list[$i]['selected'] != 'selected')
+ {
+ unset($user_list[$i]['selected']);
+ }
+ }
+
+ return $user_list;
+ }
+
+
+ function initiate_ui_vendorlookup($data)
+ {
+//_debug_array($data);
+
+ $contacts =
CreateObject($this->currentapp.'.soactor');
+ $contacts->role='vendor';
+
+ if($data['type']=='view')
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('vendor_view'));
+ }
+ else
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('vendor_form'));
+ }
+
+ $vendor['value_vendor_id']
= $data['vendor_id'];
+ $vendor['value_vendor_name'] =
$data['vendor_name'];
+
+ if($data['vendor_id'] && !$data['vendor_name'])
+ {
+ $vendor_data
= $contacts->read_single(array('actor_id'=>$data['vendor_id']));
+ if(is_array($vendor_data))
+ {
+ foreach($vendor_data['attributes'] as
$attribute)
+ {
+
if($attribute['name']=='org_name')
+ {
+
$vendor['value_vendor_name']=$attribute['value'];
+ break;
+ }
+ }
+ }
+ }
+
+ $vendor['vendor_link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor');
+ $vendor['lang_vendor']
= lang('Vendor');
+ $vendor['lang_select_vendor_help'] =
lang('Klick this link to select vendor');
+ $vendor['lang_vendor_name']
= lang('Vendor Name');
+
+ unset($contacts);
+//_debug_array($vendor);
+ return $vendor;
+ }
+
+
+ function initiate_ui_budget_account_lookup($data)
+ {
+ if($data['type']=='view')
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('b_account_view'));
+ }
+ else
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('b_account_form'));
+ }
+
+ $b_account['value_b_account_id']
= $data['b_account_id'];
+ $b_account['value_b_account_name']
= $data['b_account_name'];
+ $b_account['b_account_link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.b_account');
+ $b_account['lang_b_account']
= lang('b_account');
+ $b_account['lang_select_b_account_help'] =
lang('Klick this link to select budget account');
+ $b_account['lang_b_account']
= lang('Budget account');
+ if($data['b_account_id'] && !$data['b_account_name'])
+ {
+ $b_account_object =
CreateObject($this->currentapp.'.sob_account');
+ $b_account_data =
$b_account_object->read_single($data['b_account_id']);
+ $b_account['value_b_account_name'] =
$b_account_data['descr'];
+ }
+
+//_debug_array($b_account);
+ return $b_account;
+ }
+
+
+ function initiate_ui_alarm($data)
+ {
+ $boalarm =
CreateObject($this->currentapp.'.boalarm');
+
+ if($data['type']=='view')
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('alarm_view'));
+ }
+ else
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('alarm_form'));
+ }
+
+ $alarm['header'][] = array
+ (
+ 'lang_time' => lang('Time'),
+ 'lang_text' => lang('Text'),
+ 'lang_user' => lang('User'),
+ 'lang_enabled' => lang('Enabled'),
+ 'lang_select' => lang('Select')
+ );
+
+ $alarm['values'] =
$boalarm->read_alarms($data['alarm_type'],$data['id'],$data['text']);
+ if(!count($alarm['values'])>0)
+ {
+ unset($alarm['values']);
+ }
+
+ if($data['type']=='form')
+ {
+ $alarm['alter_alarm'][] = array
+ (
+ 'lang_enable' =>
lang('Enable'),
+ 'lang_disable' =>
lang('Disable'),
+ 'lang_delete' =>
lang('Delete')
+ );
+
+ for ($i=1; $i<=31; $i++)
+ {
+
$alarm['add_alarm']['day_list'][($i-1)][id] = $i;
+ }
+ $alarm['add_alarm']['lang_day']
= lang('Day');
+ $alarm['add_alarm']['lang_day_statustext']
= lang('Day');
+
+ for ($i=1; $i<=24; $i++)
+ {
+
$alarm['add_alarm']['hour_list'][($i-1)][id] = $i;
+ }
+ $alarm['add_alarm']['lang_hour']
= lang('Hour');
+ $alarm['add_alarm']['lang_hour_statustext']
= lang('Hour');
+
+ for ($i=1; $i<=60; $i++)
+ {
+
$alarm['add_alarm']['minute_list'][($i-1)][id] = $i;
+ }
+ $alarm['add_alarm']['lang_minute']
= lang('Minutes before the event');
+ $alarm['add_alarm']['lang_minute_statustext']
= lang('Minutes before the event');
+
+ $alarm['add_alarm']['user_list'] =
$this->get_user_list_right2('select',4,False,$data['acl_location'],False,$default=$this->account);
+
+ $alarm['add_alarm']['lang_user']
= lang('User');
+ $alarm['add_alarm']['lang_user_statustext']
= lang('Select the user the alarm belongs to.');
+ $alarm['add_alarm']['lang_no_user']
= lang('No user');
+ $alarm['add_alarm']['lang_add']
= lang('Add');
+ $alarm['add_alarm']['lang_add_alarm']
= lang('Add alarm');
+ $alarm['add_alarm']['lang_add_statustext']
= lang('Add alarm for selected user');
+
+ }
+
+//_debug_array($alarm['values']);
+ return $alarm;
+ }
+
+
+ function
select_multi_list_2($selected='',$input_list,$input_type='')
+ {
+ $j=0;
+ if (isset($input_list) AND is_array($input_list))
+ {
+ foreach($input_list as $entry)
+ {
+ $output_list[$j]['id'] = $entry['id'];
+ $output_list[$j]['value'] =
$entry['value'];
+ $output_list[$j]['input_type'] =
$input_type;
+
+ for ($i=0;$i<count($selected);$i++)
+ {
+ if($selected[$i] ==
$entry['id'])
+ {
+
$output_list[$j]['checked'] = 'checked';
+ }
+ }
+ $j++;
+ }
+ }
+
+ for ($i=0;$i<count($output_list);$i++)
+ {
+ if ($output_list[$i]['checked'] != 'checked')
+ {
+ unset($output_list[$i]['checked']);
+ }
+ }
+
+ return $output_list;
+ }
+
+ function translate_datatype($datatype)
+ {
+ $datatype_text = array(
+ 'V' => 'Varchar',
+ 'I' => 'Integer',
+ 'C' => 'char',
+ 'N' => 'Float',
+ 'D' => 'Date',
+ 'T' => 'Memo',
+ 'R' => 'Muliple radio',
+ 'CH' => 'Muliple checkbox',
+ 'LB' => 'Listbox',
+ 'AB' => 'Contact',
+ 'VENDOR' => 'Vendor',
+ 'email' => 'Email'
+ );
+
+ $datatype = lang($datatype_text[$datatype]);
+
+ return $datatype;
+ }
+
+ function translate_datatype_insert($datatype)
+ {
+ $datatype_text = array(
+ 'V' => 'varchar',
+ 'I' => 'int',
+ 'C' => 'char',
+ 'N' => 'decimal',
+ 'D' => 'timestamp',
+ 'T' => 'text',
+ 'R' => 'int',
+ 'CH' => 'text',
+ 'LB' => 'int',
+ 'AB' => 'int',
+ 'VENDOR' => 'int',
+ 'email' => 'varchar'
+ );
+
+ return $datatype_text[$datatype];
+ }
+
+ function translate_datatype_precision($datatype)
+ {
+ $datatype_precision = array(
+ 'R' => 4,
+ 'LB' => 4,
+ 'AB' => 4,
+ 'VENDOR' => 4,
+ 'email' => 64
+ );
+
+ return $datatype_precision[$datatype];
+ }
+
+ function save_attributes($values_attribute,$type)
+ {
+
+ for ($i=0;$i<count($values_attribute);$i++)
+ {
+ if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
+ }
+ if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
+ }
+
+ if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
+ }
+
+ if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
+ {
+ $dateformat=
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $dateformat =
str_replace(".","",$dateformat);
+ $dateformat =
str_replace("-","",$dateformat);
+ $dateformat =
str_replace("/","",$dateformat);
+ $y=strpos($dateformat,'Y');
+ $d=strpos($dateformat,'d');
+ $m=strpos($dateformat,'m');
+
+ $dateparts = explode('/',
$values_attribute[$i]['value']);
+ $day = $dateparts[$d];
+ $month = $dateparts[$m];
+ $year = $dateparts[$y];
+ $values_attribute[$i]['value'] =
date($this->dateformat,mktime(2,0,0,$month,$day,$year));
+ }
+ }
+
+
$this->socommon->save_attributes($values_attribute,$type);
+ }
+
+ function list_methods($_type='xmlrpc')
+ {
+ /*
+ This handles introspection or discovery by the logged
in client,
+ in which case the input might be an array. The
server always calls
+ this function to fill the server dispatch map using a
string.
+ */
+ if (is_array($_type))
+ {
+ $_type = $_type['type'] ? $_type['type'] :
$_type[0];
+ }
+ switch($_type)
+ {
+ case 'xmlrpc':
+ $xml_functions = array(
+ 'read' => array(
+ 'function' => 'read',
+ 'signature' =>
array(array(xmlrpcInt,xmlrpcStruct)),
+ 'docstring' =>
lang('Read a single entry by passing the id and fieldlist.')
+ ),
+ 'save' => array(
+ 'function' => 'save',
+ 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
+ 'docstring' =>
lang('Update a single entry by passing the fields.')
+ ),
+ 'delete' => array(
+ 'function' => 'delete',
+ 'signature' =>
array(array(xmlrpcBoolean,xmlrpcInt)),
+ 'docstring' =>
lang('Delete a single entry by passing the id.')
+ ),
+ 'list' => array(
+ 'function' => '_list',
+ 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
+ 'docstring' =>
lang('Read a list of entries.')
+ ),
+ 'list_methods' => array(
+ 'function' =>
'list_methods',
+ 'signature' =>
array(array(xmlrpcStruct,xmlrpcString)),
+ 'docstring' =>
lang('Read this list of methods.')
+ )
+ );
+ return $xml_functions;
+ break;
+ case 'soap':
+ return $this->soap_functions;
+ break;
+ default:
+ return array();
+ break;
+ }
+ }
+
+ function add_leading_zero($num)
+ {
+
+ if ($id_type == "hex")
+ {
+ $num = hexdec($num);
+ $num++;
+ $num = dechex($num);
+ }
+ else
+ {
+ $num++;
+ }
+
+ if (strlen($num) == 4)
+ $return = $num;
+ if (strlen($num) == 3)
+ $return = "0$num";
+ if (strlen($num) == 2)
+ $return = "00$num";
+ if (strlen($num) == 1)
+ $return = "000$num";
+ if (strlen($num) == 0)
+ $return = "0001";
+
+ return strtoupper($return);
+ }
+
+
+ function read_location_data($location_code)
+ {
+ $soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
+
+ $location_types =
$soadmin_location->select_location_type();
+ unset($soadmin_location);
+
+ return
$this->socommon->read_location_data($location_code,$location_types);
+ }
+
+ function read_single_tenant($tenant_id)
+ {
+ return $this->socommon->read_single_tenant($tenant_id);
+ }
+
+ function check_location($location_code='',$type_id='')
+ {
+ return
$this->socommon->check_location($location_code,$type_id);
+ }
+
+ function generate_sql($data)
+ {
+//_debug_array($data);
+
+ $cols =
(isset($data['cols'])?$data['cols']:'');
+ $entity_table =
(isset($data['entity_table'])?$data['entity_table']:'');
+ $cols_return =
(isset($data['cols_return'])?$data['cols_return']:'');
+ $uicols =
(isset($data['uicols'])?$data['uicols']:'');
+ $joinmethod =
(isset($data['joinmethod'])?$data['joinmethod']:'');
+ $paranthesis =
(isset($data['paranthesis'])?$data['paranthesis']:'');
+ $lookup =
(isset($data['lookup'])?$data['lookup']:'');
+ $location_level =
(isset($data['location_level'])?$data['location_level']:'');
+ $no_address =
(isset($data['no_address'])?$data['no_address']:'');
+
+ $this->join = $this->socommon->join;
+
+ $joinmethod .= " $this->join fm_location1 ON
($entity_table.loc1 = fm_location1.loc1))";
+ $paranthesis .='(';
+ $joinmethod .= " $this->join fm_part_of_town ON
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id))";
+ $paranthesis .='(';
+ $joinmethod .= " $this->join fm_owner ON
(fm_location1.owner_id = fm_owner.id))";
+ $paranthesis .='(';
+
+ $soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
+ $location_types =
$soadmin_location->select_location_type();
+ $config = $soadmin_location->read_config('');
+
+ if($location_level)
+ {
+ $type_id=$location_level;
+ }
+ else
+ {
+ $type_id = count($location_types);
+ }
+ $this->type_id = $type_id;
+
+ for ($i=0; $i<$type_id; $i++)
+ {
+
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] = 'loc'
. $location_types[$i]['id'];
+ $uicols['descr'][] =
$location_types[$i]['name'];
+ $uicols['statustext'][] =
$location_types[$i]['descr'];
+ }
+/*
+ $fm_location_cols =
$soadmin_location->read_attrib(array('type_id'=>$type_id,'lookup_type'=>$type_id));
+ $location_cols_count = count($fm_location_cols);
+
+ for ($i=0;$i<$location_cols_count;$i++)
+ {
+ if($fm_location_cols[$i]['list']==1)
+ {
+ $cols_extra[]
= $fm_location_cols[$i]['column_name']; // only for lookup
+ $cols_return[]
= $fm_location_cols[$i]['column_name'];
+ $uicols['input_type'][] =
'text';
+ $uicols['name'][]
= $fm_location_cols[$i]['column_name'];
+ $uicols['descr'][]
= $fm_location_cols[$i]['input_text'];
+ $uicols['statustext'][] =
$fm_location_cols[$i]['statustext'];
+ }
+ }
+
+*/
+ unset($soadmin_location);
+
+ for ($i=0; $i< $this->type_id; $i++)
+ {
+ $cols_return[] = 'loc' .
$location_types[$i]['id'];
+ }
+
+ if($lookup)
+ {
+ $cols_return[] =
'loc1_name';
+ $cols_extra[] =
'loc1_name';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] =
'loc1_name';
+ $uicols['descr'][] =
lang('Property Name');
+ $uicols['statustext'][] =
lang('Property Name');
+
+ for ($i=2;$i<($type_id+1);$i++)
+ {
+ $cols_return_lookup[] = 'loc'
. $i . '_name';
+ $uicols['input_type'][] =
'hidden';
+ $uicols['name'][]
= 'loc' . $i . '_name';
+ $uicols['descr'][]
= '';
+ $uicols['statustext'][] = '';
+ }
+ }
+
+ if(!$no_address)
+ {
+ $cols.= ",$entity_table.address";
+ $cols_return[] =
'address';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] =
'address';
+ $uicols['descr'][] =
lang('address');
+ $uicols['statustext'][] =
lang('address');
+ }
+
+
+ $config_count = count($config);
+ for ($i=0;$i<$config_count;$i++)
+ {
+
+ if (($config[$i]['location_type'] <= $type_id)
&& ($config[$i]['query_value'] ==1))
+ {
+
+
if($config[$i]['column_name']=='street_id')
+ {
+
+ $cols_return[]
= 'street_name';
+ $uicols['input_type'][]
= 'hidden';
+ $uicols['name'][]
= 'street_name';
+ $uicols['descr'][]
= lang('street name');
+ $uicols['statustext'][]
= lang('street name');
+
+ $cols_return[]
= 'street_number';
+ $uicols['input_type'][]
= 'hidden';
+ $uicols['name'][]
= 'street_number';
+ $uicols['descr'][]
= lang('street number');
+ $uicols['statustext'][]
= lang('street number');
+
+ $cols_return[]
= $config[$i]['column_name'];
+ $uicols['input_type'][]
= 'hidden';
+ $uicols['name'][]
= $config[$i]['column_name'];
+ $uicols['descr'][]
= lang($config[$i]['input_text']);
+ $uicols['statustext'][]
= lang($config[$i]['input_text']);
+ if($lookup)
+ {
+ $cols_extra[]
= 'street_name';
+ $cols_extra[]
= 'street_number';
+ $cols_extra[]
= $config[$i]['column_name'];
+ }
+
+ }
+ else
+ {
+ $cols_return[]
= $config[$i]['column_name'];
+ $uicols['input_type'][]
= 'text';
+ $uicols['name'][]
= $config[$i]['column_name'];
+ $uicols['descr'][]
= $config[$i]['input_text'];
+ $uicols['statustext'][]
= $config[$i]['input_text'];
+
+ if($lookup)
+ {
+ $cols_extra[]
= $config[$i]['column_name'];
+ }
+ }
+ }
+ }
+
+ $this->uicols = $uicols;
+ $this->cols_return = $cols_return;
+ $this->cols_extra = $cols_extra;
+ $this->cols_return_lookup = $cols_return_lookup;
+
+ $from .= " FROM $paranthesis $entity_table ";
+
+ $sql = "SELECT $cols $from $joinmethod";
+
+ return $sql;
+
+ }
+
+ function select_part_of_town($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('select_part_of_town'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_part_of_town'));
+ break;
+ }
+
+ $parts= $this->socommon->select_part_of_town();
+
+ while (is_array($parts) && list(,$part) = each($parts))
+ {
+ $sel_part = '';
+ if ($part['id']==$selected)
+ {
+ $sel_part = 'selected';
+ }
+
+ $part_of_town_list[] = array
+ (
+ 'id' => $part['id'],
+ 'name' => $part['name'],
+ 'selected' => $sel_part
+ );
+ }
+
+ for ($i=0;$i<count($part_of_town_list);$i++)
+ {
+ if ($part_of_town_list[$i]['selected'] !=
'selected')
+ {
+
unset($part_of_town_list[$i]['selected']);
+ }
+ }
+
+ return $part_of_town_list;
+ }
+
+ function select_category_property_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories=
$this->socommon->select_category_property_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function select_district_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('select_district'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_district'));
+ break;
+ }
+
+ $districts= $this->socommon->select_district_list();
+
+ while (is_array($districts) && list(,$district) =
each($districts))
+ {
+ $sel_district = '';
+ if ($district['id']==$selected)
+ {
+ $sel_district = 'selected';
+ }
+
+ $district_list[] = array
+ (
+ 'id' => $district['id'],
+ 'name' => $district['name'],
+ 'selected' => $sel_district
+ );
+ }
+
+ for ($i=0;$i<count($district_list);$i++)
+ {
+ if ($district_list[$i]['selected'] !=
'selected')
+ {
+ unset($district_list[$i]['selected']);
+ }
+ }
+
+ return $district_list;
+ }
+
+
+ function validate_db_insert($values)
+ {
+ foreach($values as $value)
+ {
+ if($value || $value === 0)
+ {
+ $insert_value[] = "'".$value."'";
+ }
+ else
+ {
+ $insert_value[] = 'NULL';
+ }
+ }
+
+ $values = implode(",", $insert_value);
+ return $values;
+ }
+
+ function validate_db_update($value_set)
+ {
+ while (is_array($value_set) && list($field,$value) =
each($value_set))
+ {
+ if($value || $value === 0)
+ {
+ $value_entry[]= "$field='$value'";
+ }
+ else
+ {
+ $value_entry[]= "$field=NULL";
+ }
+ }
+
+ $value_set = implode(",", $value_entry);
+ return $value_set;
+ }
+
+ function fm_cache($name='',$value='')
+ {
+ return $this->socommon->fm_cache($name,$value);
+ }
+
+ function next_id($table,$key='')
+ {
+ return $this->socommon->next_id($table,$key);
+ }
+
+ function select_datatype($selected='')
+ {
+ $datatypes[0]['id']= 'V';
+ $datatypes[0]['name']= lang('varchar');
+ $datatypes[1]['id']= 'C';
+ $datatypes[1]['name']= lang('Character');
+ $datatypes[2]['id']= 'I';
+ $datatypes[2]['name']= lang('Integer');
+ $datatypes[3]['id']= 'N';
+ $datatypes[3]['name']= lang('Decimal');
+ $datatypes[4]['id']= 'D';
+ $datatypes[4]['name']= lang('Date');
+ $datatypes[5]['id']= 'T';
+ $datatypes[5]['name']= lang('Memo');
+ $datatypes[6]['id']= 'R';
+ $datatypes[6]['name']= lang('Multiple radio');
+ $datatypes[7]['id']= 'CH';
+ $datatypes[7]['name']= lang('Multiple Checkbox');
+ $datatypes[8]['id']= 'LB';
+ $datatypes[8]['name']= lang('ListBox');
+ $datatypes[9]['id']= 'AB';
+ $datatypes[9]['name']= lang('Contact');
+ $datatypes[10]['id']= 'VENDOR';
+ $datatypes[10]['name']= lang('Vendor');
+ $datatypes[11]['id']= 'email';
+ $datatypes[11]['name']= lang('Email');
+
+ return $this->select_list($selected,$datatypes);
+
+ }
+
+ function select_nullable($selected='')
+ {
+ $nullable[0]['id']= 'True';
+ $nullable[0]['name']= lang('True');
+ $nullable[1]['id']= 'False';
+ $nullable[1]['name']= lang('False');
+
+ return $this->select_list($selected,$nullable);
+ }
+
+
+ function excel($list,$name,$descr,$input_type='')
+ {
+ $GLOBALS['phpgw_info']['flags'][noheader] = True;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = True;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
+
+ $filename=
$GLOBALS['phpgw_info']['user']['account_lid'].'.xls';
+
+ $workbook =
CreateObject($this->currentapp.'.excel',"-");
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($filename,'application/vnd.ms-excel');
+
+ $count_uicols_name=count($name);
+
+ $worksheet1 =& $workbook->add_worksheet('First One');
+
+ $j=0;
+ if (isset($list) AND is_array($list))
+ {
+ foreach($list as $entry)
+ {
+ $m=0;
+ for ($k=0;$k<$count_uicols_name;$k++)
+ {
+ if($input_type[$k]!='hidden')
+ {
+ $content[$j][$m]
= str_replace("\r\n"," ",$entry[$name[$k]]);
+
$worksheet1->write_string(0, $m, $descr[$k]);
+ $m++;
+ }
+ }
+ $j++;
+ }
+
+ foreach($content as $row)
+ {
+ $line++;
+ for ($i=0; $i<count($row); $i++)
+ {
+
$worksheet1->write($line,$i,$row[$i]);
+ }
+ }
+ }
+ $workbook->close();
+
+ }
+
+ function increment_id($name)
+ {
+ return $this->socommon->increment_id($name);
+ }
+
+ function get_origin_link($type)
+ {
+ if($type=='tts'):
+ {
+ $link = '.uitts.view';
+ }
+ elseif($type=='request'):
+ {
+ $link = '.uirequest.view';
+ }
+ elseif($type=='project'):
+ {
+ $link = '.uiproject.view';
+ }
+ elseif(substr($type,0,6)=='entity'):
+ {
+
+ $type = explode("_",$type);
+ $entity_id = $type[1];
+ $cat_id = $type[2];
+ $link =
".uientity.view&entity_id=$entity_id&cat_id=$cat_id";
+ }
+ endif;
+
+ return $link;
+ }
+
+ function select_wo_hours_category_list($selected='')
+ {
+ $category_list=
$this->socommon->select_wo_hours_category_list();
+ if($selected)
+ {
+ $category_list =
$this->select_list($selected,$category_list);
+ }
+
+ return $category_list;
+ }
+
+ function new_db()
+ { return $this->socommon->new_db();
+ }
+
+ }
+?>
Index: property/inc/class.bocustom.inc.php
diff -u property/inc/class.bocustom.inc.php:1.6
property/inc/class.bocustom.inc.php:1.7
--- property/inc/class.bocustom.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bocustom.inc.php Fri Feb 3 12:05:49 2006
@@ -1,195 +1,195 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 custom
- * @version $Id: class.bocustom.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bocustom
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function bocustom($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so = CreateObject($this->currentapp.'.socustom');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- 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
- {
- unset($this->cat_id);
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','custom',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','custom');
-
- $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'];
- }
-
- function check_perms($has, $needed)
- {
- return (!!($has & $needed) == True);
- }
-
-
- function read()
- {
- $custom = $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));
- $this->total_records = $this->so->total_records;
-
- for ($i=0; $i<count($custom); $i++)
- {
- $custom[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($custom[$i]['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
- return $custom;
- }
-
- function read_single($custom_id)
- {
- return $this->so->read_single($custom_id);
- }
-
- function read_custom_name($custom_id)
- {
- return $this->so->read_custom_name($custom_id);
- }
-
- function save($custom)
- {
-
- if ($custom['custom_id'])
- {
- if ($custom['custom_id'] != 0)
- {
- $custom_id = $custom['custom_id'];
- $receipt=$this->so->edit($custom);
- }
- }
- else
- {
- $receipt = $this->so->add($custom);
- }
- return $receipt;
- }
-
- function delete($params)
- {
- if (is_array($params))
- {
- $this->so->delete($params[0]);
- }
- else
- {
- $this->so->delete($params);
- }
- }
-
- function resort($data)
- {
- $this->so->resort($data);
- }
-
-
- function read_custom($custom_id,$allrows='')
- {
- if($allrows)
- {
- $this->allrows=$allrows;
- }
- $custom = $this->so->read_custom(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'custom_id' =>
$custom_id,'allrows'=>$this->allrows));
- $this->uicols = $this->so->uicols;
- $this->total_records = $this->so->total_records;
- return $custom;
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 custom
+ * @version $Id: class.bocustom.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bocustom
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function bocustom($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so = CreateObject($this->currentapp.'.socustom');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ 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
+ {
+ unset($this->cat_id);
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','custom',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','custom');
+
+ $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'];
+ }
+
+ function check_perms($has, $needed)
+ {
+ return (!!($has & $needed) == True);
+ }
+
+
+ function read()
+ {
+ $custom = $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));
+ $this->total_records = $this->so->total_records;
+
+ for ($i=0; $i<count($custom); $i++)
+ {
+ $custom[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($custom[$i]['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+ return $custom;
+ }
+
+ function read_single($custom_id)
+ {
+ return $this->so->read_single($custom_id);
+ }
+
+ function read_custom_name($custom_id)
+ {
+ return $this->so->read_custom_name($custom_id);
+ }
+
+ function save($custom)
+ {
+
+ if ($custom['custom_id'])
+ {
+ if ($custom['custom_id'] != 0)
+ {
+ $custom_id = $custom['custom_id'];
+ $receipt=$this->so->edit($custom);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($custom);
+ }
+ return $receipt;
+ }
+
+ function delete($params)
+ {
+ if (is_array($params))
+ {
+ $this->so->delete($params[0]);
+ }
+ else
+ {
+ $this->so->delete($params);
+ }
+ }
+
+ function resort($data)
+ {
+ $this->so->resort($data);
+ }
+
+
+ function read_custom($custom_id,$allrows='')
+ {
+ if($allrows)
+ {
+ $this->allrows=$allrows;
+ }
+ $custom = $this->so->read_custom(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'custom_id' =>
$custom_id,'allrows'=>$this->allrows));
+ $this->uicols = $this->so->uicols;
+ $this->total_records = $this->so->total_records;
+ return $custom;
+ }
+
+ }
+?>
Index: property/inc/class.bodocument.inc.php
diff -u property/inc/class.bodocument.inc.php:1.6
property/inc/class.bodocument.inc.php:1.7
--- property/inc/class.bodocument.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bodocument.inc.php Fri Feb 3 12:05:49 2006
@@ -1,640 +1,640 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 document
- * @version $Id: class.bodocument.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bodocument
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function bodocument($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sodocument');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->solocation =
CreateObject($this->currentapp.'.solocation');
- $this->historylog =
CreateObject($this->currentapp.'.historylog','document');
- $this->contacts =
CreateObject($this->currentapp.'.soactor');
- $this->contacts->role='vendor';
-
- $this->vfs =
CreateObject('phpgwapi.vfs');
- $this->rootdir = $this->vfs->basedir;
- $this->fakebase = $this->vfs->fakebase;
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $status_id =
get_var('status_id',array('POST','GET'));
- $entity_id =
get_var('entity_id',array('POST','GET'));
- $doc_type =
get_var('doc_type',array('POST','GET'));
- $query_location =
get_var('query_location',array('POST','GET'));
-
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(isset($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($status_id))
- {
- $this->status_id = $status_id;
- }
- if(isset($entity_id))
- {
- $this->entity_id = $entity_id;
- }
- if(isset($doc_type))
- {
- $this->doc_type = $doc_type;
- }
- if(isset($query_location))
- {
- $this->query_location = $query_location;
- }
-
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','document',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','document');
-
- //_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->entity_id = $data['entity_id'];
- $this->doc_type = $data['doc_type'];
- $this->query_location = $data['query_location'];
- }
-
- function select_status_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
- break;
- }
-
- $status_entries= $this->so->select_status_list();
-
- while (is_array($status_entries) && list(,$status) =
each($status_entries))
- {
- $sel_status = '';
- if ($status['id']==$selected)
- {
- $sel_status = 'selected';
- }
-
- $status_list[] = array
- (
- 'id' => $status['id'],
- 'name' => $status['name'],
- 'selected' => $sel_status
- );
- }
-
- for ($i=0;$i<count($status_list);$i++)
- {
- if ($status_list[$i]['selected'] != 'selected')
- {
- unset($status_list[$i]['selected']);
- }
- }
-
- return $status_list;
- }
-
- function select_branch_list($selected='')
- {
-
- $branch_entries= $this->so->select_branch_list();
-
- while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
- {
- $sel_branch = '';
- if ($branch['id']==$selected)
- {
- $sel_branch = 'selected';
- }
-
- $branch_list[] = array
- (
- 'id' => $branch['id'],
- 'name' => $branch['name'],
- 'selected' => $sel_branch
- );
- }
-
- for ($i=0;$i<count($branch_list);$i++)
- {
- if ($branch_list[$i]['selected'] != 'selected')
- {
- unset($branch_list[$i]['selected']);
- }
- }
-
- return $branch_list;
- }
-
-
- function select_doc_type_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->select_doc_type_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
-
- function read()
- {
- $document = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id,'entity_id' =>
$this->entity_id,'doc_type'=>$this->doc_type));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
- $cols_extra = $this->so->cols_extra;
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- for ($i=0; $i<count($document); $i++)
- {
-
$location_data=$this->solocation->read_single($document[$i]['location_code']);
-
- for ($j=0;$j<count($cols_extra);$j++)
- {
- $document[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
- }
- }
-
- return $document;
- }
-
- function read_at_location($location_code='')
- {
- $document = $this->so->read_at_location(array('start'
=> $this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id,'entity_id' =>
$this->entity_id,
-
'location_code' => $location_code,'doc_type'=>$this->doc_type));
- $this->total_records = $this->so->total_records;
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- for ($i=0; $i<count($document); $i++)
- {
- $document[$i]['user'] =
$GLOBALS['phpgw']->accounts->id2name($document[$i]['user_id']);
- $document[$i]['document_date'] =
$GLOBALS['phpgw']->common->show_date($document[$i]['start_date'],$dateformat);
- $document[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($document[$i]['entry_date'],$dateformat);
- }
-
- return $document;
- }
-
- function read_single($document_id)
- {
- $document
= $this->so->read_single($document_id);
- $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $document['document_date'] =
$GLOBALS['phpgw']->common->show_date($document['document_date'],$dateformat);
- $vendor
= $this->contacts->read_single(array('actor_id'=>$document['vendor_id']));
-
- if(is_array($vendor))
- {
- foreach($vendor['attributes'] as $attribute)
- {
- if($attribute['name']=='org_name')
- {
-
$document['vendor_name']=$attribute['value'];
- break;
- }
- }
- }
-
- if($document['location_code'])
- {
- $document['location_data']
=$this->solocation->read_single($document['location_code']);
- }
-
- if($document['p_num'])
- {
- $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
- $category =
$soadmin_entity->read_single_category($document['p_entity_id'],$document['p_cat_id']);
-
-
$document['p'][$document['p_entity_id']]['p_num']=$document['p_num'];
-
$document['p'][$document['p_entity_id']]['p_entity_id']=$document['p_entity_id'];
-
$document['p'][$document['p_entity_id']]['p_cat_id']=$document['p_cat_id'];
-
$document['p'][$document['p_entity_id']]['p_cat_name'] = $category['name'];
- }
-
- return $document;
- }
-
- function read_location_data($location_code)
- {
- $location_data=
$this->solocation->read_single($location_code);
-
- return $location_data;
- }
-
- function select_category_list($format='',$selected='')
- {
-/* switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
-
-*/
-
- $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
- $categories =
$soadmin_entity->read_category(array('allrows'=>True,'entity_id'=>$this->entity_id));
-
- $category_list =
$this->bocommon->select_multi_list($selected,$categories);
-
-/* while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-*/
- return $category_list;
- }
-
-
-
- function read_record_history($id)
- {
- $history_array =
$this->historylog->return_array(array('O'),array(),'','',$id);
- $i=0;
- while (is_array($history_array) && list(,$value) =
each($history_array))
- {
-
- $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
- $record_history[$i]['value_user'] =
$value['owner'];
-
- switch ($value['status'])
- {
- case 'R': $type = lang('Re-opened');
break;
- case 'X': $type = lang('Closed');
break;
- case 'O': $type = lang('Opened');
break;
- case 'A': $type = lang('Re-assigned');
break;
- case 'P': $type = lang('Priority
changed'); break;
- case 'CO': $type = lang('Initial
Coordinator'); break;
- case 'C': $type = lang('Coordinator
changed'); break;
- case 'TO': $type = lang('Initial
Category'); break;
- case 'T': $type = lang('Category
changed'); break;
- case 'SO': $type = lang('Initial
Status'); break;
- case 'S': $type = lang('Status
changed'); break;
- case 'FO': $type = lang('Initial
File'); break;
- case 'F': $type = lang('File changed');
break;
- case 'LO': $type = lang('Initial
Link'); break;
- case 'L': $type = lang('Link changed');
break;
- default: break;
- }
-
-
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
-
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
-
-
- $record_history[$i]['value_action'] =
$type?$type:'';
- unset($type);
-
- if ($value['status'] == 'A')
- {
- if (! $value['new_value'])
- {
-
$record_history[$i]['value_new_value'] = lang('None');
- }
- else
- {
-
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- }
- else if ($value['status'] == 'C' ||
$value['status'] == 'CO')
- {
- $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
- {
- $record_history[$i]['value_new_value']
= $this->so->read_single_category($value['new_value']);
- }
- else if ($value['status'] != 'O' &&
$value['new_value'])
- {
- $record_history[$i]['value_new_value']
= $value['new_value'];
- }
- else
- {
- $record_history[$i]['value_new_value']
= '';
- }
-
- $i++;
- }
-
- return $record_history;
- }
-
-
- function create_home_dir()
- {
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
'document',
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
-
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
'document',
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'document');
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'document');
- }
- $this->vfs->override_acl = 0;
- }
- return $receipt;
- }
-
-
- function create_document_dir($data,$receipt)
- {
- if(is_array($data))
- {
- $loc1 =
(isset($data['loc1'])?$data['loc1']:'');
- $entity_name =
(isset($data['entity_name'])?$data['entity_name']:'');
- $category_name =
(isset($data['category_name'])?$data['category_name']:'');
- $p_num =
(isset($data['p_num'])?$data['p_num']:'');
- }
-
- $this->vfs->override_acl = 1;
-//_debug_array($data);
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
'document' . SEP . $loc1,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
'document' . SEP . $loc1,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1);
- }
- $this->vfs->override_acl = 0;
- }
-
- if($entity_name)
- {
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
- {
-
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name);
- }
- }
- }
- if($category_name)
- {
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP . $category_name,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
- {
-
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP . $category_name,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP
. $category_name);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP
. $category_name);
- }
- }
- }
- if($p_num)
- {
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP . $category_name .
SEP . $p_num,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
- {
-
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP . $category_name .
SEP . $p_num,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP
. $category_name . SEP . $p_num);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP
. $category_name . SEP . $p_num);
- }
- }
- }
-
- $this->vfs->override_acl = 0;
-
-//_debug_array($receipt);
- return $receipt;
- }
-
-
- function save($values)
- {
-
- $document_date =
$this->bocommon->date_array($values['document_date']);
- $values['document_date'] = mktime
(2,0,0,$document_date['month'],$document_date['day'],$document_date['year']);
-
- while (is_array($values['location']) && list(,$value) =
each($values['location']))
- {
- if($value)
- {
- $location[] = $value;
- }
- }
-
- $values['location_code']=implode("-", $location);
-
-//_debug_array($values);
- if ($values['document_id'])
- {
- if ($values['document_id'] != 0)
- {
- $receipt = $this->so->edit($values);
- }
- }
- else
- {
- $receipt = $this->so->add($values);
- }
- return $receipt;
- }
-
- function delete($document_id)
- {
- $this->so->delete($document_id);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 document
+ * @version $Id: class.bodocument.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bodocument
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function bodocument($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sodocument');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->solocation =
CreateObject($this->currentapp.'.solocation');
+ $this->historylog =
CreateObject($this->currentapp.'.historylog','document');
+ $this->contacts =
CreateObject($this->currentapp.'.soactor');
+ $this->contacts->role='vendor';
+
+ $this->vfs =
CreateObject('phpgwapi.vfs');
+ $this->rootdir = $this->vfs->basedir;
+ $this->fakebase = $this->vfs->fakebase;
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $status_id =
get_var('status_id',array('POST','GET'));
+ $entity_id =
get_var('entity_id',array('POST','GET'));
+ $doc_type =
get_var('doc_type',array('POST','GET'));
+ $query_location =
get_var('query_location',array('POST','GET'));
+
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(isset($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($status_id))
+ {
+ $this->status_id = $status_id;
+ }
+ if(isset($entity_id))
+ {
+ $this->entity_id = $entity_id;
+ }
+ if(isset($doc_type))
+ {
+ $this->doc_type = $doc_type;
+ }
+ if(isset($query_location))
+ {
+ $this->query_location = $query_location;
+ }
+
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','document',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','document');
+
+ //_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->entity_id = $data['entity_id'];
+ $this->doc_type = $data['doc_type'];
+ $this->query_location = $data['query_location'];
+ }
+
+ function select_status_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
+ break;
+ }
+
+ $status_entries= $this->so->select_status_list();
+
+ while (is_array($status_entries) && list(,$status) =
each($status_entries))
+ {
+ $sel_status = '';
+ if ($status['id']==$selected)
+ {
+ $sel_status = 'selected';
+ }
+
+ $status_list[] = array
+ (
+ 'id' => $status['id'],
+ 'name' => $status['name'],
+ 'selected' => $sel_status
+ );
+ }
+
+ for ($i=0;$i<count($status_list);$i++)
+ {
+ if ($status_list[$i]['selected'] != 'selected')
+ {
+ unset($status_list[$i]['selected']);
+ }
+ }
+
+ return $status_list;
+ }
+
+ function select_branch_list($selected='')
+ {
+
+ $branch_entries= $this->so->select_branch_list();
+
+ while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
+ {
+ $sel_branch = '';
+ if ($branch['id']==$selected)
+ {
+ $sel_branch = 'selected';
+ }
+
+ $branch_list[] = array
+ (
+ 'id' => $branch['id'],
+ 'name' => $branch['name'],
+ 'selected' => $sel_branch
+ );
+ }
+
+ for ($i=0;$i<count($branch_list);$i++)
+ {
+ if ($branch_list[$i]['selected'] != 'selected')
+ {
+ unset($branch_list[$i]['selected']);
+ }
+ }
+
+ return $branch_list;
+ }
+
+
+ function select_doc_type_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->select_doc_type_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+
+ function read()
+ {
+ $document = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id,'entity_id' =>
$this->entity_id,'doc_type'=>$this->doc_type));
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+ $cols_extra = $this->so->cols_extra;
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ for ($i=0; $i<count($document); $i++)
+ {
+
$location_data=$this->solocation->read_single($document[$i]['location_code']);
+
+ for ($j=0;$j<count($cols_extra);$j++)
+ {
+ $document[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
+ }
+ }
+
+ return $document;
+ }
+
+ function read_at_location($location_code='')
+ {
+ $document = $this->so->read_at_location(array('start'
=> $this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id,'entity_id' =>
$this->entity_id,
+
'location_code' => $location_code,'doc_type'=>$this->doc_type));
+ $this->total_records = $this->so->total_records;
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ for ($i=0; $i<count($document); $i++)
+ {
+ $document[$i]['user'] =
$GLOBALS['phpgw']->accounts->id2name($document[$i]['user_id']);
+ $document[$i]['document_date'] =
$GLOBALS['phpgw']->common->show_date($document[$i]['start_date'],$dateformat);
+ $document[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($document[$i]['entry_date'],$dateformat);
+ }
+
+ return $document;
+ }
+
+ function read_single($document_id)
+ {
+ $document
= $this->so->read_single($document_id);
+ $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $document['document_date'] =
$GLOBALS['phpgw']->common->show_date($document['document_date'],$dateformat);
+ $vendor
= $this->contacts->read_single(array('actor_id'=>$document['vendor_id']));
+
+ if(is_array($vendor))
+ {
+ foreach($vendor['attributes'] as $attribute)
+ {
+ if($attribute['name']=='org_name')
+ {
+
$document['vendor_name']=$attribute['value'];
+ break;
+ }
+ }
+ }
+
+ if($document['location_code'])
+ {
+ $document['location_data']
=$this->solocation->read_single($document['location_code']);
+ }
+
+ if($document['p_num'])
+ {
+ $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
+ $category =
$soadmin_entity->read_single_category($document['p_entity_id'],$document['p_cat_id']);
+
+
$document['p'][$document['p_entity_id']]['p_num']=$document['p_num'];
+
$document['p'][$document['p_entity_id']]['p_entity_id']=$document['p_entity_id'];
+
$document['p'][$document['p_entity_id']]['p_cat_id']=$document['p_cat_id'];
+
$document['p'][$document['p_entity_id']]['p_cat_name'] = $category['name'];
+ }
+
+ return $document;
+ }
+
+ function read_location_data($location_code)
+ {
+ $location_data=
$this->solocation->read_single($location_code);
+
+ return $location_data;
+ }
+
+ function select_category_list($format='',$selected='')
+ {
+/* switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+
+*/
+
+ $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
+ $categories =
$soadmin_entity->read_category(array('allrows'=>True,'entity_id'=>$this->entity_id));
+
+ $category_list =
$this->bocommon->select_multi_list($selected,$categories);
+
+/* while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+*/
+ return $category_list;
+ }
+
+
+
+ function read_record_history($id)
+ {
+ $history_array =
$this->historylog->return_array(array('O'),array(),'','',$id);
+ $i=0;
+ while (is_array($history_array) && list(,$value) =
each($history_array))
+ {
+
+ $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
+ $record_history[$i]['value_user'] =
$value['owner'];
+
+ switch ($value['status'])
+ {
+ case 'R': $type = lang('Re-opened');
break;
+ case 'X': $type = lang('Closed');
break;
+ case 'O': $type = lang('Opened');
break;
+ case 'A': $type = lang('Re-assigned');
break;
+ case 'P': $type = lang('Priority
changed'); break;
+ case 'CO': $type = lang('Initial
Coordinator'); break;
+ case 'C': $type = lang('Coordinator
changed'); break;
+ case 'TO': $type = lang('Initial
Category'); break;
+ case 'T': $type = lang('Category
changed'); break;
+ case 'SO': $type = lang('Initial
Status'); break;
+ case 'S': $type = lang('Status
changed'); break;
+ case 'FO': $type = lang('Initial
File'); break;
+ case 'F': $type = lang('File changed');
break;
+ case 'LO': $type = lang('Initial
Link'); break;
+ case 'L': $type = lang('Link changed');
break;
+ default: break;
+ }
+
+
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
+
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
+
+
+ $record_history[$i]['value_action'] =
$type?$type:'';
+ unset($type);
+
+ if ($value['status'] == 'A')
+ {
+ if (! $value['new_value'])
+ {
+
$record_history[$i]['value_new_value'] = lang('None');
+ }
+ else
+ {
+
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ }
+ else if ($value['status'] == 'C' ||
$value['status'] == 'CO')
+ {
+ $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
+ {
+ $record_history[$i]['value_new_value']
= $this->so->read_single_category($value['new_value']);
+ }
+ else if ($value['status'] != 'O' &&
$value['new_value'])
+ {
+ $record_history[$i]['value_new_value']
= $value['new_value'];
+ }
+ else
+ {
+ $record_history[$i]['value_new_value']
= '';
+ }
+
+ $i++;
+ }
+
+ return $record_history;
+ }
+
+
+ function create_home_dir()
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'document',
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'document',
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'document');
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'document');
+ }
+ $this->vfs->override_acl = 0;
+ }
+ return $receipt;
+ }
+
+
+ function create_document_dir($data,$receipt)
+ {
+ if(is_array($data))
+ {
+ $loc1 =
(isset($data['loc1'])?$data['loc1']:'');
+ $entity_name =
(isset($data['entity_name'])?$data['entity_name']:'');
+ $category_name =
(isset($data['category_name'])?$data['category_name']:'');
+ $p_num =
(isset($data['p_num'])?$data['p_num']:'');
+ }
+
+ $this->vfs->override_acl = 1;
+//_debug_array($data);
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'document' . SEP . $loc1,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'document' . SEP . $loc1,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1);
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+ if($entity_name)
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name);
+ }
+ }
+ }
+ if($category_name)
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP . $category_name,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP . $category_name,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP
. $category_name);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP
. $category_name);
+ }
+ }
+ }
+ if($p_num)
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP . $category_name .
SEP . $p_num,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase.
SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP . $category_name .
SEP . $p_num,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP
. $category_name . SEP . $p_num);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'document' . SEP . $loc1 . SEP . $entity_name . SEP
. $category_name . SEP . $p_num);
+ }
+ }
+ }
+
+ $this->vfs->override_acl = 0;
+
+//_debug_array($receipt);
+ return $receipt;
+ }
+
+
+ function save($values)
+ {
+
+ $document_date =
$this->bocommon->date_array($values['document_date']);
+ $values['document_date'] = mktime
(2,0,0,$document_date['month'],$document_date['day'],$document_date['year']);
+
+ while (is_array($values['location']) && list(,$value) =
each($values['location']))
+ {
+ if($value)
+ {
+ $location[] = $value;
+ }
+ }
+
+ $values['location_code']=implode("-", $location);
+
+//_debug_array($values);
+ if ($values['document_id'])
+ {
+ if ($values['document_id'] != 0)
+ {
+ $receipt = $this->so->edit($values);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($values);
+ }
+ return $receipt;
+ }
+
+ function delete($document_id)
+ {
+ $this->so->delete($document_id);
+ }
+ }
+?>
Index: property/inc/class.boentity.inc.php
diff -u property/inc/class.boentity.inc.php:1.14
property/inc/class.boentity.inc.php:1.15
--- property/inc/class.boentity.inc.php:1.14 Fri Jan 27 14:05:43 2006
+++ property/inc/class.boentity.inc.php Fri Feb 3 12:05:49 2006
@@ -1,636 +1,636 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 entity
- * @version $Id: class.boentity.inc.php,v 1.14 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boentity
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 boentity($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.soentity');
-
- $this->solocation =
CreateObject($this->currentapp.'.solocation');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->vfs =
CreateObject('phpgwapi.vfs');
- $this->rootdir = $this->vfs->basedir;
- $this->fakebase = $this->vfs->fakebase;
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $district_id =
get_var('district_id',array('POST','GET'));
- $entity_id =
get_var('entity_id',array('POST','GET'));
- $status = get_var('status',array('POST','GET'));
- $start_date =
get_var('start_date',array('POST','GET'));
- $end_date =
get_var('end_date',array('POST','GET'));
-
- $this->soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity',$entity_id,$cat_id);
-
- $this->category_name =
$this->soadmin_entity->category_name;
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
- if(array_key_exists('query',$_POST) ||
array_key_exists('query',$_GET) )
- {
- $this->query = $query;
- }
- if(array_key_exists('filter',$_POST))
- {
- $this->filter = $filter;
- }
- if(array_key_exists('sort',$_POST))
- {
- $this->sort = $sort;
- }
- if(array_key_exists('order',$_POST))
- {
- $this->order = $order;
- }
- // if(array_key_exists('cat_id',$_POST) ||
array_key_exists('cat_id',$_GET) )
- if($cat_id)
- {
- $this->cat_id = $cat_id;
- }
- if(array_key_exists('district_id',$_POST))
- {
- $this->district_id = $district_id;
- }
- if($entity_id)
- {
- $this->entity_id = $entity_id;
- }
- if(array_key_exists('status',$_POST))
- {
- $this->status = $status;
- }
- if(array_key_exists('start_date',$_POST))
- {
- $this->start_date = $start_date;
- }
- if(array_key_exists('end_date',$_POST))
- {
- $this->end_date = $end_date;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','entity',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','entity');
- //_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->district_id = $data['district_id'];
- // $this->entity_id = $data['entity_id'];
- $this->status = $data['status'];
- $this->start_date = $data['start_date'];
- $this->end_date = $data['end_date'];
- }
-
- function
column_list($selected='',$entity_id='',$cat_id,$allrows='')
- {
- $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
-
- if(!$selected)
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]["entity_columns_"
. $this->entity_id . '_' . $this->cat_id];
- }
-
- $columns =
$soadmin_entity->read_attrib(array('entity_id'=>$entity_id,'cat_id'=>$cat_id,'allrows'=>$allrows));
-
$column_list=$this->bocommon->select_multi_list($selected,$columns);
-
- return $column_list;
- }
-
- function select_category_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories=
$this->soadmin_entity->read_category(array('allrows'=>True,'entity_id'=>$this->entity_id));
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
-
- function select_status_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
- break;
- }
-
- $status_entries=
$this->so->select_status_list($this->entity_id,$this->cat_id);
-
- while (is_array($status_entries) && list(,$status) =
each($status_entries))
- {
- $sel_status = '';
- if ($status['id']==$selected)
- {
- $sel_status = 'selected';
- }
-
- $status_list[] = array
- (
- 'id' => $status['id'],
- 'name' => $status['name'],
- 'selected' => $sel_status
- );
- }
-
- for ($i=0;$i<count($status_list);$i++)
- {
- if ($status_list[$i]['selected'] != 'selected')
- {
- unset($status_list[$i]['selected']);
- }
- }
-
- return $status_list;
- }
-
- function read($data='')
- {
- $entity = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id,'district_id' =>
$this->district_id,
-
'lookup'=>$data['lookup'],'allrows'=>$data['allrows'],'entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'status'=>$this->status,
-
'start_date'=>$this->bocommon->date_to_timestamp($data['start_date']),'end_date'=>$this->bocommon->date_to_timestamp($data['end_date']),
-
'allrows'=>$data['allrows']));
-
- $this->total_records = $this->so->total_records;
- $this->uicols = $this->so->uicols;
- $cols_extra = $this->so->cols_extra;
- $cols_return_lookup =
$this->so->cols_return_lookup;
-//_debug_array($entity);
-//_debug_array($cols_extra);
-//_debug_array($cols_return_lookup);
-
- if($data['lookup'])
- {
- for ($i=0;$i<count($entity);$i++)
- {
-
$location_data=$this->solocation->read_single($entity[$i]['location_code']);
- for ($j=0;$j<count($cols_extra);$j++)
- {
- $entity[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
- }
-
- if($cols_return_lookup)
- {
- for
($k=0;$k<count($cols_return_lookup);$k++)
- {
-
$entity[$i][$cols_return_lookup[$k]] = $location_data[$cols_return_lookup[$k]];
- }
- }
- }
- }
-
- return $entity;
- }
-
- function read_single($data)
- {
- $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
- $contacts =
CreateObject('phpgwapi.contacts');
- $vendor = CreateObject($this->currentapp.'.soactor');
- $vendor->role = 'vendor';
-
- $entity = $this->so->read_single($data);
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $entity['date'] =
$GLOBALS['phpgw']->common->show_date($entity['date'],$dateformat);
-
- if($entity['location_code'])
- {
-
$entity['location_data']=$this->solocation->read_single($entity['location_code']);
- if($entity['tenant_id'])
- {
-
$tenant_data=$this->bocommon->read_single_tenant($entity['tenant_id']);
- $entity['location_data']['tenant_id']
= $entity['tenant_id'];
-
$entity['location_data']['contact_phone']= $entity['contact_phone'];
- $entity['location_data']['last_name']
= $tenant_data['last_name'];
- $entity['location_data']['first_name']
= $tenant_data['first_name'];
- }
- }
-
- if($entity['p_num'])
- {
- $category =
$soadmin_entity->read_single_category($entity['p_entity_id'],$entity['p_cat_id']);
-
$entity['p'][$entity['p_entity_id']]['p_num']=$entity['p_num'];
-
$entity['p'][$entity['p_entity_id']]['p_entity_id']=$entity['p_entity_id'];
-
$entity['p'][$entity['p_entity_id']]['p_cat_id']=$entity['p_cat_id'];
-
$entity['p'][$entity['p_entity_id']]['p_cat_name'] = $category['name'];
- }
-
- $input_type_array = array(
- 'R' => 'radio',
- 'CH' => 'checkbox',
- 'LB' => 'listbox'
- );
-
- $sep = '/';
-
- $dlarr[strpos($dateformat,'Y')] = 'Y';
- $dlarr[strpos($dateformat,'m')] = 'm';
- $dlarr[strpos($dateformat,'d')] = 'd';
- ksort($dlarr);
- $dateformat= (implode($sep,$dlarr));
- $m=0;
-
- for ($i=0;$i<count($entity['attributes']);$i++)
- {
- if($entity['attributes'][$i]['datatype']=='D'
&& $entity['attributes'][$i]['value'])
- {
- $timestamp_date=
mktime(0,0,0,date(m,strtotime($entity['attributes'][$i]['value'])),date(d,strtotime($entity['attributes'][$i]['value'])),date(y,strtotime($entity['attributes'][$i]['value'])));
- $entity['attributes'][$i]['value']
= $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
- }
-
- if($entity['attributes'][$i]['datatype']=='AB')
- {
- if($entity['attributes'][$i]['value'])
- {
- $contact_data
=
$contacts->read_single_entry($entity['attributes'][$i]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-
$entity['attributes'][$i]['contact_name'] = $contact_data[0]['n_family']
. ', ' . $contact_data[0]['n_given'];
- }
-
- $insert_record_entity[] =
$entity['attributes'][$i]['name'];
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $entity['attributes'][$i]['name']);
- $lookup_functions[$m]['name'] =
'lookup_'. $entity['attributes'][$i]['name'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
-
-
if($entity['attributes'][$i]['datatype']=='VENDOR')
- {
- if($entity['attributes'][$i]['value'])
- {
- $vendor_data =
$vendor->read_single(array('actor_id'=>$entity['attributes'][$i]['value']));
- for
($n=0;$n<count($vendor_data['attributes']);$n++)
- {
-
if($vendor_data['attributes'][$n]['name'] == 'org_name')
- {
-
$entity['attributes'][$i]['vendor_name']=
$vendor_data['attributes'][$n]['value'];
- $n
=count($vendor_data['attributes']);
- }
- }
- }
-
- $insert_record_entity[] =
$entity['attributes'][$i]['name'];
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $entity['attributes'][$i]['name']);
- $lookup_functions[$m]['name'] =
'lookup_'. $entity['attributes'][$i]['name'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
-
- if($entity['attributes'][$i]['datatype']=='R'
|| $entity['attributes'][$i]['datatype']=='CH' ||
$entity['attributes'][$i]['datatype']=='LB')
- {
- $entity['attributes'][$i]['choice']
=
$soadmin_entity->read_attrib_choice($data['entity_id'],$data['cat_id'],$entity['attributes'][$i]['attrib_id']);
-
$input_type=$input_type_array[$entity['attributes'][$i]['datatype']];
-
-
if($entity['attributes'][$i]['datatype']=='CH')
- {
-
$entity['attributes'][$i]['value']=unserialize($entity['attributes'][$i]['value']);
-
$entity['attributes'][$i]['choice'] =
$this->bocommon->select_multi_list_2($entity['attributes'][$i]['value'],$entity['attributes'][$i]['choice'],$input_type);
- }
- else
- {
- for
($j=0;$j<count($entity['attributes'][$i]['choice']);$j++)
- {
-
$entity['attributes'][$i]['choice'][$j]['input_type']=$input_type;
-
if($entity['attributes'][$i]['choice'][$j]['id']==$entity['attributes'][$i]['value'])
- {
-
$entity['attributes'][$i]['choice'][$j]['checked']='checked';
- }
- }
- }
- }
-
- $entity['attributes'][$i]['datatype_text'] =
$this->bocommon->translate_datatype($entity['attributes'][$i]['datatype']);
- $entity['attributes'][$i]['counter'] = $i;
- $entity['attributes'][$i]['type_id'] =
$data['type_id'];
- }
-
- for ($j=0;$j<count($lookup_functions);$j++)
- {
- $entity['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
- $entity['lookup_functions'] .= '{'."\r\n";
- $entity['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
- $entity['lookup_functions'] .= '}'."\r\n";
- }
-
- $this->vfs->override_acl = 1;
-
- $entity['files'] = $this->vfs->ls (array(
- 'string' => $this->fakebase. '/' .
$this->category_name . '/' . $entity['location_data']['loc1'] . '/' .
$data['id'],
- 'relatives' => array(RELATIVE_NONE)));
-
- $this->vfs->override_acl = 0;
-
- if(!$entity['files'][0]['file_id'])
- {
- unset($entity['files']);
- }
-
-
-
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp,$insert_record_entity);
-
-//_debug_array($insert_record_entity);
- return $entity;
- }
-
-
- function create_home_dir($receipt='')
- {
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
$this->category_name,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
-
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
$this->category_name,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . $this->category_name);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . $this->category_name);
- }
- $this->vfs->override_acl = 0;
- }
-
- return $receipt;
- }
-
- function create_document_dir($loc1='',$id='')
- {
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
$this->category_name . SEP . $loc1,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
$this->category_name . SEP . $loc1,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $loc1);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $loc1);
- }
- $this->vfs->override_acl = 0;
- }
-
-
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
$this->category_name . SEP . $loc1 . SEP . $id,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
$this->category_name . SEP . $loc1 . SEP . $id,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $loc1 . SEP . $id);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $loc1 . SEP . $id);
- }
- $this->vfs->override_acl = 0;
- }
-
-//_debug_array($receipt);
- return $receipt;
- }
-
- function
save($values,$values_attribute,$action='',$entity_id,$cat_id)
- {
- while (is_array($values['location']) && list(,$value) =
each($values['location']))
- {
- if($value)
- {
- $location[] = $value;
- }
- }
-
- $values['location_code']=implode("-", $location);
-
- $values['date'] =
$this->bocommon->date_to_timestamp($values['date']);
-
- for ($i=0;$i<count($values_attribute);$i++)
- {
- if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
- }
- if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
- }
-
- if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
- }
-
- if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
- {
-
- $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
- }
- }
-
- if ($action=='edit')
- {
- $receipt =
$this->so->edit($values,$values_attribute,$entity_id,$cat_id);
-
- if($values['delete_file'])
- {
- for
($i=0;$i<count($values['delete_file']);$i++)
- {
- $file = $this->fakebase. SEP .
$this->category_name . SEP . $location[0] . SEP . $values['id'] . SEP .
$values['delete_file'][$i];
-
-
if($this->vfs->file_exists(array(
- 'string' =>
$file,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
- {
-
$this->vfs->override_acl = 1;
-
- if(!$this->vfs->rm
(array(
- 'string' =>
$file,
- 'relatives' =>
array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $location[0]. SEP .
$values['id'] . SEP .$values['delete_file'][$i]);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $location[0]. SEP .
$values['id'] . SEP . $values['delete_file'][$i]);
- }
-
$this->vfs->override_acl = 0;
- }
- }
- }
- }
- else
- {
- $receipt =
$this->so->add($values,$values_attribute,$entity_id,$cat_id);
- }
-
- $acl_location = '.entity.' . $entity_id . '.' . $cat_id;
- $custom_functions =
$this->soadmin_entity->read_custom_function(array('acl_location' =>
$acl_location,'allrows'=>True));
-
- if (isSet($custom_functions) AND
is_array($custom_functions))
- {
- foreach($custom_functions as $entry)
- {
- if (is_file(PHPGW_APP_INC . SEP .
'custom' . SEP . $entry['file_name']) && $entry['active'])
- include (PHPGW_APP_INC . SEP . 'custom'
. SEP . $entry['file_name']);
- }
- }
- return receipt;
- }
-
-
- function delete($id )
- {
- $this->so->delete($this->entity_id,$this->cat_id,$id);
- }
-
- function generate_id($data )
- {
- if($data['cat_id'])
- {
- return $this->so->generate_id($data);
- }
- }
- }
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 entity
+ * @version $Id: class.boentity.inc.php,v 1.15 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boentity
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 boentity($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.soentity');
+
+ $this->solocation =
CreateObject($this->currentapp.'.solocation');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->vfs =
CreateObject('phpgwapi.vfs');
+ $this->rootdir = $this->vfs->basedir;
+ $this->fakebase = $this->vfs->fakebase;
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $district_id =
get_var('district_id',array('POST','GET'));
+ $entity_id =
get_var('entity_id',array('POST','GET'));
+ $status = get_var('status',array('POST','GET'));
+ $start_date =
get_var('start_date',array('POST','GET'));
+ $end_date =
get_var('end_date',array('POST','GET'));
+
+ $this->soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity',$entity_id,$cat_id);
+
+ $this->category_name =
$this->soadmin_entity->category_name;
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+ if(array_key_exists('query',$_POST) ||
array_key_exists('query',$_GET) )
+ {
+ $this->query = $query;
+ }
+ if(array_key_exists('filter',$_POST))
+ {
+ $this->filter = $filter;
+ }
+ if(array_key_exists('sort',$_POST))
+ {
+ $this->sort = $sort;
+ }
+ if(array_key_exists('order',$_POST))
+ {
+ $this->order = $order;
+ }
+ // if(array_key_exists('cat_id',$_POST) ||
array_key_exists('cat_id',$_GET) )
+ if($cat_id)
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(array_key_exists('district_id',$_POST))
+ {
+ $this->district_id = $district_id;
+ }
+ if($entity_id)
+ {
+ $this->entity_id = $entity_id;
+ }
+ if(array_key_exists('status',$_POST))
+ {
+ $this->status = $status;
+ }
+ if(array_key_exists('start_date',$_POST))
+ {
+ $this->start_date = $start_date;
+ }
+ if(array_key_exists('end_date',$_POST))
+ {
+ $this->end_date = $end_date;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','entity',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','entity');
+ //_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->district_id = $data['district_id'];
+ // $this->entity_id = $data['entity_id'];
+ $this->status = $data['status'];
+ $this->start_date = $data['start_date'];
+ $this->end_date = $data['end_date'];
+ }
+
+ function
column_list($selected='',$entity_id='',$cat_id,$allrows='')
+ {
+ $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
+
+ if(!$selected)
+ {
+
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]["entity_columns_"
. $this->entity_id . '_' . $this->cat_id];
+ }
+
+ $columns =
$soadmin_entity->read_attrib(array('entity_id'=>$entity_id,'cat_id'=>$cat_id,'allrows'=>$allrows));
+
$column_list=$this->bocommon->select_multi_list($selected,$columns);
+
+ return $column_list;
+ }
+
+ function select_category_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories=
$this->soadmin_entity->read_category(array('allrows'=>True,'entity_id'=>$this->entity_id));
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+
+ function select_status_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
+ break;
+ }
+
+ $status_entries=
$this->so->select_status_list($this->entity_id,$this->cat_id);
+
+ while (is_array($status_entries) && list(,$status) =
each($status_entries))
+ {
+ $sel_status = '';
+ if ($status['id']==$selected)
+ {
+ $sel_status = 'selected';
+ }
+
+ $status_list[] = array
+ (
+ 'id' => $status['id'],
+ 'name' => $status['name'],
+ 'selected' => $sel_status
+ );
+ }
+
+ for ($i=0;$i<count($status_list);$i++)
+ {
+ if ($status_list[$i]['selected'] != 'selected')
+ {
+ unset($status_list[$i]['selected']);
+ }
+ }
+
+ return $status_list;
+ }
+
+ function read($data='')
+ {
+ $entity = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id,'district_id' =>
$this->district_id,
+
'lookup'=>$data['lookup'],'allrows'=>$data['allrows'],'entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'status'=>$this->status,
+
'start_date'=>$this->bocommon->date_to_timestamp($data['start_date']),'end_date'=>$this->bocommon->date_to_timestamp($data['end_date']),
+
'allrows'=>$data['allrows']));
+
+ $this->total_records = $this->so->total_records;
+ $this->uicols = $this->so->uicols;
+ $cols_extra = $this->so->cols_extra;
+ $cols_return_lookup =
$this->so->cols_return_lookup;
+//_debug_array($entity);
+//_debug_array($cols_extra);
+//_debug_array($cols_return_lookup);
+
+ if($data['lookup'])
+ {
+ for ($i=0;$i<count($entity);$i++)
+ {
+
$location_data=$this->solocation->read_single($entity[$i]['location_code']);
+ for ($j=0;$j<count($cols_extra);$j++)
+ {
+ $entity[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
+ }
+
+ if($cols_return_lookup)
+ {
+ for
($k=0;$k<count($cols_return_lookup);$k++)
+ {
+
$entity[$i][$cols_return_lookup[$k]] = $location_data[$cols_return_lookup[$k]];
+ }
+ }
+ }
+ }
+
+ return $entity;
+ }
+
+ function read_single($data)
+ {
+ $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
+ $contacts =
CreateObject('phpgwapi.contacts');
+ $vendor = CreateObject($this->currentapp.'.soactor');
+ $vendor->role = 'vendor';
+
+ $entity = $this->so->read_single($data);
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $entity['date'] =
$GLOBALS['phpgw']->common->show_date($entity['date'],$dateformat);
+
+ if($entity['location_code'])
+ {
+
$entity['location_data']=$this->solocation->read_single($entity['location_code']);
+ if($entity['tenant_id'])
+ {
+
$tenant_data=$this->bocommon->read_single_tenant($entity['tenant_id']);
+ $entity['location_data']['tenant_id']
= $entity['tenant_id'];
+
$entity['location_data']['contact_phone']= $entity['contact_phone'];
+ $entity['location_data']['last_name']
= $tenant_data['last_name'];
+ $entity['location_data']['first_name']
= $tenant_data['first_name'];
+ }
+ }
+
+ if($entity['p_num'])
+ {
+ $category =
$soadmin_entity->read_single_category($entity['p_entity_id'],$entity['p_cat_id']);
+
$entity['p'][$entity['p_entity_id']]['p_num']=$entity['p_num'];
+
$entity['p'][$entity['p_entity_id']]['p_entity_id']=$entity['p_entity_id'];
+
$entity['p'][$entity['p_entity_id']]['p_cat_id']=$entity['p_cat_id'];
+
$entity['p'][$entity['p_entity_id']]['p_cat_name'] = $category['name'];
+ }
+
+ $input_type_array = array(
+ 'R' => 'radio',
+ 'CH' => 'checkbox',
+ 'LB' => 'listbox'
+ );
+
+ $sep = '/';
+
+ $dlarr[strpos($dateformat,'Y')] = 'Y';
+ $dlarr[strpos($dateformat,'m')] = 'm';
+ $dlarr[strpos($dateformat,'d')] = 'd';
+ ksort($dlarr);
+ $dateformat= (implode($sep,$dlarr));
+ $m=0;
+
+ for ($i=0;$i<count($entity['attributes']);$i++)
+ {
+ if($entity['attributes'][$i]['datatype']=='D'
&& $entity['attributes'][$i]['value'])
+ {
+ $timestamp_date=
mktime(0,0,0,date(m,strtotime($entity['attributes'][$i]['value'])),date(d,strtotime($entity['attributes'][$i]['value'])),date(y,strtotime($entity['attributes'][$i]['value'])));
+ $entity['attributes'][$i]['value']
= $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
+ }
+
+ if($entity['attributes'][$i]['datatype']=='AB')
+ {
+ if($entity['attributes'][$i]['value'])
+ {
+ $contact_data
=
$contacts->read_single_entry($entity['attributes'][$i]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
+
$entity['attributes'][$i]['contact_name'] = $contact_data[0]['n_family']
. ', ' . $contact_data[0]['n_given'];
+ }
+
+ $insert_record_entity[] =
$entity['attributes'][$i]['name'];
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $entity['attributes'][$i]['name']);
+ $lookup_functions[$m]['name'] =
'lookup_'. $entity['attributes'][$i]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+
+
if($entity['attributes'][$i]['datatype']=='VENDOR')
+ {
+ if($entity['attributes'][$i]['value'])
+ {
+ $vendor_data =
$vendor->read_single(array('actor_id'=>$entity['attributes'][$i]['value']));
+ for
($n=0;$n<count($vendor_data['attributes']);$n++)
+ {
+
if($vendor_data['attributes'][$n]['name'] == 'org_name')
+ {
+
$entity['attributes'][$i]['vendor_name']=
$vendor_data['attributes'][$n]['value'];
+ $n
=count($vendor_data['attributes']);
+ }
+ }
+ }
+
+ $insert_record_entity[] =
$entity['attributes'][$i]['name'];
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $entity['attributes'][$i]['name']);
+ $lookup_functions[$m]['name'] =
'lookup_'. $entity['attributes'][$i]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+
+ if($entity['attributes'][$i]['datatype']=='R'
|| $entity['attributes'][$i]['datatype']=='CH' ||
$entity['attributes'][$i]['datatype']=='LB')
+ {
+ $entity['attributes'][$i]['choice']
=
$soadmin_entity->read_attrib_choice($data['entity_id'],$data['cat_id'],$entity['attributes'][$i]['attrib_id']);
+
$input_type=$input_type_array[$entity['attributes'][$i]['datatype']];
+
+
if($entity['attributes'][$i]['datatype']=='CH')
+ {
+
$entity['attributes'][$i]['value']=unserialize($entity['attributes'][$i]['value']);
+
$entity['attributes'][$i]['choice'] =
$this->bocommon->select_multi_list_2($entity['attributes'][$i]['value'],$entity['attributes'][$i]['choice'],$input_type);
+ }
+ else
+ {
+ for
($j=0;$j<count($entity['attributes'][$i]['choice']);$j++)
+ {
+
$entity['attributes'][$i]['choice'][$j]['input_type']=$input_type;
+
if($entity['attributes'][$i]['choice'][$j]['id']==$entity['attributes'][$i]['value'])
+ {
+
$entity['attributes'][$i]['choice'][$j]['checked']='checked';
+ }
+ }
+ }
+ }
+
+ $entity['attributes'][$i]['datatype_text'] =
$this->bocommon->translate_datatype($entity['attributes'][$i]['datatype']);
+ $entity['attributes'][$i]['counter'] = $i;
+ $entity['attributes'][$i]['type_id'] =
$data['type_id'];
+ }
+
+ for ($j=0;$j<count($lookup_functions);$j++)
+ {
+ $entity['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
+ $entity['lookup_functions'] .= '{'."\r\n";
+ $entity['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
+ $entity['lookup_functions'] .= '}'."\r\n";
+ }
+
+ $this->vfs->override_acl = 1;
+
+ $entity['files'] = $this->vfs->ls (array(
+ 'string' => $this->fakebase. '/' .
$this->category_name . '/' . $entity['location_data']['loc1'] . '/' .
$data['id'],
+ 'relatives' => array(RELATIVE_NONE)));
+
+ $this->vfs->override_acl = 0;
+
+ if(!$entity['files'][0]['file_id'])
+ {
+ unset($entity['files']);
+ }
+
+
+
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp,$insert_record_entity);
+
+//_debug_array($insert_record_entity);
+ return $entity;
+ }
+
+
+ function create_home_dir($receipt='')
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
$this->category_name,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
$this->category_name,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . $this->category_name);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . $this->category_name);
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+ return $receipt;
+ }
+
+ function create_document_dir($loc1='',$id='')
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
$this->category_name . SEP . $loc1,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
$this->category_name . SEP . $loc1,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $loc1);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $loc1);
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
$this->category_name . SEP . $loc1 . SEP . $id,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
$this->category_name . SEP . $loc1 . SEP . $id,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $loc1 . SEP . $id);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $loc1 . SEP . $id);
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+//_debug_array($receipt);
+ return $receipt;
+ }
+
+ function
save($values,$values_attribute,$action='',$entity_id,$cat_id)
+ {
+ while (is_array($values['location']) && list(,$value) =
each($values['location']))
+ {
+ if($value)
+ {
+ $location[] = $value;
+ }
+ }
+
+ $values['location_code']=implode("-", $location);
+
+ $values['date'] =
$this->bocommon->date_to_timestamp($values['date']);
+
+ for ($i=0;$i<count($values_attribute);$i++)
+ {
+ if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
+ }
+ if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
+ }
+
+ if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
+ }
+
+ if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
+ {
+
+ $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
+ }
+ }
+
+ if ($action=='edit')
+ {
+ $receipt =
$this->so->edit($values,$values_attribute,$entity_id,$cat_id);
+
+ if($values['delete_file'])
+ {
+ for
($i=0;$i<count($values['delete_file']);$i++)
+ {
+ $file = $this->fakebase. SEP .
$this->category_name . SEP . $location[0] . SEP . $values['id'] . SEP .
$values['delete_file'][$i];
+
+
if($this->vfs->file_exists(array(
+ 'string' =>
$file,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
$this->vfs->override_acl = 1;
+
+ if(!$this->vfs->rm
(array(
+ 'string' =>
$file,
+ 'relatives' =>
array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $location[0]. SEP .
$values['id'] . SEP .$values['delete_file'][$i]);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . $this->category_name . SEP . $location[0]. SEP .
$values['id'] . SEP . $values['delete_file'][$i]);
+ }
+
$this->vfs->override_acl = 0;
+ }
+ }
+ }
+ }
+ else
+ {
+ $receipt =
$this->so->add($values,$values_attribute,$entity_id,$cat_id);
+ }
+
+ $acl_location = '.entity.' . $entity_id . '.' . $cat_id;
+ $custom_functions =
$this->soadmin_entity->read_custom_function(array('acl_location' =>
$acl_location,'allrows'=>True));
+
+ if (isSet($custom_functions) AND
is_array($custom_functions))
+ {
+ foreach($custom_functions as $entry)
+ {
+ if (is_file(PHPGW_APP_INC . SEP .
'custom' . SEP . $entry['file_name']) && $entry['active'])
+ include (PHPGW_APP_INC . SEP . 'custom'
. SEP . $entry['file_name']);
+ }
+ }
+ return receipt;
+ }
+
+
+ function delete($id )
+ {
+ $this->so->delete($this->entity_id,$this->cat_id,$id);
+ }
+
+ function generate_id($data )
+ {
+ if($data['cat_id'])
+ {
+ return $this->so->generate_id($data);
+ }
+ }
+ }
?>
\ No newline at end of file
Index: property/inc/class.bogab.inc.php
diff -u property/inc/class.bogab.inc.php:1.7
property/inc/class.bogab.inc.php:1.8
--- property/inc/class.bogab.inc.php:1.7 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bogab.inc.php Fri Feb 3 12:05:49 2006
@@ -1,208 +1,208 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 location
- * @version $Id: class.bogab.inc.php,v 1.7 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bogab
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function bogab($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->solocation =
CreateObject($this->currentapp.'.solocation');
- $this->config =
CreateObject('phpgwapi.config');
- $this->config->read_repository();
- $gab_insert_level =
$this->config->config_data['gab_insert_level'];
-
- if (! $gab_insert_level)
- {
- $gab_insert_level = 3;
- }
-
- $this->gab_insert_level = $gab_insert_level;
-
- $this->so =
CreateObject($this->currentapp.'.sogab',$this->gab_insert_level);
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','gab',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','gab');
-
- //_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'];
- }
-
-
- function
read($loc1='',$gaards_nr='',$bruksnr='',$feste_nr='',$seksjons_nr='',$address='')
- {
- $gab = $this->so->read(array('start' =>
$this->start,'sort' => $this->sort,'order' =>
$this->order,'allrows'=>$this->allrows,
-
'cat_id' => $this->cat_id,'loc1' => $loc1,
-
'gaards_nr' => $gaards_nr,'bruksnr' => $bruksnr,'feste_nr' => $feste_nr,
-
'seksjons_nr' => $seksjons_nr,'address' => $address));
- $this->total_records = $this->so->total_records;
- return $gab;
- }
-
- function read_detail($gab_id='')
- {
- $gab = $this->so->read_detail(array('start' =>
$this->start,'sort' => $this->sort,'order' => $this->order,
-
'cat_id' => $this->cat_id,'gab_id' =>
$gab_id,'allrows'=>$this->allrows));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
- $cols_extra = $this->so->cols_extra;
-
-
- for ($i=0; $i<count($gab); $i++)
- {
-
$location_data=$this->solocation->read_single($gab[$i]['location_code']);
-
- for ($j=0;$j<count($cols_extra);$j++)
- {
- $gab[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
- }
- }
-
- return $gab;
- }
-
- function read_single($gab_id='',$location_code='')
- {
- $gab = $this->so->read_single($gab_id,$location_code);
-
- if($gab['location_code'])
- {
- $gab['location_data']
=$this->solocation->read_single($gab['location_code']);
- }
-
- return $gab;
- }
-
-
- function save($values)
- {
- if(!$values['location_code'])
- {
- while (is_array($values['location']) &&
list(,$value) = each($values['location']))
- {
- if($value)
- {
- $location[] = $value;
- }
- }
-
- $values['location_code']=implode("-",
$location);
- }
-
- if ($values['action']=='edit')
- {
- $receipt = $this->so->edit($values);
- }
- else
- {
- $receipt = $this->so->add($values);
- }
-
- $receipt['location_code']=$values['location_code'];
- return $receipt;
- }
-
- function delete($gab_id='',$location_code='')
- {
- $this->so->delete($gab_id,$location_code);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 location
+ * @version $Id: class.bogab.inc.php,v 1.8 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bogab
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function bogab($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->solocation =
CreateObject($this->currentapp.'.solocation');
+ $this->config =
CreateObject('phpgwapi.config');
+ $this->config->read_repository();
+ $gab_insert_level =
$this->config->config_data['gab_insert_level'];
+
+ if (! $gab_insert_level)
+ {
+ $gab_insert_level = 3;
+ }
+
+ $this->gab_insert_level = $gab_insert_level;
+
+ $this->so =
CreateObject($this->currentapp.'.sogab',$this->gab_insert_level);
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','gab',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','gab');
+
+ //_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'];
+ }
+
+
+ function
read($loc1='',$gaards_nr='',$bruksnr='',$feste_nr='',$seksjons_nr='',$address='')
+ {
+ $gab = $this->so->read(array('start' =>
$this->start,'sort' => $this->sort,'order' =>
$this->order,'allrows'=>$this->allrows,
+
'cat_id' => $this->cat_id,'loc1' => $loc1,
+
'gaards_nr' => $gaards_nr,'bruksnr' => $bruksnr,'feste_nr' => $feste_nr,
+
'seksjons_nr' => $seksjons_nr,'address' => $address));
+ $this->total_records = $this->so->total_records;
+ return $gab;
+ }
+
+ function read_detail($gab_id='')
+ {
+ $gab = $this->so->read_detail(array('start' =>
$this->start,'sort' => $this->sort,'order' => $this->order,
+
'cat_id' => $this->cat_id,'gab_id' =>
$gab_id,'allrows'=>$this->allrows));
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+ $cols_extra = $this->so->cols_extra;
+
+
+ for ($i=0; $i<count($gab); $i++)
+ {
+
$location_data=$this->solocation->read_single($gab[$i]['location_code']);
+
+ for ($j=0;$j<count($cols_extra);$j++)
+ {
+ $gab[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
+ }
+ }
+
+ return $gab;
+ }
+
+ function read_single($gab_id='',$location_code='')
+ {
+ $gab = $this->so->read_single($gab_id,$location_code);
+
+ if($gab['location_code'])
+ {
+ $gab['location_data']
=$this->solocation->read_single($gab['location_code']);
+ }
+
+ return $gab;
+ }
+
+
+ function save($values)
+ {
+ if(!$values['location_code'])
+ {
+ while (is_array($values['location']) &&
list(,$value) = each($values['location']))
+ {
+ if($value)
+ {
+ $location[] = $value;
+ }
+ }
+
+ $values['location_code']=implode("-",
$location);
+ }
+
+ if ($values['action']=='edit')
+ {
+ $receipt = $this->so->edit($values);
+ }
+ else
+ {
+ $receipt = $this->so->add($values);
+ }
+
+ $receipt['location_code']=$values['location_code'];
+ return $receipt;
+ }
+
+ function delete($gab_id='',$location_code='')
+ {
+ $this->so->delete($gab_id,$location_code);
+ }
+ }
+?>
Index: property/inc/class.boinvestment.inc.php
diff -u property/inc/class.boinvestment.inc.php:1.6
property/inc/class.boinvestment.inc.php:1.7
--- property/inc/class.boinvestment.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.boinvestment.inc.php Fri Feb 3 12:05:49 2006
@@ -1,393 +1,393 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 eco
- * @version $Id: class.boinvestment.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boinvestment
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-// var $part_of_town_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 boinvestment($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.soinvestment');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->socommon =
CreateObject($this->currentapp.'.socommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start =
get_var('start',array('POST','GET'));
- $query =
get_var('query',array('POST','GET'));
- $sort =
get_var('sort',array('POST','GET'));
- $order =
get_var('order',array('POST','GET'));
- $filter =
get_var('filter',array('POST','GET'));
- $cat_id =
get_var('cat_id',array('POST','GET'));
- $part_of_town_id =
get_var('part_of_town_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(isset($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($part_of_town_id))
- {
- $this->part_of_town_id = $part_of_town_id;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
-
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','investment');
- $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->part_of_town_id = $data['part_of_town_id'];
- $this->allrows = $data['allrows'];
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','investment',$data);
- }
- }
-
- function read()
- {
-
- $investment = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id,'part_of_town_id'
=> $this->part_of_town_id,'allrows'=>$this->allrows));
- $this->total_records = $this->so->total_records;
-
- /* for ($i=0; $i<count($investment); $i++)
- {
- $investment[$i]['date'] =
$GLOBALS['phpgw']->common->show_date($investment[$i]['date']);
- }
- */
- return $investment;
- }
-
-
- function select_category($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->get_type_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['num'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function write_off_period_list($selected='')
- {
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
-
-
- $categories= $this->so->write_off_period_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['period']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['period'],
- 'name' => $category['period'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
-
-
-
- function save_investment($values)
- {
- while (is_array($values['location']) && list(,$value) =
each($values['location']))
- {
- if($value)
- {
- $location[] = $value;
- }
- }
-
- $values['location_code']=implode("-", $location);
-
-//_debug_array($values);
-
- $values['date'] =
$this->bocommon->date_to_timestamp($values['date']);
- $values['date']=
date($this->bocommon->dateformat,$values['date']);
-
- $values['initial_value'] =
abs($values['initial_value']);
-
- if($values['type']=='funding')
- {
- $values['initial_value'] =
-$values['initial_value'];
- }
-
- if($values['new_period'])
- {
- $values['period'] = $values['new_period'];
- unset($values['new_period']);
- }
-
- if($values['extra']['p_num'])
- {
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- $category =
$boadmin_entity->read_single_category($values['extra']['p_entity_id'],$values['extra']['p_cat_id']);
- $values['entity_id'] =
$values['extra']['p_num'];
- $values['entity_type'] =$category['name'];
-
- }
- else
- {
- $values['entity_id'] =
$values['location_code'];
- $values['entity_type'] ='property';
- }
-
-
- $receipt=$this->so->save_investment($values);
-
- return $receipt;
- }
-
-
- function update_investment($values)
- {
-
-
$date_array=$this->bocommon->date_array($values['date']);
-
- $date = mktime
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
- $date= date($this->bocommon->dateformat,$date);
-
- $new_index=str_replace(",",".",$values['new_index']);
-
- while($entry=each($values['update']))
- {
- $local_error='';
- $n=$entry[0];
-
- if ($values['value'][$n])
- {
- if ((abs($values['value'][$n])-
abs(($values['initial_value'][$n]*$new_index)))<0)
- {
- $new_value=0;
-
$new_index=$values['value'][$n]/$values['initial_value'][$n];
- }
- else
- {
-
$new_value=$values['value'][$n]-($values['initial_value'][$n]*$new_index);
- }
-
- $update[]=array(
- 'entity_id'
=>$values['entity_id'][$n],
- 'invest_id'
=>$values['investment_id'][$n],
- 'new_index'
=>$new_index,
- 'new_value'
=>$new_value,
- 'initial_value'
=>$values['initial_value'][$n],
- 'date' =>$date
- );
- }
- }
- $this->so->update_investment($update);
- }
-
-
- function filter($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_filter'));
- break;
- }
-
- $filters[0][id]='investment';
- $filters[0][name]=lang('Investment');
- $filters[1][id]='funding';
- $filters[1][name]=lang('Funding');
-
- while (is_array($filters) && list(,$filter) =
each($filters))
- {
- $sel_filter = '';
- if ($filter['id']==$selected)
- {
- $sel_filter = 'selected';
- }
-
- $filter_list[] = array
- (
- 'id' => $filter['id'],
- 'name' => $filter['name'],
- 'selected' => $sel_filter
- );
- }
-
- for ($i=0;$i<count($filter_list);$i++)
- {
- if ($filter_list[$i]['selected'] != 'selected')
- {
- unset($filter_list[$i]['selected']);
- }
- }
-
- return $filter_list;
- }
-
-
- function read_single($entity_id,$investment_id)
- {
- $history =
$this->so->read_single($entity_id,$investment_id,$this->start,$this->allrows);
-
- $this->total_records = $this->so->total_records;
-
- return $history;
- }
-
-
- function select_part_of_town($part_of_town_id)
- {
- return
$this->socommon->select_part_of_town($part_of_town_id);
- }
-
-
- function delete($entity_id,$investment_id,$index_count)
- {
-
$this->so->delete($entity_id,$investment_id,$index_count);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 eco
+ * @version $Id: class.boinvestment.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boinvestment
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+// var $part_of_town_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 boinvestment($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.soinvestment');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->socommon =
CreateObject($this->currentapp.'.socommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start =
get_var('start',array('POST','GET'));
+ $query =
get_var('query',array('POST','GET'));
+ $sort =
get_var('sort',array('POST','GET'));
+ $order =
get_var('order',array('POST','GET'));
+ $filter =
get_var('filter',array('POST','GET'));
+ $cat_id =
get_var('cat_id',array('POST','GET'));
+ $part_of_town_id =
get_var('part_of_town_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(isset($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($part_of_town_id))
+ {
+ $this->part_of_town_id = $part_of_town_id;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','investment');
+ $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->part_of_town_id = $data['part_of_town_id'];
+ $this->allrows = $data['allrows'];
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','investment',$data);
+ }
+ }
+
+ function read()
+ {
+
+ $investment = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id,'part_of_town_id'
=> $this->part_of_town_id,'allrows'=>$this->allrows));
+ $this->total_records = $this->so->total_records;
+
+ /* for ($i=0; $i<count($investment); $i++)
+ {
+ $investment[$i]['date'] =
$GLOBALS['phpgw']->common->show_date($investment[$i]['date']);
+ }
+ */
+ return $investment;
+ }
+
+
+ function select_category($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->get_type_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['num'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function write_off_period_list($selected='')
+ {
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+
+
+ $categories= $this->so->write_off_period_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['period']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['period'],
+ 'name' => $category['period'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+
+
+
+ function save_investment($values)
+ {
+ while (is_array($values['location']) && list(,$value) =
each($values['location']))
+ {
+ if($value)
+ {
+ $location[] = $value;
+ }
+ }
+
+ $values['location_code']=implode("-", $location);
+
+//_debug_array($values);
+
+ $values['date'] =
$this->bocommon->date_to_timestamp($values['date']);
+ $values['date']=
date($this->bocommon->dateformat,$values['date']);
+
+ $values['initial_value'] =
abs($values['initial_value']);
+
+ if($values['type']=='funding')
+ {
+ $values['initial_value'] =
-$values['initial_value'];
+ }
+
+ if($values['new_period'])
+ {
+ $values['period'] = $values['new_period'];
+ unset($values['new_period']);
+ }
+
+ if($values['extra']['p_num'])
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ $category =
$boadmin_entity->read_single_category($values['extra']['p_entity_id'],$values['extra']['p_cat_id']);
+ $values['entity_id'] =
$values['extra']['p_num'];
+ $values['entity_type'] =$category['name'];
+
+ }
+ else
+ {
+ $values['entity_id'] =
$values['location_code'];
+ $values['entity_type'] ='property';
+ }
+
+
+ $receipt=$this->so->save_investment($values);
+
+ return $receipt;
+ }
+
+
+ function update_investment($values)
+ {
+
+
$date_array=$this->bocommon->date_array($values['date']);
+
+ $date = mktime
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
+ $date= date($this->bocommon->dateformat,$date);
+
+ $new_index=str_replace(",",".",$values['new_index']);
+
+ while($entry=each($values['update']))
+ {
+ $local_error='';
+ $n=$entry[0];
+
+ if ($values['value'][$n])
+ {
+ if ((abs($values['value'][$n])-
abs(($values['initial_value'][$n]*$new_index)))<0)
+ {
+ $new_value=0;
+
$new_index=$values['value'][$n]/$values['initial_value'][$n];
+ }
+ else
+ {
+
$new_value=$values['value'][$n]-($values['initial_value'][$n]*$new_index);
+ }
+
+ $update[]=array(
+ 'entity_id'
=>$values['entity_id'][$n],
+ 'invest_id'
=>$values['investment_id'][$n],
+ 'new_index'
=>$new_index,
+ 'new_value'
=>$new_value,
+ 'initial_value'
=>$values['initial_value'][$n],
+ 'date' =>$date
+ );
+ }
+ }
+ $this->so->update_investment($update);
+ }
+
+
+ function filter($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_filter'));
+ break;
+ }
+
+ $filters[0][id]='investment';
+ $filters[0][name]=lang('Investment');
+ $filters[1][id]='funding';
+ $filters[1][name]=lang('Funding');
+
+ while (is_array($filters) && list(,$filter) =
each($filters))
+ {
+ $sel_filter = '';
+ if ($filter['id']==$selected)
+ {
+ $sel_filter = 'selected';
+ }
+
+ $filter_list[] = array
+ (
+ 'id' => $filter['id'],
+ 'name' => $filter['name'],
+ 'selected' => $sel_filter
+ );
+ }
+
+ for ($i=0;$i<count($filter_list);$i++)
+ {
+ if ($filter_list[$i]['selected'] != 'selected')
+ {
+ unset($filter_list[$i]['selected']);
+ }
+ }
+
+ return $filter_list;
+ }
+
+
+ function read_single($entity_id,$investment_id)
+ {
+ $history =
$this->so->read_single($entity_id,$investment_id,$this->start,$this->allrows);
+
+ $this->total_records = $this->so->total_records;
+
+ return $history;
+ }
+
+
+ function select_part_of_town($part_of_town_id)
+ {
+ return
$this->socommon->select_part_of_town($part_of_town_id);
+ }
+
+
+ function delete($entity_id,$investment_id,$index_count)
+ {
+
$this->so->delete($entity_id,$investment_id,$index_count);
+ }
+ }
+?>
Index: property/inc/class.boinvoice.inc.php
diff -u property/inc/class.boinvoice.inc.php:1.16
property/inc/class.boinvoice.inc.php:1.17
--- property/inc/class.boinvoice.inc.php:1.16 Fri Jan 27 14:05:43 2006
+++ property/inc/class.boinvoice.inc.php Fri Feb 3 12:05:49 2006
@@ -1,725 +1,725 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 eco
- * @version $Id: class.boinvoice.inc.php,v 1.16 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boinvoice
- {
- var $db = '';
-
- function boinvoice($session=False)
- {
- $this->db = $GLOBALS['phpgw']->db;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.soinvoice',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start =
get_var('start',array('POST','GET'));
- $query =
get_var('query',array('POST','GET'));
- $sort =
get_var('sort',array('POST','GET'));
- $order =
get_var('order',array('POST','GET'));
- $filter =
get_var('filter',array('POST','GET'));
- $cat_id =
get_var('cat_id',array('POST','GET'));
- $user_lid =
get_var('user_lid',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($user_lid))
- {
- $this->user_lid = $user_lid;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','invoice',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data',invoice);
-
-// _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->user_lid = $data['user_lid'];
- $this->sub = $data['sub'];
- $this->allrows = $data['allrows'];
- }
-
- function
read_invoice($paid='',$start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='',$voucher_id='')
- {
- $invoice = $this->so->read_invoice(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'user_lid' => $this->user_lid,'cat_id' => $this->cat_id, 'paid' =>
$paid,
-
'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
-
'loc1'=>$loc1,'workorder_id'=>$workorder_id,'allrows'=>$this->allrows,
-
'voucher_id'=>$voucher_id));
-
- $this->total_records = $this->so->total_records;
- $this->end_time = $this->so->end_time;
-
- return $invoice;
- }
-
- function read_invoice_sub($voucher_id='',$paid='')
- {
- $invoice = $this->so->read_invoice_sub(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'user_lid' => $this->user_lid,'cat_id' =>
$this->cat_id,'voucher_id'=>$voucher_id,'paid' => $paid));
- $this->total_records = $this->so->total_records;
- return $invoice;
- }
-
- function read_remark($id='',$paid='')
- {
- return $remark = $this->so->read_remark($id,$paid);
- }
-
-
- function
read_consume($start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='',$b_account_class='',$district_id='')
- {
- $invoice = $this->so->read_consume(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'user_lid' => $this->user_lid,'cat_id' => $this->cat_id,
-
'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
-
'loc1'=>$loc1,'workorder_id'=>$workorder_id,'b_account_class'
=>$b_account_class,
-
'district_id' => $district_id ));
-
- $this->total_records = $this->so->total_records;
-
- return $invoice;
- }
-
-
- function update_invoice($values)
- {
-
- return $this->so->update_invoice($values);
-
- }
-
-
- function update_invoice_sub($values)
- {
- return $this->so->update_invoice_sub($values);
- }
-
- function select_account_class($selected='')
- {
-
- $b_account_class_list=
$this->so->select_account_class();
-
- while (is_array($b_account_class_list) && list(,$class)
= each($b_account_class_list))
- {
- $sel_class = '';
- if ($class['id']==$selected)
- {
- $sel_class = 'selected';
- }
-
- $class_list[] = array
- (
- 'id' => $class['id'],
- 'name' => $class['name'],
- 'selected' => $sel_class
- );
- }
-
- for ($i=0;$i<count($class_list);$i++)
- {
- if ($class_list[$i]['selected'] != 'selected')
- {
- unset($class_list[$i]['selected']);
- }
- }
-
- return $class_list;
- }
-
-
-
- function period_list($selected='')
- {
- for ($i=1; $i<=12; $i++)
- {
- $period_list[$i]['id'] = $i;
- $period_list[$i]['name'] = $i;
- if($i==$selected)
- {
- $period_list[$i]['selected'] =
'selected';
- }
- }
- return $period_list;
- }
-
- function tax_code_list($selected='')
- {
- $tax_codes=$this->so->tax_code_list();
-
- while (is_array($tax_codes) && list(,$code) =
each($tax_codes))
- {
- $sel_code = '';
- if ($code['id']==$selected)
- {
- $sel_code = 'selected';
- }
-
- $tax_code_list[] = array
- (
- 'id' => $code['id'],
- 'selected' => $sel_code
- );
- }
-
- for ($i=0;$i<count($tax_code_list);$i++)
- {
- if ($tax_code_list[$i]['selected'] !=
'selected')
- {
- unset($tax_code_list[$i]['selected']);
- }
- }
-
- return $tax_code_list;
- }
-
- function update_period($voucher_id='',$period='')
- {
- return $this->so->update_period($voucher_id,$period);
- }
-
- function increment_bilagsnr()
- {
-
- return $this->so->increment_bilagsnr();
-
- }
-
- function next_bilagsnr()
- {
- return $this->so->next_bilagsnr();
- }
-
- function check_vendor($vendor_id)
- {
-
- return $this->so->check_vendor($vendor_id);
- }
-
-
- function get_lisfm_ecoart($selected='')
- {
- $arts=$this->so->get_lisfm_ecoart();
-
- while (is_array($arts) && list(,$art) = each($arts))
- {
- $sel_art = '';
- if ($art['id']==$selected)
- {
- $sel_art = 'selected';
- }
-
- $art_list[] = array
- (
- 'id' => $art['id'],
- 'num' => $art['num'],
- 'selected' => $sel_art
- );
- }
-
- for ($i=0;$i<count($art_list);$i++)
- {
- if ($art_list[$i]['selected'] != 'selected')
- {
- unset($art_list[$i]['selected']);
- }
- }
-
- return $art_list;
- }
- //----------
-
- function select_category($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->get_type_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['num'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
-
- function
get_invoice_user_list($format='',$selected='',$extra='',$default='')
- {
- if(!$selected && $default)
- {
- $selected = $default;
- }
-
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('user_lid_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('user_lid_filter'));
- break;
- }
-
- if (is_array($extra))
- {
- foreach($extra as $extra_user)
- {
- $users_extra[]=array
- (
- 'account_lid' => $extra_user,
- 'account_firstname' =>
lang($extra_user)
- );
- }
- }
-
- $users= $this->so->get_invoice_user_list();
- if (is_array($users_extra) && is_array($users))
- {
- $users = $users_extra + $users;
- }
-
- while (is_array($users) && list(,$user) = each($users))
- {
- $sel_user = '';
- if ($user['account_lid']==$selected)
- {
- $sel_user = 'selected';
- }
-
- $user_list[] = array
- (
- 'user_lid' => $user['account_lid'],
- 'name' =>
$user['account_lastname'].' '.$user['account_firstname'],
- 'selected' => $sel_user
- );
- }
-
- for ($i=0;$i<count($user_list);$i++)
- {
- if ($user_list[$i]['selected'] != 'selected')
- {
- unset($user_list[$i]['selected']);
- }
- }
-
-//_debug_array($user_list);
- return $user_list;
- }
-
-
-
- function get_type_list($selected='')
- {
- $types=$this->so->get_type_list();
-
- while (is_array($types) && list(,$type) = each($types))
- {
- $sel_type = '';
- if ($type['id']==$selected)
- {
- $sel_type = 'selected';
- }
-
- $type_list[] = array
- (
- 'id' => $type['id'],
- 'num' => $type['num'],
- 'selected' => $sel_type
- );
- }
-
- for ($i=0;$i<count($type_list);$i++)
- {
- if ($type_list[$i]['selected'] != 'selected')
- {
- unset($type_list[$i]['selected']);
- }
- }
-
- return $type_list;
- }
-
- //----------
- function select_dimb_list($selected='')
- {
- $dimbs=$this->so->select_dimb_list();
-
- while (is_array($dimbs) && list(,$dimb) = each($dimbs))
- {
- $sel_dimb = '';
- if ($dimb['id']==$selected)
- {
- $sel_dimb = 'selected';
- }
-
- $dimb_list[] = array
- (
- 'id' => $dimb['id'],
- 'num' => $dimb['num'],
- 'selected' => $sel_dimb
- );
- }
-
- for ($i=0;$i<count($dimb_list);$i++)
- {
- if ($dimb_list[$i]['selected'] != 'selected')
- {
- unset($dimb_list[$i]['selected']);
- }
- }
-
- return $dimb_list;
- }
-
- //-------------------
- function select_dimd_list($selected='')
- {
- $dimds=$this->so->select_dimd_list();
-
- while (is_array($dimds) && list(,$dimd) = each($dimds))
- {
- $sel_dimd = '';
- if ($dimd['id']==$selected)
- {
- $sel_dimd = 'selected';
- }
-
- $dimd_list[] = array
- (
- 'id' => $dimd['id'],
- 'num' => $dimd['num'],
- 'selected' => $sel_dimd
- );
- }
-
- for ($i=0;$i<count($dimd_list);$i++)
- {
- if ($dimd_list[$i]['selected'] != 'selected')
- {
- unset($dimd_list[$i]['selected']);
- }
- }
-
- return $dimd_list;
- }
-
- function select_tax_code_list($selected='')
- {
- $tax_codes=$this->so->select_tax_code_list();
-
- while (is_array($tax_codes) && list(,$tax_code) =
each($tax_codes))
- {
- $sel_tax_code = '';
- if ($tax_code['id']==$selected)
- {
- $sel_tax_code = 'selected';
- }
-
- $tax_code_list[] = array
- (
- 'id' => $tax_code['id'],
- 'num' => $tax_code['num'],
- 'selected' => $sel_tax_code
- );
- }
-
- for ($i=0;$i<count($tax_code_list);$i++)
- {
- if ($tax_code_list[$i]['selected'] !=
'selected')
- {
- unset($tax_code_list[$i]['selected']);
- }
- }
- return $tax_code_list;
- }
-
- function delete($params)
- {
- if (is_array($params))
- {
- $this->so->delete($params[0]);
- }
- else
- {
- $this->so->delete($params);
- }
- }
-
- function add($values,$debug='')
- {
- $this->soXport =
CreateObject($this->currentapp.'.soXport');
- if($values['loc1']=$values['location']['loc1'])
- {
- $values['dima']=implode('',$values['location']);
- }
-
- $values['spbudact_code']=$values['b_account_id'];
- $values['fakturanr']=$values['invoice_num'];
- $values['spvend_code']=$values['vendor_id'];
-
- $values['belop'] =
str_replace('kr','',$values['amount']);
- $values['belop'] = str_replace(' ','',$values['belop']);
- $values['belop'] =
str_replace(',','.',$values['belop']);
- $values['godkjentbelop']=$values['belop'];
-
- $values['fakturadato'] =
date($this->bocommon->dateformat,mktime(2,0,0,$values['smonth'],$values['sday'],$values['syear']));
-
- if($values['num_days'])
- {
- $values['forfallsdato'] =
date($this->bocommon->dateformat,mktime(2,0,0,$values['smonth'],$values['sday'],$values['syear'])+(86400*$values['num_days']));
- }
- else
- {
- $values['forfallsdato'] =
date($this->bocommon->dateformat,mktime(2,0,0,$values['emonth'],$values['eday'],$values['eyear']));
- }
-
- $values['artid'] =
$values['art'];
- $values['periode'] =
$values['smonth'];
- $values['dimb'] =
$values['dim_b'];
- $values['oppsynsmannid'] = $values['janitor'];
- $values['saksbehandlerid'] = $values['supervisor'];
- $values['budsjettansvarligid'] =
$values['budget_responsible'];
- $values['kildeid'] = 1;
- $values['kidnr'] =
$values['kid_nr'];
- $values['typeid'] =
$values['type'];
- if($order_type =
$this->soXport->check_order(intval($values['order'])))
- {
- if($order_type=='workorder')
- {
- $soworkorder =
CreateObject($this->currentapp.'.soworkorder');
- $soproject =
CreateObject($this->currentapp.'.soproject');
- $workorder =
$soworkorder->read_single($values['order']);
- $project =
$soproject->read_single($workorder['project_id']);
-
- $values['spvend_code'] =
$workorder['vendor_id'];
- $values['spbudact_code'] =
$workorder['b_account_id'];
- $values['location_code']
=$project['location_code'];
- $values['dima']
=str_replace('-','',$project['location_code']);
- $values['vendor_name'] =
$this->get_vendor_name($workorder['vendor_id']);
- $values['pmwrkord_code'] =
$values['order'];
- $values['project_id']
= $workorder['project_id'];
-
- $values =
$this->set_responsible($values,$workorder['user_id'],$workorder['b_account_id']);
-
- if($values['auto_tax'])
- {
- $values['mvakode'] =
$this->soXport->auto_tax($values['dima']);
- $values['mvakode'] =
$this->soXport->tax_b_account_override($values['mvakode'],$values['spbudact_code']);
- $values['mvakode'] =
$this->soXport->tax_vendor_override($values['mvakode'],$values['spvend_code']);
- $values['kostra_id'] =
$this->soXport->get_kostra_id($values['dima']);
- }
-
- $buffer[0]=$values;
- }
-
- if($order_type=='s_agreement')
- {
- $sos_agreement =
CreateObject($this->currentapp.'.sos_agreement');
- $s_agreement =
$sos_agreement->read_single(array('s_agreement_id'=>$values['order']));
-
- $values['spvend_code'] =
$s_agreement['vendor_id'];
- $values['spbudact_code'] =
$s_agreement['b_account_id'];
- $values['vendor_name'] =
$this->get_vendor_name($s_agreement['vendor_id']);
- $values['pmwrkord_code'] =
intval($values['order']);
- $values =
$this->set_responsible($values,$s_agreement['user_id'],$s_agreement['b_account_id']);
-
-
- $s_agreement_detail =
$sos_agreement->read(array('allrows'=>True,'s_agreement_id'=>$values['order'],'detail'=>True));
-
- $sum_agreement=0;
- for
($i=0;$i<count($s_agreement_detail);$i++)
- {
- $sum_agreement = $sum_agreement
+ $s_agreement_detail[$i]['cost'];
- }
-
-
- for
($i=0;$i<count($s_agreement_detail);$i++)
- {
- $buffer[$i]=$values;
-
- $buffer[$i]['location_code']
=$s_agreement_detail[$i]['location_code'];
- $buffer[$i]['dima']
=str_replace('-','',$s_agreement_detail[$i]['location_code']);
-
-
- $buffer[$i]['belop'] =
round($values['belop'] / $sum_agreement * $s_agreement_detail[$i]['cost'],2);
- $buffer[$i]['godkjentbelop']
=$buffer[$i]['belop'];
-
- if($values['auto_tax'])
- {
- $buffer[$i]['mvakode']
= $this->soXport->auto_tax($buffer[$i]['dima']);
- $buffer[$i]['mvakode']
=
$this->soXport->tax_b_account_override($buffer[$i]['mvakode'],$buffer[$i]['spbudact_code']);
- $buffer[$i]['mvakode']
=
$this->soXport->tax_vendor_override($buffer[$i]['mvakode'],$buffer[$i]['spvend_code']);
-
$buffer[$i]['kostra_id'] = $this->soXport->get_kostra_id($buffer[$i]['dima']);
- }
- }
- }
- }
- else
- {
- if($values['auto_tax'])
- {
- $values['mvakode'] =
$this->soXport->auto_tax($values['loc1']);
- $values['mvakode'] =
$this->soXport->tax_b_account_override($values['mvakode'],$values['spbudact_code']);
- $values['mvakode'] =
$this->soXport->tax_vendor_override($values['mvakode'],$values['spvend_code']);
- $values['kostra_id'] =
$this->soXport->get_kostra_id($values['loc1']);
- }
-
- $buffer[0]=$values;
- }
-
- if($debug)
- {
- return $buffer;
- }
-
- if($this->soXport->add($buffer)>0)
- {
- $receipt['message'][] =
array('msg'=>lang('Invoice %1 is added',$values['bilagsnr']));
- }
- else
- {
- $receipt['error'][] =
array('msg'=>lang('Invoice is NOT added!'));
- }
- return $receipt;
- }
-
- function get_vendor_name($vendor_id='')
- {
- $contacts =
CreateObject($this->currentapp.'.soactor');
- $contacts->role='vendor';
-
- $vendor_data =
$contacts->read_single(array('actor_id'=>$vendor_id));
- if(is_array($vendor_data))
- {
- foreach($vendor_data['attributes'] as
$attribute)
- {
- if($attribute['name']=='org_name')
- {
- return $attribute['value'];
- }
- }
- }
- }
-
- function set_responsible($values,$user_id='',$b_account_id='')
- {
- if (!$values['budget_responsible'])
- {
- $values['budget_responsible'] =
$this->soXport->get_responsible($b_account_id);
- $values['budsjettansvarligid'] =
$values['budget_responsible'];
- }
-
- $acl2 =
CreateObject($this->currentapp.'.acl2',$user_id);
- if($acl2->check('.invoice',32) &&
!$acl2->check('.invoice',64)):
- {
- $values['janitor'] =
$GLOBALS['phpgw']->accounts->id2name($user_id);
- $values['oppsynsmannid'] =
$values['janitor'];
- }
- // elseif((!$acl2->check('.invoice',32) &&
$acl2->check('.invoice',64)) || ($acl2->check('.invoice',32) &&
$acl2->check('.invoice',64))):
- elseif($acl2->check('.invoice',64)):
- {
- $values['supervisor'] =
$GLOBALS['phpgw']->accounts->id2name($user_id);
- $values['saksbehandlerid'] =
$values['supervisor'];
- }
- endif;
-
- return $values;
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 eco
+ * @version $Id: class.boinvoice.inc.php,v 1.17 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boinvoice
+ {
+ var $db = '';
+
+ function boinvoice($session=False)
+ {
+ $this->db = $GLOBALS['phpgw']->db;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.soinvoice',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start =
get_var('start',array('POST','GET'));
+ $query =
get_var('query',array('POST','GET'));
+ $sort =
get_var('sort',array('POST','GET'));
+ $order =
get_var('order',array('POST','GET'));
+ $filter =
get_var('filter',array('POST','GET'));
+ $cat_id =
get_var('cat_id',array('POST','GET'));
+ $user_lid =
get_var('user_lid',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($user_lid))
+ {
+ $this->user_lid = $user_lid;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','invoice',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data',invoice);
+
+// _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->user_lid = $data['user_lid'];
+ $this->sub = $data['sub'];
+ $this->allrows = $data['allrows'];
+ }
+
+ function
read_invoice($paid='',$start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='',$voucher_id='')
+ {
+ $invoice = $this->so->read_invoice(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'user_lid' => $this->user_lid,'cat_id' => $this->cat_id, 'paid' =>
$paid,
+
'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
+
'loc1'=>$loc1,'workorder_id'=>$workorder_id,'allrows'=>$this->allrows,
+
'voucher_id'=>$voucher_id));
+
+ $this->total_records = $this->so->total_records;
+ $this->end_time = $this->so->end_time;
+
+ return $invoice;
+ }
+
+ function read_invoice_sub($voucher_id='',$paid='')
+ {
+ $invoice = $this->so->read_invoice_sub(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'user_lid' => $this->user_lid,'cat_id' =>
$this->cat_id,'voucher_id'=>$voucher_id,'paid' => $paid));
+ $this->total_records = $this->so->total_records;
+ return $invoice;
+ }
+
+ function read_remark($id='',$paid='')
+ {
+ return $remark = $this->so->read_remark($id,$paid);
+ }
+
+
+ function
read_consume($start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='',$b_account_class='',$district_id='')
+ {
+ $invoice = $this->so->read_consume(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'user_lid' => $this->user_lid,'cat_id' => $this->cat_id,
+
'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
+
'loc1'=>$loc1,'workorder_id'=>$workorder_id,'b_account_class'
=>$b_account_class,
+
'district_id' => $district_id ));
+
+ $this->total_records = $this->so->total_records;
+
+ return $invoice;
+ }
+
+
+ function update_invoice($values)
+ {
+
+ return $this->so->update_invoice($values);
+
+ }
+
+
+ function update_invoice_sub($values)
+ {
+ return $this->so->update_invoice_sub($values);
+ }
+
+ function select_account_class($selected='')
+ {
+
+ $b_account_class_list=
$this->so->select_account_class();
+
+ while (is_array($b_account_class_list) && list(,$class)
= each($b_account_class_list))
+ {
+ $sel_class = '';
+ if ($class['id']==$selected)
+ {
+ $sel_class = 'selected';
+ }
+
+ $class_list[] = array
+ (
+ 'id' => $class['id'],
+ 'name' => $class['name'],
+ 'selected' => $sel_class
+ );
+ }
+
+ for ($i=0;$i<count($class_list);$i++)
+ {
+ if ($class_list[$i]['selected'] != 'selected')
+ {
+ unset($class_list[$i]['selected']);
+ }
+ }
+
+ return $class_list;
+ }
+
+
+
+ function period_list($selected='')
+ {
+ for ($i=1; $i<=12; $i++)
+ {
+ $period_list[$i]['id'] = $i;
+ $period_list[$i]['name'] = $i;
+ if($i==$selected)
+ {
+ $period_list[$i]['selected'] =
'selected';
+ }
+ }
+ return $period_list;
+ }
+
+ function tax_code_list($selected='')
+ {
+ $tax_codes=$this->so->tax_code_list();
+
+ while (is_array($tax_codes) && list(,$code) =
each($tax_codes))
+ {
+ $sel_code = '';
+ if ($code['id']==$selected)
+ {
+ $sel_code = 'selected';
+ }
+
+ $tax_code_list[] = array
+ (
+ 'id' => $code['id'],
+ 'selected' => $sel_code
+ );
+ }
+
+ for ($i=0;$i<count($tax_code_list);$i++)
+ {
+ if ($tax_code_list[$i]['selected'] !=
'selected')
+ {
+ unset($tax_code_list[$i]['selected']);
+ }
+ }
+
+ return $tax_code_list;
+ }
+
+ function update_period($voucher_id='',$period='')
+ {
+ return $this->so->update_period($voucher_id,$period);
+ }
+
+ function increment_bilagsnr()
+ {
+
+ return $this->so->increment_bilagsnr();
+
+ }
+
+ function next_bilagsnr()
+ {
+ return $this->so->next_bilagsnr();
+ }
+
+ function check_vendor($vendor_id)
+ {
+
+ return $this->so->check_vendor($vendor_id);
+ }
+
+
+ function get_lisfm_ecoart($selected='')
+ {
+ $arts=$this->so->get_lisfm_ecoart();
+
+ while (is_array($arts) && list(,$art) = each($arts))
+ {
+ $sel_art = '';
+ if ($art['id']==$selected)
+ {
+ $sel_art = 'selected';
+ }
+
+ $art_list[] = array
+ (
+ 'id' => $art['id'],
+ 'num' => $art['num'],
+ 'selected' => $sel_art
+ );
+ }
+
+ for ($i=0;$i<count($art_list);$i++)
+ {
+ if ($art_list[$i]['selected'] != 'selected')
+ {
+ unset($art_list[$i]['selected']);
+ }
+ }
+
+ return $art_list;
+ }
+ //----------
+
+ function select_category($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->get_type_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['num'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+
+ function
get_invoice_user_list($format='',$selected='',$extra='',$default='')
+ {
+ if(!$selected && $default)
+ {
+ $selected = $default;
+ }
+
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('user_lid_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('user_lid_filter'));
+ break;
+ }
+
+ if (is_array($extra))
+ {
+ foreach($extra as $extra_user)
+ {
+ $users_extra[]=array
+ (
+ 'account_lid' => $extra_user,
+ 'account_firstname' =>
lang($extra_user)
+ );
+ }
+ }
+
+ $users= $this->so->get_invoice_user_list();
+ if (is_array($users_extra) && is_array($users))
+ {
+ $users = $users_extra + $users;
+ }
+
+ while (is_array($users) && list(,$user) = each($users))
+ {
+ $sel_user = '';
+ if ($user['account_lid']==$selected)
+ {
+ $sel_user = 'selected';
+ }
+
+ $user_list[] = array
+ (
+ 'user_lid' => $user['account_lid'],
+ 'name' =>
$user['account_lastname'].' '.$user['account_firstname'],
+ 'selected' => $sel_user
+ );
+ }
+
+ for ($i=0;$i<count($user_list);$i++)
+ {
+ if ($user_list[$i]['selected'] != 'selected')
+ {
+ unset($user_list[$i]['selected']);
+ }
+ }
+
+//_debug_array($user_list);
+ return $user_list;
+ }
+
+
+
+ function get_type_list($selected='')
+ {
+ $types=$this->so->get_type_list();
+
+ while (is_array($types) && list(,$type) = each($types))
+ {
+ $sel_type = '';
+ if ($type['id']==$selected)
+ {
+ $sel_type = 'selected';
+ }
+
+ $type_list[] = array
+ (
+ 'id' => $type['id'],
+ 'num' => $type['num'],
+ 'selected' => $sel_type
+ );
+ }
+
+ for ($i=0;$i<count($type_list);$i++)
+ {
+ if ($type_list[$i]['selected'] != 'selected')
+ {
+ unset($type_list[$i]['selected']);
+ }
+ }
+
+ return $type_list;
+ }
+
+ //----------
+ function select_dimb_list($selected='')
+ {
+ $dimbs=$this->so->select_dimb_list();
+
+ while (is_array($dimbs) && list(,$dimb) = each($dimbs))
+ {
+ $sel_dimb = '';
+ if ($dimb['id']==$selected)
+ {
+ $sel_dimb = 'selected';
+ }
+
+ $dimb_list[] = array
+ (
+ 'id' => $dimb['id'],
+ 'num' => $dimb['num'],
+ 'selected' => $sel_dimb
+ );
+ }
+
+ for ($i=0;$i<count($dimb_list);$i++)
+ {
+ if ($dimb_list[$i]['selected'] != 'selected')
+ {
+ unset($dimb_list[$i]['selected']);
+ }
+ }
+
+ return $dimb_list;
+ }
+
+ //-------------------
+ function select_dimd_list($selected='')
+ {
+ $dimds=$this->so->select_dimd_list();
+
+ while (is_array($dimds) && list(,$dimd) = each($dimds))
+ {
+ $sel_dimd = '';
+ if ($dimd['id']==$selected)
+ {
+ $sel_dimd = 'selected';
+ }
+
+ $dimd_list[] = array
+ (
+ 'id' => $dimd['id'],
+ 'num' => $dimd['num'],
+ 'selected' => $sel_dimd
+ );
+ }
+
+ for ($i=0;$i<count($dimd_list);$i++)
+ {
+ if ($dimd_list[$i]['selected'] != 'selected')
+ {
+ unset($dimd_list[$i]['selected']);
+ }
+ }
+
+ return $dimd_list;
+ }
+
+ function select_tax_code_list($selected='')
+ {
+ $tax_codes=$this->so->select_tax_code_list();
+
+ while (is_array($tax_codes) && list(,$tax_code) =
each($tax_codes))
+ {
+ $sel_tax_code = '';
+ if ($tax_code['id']==$selected)
+ {
+ $sel_tax_code = 'selected';
+ }
+
+ $tax_code_list[] = array
+ (
+ 'id' => $tax_code['id'],
+ 'num' => $tax_code['num'],
+ 'selected' => $sel_tax_code
+ );
+ }
+
+ for ($i=0;$i<count($tax_code_list);$i++)
+ {
+ if ($tax_code_list[$i]['selected'] !=
'selected')
+ {
+ unset($tax_code_list[$i]['selected']);
+ }
+ }
+ return $tax_code_list;
+ }
+
+ function delete($params)
+ {
+ if (is_array($params))
+ {
+ $this->so->delete($params[0]);
+ }
+ else
+ {
+ $this->so->delete($params);
+ }
+ }
+
+ function add($values,$debug='')
+ {
+ $this->soXport =
CreateObject($this->currentapp.'.soXport');
+ if($values['loc1']=$values['location']['loc1'])
+ {
+ $values['dima']=implode('',$values['location']);
+ }
+
+ $values['spbudact_code']=$values['b_account_id'];
+ $values['fakturanr']=$values['invoice_num'];
+ $values['spvend_code']=$values['vendor_id'];
+
+ $values['belop'] =
str_replace('kr','',$values['amount']);
+ $values['belop'] = str_replace(' ','',$values['belop']);
+ $values['belop'] =
str_replace(',','.',$values['belop']);
+ $values['godkjentbelop']=$values['belop'];
+
+ $values['fakturadato'] =
date($this->bocommon->dateformat,mktime(2,0,0,$values['smonth'],$values['sday'],$values['syear']));
+
+ if($values['num_days'])
+ {
+ $values['forfallsdato'] =
date($this->bocommon->dateformat,mktime(2,0,0,$values['smonth'],$values['sday'],$values['syear'])+(86400*$values['num_days']));
+ }
+ else
+ {
+ $values['forfallsdato'] =
date($this->bocommon->dateformat,mktime(2,0,0,$values['emonth'],$values['eday'],$values['eyear']));
+ }
+
+ $values['artid'] =
$values['art'];
+ $values['periode'] =
$values['smonth'];
+ $values['dimb'] =
$values['dim_b'];
+ $values['oppsynsmannid'] = $values['janitor'];
+ $values['saksbehandlerid'] = $values['supervisor'];
+ $values['budsjettansvarligid'] =
$values['budget_responsible'];
+ $values['kildeid'] = 1;
+ $values['kidnr'] =
$values['kid_nr'];
+ $values['typeid'] =
$values['type'];
+ if($order_type =
$this->soXport->check_order(intval($values['order'])))
+ {
+ if($order_type=='workorder')
+ {
+ $soworkorder =
CreateObject($this->currentapp.'.soworkorder');
+ $soproject =
CreateObject($this->currentapp.'.soproject');
+ $workorder =
$soworkorder->read_single($values['order']);
+ $project =
$soproject->read_single($workorder['project_id']);
+
+ $values['spvend_code'] =
$workorder['vendor_id'];
+ $values['spbudact_code'] =
$workorder['b_account_id'];
+ $values['location_code']
=$project['location_code'];
+ $values['dima']
=str_replace('-','',$project['location_code']);
+ $values['vendor_name'] =
$this->get_vendor_name($workorder['vendor_id']);
+ $values['pmwrkord_code'] =
$values['order'];
+ $values['project_id']
= $workorder['project_id'];
+
+ $values =
$this->set_responsible($values,$workorder['user_id'],$workorder['b_account_id']);
+
+ if($values['auto_tax'])
+ {
+ $values['mvakode'] =
$this->soXport->auto_tax($values['dima']);
+ $values['mvakode'] =
$this->soXport->tax_b_account_override($values['mvakode'],$values['spbudact_code']);
+ $values['mvakode'] =
$this->soXport->tax_vendor_override($values['mvakode'],$values['spvend_code']);
+ $values['kostra_id'] =
$this->soXport->get_kostra_id($values['dima']);
+ }
+
+ $buffer[0]=$values;
+ }
+
+ if($order_type=='s_agreement')
+ {
+ $sos_agreement =
CreateObject($this->currentapp.'.sos_agreement');
+ $s_agreement =
$sos_agreement->read_single(array('s_agreement_id'=>$values['order']));
+
+ $values['spvend_code'] =
$s_agreement['vendor_id'];
+ $values['spbudact_code'] =
$s_agreement['b_account_id'];
+ $values['vendor_name'] =
$this->get_vendor_name($s_agreement['vendor_id']);
+ $values['pmwrkord_code'] =
intval($values['order']);
+ $values =
$this->set_responsible($values,$s_agreement['user_id'],$s_agreement['b_account_id']);
+
+
+ $s_agreement_detail =
$sos_agreement->read(array('allrows'=>True,'s_agreement_id'=>$values['order'],'detail'=>True));
+
+ $sum_agreement=0;
+ for
($i=0;$i<count($s_agreement_detail);$i++)
+ {
+ $sum_agreement = $sum_agreement
+ $s_agreement_detail[$i]['cost'];
+ }
+
+
+ for
($i=0;$i<count($s_agreement_detail);$i++)
+ {
+ $buffer[$i]=$values;
+
+ $buffer[$i]['location_code']
=$s_agreement_detail[$i]['location_code'];
+ $buffer[$i]['dima']
=str_replace('-','',$s_agreement_detail[$i]['location_code']);
+
+
+ $buffer[$i]['belop'] =
round($values['belop'] / $sum_agreement * $s_agreement_detail[$i]['cost'],2);
+ $buffer[$i]['godkjentbelop']
=$buffer[$i]['belop'];
+
+ if($values['auto_tax'])
+ {
+ $buffer[$i]['mvakode']
= $this->soXport->auto_tax($buffer[$i]['dima']);
+ $buffer[$i]['mvakode']
=
$this->soXport->tax_b_account_override($buffer[$i]['mvakode'],$buffer[$i]['spbudact_code']);
+ $buffer[$i]['mvakode']
=
$this->soXport->tax_vendor_override($buffer[$i]['mvakode'],$buffer[$i]['spvend_code']);
+
$buffer[$i]['kostra_id'] = $this->soXport->get_kostra_id($buffer[$i]['dima']);
+ }
+ }
+ }
+ }
+ else
+ {
+ if($values['auto_tax'])
+ {
+ $values['mvakode'] =
$this->soXport->auto_tax($values['loc1']);
+ $values['mvakode'] =
$this->soXport->tax_b_account_override($values['mvakode'],$values['spbudact_code']);
+ $values['mvakode'] =
$this->soXport->tax_vendor_override($values['mvakode'],$values['spvend_code']);
+ $values['kostra_id'] =
$this->soXport->get_kostra_id($values['loc1']);
+ }
+
+ $buffer[0]=$values;
+ }
+
+ if($debug)
+ {
+ return $buffer;
+ }
+
+ if($this->soXport->add($buffer)>0)
+ {
+ $receipt['message'][] =
array('msg'=>lang('Invoice %1 is added',$values['bilagsnr']));
+ }
+ else
+ {
+ $receipt['error'][] =
array('msg'=>lang('Invoice is NOT added!'));
+ }
+ return $receipt;
+ }
+
+ function get_vendor_name($vendor_id='')
+ {
+ $contacts =
CreateObject($this->currentapp.'.soactor');
+ $contacts->role='vendor';
+
+ $vendor_data =
$contacts->read_single(array('actor_id'=>$vendor_id));
+ if(is_array($vendor_data))
+ {
+ foreach($vendor_data['attributes'] as
$attribute)
+ {
+ if($attribute['name']=='org_name')
+ {
+ return $attribute['value'];
+ }
+ }
+ }
+ }
+
+ function set_responsible($values,$user_id='',$b_account_id='')
+ {
+ if (!$values['budget_responsible'])
+ {
+ $values['budget_responsible'] =
$this->soXport->get_responsible($b_account_id);
+ $values['budsjettansvarligid'] =
$values['budget_responsible'];
+ }
+
+ $acl2 =
CreateObject($this->currentapp.'.acl2',$user_id);
+ if($acl2->check('.invoice',32) &&
!$acl2->check('.invoice',64)):
+ {
+ $values['janitor'] =
$GLOBALS['phpgw']->accounts->id2name($user_id);
+ $values['oppsynsmannid'] =
$values['janitor'];
+ }
+ // elseif((!$acl2->check('.invoice',32) &&
$acl2->check('.invoice',64)) || ($acl2->check('.invoice',32) &&
$acl2->check('.invoice',64))):
+ elseif($acl2->check('.invoice',64)):
+ {
+ $values['supervisor'] =
$GLOBALS['phpgw']->accounts->id2name($user_id);
+ $values['saksbehandlerid'] =
$values['supervisor'];
+ }
+ endif;
+
+ return $values;
+ }
+ }
+?>
Index: property/inc/class.bolocation.inc.php
diff -u property/inc/class.bolocation.inc.php:1.9
property/inc/class.bolocation.inc.php:1.10
--- property/inc/class.bolocation.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bolocation.inc.php Fri Feb 3 12:05:49 2006
@@ -1,820 +1,835 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 location
- * @version $Id: class.bolocation.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bolocation
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 bolocation($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.solocation');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
- $district_id =
get_var('district_id',array('POST','GET'));
- $part_of_town_id =
get_var('part_of_town_id',array('POST','GET'));
- $status = get_var('status',array('POST','GET'));
- $type_id =
get_var('type_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(isset($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($part_of_town_id))
- {
- $this->part_of_town_id = $part_of_town_id;
- }
- if(isset($district_id))
- {
- $this->district_id = $district_id;
- }
- if(isset($status))
- {
- $this->status = $status;
- }
- if(isset($type_id))
- {
- $this->type_id = $type_id;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
-
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','location');
-
- $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->part_of_town_id = $data['part_of_town_id'];
- $this->district_id = $data['district_id'];
- $this->status = $data['status'];
- $this->type_id = $data['type_id'];
- $this->allrows = $data['allrows'];
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','location',$data);
- }
- }
-
-
- function select_status_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
- break;
- }
-
- $list= $this->so->select_status_list($this->type_id);
- return $this->bocommon->select_list($selected,$list);
- }
-
- function read_entity_to_link()
- {
- return $this->so->read_entity_to_link();
- }
-
- function get_owner_list($format='',$selected='')
- {
-
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_filter'));
- break;
- }
-
- $owners = $this->so->get_owner_list();
-
- while (is_array($owners) && list(,$owner) =
each($owners))
- {
- $sel_owner = '';
- if ($owner['id']==$selected)
- {
- $sel_owner = 'selected';
- }
-
- $owner_list[] = array
- (
- 'id' => $owner['id'],
- 'name' => $owner['name'],
- 'selected' => $sel_owner
- );
- }
-
- $owner_count=count($owner_list);
- for ($i=0;$i<$owner_count;$i++)
- {
- if ($owner_list[$i]['selected'] != 'selected')
- {
- unset($owner_list[$i]['selected']);
- }
- }
-
- return $owner_list;
- }
-
- function get_owner_type_list($format='',$selected='')
- {
-
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('owner_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('owner_filter'));
- break;
- }
-
- $owners = $this->so->get_owner_type_list();
-
- while (is_array($owners) && list(,$owner) =
each($owners))
- {
- $sel_owner = '';
- if ($owner['id']==$selected)
- {
- $sel_owner = 'selected';
- }
-
- $owner_list[] = array
- (
- 'id' => $owner['id'],
- 'name' => $owner['name'],
- 'selected' => $sel_owner
- );
- }
-
- $owner_count=count($owner_list);
-
- for ($i=0;$i<$owner_count;$i++)
- {
- if ($owner_list[$i]['selected'] != 'selected')
- {
- unset($owner_list[$i]['selected']);
- }
- }
-
- return $owner_list;
- }
-
-
- function initiate_ui_location($data)
- {
-
- switch($data['lookup_type'])
- {
- case 'form':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('location_form'));
- break;
- case 'view':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('location_view'));
- break;
- }
-
- $location_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index&lookup=1');
-
- $config = $this->soadmin_location->read_config('');
-
- $this->config = $config;
-//_debug_array($config);
- $location_types =
$this->soadmin_location->select_location_type();
- $this->location_types = $location_types;
-
- if($data['type_id']<0)
- {
- $data['type_id'] = count($location_types);
- }
-//_debug_array($data);
-//_debug_array($location_types);
- $fm_location_cols =
$this->soadmin_location->read_attrib(array('type_id'=>$data['type_id'],'lookup_type'=>$data['type_id']));
-//_debug_array($fm_location_cols);
-
- for ($i=0;$i<$data['type_id'];$i++)
- {
- $location['location'][$i]['input_type']
= 'text';
- $location['location'][$i]['input_name']
= 'loc' . ($i+1);
- $input_name[]
=
$location['location'][$i]['input_name'];
- $insert_record['location'][]
= $location['location'][$i]['input_name'];
- $location['location'][$i]['size']
= 5;
- $location['location'][$i]['name']
= $location_types[($i)]['name'];
- $location['location'][$i]['value']
= $data['values']['loc' . ($i+1)];
- $location['location'][$i]['statustext']
= lang('Klick this link to select') . ' ' .
$location_types[($i)]['name'];
-
- if($i==0)
- {
-
$location['location'][$i]['extra'][0]['input_name'] = 'loc' .
($i+1).'_name';
- $input_name[]
=
$location['location'][$i]['extra'][0]['input_name'];
-
$location['location'][$i]['extra'][0]['input_type']
= 'text';
-
$location['location'][$i]['extra'][0]['size'] = 30;
-
$location['location'][$i]['extra'][0]['lookup_function_call'] = 'lookup_loc'
. ($i+1) . '()';
-
$location['location'][$i]['extra'][0]['value'] =
$data['values']['loc' . ($i+1).'_name'];
- }
- else
- {
-
$location['location'][$i]['extra'][0]['input_name'] = 'loc' .
($i+1).'_name';
- $input_name[]
=
$location['location'][$i]['extra'][0]['input_name'];
-
$location['location'][$i]['extra'][0]['input_type']
= 'text';
-
$location['location'][$i]['extra'][0]['size'] = 30;
-
$location['location'][$i]['extra'][0]['lookup_function_call'] = 'lookup_loc'
. ($i+1) . '()';
-
$location['location'][$i]['extra'][0]['value'] =
$data['values']['loc' . ($i+1).'_name'];
- }
-
-
$location['location'][$i]['lookup_function_call'] = 'lookup_loc' . ($i+1)
. '()';
- $location['location'][$i]['lookup_link']
= True;
- $location['location'][$i]['readonly']
= True;
- $lookup_functions[$i]['name']
= 'lookup_loc' . ($i+1) . '()';
- $lookup_functions[$i]['action']
= 'Window1=window.open('."'" . $location_link
.'&type_id=' . ($i+1) . '&lookup_name=' . $i . "'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
-
- if($data['no_link']>=($i+3))
- {
-
$location['location'][$i]['lookup_link'] = False;
- $lookup_functions[$i]['action']
= 'Window1=window.open('."'" . $location_link
.'&type_id=' . ($data['no_link']-1) . '&lookup_name=' . ($data[no_link]-2) .
"'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $location['location'][$i]['statustext']
= lang('Klick this link to select') . ' ' .
$location_types[($data[no_link]-2)]['name'];
- }
-
-
- if($data['query_link'] && $i <
($data['type_id']-1))
- {
- for ($j=1;$j<$i+2;$j++)
- {
- $temp_location[]=
$data['values']['loc' . ($j)];
- }
-
-
- $data['link_data']['query_location']
= implode('-',$temp_location);
- $location['location'][$i]['query_link']
= $GLOBALS['phpgw']->link('/index.php',$data['link_data']);
- unset($temp_location);
- }
-
-
- $m=$i;
- }
-
-//_debug_array($fm_location_cols);
-//_debug_array($data);
-
- $location_cols_count =count($fm_location_cols);
- for ($j=0;$j<$location_cols_count;$j++)
- {
- if(($fm_location_cols[$j]['location_type'] <=
$data['type_id']) && $fm_location_cols[$j]['lookup_form'])
- {
- $location['location'][$i]['input_type']
= 'text';
- $location['location'][$i]['input_name']
= $fm_location_cols[$j]['column_name'];
- $input_name[]
=
$location['location'][$i]['input_name'];
- $location['location'][$i]['size']
= 5;
-
$location['location'][$i]['lookup_function_call'] = 'lookup_loc' .
$fm_location_cols[$j]['location_type'] . '()';
-
$location['location'][$i]['lookup_link'] = True;
- $location['location'][$i]['readonly']
= True;
- $location['location'][$i]['name']
= $fm_location_cols[$j]['input_text'];
- $location['location'][$i]['value']
=
$data['values'][$fm_location_cols[$j]['column_name']];
- $location['location'][$i]['statustext']
= lang('Klick this link to select') . ' ' .
$location_types[($fm_location_cols[$j]['location_type']-1)]['name'];
- $i++;
-
- }
- }
-
-
- $config_count =count($config);
- for ($j=0;$j<$config_count;$j++)
- {
- if($config[$j]['location_type'] <=
$data['type_id'] && $config[$j]['lookup_form'] )
- {
-
if($config[$j]['column_name']=='street_id'):
- {
-
$location['location'][$i]['input_name'] =
$config[$j]['column_name'];
- $input_name[]
= 'street_id';
-
$location['location'][$i]['lookup_link'] = True;
-
$location['location'][$i]['lookup_function_call'] = 'lookup_loc' .
$config[$j]['location_type'] . '()';
-
$location['location'][$i]['name'] =
lang('address');
-
$location['location'][$i]['input_type'] = 'hidden';
-
$location['location'][$i]['value'] =
$data['values'][$config[$j]['column_name']];
-
-
$location['location'][$i]['extra'][0]['input_type']
= 'text';
-
$location['location'][$i]['extra'][0]['input_name']
= 'street_name';
-
$location['location'][$i]['extra'][0]['readonly']
= True;
- $input_name[]
= $location['location'][$i]['extra'][0]['input_name'];
-
$location['location'][$i]['extra'][0]['size']
= 30;
-
$location['location'][$i]['extra'][0]['lookup_function_call'] = 'lookup_loc'
. $config[$j]['location_type'] . '()';
-
$location['location'][$i]['extra'][0]['value']
= $data['values']['street_name'];
-
-
$location['location'][$i]['extra'][1]['input_type']
= 'text';
-
$location['location'][$i]['extra'][1]['input_name']
= 'street_number';
-
$location['location'][$i]['extra'][1]['readonly']
= True;
- $input_name[]
= $location['location'][$i]['extra'][1]['input_name'];
-
$location['location'][$i]['extra'][1]['size']
= 6;
-
$location['location'][$i]['extra'][1]['lookup_function_call'] = 'lookup_loc'
. $config[$j]['location_type'] . '()';
-
$location['location'][$i]['extra'][1]['value']
= $data['values']['street_number'];
- }
-
elseif($config[$j]['column_name']=='tenant_id' && $data['tenant']):
- {
- $m++;
- $lookup_functions[$m]['name'] =
'lookup_loc' . ($m+1) . '()';
- $lookup_functions[$m]['action']
= 'Window1=window.open('."'" . $location_link .'&lookup_tenant=1&type_id=' .
$config[$j]['location_type'] . '&lookup_name=' . $i ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
-
-
$location['location'][$i]['lookup_link']
= True;
-
$location['location'][$i]['name']
= lang('Tenant');
-
$location['location'][$i]['input_type']
= 'hidden';
-
$location['location'][$i]['input_name']
= 'tenant_id';
- $input_name[]
= $location['location'][$i]['input_name'];
-
$location['location'][$i]['value']
= $data['values'][$config[$j]['column_name']];
-
$location['location'][$i]['lookup_function_call']
= $lookup_functions[$m]['name'];
-
$location['location'][$i]['statustext']
= lang('tenant');
-
$insert_record['extra']['tenant_id']
= 'tenant_id';
-
-
$location['location'][$i]['extra'][0]['input_type']
= 'text';
-
$location['location'][$i]['extra'][0]['input_name']
= 'last_name';
-
$location['location'][$i]['extra'][0]['readonly']
= True;
- $input_name[]
= $location['location'][$i]['extra'][0]['input_name'];
-
$location['location'][$i]['extra'][0]['size']
= 15;
-
$location['location'][$i]['extra'][0]['lookup_function_call'] =
$lookup_functions[$m]['name'];
-
$location['location'][$i]['extra'][0]['value']
= $data['values']['last_name'];
-
$location['location'][$i]['extra'][0]['statustext']
= lang('last name');
-
-
$location['location'][$i]['extra'][1]['input_type']
= 'text';
-
$location['location'][$i]['extra'][1]['input_name']
= 'first_name';
-
$location['location'][$i]['extra'][1]['readonly']
= True;
- $input_name[]
= $location['location'][$i]['extra'][1]['input_name'];
-
$location['location'][$i]['extra'][1]['size']
= 15;
-
$location['location'][$i]['extra'][1]['lookup_function_call'] =
$lookup_functions[$m]['name'];
-
$location['location'][$i]['extra'][1]['value']
= $data['values']['first_name'];
-
$location['location'][$i]['extra'][1]['statustext']
= lang('first name');
- $i++;
-
$location['location'][$i]['input_type'] = 'text';
-
$location['location'][$i]['name'] =
lang('Contact phone');
-
$location['location'][$i]['input_name'] =
'contact_phone';
- $input_name[]
=
$location['location'][$i]['input_name'];
-
$location['location'][$i]['size'] = 12;
-
$location['location'][$i]['lookup_function_call'] =
'';//$lookup_functions[$m]['name'];
-
$insert_record['extra']['contact_phone'] =
'contact_phone';
-
$location['location'][$i]['value'] =
$data['values']['contact_phone'];
-
$location['location'][$i]['statustext'] = lang('contact
phone');
- }
-
elseif($config[$j]['column_name']!='tenant_id' &&
$config[$j]['column_name']!='street_id'):
- {
-
$location['location'][$i]['input_name'] =
$config[$j]['column_name'];
- $input_name[]
=
$location['location'][$i]['input_name'];
-// $insert_record[]
=
$location['location'][$i]['input_name'];
-
$location['location'][$i]['size'] = 5;
-
$location['location'][$i]['value'] =
$data['location']['value'][$config[$j]['column_name']];
-
$location['location'][$i]['lookup_function_call'] = 'lookup_loc' .
$fm_location_cols[$j]['location_type'] . '()';
-
$location['location'][$i]['lookup_link'] = True;
-
$location['location'][$i]['name'] =
$config[$j]['descr'];
-
$location['location'][$i]['value'] =
$data['values'][$config[$j]['column_name']];
-
$location['location'][$i]['statustext'] = lang('Klick
this link to select') . ' '
.$location_types[($fm_location_cols[$j]['location_type']-1)]['name'];
-
$location['location'][$i]['input_type'] = 'text';
- }
- endif;
- $i++;
- }
- }
-
- if (isset($data['lookup_entity']) &&
is_array($data['lookup_entity']))
- {
- foreach($data['lookup_entity'] as $entity)
- {
- $m++;
- $entity_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.entity&location_type='
. $data['type_id'] . '&entity_id=' .$entity['id']);
-
- $lookup_functions[$m]['name'] =
'lookup_entity_' . $entity['id'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $entity_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
-
- $location['location'][$i]['input_type']
= 'text';
- $location['location'][$i]['input_name']
= 'entity_num_' . $entity['id'];
- $input_name[]
=
'entity_num_' . $entity['id'];
- $insert_record['extra']['entity_num_' .
$entity['id']] = 'p_num';
-
- $location['location'][$i]['size']
= 8;
-
$location['location'][$i]['lookup_function_call']
= 'lookup_entity_' . $entity['id'] .'()';
-
$location['location'][$i]['lookup_link']
= True;
- $location['location'][$i]['name']
= $entity['name'];
- $location['location'][$i]['value']
=
$data['entity_data'][$entity['id']]['p_num'];
- $location['location'][$i]['statustext']
= lang('Klick this link to
select') .' ' . $entity['name'];
-
-
$location['location'][$i]['extra'][0]['input_name']
= 'entity_cat_name_' . $entity['id'];
- $input_name[]
=
$location['location'][$i]['extra'][0]['input_name'];
-
$location['location'][$i]['extra'][0]['input_type']
= 'text';
-
$location['location'][$i]['extra'][0]['size']
= 30;
-
$location['location'][$i]['extra'][0]['lookup_function_call'] =
'lookup_entity_' . $entity['id'] .'()';
-
$location['location'][$i]['extra'][0]['value']
= $data['entity_data'][$entity['id']]['p_cat_name'];
-
-
$location['location'][$i]['extra'][1]['input_type']
= 'hidden';
-
$location['location'][$i]['extra'][1]['input_name']
= 'entity_id_' . $entity['id'];
- $input_name[]
=
'entity_id_' . $entity['id'];
- $insert_record['extra']['entity_id_' .
$entity['id']] = 'p_entity_id';
-
$location['location'][$i]['extra'][1]['value']
= $data['entity_data'][$entity['id']]['p_entity_id'];
-
-
$location['location'][$i]['extra'][2]['input_type']
= 'hidden';
-
$location['location'][$i]['extra'][2]['input_name']
= 'cat_id_' . $entity['id'];
- $input_name[]
=
'cat_id_' . $entity['id'];
- $insert_record['extra']['cat_id_' .
$entity['id']] = 'p_cat_id';
-
$location['location'][$i]['extra'][2]['value']
= $data['entity_data'][$entity['id']]['p_cat_id'];
-
- $i++;
- }
- }
-
-//_debug_array($location['location']);
-
-
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp,$input_name);
-
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp,$insert_record);
-//
$GLOBALS['phpgw']->session->appsession('input_name',$this->currentapp,$input_name);
-
- for ($i=0;$i<count($location['location']);$i++)
- {
- $lookup_name[] =
$location['location'][$i]['name'];
-
- }
-
-
$GLOBALS['phpgw']->session->appsession('lookup_name',$this->currentapp,$lookup_name);
-
- for ($j=0;$j<count($lookup_functions);$j++)
- {
- $location['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
- $location['lookup_functions'] .= '{'."\r\n";
- $location['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
- $location['lookup_functions'] .= '}'."\r\n";
- }
-
-
-//_debug_array($location);
-
- return $location;
-
- }
-
- function
select_category_list($format='',$selected='',$type_id='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->select_category_list($type_id);
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- $category_count=count($category_list);
- for ($i=0;$i<$category_count;$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
-
- function read($data='')
- {
- $location = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id,'type_id' =>
$data['type_id'],
-
'lookup_tenant'=>$data['lookup_tenant'],'lookup'=>$data['lookup'],
-
'district_id'=>$this->district_id,'allrows'=>$data['allrows'],
-
'status'=>$this->status,'part_of_town_id'=>$this->part_of_town_id));
- $this->total_records = $this->so->total_records;
- $this->uicols = $this->so->uicols;
-
- return $location;
- }
-
- function read_single($location_code='',$extra='')
- {
- $location_data = $this->so->read_single($location_code);
-
- if(!$extra['tenant_id']=='lookup')
- {
- if($extra['tenant_id']>0)
- {
-
$tenant_data=$this->bocommon->read_single_tenant($extra['tenant_id']);
- $location_data['tenant_id'] =
$extra['tenant_id'];
- $location_data['contact_phone']=
$extra['contact_phone'];
- $location_data['last_name'] =
$tenant_data['last_name'];
- $location_data['first_name'] =
$tenant_data['first_name'];
- }
- else
- {
- unset($location_data['tenant_id']);
- unset($location_data['contact_phone']);
- unset($location_data['last_name']);
- unset($location_data['first_name']);
- }
- }
-
- if(is_array($extra))
- {
- $location_data = $location_data + $extra;
- }
- return $location_data;
- }
-
- function check_location($location_code='',$type_id='')
- {
- return
$this->so->check_location($location_code,$type_id);
- }
-
-
- function
save($location,$values_attribute,$action='',$type_id='',$location_code_parent='')
- {
-
-
-//_debug_array($values_attribute);
-/* $location_datatype =
$GLOBALS['phpgw']->session->appsession('location_datatype',$this->currentapp);
-// _debug_array($location_datatype);
-
- if(is_array($location_datatype))
- {
- for ($i=0;$i<count($location_datatype);$i++)
- {
-
if($location_datatype[$i]['datatype']=='decimal' &&
$location[$location_datatype[$i]['input_name']])
- {
-
$location[$location_datatype[$i]['input_name']] =
str_replace(",",".",$location[$location_datatype[$i]['input_name']]);
- }
-
-
if($location_datatype[$i]['datatype']=='date' &&
$location[$location_datatype[$i]['input_name']])
- {
- $dateformat=
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $dateformat =
str_replace(".","",$dateformat);
- $dateformat =
str_replace("-","",$dateformat);
- $dateformat =
str_replace("/","",$dateformat);
- $y=strpos($dateformat,'Y');
- $d=strpos($dateformat,'d');
- $m=strpos($dateformat,'m');
-
- $dateparts = explode('/',
$location[$location_datatype[$i]['input_name']]);
- $day =
$dateparts[$d];
- $month =
$dateparts[$m];
- $year =
$dateparts[$y];
-
-//
$location[$location_datatype[$i]['input_name']] =
date($this->bocommon->dateformat,mktime(2,0,0,$month,$day,$year));
-
$location[$location_datatype[$i]['input_name']] =
mktime(0,0,0,$month,$day,$year);
-
- }
- }
- }
-
-*/
-
- $m=count($values_attribute);
- for ($i=0;$i<$m;$i++)
- {
- if($values_attribute[$i]['datatype']=='AB' ||
$values_attribute[$i]['datatype']=='VENDOR')
- {
- $values_attribute[$i]['value'] =
$_POST[$values_attribute[$i]['name']];
- }
- if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
- }
- if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
- }
-
- if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
- }
-
- if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
- {
-
- $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
- }
- }
-
-
-//_debug_array($values_attribute);
-
-
-
-// _debug_array($location);
-
- if ($action=='edit')
- {
- if
($this->so->check_location($location['location_code'],$type_id))
- {
- $receipt =
$this->so->edit($location,$values_attribute,$type_id);
- }
- else
- {
-
$receipt['error'][]=array('msg'=>lang('This location ID does not exist!'));
- }
- }
- else
- {
-
-/* if($type_id>1)
- {
-
if(!$this->so->check_location($location_code_parent,($type_id-1)))
- {
-
$receipt['error'][]=array('msg'=>lang('This location parent ID does not
exist!'));
- }
- }
-
-*/
- if(!$receipt['error'])
- {
- $receipt =
$this->so->add($location,$values_attribute,$type_id);
- }
- }
- return $receipt;
- }
-
- function delete($location_code)
- {
- $this->so->delete($location_code);
- }
-
- function update_cat()
- {
- return $this->so->update_cat();
- }
- function read_summary()
- {
-
- $summary = $this->so->read_summary(array('filter' =>
$this->filter,'type_id' => $data['type_id'],
-
'district_id'=>$this->district_id,'part_of_town_id'=>$this->part_of_town_id));
- $this->uicols = $this->so->uicols;
- return $summary;
-
- }
-
- function select_change_type($selected='')
- {
- $nullable[0]['id']= 1;
- $nullable[0]['name']= lang('Correct error');
- $nullable[1]['id']= 2;
- $nullable[1]['name']= lang('New values');
-
- while (is_array($nullable) && list(,$type) =
each($nullable))
- {
- $sel_type = '';
- if ($type['id']==$selected)
- {
- $sel_type = 'selected';
- }
-
- $change_type_list[] = array
- (
- 'id' => $type['id'],
- 'name' => $type['name'],
- 'selected' => $sel_type
- );
- }
-
- for ($i=0;$i<count($change_type_list);$i++)
- {
- if ($change_type_list[$i]['selected'] !=
'selected')
- {
-
unset($change_type_list[$i]['selected']);
- }
- }
- return $change_type_list;
- }
-
- function check_history($location_code)
- {
- return $this->so->check_history($location_code);
- }
-
- function get_history($location_code)
- {
- $history = $this->so->get_history($location_code);
- $this->total_records = $this->so->total_records;
- $this->uicols = $this->so->uicols;
-
- return $history;
-
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 location
+ * @version $Id: class.bolocation.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bolocation
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 bolocation($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.solocation');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
+ $district_id =
get_var('district_id',array('POST','GET'));
+ $part_of_town_id =
get_var('part_of_town_id',array('POST','GET'));
+ $status = get_var('status',array('POST','GET'));
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(isset($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($part_of_town_id))
+ {
+ $this->part_of_town_id = $part_of_town_id;
+ }
+ if(isset($district_id))
+ {
+ $this->district_id = $district_id;
+ }
+ if(isset($status))
+ {
+ $this->status = $status;
+ }
+ if(isset($type_id))
+ {
+ $this->type_id = $type_id;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','location');
+
+ $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->part_of_town_id =
$data['part_of_town_id'];
+ $this->district_id = $data['district_id'];
+ $this->status = $data['status'];
+ $this->type_id = $data['type_id'];
+ $this->allrows = $data['allrows'];
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','location',$data);
+ }
+ }
+
+
+ function select_status_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
+ break;
+ }
+
+ $list= $this->so->select_status_list($this->type_id);
+ return $this->bocommon->select_list($selected,$list);
+ }
+
+ function read_entity_to_link()
+ {
+ return $this->so->read_entity_to_link();
+ }
+
+ function get_owner_list($format='',$selected='')
+ {
+
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_filter'));
+ break;
+ }
+
+ $owners = $this->so->get_owner_list();
+
+ while (is_array($owners) && list(,$owner) =
each($owners))
+ {
+ $sel_owner = '';
+ if ($owner['id']==$selected)
+ {
+ $sel_owner = 'selected';
+ }
+
+ $owner_list[] = array
+ (
+ 'id' => $owner['id'],
+ 'name' => $owner['name'],
+ 'selected' => $sel_owner
+ );
+ }
+
+ $owner_count=count($owner_list);
+ for ($i=0;$i<$owner_count;$i++)
+ {
+ if ($owner_list[$i]['selected'] != 'selected')
+ {
+ unset($owner_list[$i]['selected']);
+ }
+ }
+
+ return $owner_list;
+ }
+
+ function get_owner_type_list($format='',$selected='')
+ {
+
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('owner_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('owner_filter'));
+ break;
+ }
+
+ $owners = $this->so->get_owner_type_list();
+
+ while (is_array($owners) && list(,$owner) =
each($owners))
+ {
+ $sel_owner = '';
+ if ($owner['id']==$selected)
+ {
+ $sel_owner = 'selected';
+ }
+
+ $owner_list[] = array
+ (
+ 'id' => $owner['id'],
+ 'name' => $owner['name'],
+ 'selected' => $sel_owner
+ );
+ }
+
+ $owner_count=count($owner_list);
+
+ for ($i=0;$i<$owner_count;$i++)
+ {
+ if ($owner_list[$i]['selected'] != 'selected')
+ {
+ unset($owner_list[$i]['selected']);
+ }
+ }
+
+ return $owner_list;
+ }
+
+
+ function initiate_ui_location($data)
+ {
+
+ switch($data['lookup_type'])
+ {
+ case 'form':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('location_form'));
+ break;
+ case 'view':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('location_view'));
+ break;
+ }
+
+ $location_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index&lookup=1');
+
+ $config = $this->soadmin_location->read_config('');
+
+ $this->config = $config;
+//_debug_array($config);
+ $location_types =
$this->soadmin_location->select_location_type();
+ $this->location_types = $location_types;
+
+ if($data['type_id']<0)
+ {
+ $data['type_id'] = count($location_types);
+ }
+//_debug_array($data);
+//_debug_array($location_types);
+ $fm_location_cols =
$this->soadmin_location->read_attrib(array('type_id'=>$data['type_id'],'lookup_type'=>$data['type_id']));
+//_debug_array($fm_location_cols);
+
+ for ($i=0;$i<$data['type_id'];$i++)
+ {
+ $location['location'][$i]['input_type']
= 'text';
+ $location['location'][$i]['input_name']
= 'loc' . ($i+1);
+ $input_name[]
= $location['location'][$i]['input_name'];
+ $insert_record['location'][]
= $location['location'][$i]['input_name'];
+ $location['location'][$i]['size']
= 5;
+ $location['location'][$i]['name']
= $location_types[($i)]['name'];
+ $location['location'][$i]['value']
= $data['values']['loc' . ($i+1)];
+ $location['location'][$i]['statustext']
= lang('Klick this link to select') . ' ' .
$location_types[($i)]['name'];
+
+ if($i==0)
+ {
+
$location['location'][$i]['extra'][0]['input_name'] = 'loc' .
($i+1).'_name';
+ $input_name[]
= $location['location'][$i]['extra'][0]['input_name'];
+
$location['location'][$i]['extra'][0]['input_type'] = 'text';
+
$location['location'][$i]['extra'][0]['size'] = 30;
+
$location['location'][$i]['extra'][0]['lookup_function_call'] = 'lookup_loc'
. ($i+1) . '()';
+
$location['location'][$i]['extra'][0]['value'] =
$data['values']['loc' . ($i+1).'_name'];
+ }
+ else
+ {
+
$location['location'][$i]['extra'][0]['input_name'] = 'loc' .
($i+1).'_name';
+ $input_name[]
= $location['location'][$i]['extra'][0]['input_name'];
+
$location['location'][$i]['extra'][0]['input_type'] = 'text';
+
$location['location'][$i]['extra'][0]['size'] = 30;
+
$location['location'][$i]['extra'][0]['lookup_function_call'] = 'lookup_loc'
. ($i+1) . '()';
+
$location['location'][$i]['extra'][0]['value'] =
$data['values']['loc' . ($i+1).'_name'];
+ }
+
+
$location['location'][$i]['lookup_function_call'] =
'lookup_loc' . ($i+1) . '()';
+ $location['location'][$i]['lookup_link']
= True;
+ $location['location'][$i]['readonly']
= True;
+ $lookup_functions[$i]['name']
= 'lookup_loc' . ($i+1) . '()';
+ $lookup_functions[$i]['action']
= 'Window1=window.open('."'" . $location_link
.'&type_id=' . ($i+1) . '&lookup_name=' . $i . "'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+
+ if($data['no_link']>=($i+3))
+ {
+
$location['location'][$i]['lookup_link'] = False;
+ $lookup_functions[$i]['action']
= 'Window1=window.open('."'" . $location_link
.'&type_id=' . ($data['no_link']-1) . '&lookup_name=' . ($data[no_link]-2) .
"'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $location['location'][$i]['statustext']
= lang('Klick this link to select') . ' ' .
$location_types[($data[no_link]-2)]['name'];
+ }
+
+
+ if($data['query_link'] && $i <
($data['type_id']-1))
+ {
+ for ($j=1;$j<$i+2;$j++)
+ {
+ $temp_location[]=
$data['values']['loc' . ($j)];
+ }
+
+
+ $data['link_data']['query_location']
= implode('-',$temp_location);
+ $location['location'][$i]['query_link']
=
$GLOBALS['phpgw']->link('/index.php',$data['link_data']);
+ unset($temp_location);
+ }
+
+
+ $m=$i;
+ }
+
+//_debug_array($fm_location_cols);
+//_debug_array($data);
+
+ $location_cols_count =count($fm_location_cols);
+ for ($j=0;$j<$location_cols_count;$j++)
+ {
+ if(($fm_location_cols[$j]['location_type'] <=
$data['type_id']) && $fm_location_cols[$j]['lookup_form'])
+ {
+ $location['location'][$i]['input_type']
= 'text';
+ $location['location'][$i]['input_name']
= $fm_location_cols[$j]['column_name'];
+ $input_name[]
= $location['location'][$i]['input_name'];
+ $location['location'][$i]['size']
= 5;
+
$location['location'][$i]['lookup_function_call'] = 'lookup_loc'
. $fm_location_cols[$j]['location_type'] . '()';
+
$location['location'][$i]['lookup_link'] = True;
+ $location['location'][$i]['readonly']
= True;
+ $location['location'][$i]['name']
= $fm_location_cols[$j]['input_text'];
+ $location['location'][$i]['value']
= $data['values'][$fm_location_cols[$j]['column_name']];
+ $location['location'][$i]['statustext']
= lang('Klick this link to select') . ' ' .
$location_types[($fm_location_cols[$j]['location_type']-1)]['name'];
+ $i++;
+
+ }
+ }
+
+
+ $config_count =count($config);
+ for ($j=0;$j<$config_count;$j++)
+ {
+ if($config[$j]['location_type'] <=
$data['type_id'] && $config[$j]['lookup_form'] )
+ {
+
if($config[$j]['column_name']=='street_id'):
+ {
+
$location['location'][$i]['input_name'] =
$config[$j]['column_name'];
+ $input_name[]
= 'street_id';
+
$location['location'][$i]['lookup_link'] = True;
+
$location['location'][$i]['lookup_function_call'] = 'lookup_loc' .
$config[$j]['location_type'] . '()';
+
$location['location'][$i]['name'] = lang('address');
+
$location['location'][$i]['input_type'] = 'hidden';
+
$location['location'][$i]['value'] =
$data['values'][$config[$j]['column_name']];
+
+
$location['location'][$i]['extra'][0]['input_type'] = 'text';
+
$location['location'][$i]['extra'][0]['input_name'] = 'street_name';
+
$location['location'][$i]['extra'][0]['readonly'] = True;
+ $input_name[]
= $location['location'][$i]['extra'][0]['input_name'];
+
$location['location'][$i]['extra'][0]['size'] = 30;
+
$location['location'][$i]['extra'][0]['lookup_function_call'] = 'lookup_loc'
. $config[$j]['location_type'] . '()';
+
$location['location'][$i]['extra'][0]['value'] =
$data['values']['street_name'];
+
+
$location['location'][$i]['extra'][1]['input_type'] = 'text';
+
$location['location'][$i]['extra'][1]['input_name'] = 'street_number';
+
$location['location'][$i]['extra'][1]['readonly'] = True;
+ $input_name[]
= $location['location'][$i]['extra'][1]['input_name'];
+
$location['location'][$i]['extra'][1]['size'] = 6;
+
$location['location'][$i]['extra'][1]['lookup_function_call'] = 'lookup_loc'
. $config[$j]['location_type'] . '()';
+
$location['location'][$i]['extra'][1]['value'] =
$data['values']['street_number'];
+ }
+
elseif($config[$j]['column_name']=='tenant_id' && $data['tenant']):
+ {
+ $m++;
+ $lookup_functions[$m]['name'] =
'lookup_loc' . ($m+1) . '()';
+ $lookup_functions[$m]['action']
= 'Window1=window.open('."'" . $location_link .'&lookup_tenant=1&type_id=' .
$config[$j]['location_type'] . '&lookup_name=' . $i ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+
+
$location['location'][$i]['lookup_link'] = True;
+
$location['location'][$i]['name'] = lang('Tenant');
+
$location['location'][$i]['input_type'] = 'hidden';
+
$location['location'][$i]['input_name'] = 'tenant_id';
+ $input_name[]
= $location['location'][$i]['input_name'];
+
$location['location'][$i]['value'] =
$data['values'][$config[$j]['column_name']];
+
$location['location'][$i]['lookup_function_call'] =
$lookup_functions[$m]['name'];
+
$location['location'][$i]['statustext'] = lang('tenant');
+
$insert_record['extra']['tenant_id'] = 'tenant_id';
+
+
$location['location'][$i]['extra'][0]['input_type'] = 'text';
+
$location['location'][$i]['extra'][0]['input_name'] = 'last_name';
+
$location['location'][$i]['extra'][0]['readonly'] = True;
+ $input_name[]
= $location['location'][$i]['extra'][0]['input_name'];
+
$location['location'][$i]['extra'][0]['size'] = 15;
+
$location['location'][$i]['extra'][0]['lookup_function_call'] =
$lookup_functions[$m]['name'];
+
$location['location'][$i]['extra'][0]['value'] =
$data['values']['last_name'];
+
$location['location'][$i]['extra'][0]['statustext'] = lang('last name');
+
+
$location['location'][$i]['extra'][1]['input_type'] = 'text';
+
$location['location'][$i]['extra'][1]['input_name'] = 'first_name';
+
$location['location'][$i]['extra'][1]['readonly'] = True;
+ $input_name[]
= $location['location'][$i]['extra'][1]['input_name'];
+
$location['location'][$i]['extra'][1]['size'] = 15;
+
$location['location'][$i]['extra'][1]['lookup_function_call'] =
$lookup_functions[$m]['name'];
+
$location['location'][$i]['extra'][1]['value'] =
$data['values']['first_name'];
+
$location['location'][$i]['extra'][1]['statustext'] = lang('first name');
+ $i++;
+
$location['location'][$i]['input_type'] = 'text';
+
$location['location'][$i]['name'] = lang('Contact phone');
+
$location['location'][$i]['input_name'] = 'contact_phone';
+ $input_name[]
= $location['location'][$i]['input_name'];
+
$location['location'][$i]['size'] = 12;
+
$location['location'][$i]['lookup_function_call'] =
'';//$lookup_functions[$m]['name'];
+
$insert_record['extra']['contact_phone'] = 'contact_phone';
+
$location['location'][$i]['value'] =
$data['values']['contact_phone'];
+
$location['location'][$i]['statustext'] = lang('contact phone');
+ }
+
elseif($config[$j]['column_name']!='tenant_id' &&
$config[$j]['column_name']!='street_id'):
+ {
+
$location['location'][$i]['input_name'] =
$config[$j]['column_name'];
+ $input_name[]
= $location['location'][$i]['input_name'];
+// $insert_record[]
= $location['location'][$i]['input_name'];
+
$location['location'][$i]['size'] = 5;
+
$location['location'][$i]['value'] =
$data['location']['value'][$config[$j]['column_name']];
+
$location['location'][$i]['lookup_function_call'] = 'lookup_loc' .
$fm_location_cols[$j]['location_type'] . '()';
+
$location['location'][$i]['lookup_link'] = True;
+
$location['location'][$i]['name'] = $config[$j]['descr'];
+
$location['location'][$i]['value'] =
$data['values'][$config[$j]['column_name']];
+
$location['location'][$i]['statustext'] = lang('Klick this link
to select') . ' '
.$location_types[($fm_location_cols[$j]['location_type']-1)]['name'];
+
$location['location'][$i]['input_type'] = 'text';
+ }
+ endif;
+ $i++;
+ }
+ }
+
+ if (isset($data['lookup_entity']) &&
is_array($data['lookup_entity']))
+ {
+ foreach($data['lookup_entity'] as $entity)
+ {
+ $m++;
+ $entity_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.entity&location_type='
. $data['type_id'] . '&entity_id=' .$entity['id']);
+
+ $lookup_functions[$m]['name'] =
'lookup_entity_' . $entity['id'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $entity_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+
+ $location['location'][$i]['input_type']
= 'text';
+ $location['location'][$i]['input_name']
= 'entity_num_' . $entity['id'];
+ $input_name[]
=
'entity_num_' . $entity['id'];
+ $insert_record['extra']['entity_num_' .
$entity['id']] = 'p_num';
+
+ $location['location'][$i]['size']
= 8;
+
$location['location'][$i]['lookup_function_call']
= 'lookup_entity_' . $entity['id'] .'()';
+
$location['location'][$i]['lookup_link']
= True;
+ $location['location'][$i]['name']
= $entity['name'];
+
+ if (is_array($data['entity_data']))
+ {
+
$location['location'][$i]['value'] =
$data['entity_data'][$entity['id']]['p_num'];
+ }
+ $location['location'][$i]['statustext']
= lang('Klick this link to select') .'
' . $entity['name'];
+
+
$location['location'][$i]['extra'][0]['input_name']
= 'entity_cat_name_' . $entity['id'];
+ $input_name[]
=
$location['location'][$i]['extra'][0]['input_name'];
+
$location['location'][$i]['extra'][0]['input_type']
= 'text';
+
$location['location'][$i]['extra'][0]['size']
= 30;
+
$location['location'][$i]['extra'][0]['lookup_function_call'] =
'lookup_entity_' . $entity['id'] .'()';
+
+ if (is_array($data['entity_data']))
+ {
+
$location['location'][$i]['extra'][0]['value'] =
$data['entity_data'][$entity['id']]['p_cat_name'];
+ }
+
+
$location['location'][$i]['extra'][1]['input_type']
= 'hidden';
+
$location['location'][$i]['extra'][1]['input_name']
= 'entity_id_' . $entity['id'];
+ $input_name[]
=
'entity_id_' . $entity['id'];
+ $insert_record['extra']['entity_id_' .
$entity['id']] = 'p_entity_id';
+ if (is_array($data['entity_data']))
+ {
+
$location['location'][$i]['extra'][1]['value'] =
$data['entity_data'][$entity['id']]['p_entity_id'];
+ }
+
+
$location['location'][$i]['extra'][2]['input_type']
= 'hidden';
+
$location['location'][$i]['extra'][2]['input_name']
= 'cat_id_' . $entity['id'];
+ $input_name[]
=
'cat_id_' . $entity['id'];
+ $insert_record['extra']['cat_id_' .
$entity['id']] = 'p_cat_id';
+
+ if (is_array($data['entity_data']))
+ {
+
$location['location'][$i]['extra'][2]['value'] =
$data['entity_data'][$entity['id']]['p_cat_id'];
+ }
+
+ $i++;
+ }
+ }
+
+//_debug_array($location['location']);
+
+
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp,$input_name);
+
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp,$insert_record);
+//
$GLOBALS['phpgw']->session->appsession('input_name',$this->currentapp,$input_name);
+
+ for ($i=0;$i<count($location['location']);$i++)
+ {
+ $lookup_name[] =
$location['location'][$i]['name'];
+
+ }
+
+
$GLOBALS['phpgw']->session->appsession('lookup_name',$this->currentapp,$lookup_name);
+
+ for ($j=0;$j<count($lookup_functions);$j++)
+ {
+ $location['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
+ $location['lookup_functions'] .= '{'."\r\n";
+ $location['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
+ $location['lookup_functions'] .= '}'."\r\n";
+ }
+
+
+//_debug_array($location);
+
+ return $location;
+
+ }
+
+ function
select_category_list($format='',$selected='',$type_id='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->select_category_list($type_id);
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ $category_count=count($category_list);
+ for ($i=0;$i<$category_count;$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+
+ function read($data='')
+ {
+ $location = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id,'type_id' =>
$data['type_id'],
+
'lookup_tenant'=>$data['lookup_tenant'],'lookup'=>$data['lookup'],
+
'district_id'=>$this->district_id,'allrows'=>$data['allrows'],
+
'status'=>$this->status,'part_of_town_id'=>$this->part_of_town_id));
+ $this->total_records = $this->so->total_records;
+ $this->uicols = $this->so->uicols;
+
+ return $location;
+ }
+
+ function read_single($location_code='',$extra='')
+ {
+ $location_data = $this->so->read_single($location_code);
+
+ if(!$extra['tenant_id']=='lookup')
+ {
+ if($extra['tenant_id']>0)
+ {
+
$tenant_data=$this->bocommon->read_single_tenant($extra['tenant_id']);
+ $location_data['tenant_id'] =
$extra['tenant_id'];
+ $location_data['contact_phone']=
$extra['contact_phone'];
+ $location_data['last_name'] =
$tenant_data['last_name'];
+ $location_data['first_name'] =
$tenant_data['first_name'];
+ }
+ else
+ {
+ unset($location_data['tenant_id']);
+ unset($location_data['contact_phone']);
+ unset($location_data['last_name']);
+ unset($location_data['first_name']);
+ }
+ }
+
+ if(is_array($extra))
+ {
+ $location_data = $location_data + $extra;
+ }
+ return $location_data;
+ }
+
+ function check_location($location_code='',$type_id='')
+ {
+ return
$this->so->check_location($location_code,$type_id);
+ }
+
+
+ function
save($location,$values_attribute,$action='',$type_id='',$location_code_parent='')
+ {
+
+
+//_debug_array($values_attribute);
+/* $location_datatype =
$GLOBALS['phpgw']->session->appsession('location_datatype',$this->currentapp);
+// _debug_array($location_datatype);
+
+ if(is_array($location_datatype))
+ {
+ for ($i=0;$i<count($location_datatype);$i++)
+ {
+
if($location_datatype[$i]['datatype']=='decimal' &&
$location[$location_datatype[$i]['input_name']])
+ {
+
$location[$location_datatype[$i]['input_name']] =
str_replace(",",".",$location[$location_datatype[$i]['input_name']]);
+ }
+
+
if($location_datatype[$i]['datatype']=='date' &&
$location[$location_datatype[$i]['input_name']])
+ {
+ $dateformat=
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $dateformat =
str_replace(".","",$dateformat);
+ $dateformat =
str_replace("-","",$dateformat);
+ $dateformat =
str_replace("/","",$dateformat);
+ $y=strpos($dateformat,'Y');
+ $d=strpos($dateformat,'d');
+ $m=strpos($dateformat,'m');
+
+ $dateparts = explode('/',
$location[$location_datatype[$i]['input_name']]);
+ $day =
$dateparts[$d];
+ $month =
$dateparts[$m];
+ $year =
$dateparts[$y];
+
+//
$location[$location_datatype[$i]['input_name']] =
date($this->bocommon->dateformat,mktime(2,0,0,$month,$day,$year));
+
$location[$location_datatype[$i]['input_name']] =
mktime(0,0,0,$month,$day,$year);
+
+ }
+ }
+ }
+
+*/
+
+ $m=count($values_attribute);
+ for ($i=0;$i<$m;$i++)
+ {
+ if($values_attribute[$i]['datatype']=='AB' ||
$values_attribute[$i]['datatype']=='VENDOR')
+ {
+ $values_attribute[$i]['value'] =
$_POST[$values_attribute[$i]['name']];
+ }
+ if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
+ }
+ if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
+ }
+
+ if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
+ }
+
+ if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
+ {
+
+ $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
+ }
+ }
+
+
+//_debug_array($values_attribute);
+
+
+
+// _debug_array($location);
+
+ if ($action=='edit')
+ {
+ if
($this->so->check_location($location['location_code'],$type_id))
+ {
+ $receipt =
$this->so->edit($location,$values_attribute,$type_id);
+ }
+ else
+ {
+
$receipt['error'][]=array('msg'=>lang('This location ID does not exist!'));
+ }
+ }
+ else
+ {
+
+/* if($type_id>1)
+ {
+
if(!$this->so->check_location($location_code_parent,($type_id-1)))
+ {
+
$receipt['error'][]=array('msg'=>lang('This location parent ID does not
exist!'));
+ }
+ }
+
+*/
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->so->add($location,$values_attribute,$type_id);
+ }
+ }
+ return $receipt;
+ }
+
+ function delete($location_code)
+ {
+ $this->so->delete($location_code);
+ }
+
+ function update_cat()
+ {
+ return $this->so->update_cat();
+ }
+ function read_summary()
+ {
+
+ $summary = $this->so->read_summary(array('filter' =>
$this->filter,'type_id' => $data['type_id'],
+
'district_id'=>$this->district_id,'part_of_town_id'=>$this->part_of_town_id));
+ $this->uicols = $this->so->uicols;
+ return $summary;
+
+ }
+
+ function select_change_type($selected='')
+ {
+ $nullable[0]['id']= 1;
+ $nullable[0]['name']= lang('Correct error');
+ $nullable[1]['id']= 2;
+ $nullable[1]['name']= lang('New values');
+
+ while (is_array($nullable) && list(,$type) =
each($nullable))
+ {
+ $sel_type = '';
+ if ($type['id']==$selected)
+ {
+ $sel_type = 'selected';
+ }
+
+ $change_type_list[] = array
+ (
+ 'id' => $type['id'],
+ 'name' => $type['name'],
+ 'selected' => $sel_type
+ );
+ }
+
+ for ($i=0;$i<count($change_type_list);$i++)
+ {
+ if ($change_type_list[$i]['selected'] !=
'selected')
+ {
+
unset($change_type_list[$i]['selected']);
+ }
+ }
+ return $change_type_list;
+ }
+
+ function check_history($location_code)
+ {
+ return $this->so->check_history($location_code);
+ }
+
+ function get_history($location_code)
+ {
+ $history = $this->so->get_history($location_code);
+ $this->total_records = $this->so->total_records;
+ $this->uicols = $this->so->uicols;
+
+ return $history;
+
+ }
+
+ }
+?>
Index: property/inc/class.bolookup.inc.php
diff -u property/inc/class.bolookup.inc.php:1.7
property/inc/class.bolookup.inc.php:1.8
--- property/inc/class.bolookup.inc.php:1.7 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bolookup.inc.php Fri Feb 3 12:05:49 2006
@@ -1,254 +1,254 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 core
- * @version $Id: class.bolookup.inc.php,v 1.7 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bolookup
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 bolookup($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.solookup');
- $this->solocation =
CreateObject($this->currentapp.'.solocation');
-
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start =
get_var('start',array('POST','GET'));
- $query =
get_var('query',array('POST','GET'));
- $sort =
get_var('sort',array('POST','GET'));
- $order =
get_var('order',array('POST','GET'));
- $filter =
get_var('filter',array('POST','GET'));
- $cat_id =
get_var('cat_id',array('POST','GET'));
- $district_id =
get_var('district_id',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($district_id))
- {
- $this->district_id = $district_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','lookup',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','lookup');
-
- //_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->district_id = $data['district_id'];
- }
-
-
- function read_addressbook()
- {
-// $contact = $this->so->read_addressbook(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-//
'filter' => $this->filter,'cat_id' => $this->cat_id));
-// $this->total_records = $this->so->total_records;
-
-
-
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] &&
-
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
- {
- $this->limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $this->limit = 15;
- }
-
- $fields[0] = 'per_first_name';
- $fields[1] = 'per_last_name';
- $fields[2] = 'per_department';
- $fields[3] = 'per_title';
- $fields[4] = 'addr_add1';
- $fields[5] = 'addr_city';
- $fields['owner'] = 'owner';
- $fields['contact_id'] = 'contact_id';
-
-
- $addressbook =
CreateObject('addressbook.boaddressbook');
-
- $criteria = $addressbook->criteria_contacts(1, -3,
'person', $this->query, $fields_search);
-
-//_debug_array($criteria);
- $entries = $addressbook->get_persons($fields,
$this->limit, $this->start, $this->order, $this->sort, '', $criteria);
-
-//_debug_array($entries);
- return $entries;
- }
-
-
- /**
- * Get the the person data what you want
- *
- * @param array $fields The fields that you can see from person
- * @param integer $limit Limit of records that you want
- * @param integer $ofset Ofset of record that you want start
- * @param string $orderby The field which you want order
- * @param string $sort ASC | DESC depending what you want
- * @param mixed $criteria All criterias what you want
- * @param mixed $criteria_token same like $criteria but
builded<br>with sql_criteria class, more powerfull
- * @return array with records
- */
- function get_persons($fields, $start='', $limit='',
$orderby='', $sort='', $criteria='', $token_criteria='')
- {
- $entries = $this->so->get_persons($fields, $start,
$limit, $orderby, $sort, $criteria, $token_criteria);
- if(is_array($entries))
- {
- foreach($entries as $data)
- {
- $persons[$data['contact_id']] = $data;
- }
- }
- else
- {
- $persons = array();
- }
- $this->total = $this->so->contacts->total_records;
- return $persons;
- }
-
-
-
-
-
- function read_vendor()
- {
- $vendor = $this->so->read_vendor(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id));
- $this->total_records = $this->so->total_records;
-
- return $vendor;
- }
-
- function read_b_account()
- {
- $b_account = $this->so->read_b_account(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id));
- $this->total_records = $this->so->total_records;
-
- return $b_account;
- }
-
- function read_street()
- {
- $street = $this->so->read_street(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id));
- $this->total_records = $this->so->total_records;
-
- return $street;
- }
-
- function read_tenant()
- {
- $tenant = $this->so->read_tenant(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id));
- $this->total_records = $this->so->total_records;
-
- return $tenant;
- }
-
- function read_ns3420()
- {
- $ns3420 = $this->so->read_ns3420(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id));
- $this->total_records = $this->so->total_records;
-
- return $ns3420;
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 core
+ * @version $Id: class.bolookup.inc.php,v 1.8 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bolookup
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 bolookup($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.solookup');
+ $this->solocation =
CreateObject($this->currentapp.'.solocation');
+
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start =
get_var('start',array('POST','GET'));
+ $query =
get_var('query',array('POST','GET'));
+ $sort =
get_var('sort',array('POST','GET'));
+ $order =
get_var('order',array('POST','GET'));
+ $filter =
get_var('filter',array('POST','GET'));
+ $cat_id =
get_var('cat_id',array('POST','GET'));
+ $district_id =
get_var('district_id',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($district_id))
+ {
+ $this->district_id = $district_id;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','lookup',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','lookup');
+
+ //_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->district_id = $data['district_id'];
+ }
+
+
+ function read_addressbook()
+ {
+// $contact = $this->so->read_addressbook(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+//
'filter' => $this->filter,'cat_id' => $this->cat_id));
+// $this->total_records = $this->so->total_records;
+
+
+
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] &&
+
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+ {
+ $this->limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $this->limit = 15;
+ }
+
+ $fields[0] = 'per_first_name';
+ $fields[1] = 'per_last_name';
+ $fields[2] = 'per_department';
+ $fields[3] = 'per_title';
+ $fields[4] = 'addr_add1';
+ $fields[5] = 'addr_city';
+ $fields['owner'] = 'owner';
+ $fields['contact_id'] = 'contact_id';
+
+
+ $addressbook =
CreateObject('addressbook.boaddressbook');
+
+ $criteria = $addressbook->criteria_contacts(1, -3,
'person', $this->query, $fields_search);
+
+//_debug_array($criteria);
+ $entries = $addressbook->get_persons($fields,
$this->limit, $this->start, $this->order, $this->sort, '', $criteria);
+
+//_debug_array($entries);
+ return $entries;
+ }
+
+
+ /**
+ * Get the the person data what you want
+ *
+ * @param array $fields The fields that you can see from person
+ * @param integer $limit Limit of records that you want
+ * @param integer $ofset Ofset of record that you want start
+ * @param string $orderby The field which you want order
+ * @param string $sort ASC | DESC depending what you want
+ * @param mixed $criteria All criterias what you want
+ * @param mixed $criteria_token same like $criteria but
builded<br>with sql_criteria class, more powerfull
+ * @return array with records
+ */
+ function get_persons($fields, $start='', $limit='',
$orderby='', $sort='', $criteria='', $token_criteria='')
+ {
+ $entries = $this->so->get_persons($fields, $start,
$limit, $orderby, $sort, $criteria, $token_criteria);
+ if(is_array($entries))
+ {
+ foreach($entries as $data)
+ {
+ $persons[$data['contact_id']] = $data;
+ }
+ }
+ else
+ {
+ $persons = array();
+ }
+ $this->total = $this->so->contacts->total_records;
+ return $persons;
+ }
+
+
+
+
+
+ function read_vendor()
+ {
+ $vendor = $this->so->read_vendor(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id));
+ $this->total_records = $this->so->total_records;
+
+ return $vendor;
+ }
+
+ function read_b_account()
+ {
+ $b_account = $this->so->read_b_account(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id));
+ $this->total_records = $this->so->total_records;
+
+ return $b_account;
+ }
+
+ function read_street()
+ {
+ $street = $this->so->read_street(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id));
+ $this->total_records = $this->so->total_records;
+
+ return $street;
+ }
+
+ function read_tenant()
+ {
+ $tenant = $this->so->read_tenant(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id));
+ $this->total_records = $this->so->total_records;
+
+ return $tenant;
+ }
+
+ function read_ns3420()
+ {
+ $ns3420 = $this->so->read_ns3420(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id));
+ $this->total_records = $this->so->total_records;
+
+ return $ns3420;
+ }
+ }
+?>
Index: property/inc/class.bometer.inc.php
diff -u property/inc/class.bometer.inc.php:1.6
property/inc/class.bometer.inc.php:1.7
--- property/inc/class.bometer.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bometer.inc.php Fri Feb 3 12:05:49 2006
@@ -1,260 +1,260 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 entity
- * @version $Id: class.bometer.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bometer
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 bometer($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.someter');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','meter',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','meter');
-
- $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'];
- }
-
- function get_category_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->get_category_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function read()
- {
- $meter = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
-/* $cols_extra = $this->so->cols_extra;
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $solocation =
CreateObject($this->currentapp.'.solocation');
-
- for ($i=0; $i<count($meter); $i++)
- {
- $meter[$i]['user'] =
$GLOBALS['phpgw']->accounts->id2name($meter[$i]['user_id']);
- $meter[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($meter[$i]['entry_date'],$dateformat);
-
$location_data=$solocation->read_single($meter[$i]['location_code']);
-
- for ($j=0;$j<count($cols_extra);$j++)
- {
- $meter[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
- }
-
- }
-*/
- return $meter;
- }
-
- function read_single($meter_id)
- {
- $meter= $this->so->read_single($meter_id);
-
- if($meter['location_code'])
- {
- $solocation =
CreateObject($this->currentapp.'.solocation');
-
- $meter['location_data']
=$solocation->read_single($meter['location_code']);
- }
-
- if($meter['p_num'])
- {
- $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
- $category =
$soadmin_entity->read_single_category($meter['p_entity_id'],$meter['p_cat_id']);
-
-
$meter['p'][$meter['p_entity_id']]['p_num']=$meter['p_num'];
-
$meter['p'][$meter['p_entity_id']]['p_entity_id']=$meter['p_entity_id'];
-
$meter['p'][$meter['p_entity_id']]['p_cat_id']=$meter['p_cat_id'];
-
$meter['p'][$meter['p_entity_id']]['p_cat_name'] = $category['name'];
- }
-
- return $meter;
- }
-
- function check_meter_num($num)
- {
- return $this->so->check_meter_num($num);
- }
-
- function save($values,$action='')
- {
- while (is_array($values['location']) && list(,$value) =
each($values['location']))
- {
- if($value)
- {
- $location[] = $value;
- }
- }
-
- $values['location_code']=implode("-", $location);
-
- if ($action=='edit')
- {
- $receipt = $this->so->edit($values);
- }
- else
- {
- $receipt = $this->so->add($values);
- }
- return $receipt;
- }
-
- function delete($params)
- {
- if (is_array($params))
- {
- $this->so->delete($params[0]);
- }
- else
- {
- $this->so->delete($params);
- }
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 entity
+ * @version $Id: class.bometer.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bometer
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 bometer($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.someter');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','meter',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','meter');
+
+ $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'];
+ }
+
+ function get_category_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->get_category_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function read()
+ {
+ $meter = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id));
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+/* $cols_extra = $this->so->cols_extra;
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $solocation =
CreateObject($this->currentapp.'.solocation');
+
+ for ($i=0; $i<count($meter); $i++)
+ {
+ $meter[$i]['user'] =
$GLOBALS['phpgw']->accounts->id2name($meter[$i]['user_id']);
+ $meter[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($meter[$i]['entry_date'],$dateformat);
+
$location_data=$solocation->read_single($meter[$i]['location_code']);
+
+ for ($j=0;$j<count($cols_extra);$j++)
+ {
+ $meter[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
+ }
+
+ }
+*/
+ return $meter;
+ }
+
+ function read_single($meter_id)
+ {
+ $meter= $this->so->read_single($meter_id);
+
+ if($meter['location_code'])
+ {
+ $solocation =
CreateObject($this->currentapp.'.solocation');
+
+ $meter['location_data']
=$solocation->read_single($meter['location_code']);
+ }
+
+ if($meter['p_num'])
+ {
+ $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
+ $category =
$soadmin_entity->read_single_category($meter['p_entity_id'],$meter['p_cat_id']);
+
+
$meter['p'][$meter['p_entity_id']]['p_num']=$meter['p_num'];
+
$meter['p'][$meter['p_entity_id']]['p_entity_id']=$meter['p_entity_id'];
+
$meter['p'][$meter['p_entity_id']]['p_cat_id']=$meter['p_cat_id'];
+
$meter['p'][$meter['p_entity_id']]['p_cat_name'] = $category['name'];
+ }
+
+ return $meter;
+ }
+
+ function check_meter_num($num)
+ {
+ return $this->so->check_meter_num($num);
+ }
+
+ function save($values,$action='')
+ {
+ while (is_array($values['location']) && list(,$value) =
each($values['location']))
+ {
+ if($value)
+ {
+ $location[] = $value;
+ }
+ }
+
+ $values['location_code']=implode("-", $location);
+
+ if ($action=='edit')
+ {
+ $receipt = $this->so->edit($values);
+ }
+ else
+ {
+ $receipt = $this->so->add($values);
+ }
+ return $receipt;
+ }
+
+ function delete($params)
+ {
+ if (is_array($params))
+ {
+ $this->so->delete($params[0]);
+ }
+ else
+ {
+ $this->so->delete($params);
+ }
+ }
+
+ }
+?>
Index: property/inc/class.bop_of_town.inc.php
diff -u property/inc/class.bop_of_town.inc.php:1.6
property/inc/class.bop_of_town.inc.php:1.7
--- property/inc/class.bop_of_town.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bop_of_town.inc.php Fri Feb 3 12:05:49 2006
@@ -1,242 +1,242 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.bop_of_town.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bop_of_town
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $district_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 bop_of_town($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sop_of_town');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $district_id =
get_var('district_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- 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($district_id) && !empty($district_id))
- {
- $this->district_id = $district_id;
- }
- else
- {
- unset($this->district_id);
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
- function list_methods($_type='xmlrpc')
- {
- /*
- This handles introspection or discovery by the logged
in client,
- in which case the input might be an array. The
server always calls
- this function to fill the server dispatch map using a
string.
- */
- if (is_array($_type))
- {
- $_type = $_type['type'] ? $_type['type'] :
$_type[0];
- }
- switch($_type)
- {
- case 'xmlrpc':
- $xml_functions = array(
- 'read' => array(
- 'function' => 'read',
- 'signature' =>
array(array(xmlrpcInt,xmlrpcStruct)),
- 'docstring' =>
lang('Read a single entry by passing the id and fieldlist.')
- ),
- 'save' => array(
- 'function' => 'save',
- 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
- 'docstring' =>
lang('Update a single entry by passing the fields.')
- ),
- 'delete' => array(
- 'function' => 'delete',
- 'signature' =>
array(array(xmlrpcBoolean,xmlrpcInt)),
- 'docstring' =>
lang('Delete a single entry by passing the id.')
- ),
- 'list' => array(
- 'function' => '_list',
- 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
- 'docstring' =>
lang('Read a list of entries.')
- ),
- 'list_methods' => array(
- 'function' =>
'list_methods',
- 'signature' =>
array(array(xmlrpcStruct,xmlrpcString)),
- 'docstring' =>
lang('Read this list of methods.')
- )
- );
- return $xml_functions;
- break;
- case 'soap':
- return $this->soap_functions;
- break;
- default:
- return array();
- break;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','p_of_town',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','p_of_town');
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->district_id = $data['district_id'];
- }
-
- function check_perms($has, $needed)
- {
- return (!!($has & $needed) == True);
- }
-
-
- function read_district_name($district_id='')
- {
- return $this->so->read_district_name($district_id);
- }
-
-
- function read()
- {
- $p_of_town = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'district_id' =>
$this->district_id,'allrows'=>$this->allrows));
- $this->total_records = $this->so->total_records;
-
- return $p_of_town;
- }
-
- function read_single($part_of_town_id)
- {
- return $this->so->read_single($part_of_town_id);
- }
-
- function save($p_of_town)
- {
-
- if ($p_of_town['part_of_town_id'])
- {
- if ($p_of_town['part_of_town_id'] != 0)
- {
- $part_of_town_id =
$p_of_town['part_of_town_id'];
- $receipt=$this->so->edit($p_of_town);
- }
- }
- else
- {
- $receipt = $this->so->add($p_of_town);
- }
- return $receipt;
- }
-
- function delete($params)
- {
- if (is_array($params))
- {
- $this->so->delete($params[0]);
- }
- else
- {
- $this->so->delete($params);
- }
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.bop_of_town.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bop_of_town
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $district_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 bop_of_town($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sop_of_town');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $district_id =
get_var('district_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ 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($district_id) && !empty($district_id))
+ {
+ $this->district_id = $district_id;
+ }
+ else
+ {
+ unset($this->district_id);
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+ function list_methods($_type='xmlrpc')
+ {
+ /*
+ This handles introspection or discovery by the logged
in client,
+ in which case the input might be an array. The
server always calls
+ this function to fill the server dispatch map using a
string.
+ */
+ if (is_array($_type))
+ {
+ $_type = $_type['type'] ? $_type['type'] :
$_type[0];
+ }
+ switch($_type)
+ {
+ case 'xmlrpc':
+ $xml_functions = array(
+ 'read' => array(
+ 'function' => 'read',
+ 'signature' =>
array(array(xmlrpcInt,xmlrpcStruct)),
+ 'docstring' =>
lang('Read a single entry by passing the id and fieldlist.')
+ ),
+ 'save' => array(
+ 'function' => 'save',
+ 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
+ 'docstring' =>
lang('Update a single entry by passing the fields.')
+ ),
+ 'delete' => array(
+ 'function' => 'delete',
+ 'signature' =>
array(array(xmlrpcBoolean,xmlrpcInt)),
+ 'docstring' =>
lang('Delete a single entry by passing the id.')
+ ),
+ 'list' => array(
+ 'function' => '_list',
+ 'signature' =>
array(array(xmlrpcStruct,xmlrpcStruct)),
+ 'docstring' =>
lang('Read a list of entries.')
+ ),
+ 'list_methods' => array(
+ 'function' =>
'list_methods',
+ 'signature' =>
array(array(xmlrpcStruct,xmlrpcString)),
+ 'docstring' =>
lang('Read this list of methods.')
+ )
+ );
+ return $xml_functions;
+ break;
+ case 'soap':
+ return $this->soap_functions;
+ break;
+ default:
+ return array();
+ break;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','p_of_town',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','p_of_town');
+
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->filter = $data['filter'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
+ $this->district_id = $data['district_id'];
+ }
+
+ function check_perms($has, $needed)
+ {
+ return (!!($has & $needed) == True);
+ }
+
+
+ function read_district_name($district_id='')
+ {
+ return $this->so->read_district_name($district_id);
+ }
+
+
+ function read()
+ {
+ $p_of_town = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'district_id' =>
$this->district_id,'allrows'=>$this->allrows));
+ $this->total_records = $this->so->total_records;
+
+ return $p_of_town;
+ }
+
+ function read_single($part_of_town_id)
+ {
+ return $this->so->read_single($part_of_town_id);
+ }
+
+ function save($p_of_town)
+ {
+
+ if ($p_of_town['part_of_town_id'])
+ {
+ if ($p_of_town['part_of_town_id'] != 0)
+ {
+ $part_of_town_id =
$p_of_town['part_of_town_id'];
+ $receipt=$this->so->edit($p_of_town);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($p_of_town);
+ }
+ return $receipt;
+ }
+
+ function delete($params)
+ {
+ if (is_array($params))
+ {
+ $this->so->delete($params[0]);
+ }
+ else
+ {
+ $this->so->delete($params);
+ }
+ }
+ }
+?>
Index: property/inc/class.bopricebook.inc.php
diff -u property/inc/class.bopricebook.inc.php:1.7
property/inc/class.bopricebook.inc.php:1.8
--- property/inc/class.bopricebook.inc.php:1.7 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bopricebook.inc.php Fri Feb 3 12:05:49 2006
@@ -1,565 +1,565 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 agreement
- * @version $Id: class.bopricebook.inc.php,v 1.7 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bopricebook
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 bopricebook($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sopricebook');
- $this->socommon =
CreateObject($this->currentapp.'.socommon');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','pricebook',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','pricebook');
-
- //_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'];
- }
-
-
- function select_status_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
- break;
- }
-
- $status_entries= $this->so->select_status_list();
-
- while (is_array($status_entries) && list(,$status) =
each($status_entries))
- {
- $sel_status = '';
- if ($status['id']==$selected)
- {
- $sel_status = 'selected';
- }
-
- $status_list[] = array
- (
- 'id' => $status['id'],
- 'name' => $status['name'],
- 'selected' => $sel_status
- );
- }
-
- for ($i=0;$i<count($status_list);$i++)
- {
- if ($status_list[$i]['selected'] != 'selected')
- {
- unset($status_list[$i]['selected']);
- }
- }
-
- return $status_list;
- }
-
- function read()
- {
- $pricebook = $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));
- $this->total_records = $this->so->total_records;
- return $pricebook;
- }
-
- function read_agreement_group()
- {
- $agreement_group =
$this->so->read_agreement_group(array('start' => $this->start,'query' =>
$this->query,'sort' => $this->sort,'order' => $this->order,
-
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows));
- $this->total_records = $this->so->total_records;
- return $agreement_group;
- }
-
- function read_activity_prize($activity_id,$vendor_id)
- {
- $pricebook =
$this->so->read_activity_prize(array('start' => $this->start,'query' =>
$this->query,'sort' => $this->sort,'order' => $this->order,
-
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows,'activity_id'=>$activity_id,'vendor_id'=>$vendor_id));
- $this->total_records = $this->so->total_records;
- return $pricebook;
- }
-
-
- function read_activities_pr_agreement_group()
- {
- $pricebook =
$this->so->read_activities_pr_agreement_group(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows));
- $this->total_records = $this->so->total_records;
- return $pricebook;
- }
-
- function read_vendor_pr_activity($activity_id)
- {
- $pricebook =
$this->so->read_vendor_pr_activity(array('start' => $this->start,'query' =>
$this->query,'sort' => $this->sort,'order' => $this->order,
-
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows,'activity_id'=>$activity_id));
- $this->total_records = $this->so->total_records;
- return $pricebook;
- }
-
- function add_activity_vendor($values)
- {
- return $this->so->add_activity_vendor($values);
- }
-
- function read_single_activity($id='')
- {
- return $this->so->read_single_activity($id);
- }
-
- function read_single_agreement_group($id='')
- {
- return $this->so->read_single_agreement_group($id);
- }
-
-
- function read_category_name($cat_id)
- {
- return $this->so->read_category_name($cat_id);
- }
-
- function update_pricebook($values)
- {
-
-//_debug_array($values);
-
$date_array=$this->bocommon->date_array($values['date']);
-
- $date = mktime
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
-// $date= date($this->bocommon->dateformat,$date);
-
- $new_index=str_replace(",",".",$values['new_index']);
-
- while(address@hidden($values['update']))
- {
- $n=$entry[0];
-
- if(!$values['old_total_cost'][$n])
- {
-
$new_total_cost=($values['old_m_cost'][$n]+$values['old_w_cost'][$n])*$new_index;
- }
- else
- {
-
$new_total_cost=$values['old_total_cost'][$n]*$new_index;
- }
-
- if(!$values['old_m_cost'][$n])
- {
- $new_m_cost=0;
- }
- else
- {
-
$new_m_cost=$values['old_m_cost'][$n]*$new_index;
- }
-
- if(!$values['old_w_cost'][$n])
- {
- $new_w_cost=0;
- }
- else
- {
-
$new_w_cost=$values['old_w_cost'][$n]*$new_index;
- }
-
- $update[]=array(
- 'new_m_cost' => $new_m_cost,
- 'new_w_cost' => $new_w_cost,
- 'new_total_cost' =>
$new_total_cost,
- 'activity_id' =>
$values['activity_id'][$n],
- 'vendor_id' =>
$values['vendor_id'][$n],
- 'new_index' =>
$new_index,
- 'new_date' =>
$date,
- );
-
- }
-//_debug_array($update);
-
- if($update)
- {
- $receipt =
$this->so->update_pricebook($update);
- }
- else
- {
- $receipt['message'][] =
array('msg'=>lang('Nothing to do!'));
- }
-
- return $receipt;
-
- }
-
- function add_activity_first_prize($values)
- {
-
-
$date_array=$this->bocommon->date_array($values['date']);
-
- $date = mktime
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
-// $date= date($this->bocommon->dateformat,$date);
-
- $m_cost =
str_replace(",",".",$values['m_cost']);
- $w_cost =
str_replace(",",".",$values['w_cost']);
- $total_cost = $m_cost + $w_cost;
- $activity_id = $values['activity_id'][0];
- $vendor_id = $values['vendor_id'][0];
-
- $receipt =
$this->so->add_activity_first_prize($m_cost,$w_cost,$total_cost,$activity_id,$vendor_id,$date);
-
- return $receipt;
- }
-
- function get_vendor_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $vendors= $this->so->get_vendor_list();
-
- while (is_array($vendors) && list(,$vendor_entry) =
each($vendors))
- {
- $sel_vendor_entry = '';
- if ($vendor_entry['id']==$selected)
- {
- $sel_vendor_entry = 'selected';
- }
-
- $vendor_list[] = array
- (
- 'cat_id' => $vendor_entry['id'],
- 'name' =>
$vendor_entry['name'],
- 'selected' => $sel_vendor_entry
- );
- }
-
- for ($i=0;$i<count($vendor_list);$i++)
- {
- if ($vendor_list[$i]['selected'] != 'selected')
- {
- unset($vendor_list[$i]['selected']);
- }
- }
-
- return $vendor_list;
- }
-
- function get_dim_d_list($selected='')
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('dim_d_select'));
-
- $dim_ds= $this->so->get_dim_d_list();
-
- while (is_array($dim_ds) && list(,$dim_d_entry) =
each($dim_ds))
- {
- $sel_dim_d_entry = '';
- if ($dim_d_entry['id']==$selected)
- {
- $sel_dim_d_entry = 'selected';
- }
-
- $dim_d_list[] = array
- (
- 'id' => $dim_d_entry['id'],
- 'name' => $dim_d_entry['name'],
- 'selected' => $sel_dim_d_entry
- );
- }
-
- for ($i=0;$i<count($dim_d_list);$i++)
- {
- if ($dim_d_list[$i]['selected'] != 'selected')
- {
- unset($dim_d_list[$i]['selected']);
- }
- }
-
- return $dim_d_list;
- }
-
- function get_unit_list($selected='')
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('unit_select'));
-
- $units= $this->so->get_unit_list();
-
- while (is_array($units) && list(,$unit_entry) =
each($units))
- {
- $sel_unit_entry = '';
- if ($unit_entry['id']==$selected)
- {
- $sel_unit_entry = 'selected';
- }
-
- $unit_list[] = array
- (
- 'id' => $unit_entry['id'],
- 'name' => $unit_entry['name'],
- 'selected' => $sel_unit_entry
- );
- }
-
- for ($i=0;$i<count($unit_list);$i++)
- {
- if ($unit_list[$i]['selected'] != 'selected')
- {
- unset($unit_list[$i]['selected']);
- }
- }
-
- return $unit_list;
- }
-
- function get_branch_list($selected='')
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('branch_select'));
-
- $branches= $this->so->get_branch_list();
-
- while (is_array($branches) && list(,$branch_entry) =
each($branches))
- {
- $sel_branch_entry = '';
- if ($branch_entry['id']==$selected)
- {
- $sel_branch_entry = 'selected';
- }
-
- $branch_list[] = array
- (
- 'id' => $branch_entry['id'],
- 'name' =>
$branch_entry['name'],
- 'selected' => $sel_branch_entry
- );
- }
-
- for ($i=0;$i<count($branch_list);$i++)
- {
- if ($branch_list[$i]['selected'] != 'selected')
- {
- unset($branch_list[$i]['selected']);
- }
- }
-
- return $branch_list;
- }
-
- function get_agreement_group_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $agreement_groups=
$this->so->get_agreement_group_list();
-
- while (is_array($agreement_groups) &&
list(,$agreement_group_entry) = each($agreement_groups))
- {
- $sel_agreement_group_entry = '';
- if ($agreement_group_entry['id']==$selected)
- {
- $sel_agreement_group_entry = 'selected';
- }
-
- $agreement_group_list[] = array
- (
- 'cat_id' =>
$agreement_group_entry['id'],
- 'name' =>
$agreement_group_entry['name'],
- 'selected' =>
$sel_agreement_group_entry
- );
- }
-
- for ($i=0;$i<count($agreement_group_list);$i++)
- {
- if ($agreement_group_list[$i]['selected'] !=
'selected')
- {
-
unset($agreement_group_list[$i]['selected']);
- }
- }
-
- return $agreement_group_list;
- }
-
-
- function check_activity_num($num='',$agreement_group_id='')
- {
- return
$this->so->check_activity_num($num,$agreement_group_id);
- }
-
- function save_activity($values,$action='')
- {
- if ($action=='edit')
- {
- $receipt = $this->so->edit_activity($values);
- }
- else
- {
-
$values['activity_id']=$this->socommon->next_id('fm_activities');
- $receipt = $this->so->add_activity($values);
- }
- return $receipt;
- }
-
- function check_agreement_group_num($num='')
- {
- return $this->so->check_agreement_group_num($num);
- }
-
- function save_agreement_group($values,$action='')
- {
- if ($action=='edit')
- {
- $receipt =
$this->so->edit_agreement_group($values);
- }
- else
- {
-
$values['agreement_group_id']=$this->socommon->next_id('fm_agreement_group');
- $receipt =
$this->so->add_agreement_group($values);
- }
- return $receipt;
- }
-
- function delete_activity_vendor($activity_id,$vendor_id)
- {
-
$this->so->delete_activity_vendor($activity_id,$vendor_id);
- }
-
- function delete_activity($activity_id)
- {
- $this->so->delete_activity($activity_id);
- }
-
- function
delete_prize_index($activity_id,$vendor_id,$index_count)
- {
-
$this->so->delete_prize_index($activity_id,$vendor_id,$index_count);
- }
-
- function delete_agreement_group($agreement_group_id)
- {
- $this->so->delete_agreement_group($agreement_group_id);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 agreement
+ * @version $Id: class.bopricebook.inc.php,v 1.8 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bopricebook
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 bopricebook($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sopricebook');
+ $this->socommon =
CreateObject($this->currentapp.'.socommon');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','pricebook',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','pricebook');
+
+ //_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'];
+ }
+
+
+ function select_status_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
+ break;
+ }
+
+ $status_entries= $this->so->select_status_list();
+
+ while (is_array($status_entries) && list(,$status) =
each($status_entries))
+ {
+ $sel_status = '';
+ if ($status['id']==$selected)
+ {
+ $sel_status = 'selected';
+ }
+
+ $status_list[] = array
+ (
+ 'id' => $status['id'],
+ 'name' => $status['name'],
+ 'selected' => $sel_status
+ );
+ }
+
+ for ($i=0;$i<count($status_list);$i++)
+ {
+ if ($status_list[$i]['selected'] != 'selected')
+ {
+ unset($status_list[$i]['selected']);
+ }
+ }
+
+ return $status_list;
+ }
+
+ function read()
+ {
+ $pricebook = $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));
+ $this->total_records = $this->so->total_records;
+ return $pricebook;
+ }
+
+ function read_agreement_group()
+ {
+ $agreement_group =
$this->so->read_agreement_group(array('start' => $this->start,'query' =>
$this->query,'sort' => $this->sort,'order' => $this->order,
+
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows));
+ $this->total_records = $this->so->total_records;
+ return $agreement_group;
+ }
+
+ function read_activity_prize($activity_id,$vendor_id)
+ {
+ $pricebook =
$this->so->read_activity_prize(array('start' => $this->start,'query' =>
$this->query,'sort' => $this->sort,'order' => $this->order,
+
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows,'activity_id'=>$activity_id,'vendor_id'=>$vendor_id));
+ $this->total_records = $this->so->total_records;
+ return $pricebook;
+ }
+
+
+ function read_activities_pr_agreement_group()
+ {
+ $pricebook =
$this->so->read_activities_pr_agreement_group(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows));
+ $this->total_records = $this->so->total_records;
+ return $pricebook;
+ }
+
+ function read_vendor_pr_activity($activity_id)
+ {
+ $pricebook =
$this->so->read_vendor_pr_activity(array('start' => $this->start,'query' =>
$this->query,'sort' => $this->sort,'order' => $this->order,
+
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows,'activity_id'=>$activity_id));
+ $this->total_records = $this->so->total_records;
+ return $pricebook;
+ }
+
+ function add_activity_vendor($values)
+ {
+ return $this->so->add_activity_vendor($values);
+ }
+
+ function read_single_activity($id='')
+ {
+ return $this->so->read_single_activity($id);
+ }
+
+ function read_single_agreement_group($id='')
+ {
+ return $this->so->read_single_agreement_group($id);
+ }
+
+
+ function read_category_name($cat_id)
+ {
+ return $this->so->read_category_name($cat_id);
+ }
+
+ function update_pricebook($values)
+ {
+
+//_debug_array($values);
+
$date_array=$this->bocommon->date_array($values['date']);
+
+ $date = mktime
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
+// $date= date($this->bocommon->dateformat,$date);
+
+ $new_index=str_replace(",",".",$values['new_index']);
+
+ while(address@hidden($values['update']))
+ {
+ $n=$entry[0];
+
+ if(!$values['old_total_cost'][$n])
+ {
+
$new_total_cost=($values['old_m_cost'][$n]+$values['old_w_cost'][$n])*$new_index;
+ }
+ else
+ {
+
$new_total_cost=$values['old_total_cost'][$n]*$new_index;
+ }
+
+ if(!$values['old_m_cost'][$n])
+ {
+ $new_m_cost=0;
+ }
+ else
+ {
+
$new_m_cost=$values['old_m_cost'][$n]*$new_index;
+ }
+
+ if(!$values['old_w_cost'][$n])
+ {
+ $new_w_cost=0;
+ }
+ else
+ {
+
$new_w_cost=$values['old_w_cost'][$n]*$new_index;
+ }
+
+ $update[]=array(
+ 'new_m_cost' => $new_m_cost,
+ 'new_w_cost' => $new_w_cost,
+ 'new_total_cost' =>
$new_total_cost,
+ 'activity_id' =>
$values['activity_id'][$n],
+ 'vendor_id' =>
$values['vendor_id'][$n],
+ 'new_index' =>
$new_index,
+ 'new_date' =>
$date,
+ );
+
+ }
+//_debug_array($update);
+
+ if($update)
+ {
+ $receipt =
$this->so->update_pricebook($update);
+ }
+ else
+ {
+ $receipt['message'][] =
array('msg'=>lang('Nothing to do!'));
+ }
+
+ return $receipt;
+
+ }
+
+ function add_activity_first_prize($values)
+ {
+
+
$date_array=$this->bocommon->date_array($values['date']);
+
+ $date = mktime
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
+// $date= date($this->bocommon->dateformat,$date);
+
+ $m_cost =
str_replace(",",".",$values['m_cost']);
+ $w_cost =
str_replace(",",".",$values['w_cost']);
+ $total_cost = $m_cost + $w_cost;
+ $activity_id = $values['activity_id'][0];
+ $vendor_id = $values['vendor_id'][0];
+
+ $receipt =
$this->so->add_activity_first_prize($m_cost,$w_cost,$total_cost,$activity_id,$vendor_id,$date);
+
+ return $receipt;
+ }
+
+ function get_vendor_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $vendors= $this->so->get_vendor_list();
+
+ while (is_array($vendors) && list(,$vendor_entry) =
each($vendors))
+ {
+ $sel_vendor_entry = '';
+ if ($vendor_entry['id']==$selected)
+ {
+ $sel_vendor_entry = 'selected';
+ }
+
+ $vendor_list[] = array
+ (
+ 'cat_id' => $vendor_entry['id'],
+ 'name' =>
$vendor_entry['name'],
+ 'selected' => $sel_vendor_entry
+ );
+ }
+
+ for ($i=0;$i<count($vendor_list);$i++)
+ {
+ if ($vendor_list[$i]['selected'] != 'selected')
+ {
+ unset($vendor_list[$i]['selected']);
+ }
+ }
+
+ return $vendor_list;
+ }
+
+ function get_dim_d_list($selected='')
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('dim_d_select'));
+
+ $dim_ds= $this->so->get_dim_d_list();
+
+ while (is_array($dim_ds) && list(,$dim_d_entry) =
each($dim_ds))
+ {
+ $sel_dim_d_entry = '';
+ if ($dim_d_entry['id']==$selected)
+ {
+ $sel_dim_d_entry = 'selected';
+ }
+
+ $dim_d_list[] = array
+ (
+ 'id' => $dim_d_entry['id'],
+ 'name' => $dim_d_entry['name'],
+ 'selected' => $sel_dim_d_entry
+ );
+ }
+
+ for ($i=0;$i<count($dim_d_list);$i++)
+ {
+ if ($dim_d_list[$i]['selected'] != 'selected')
+ {
+ unset($dim_d_list[$i]['selected']);
+ }
+ }
+
+ return $dim_d_list;
+ }
+
+ function get_unit_list($selected='')
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('unit_select'));
+
+ $units= $this->so->get_unit_list();
+
+ while (is_array($units) && list(,$unit_entry) =
each($units))
+ {
+ $sel_unit_entry = '';
+ if ($unit_entry['id']==$selected)
+ {
+ $sel_unit_entry = 'selected';
+ }
+
+ $unit_list[] = array
+ (
+ 'id' => $unit_entry['id'],
+ 'name' => $unit_entry['name'],
+ 'selected' => $sel_unit_entry
+ );
+ }
+
+ for ($i=0;$i<count($unit_list);$i++)
+ {
+ if ($unit_list[$i]['selected'] != 'selected')
+ {
+ unset($unit_list[$i]['selected']);
+ }
+ }
+
+ return $unit_list;
+ }
+
+ function get_branch_list($selected='')
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('branch_select'));
+
+ $branches= $this->so->get_branch_list();
+
+ while (is_array($branches) && list(,$branch_entry) =
each($branches))
+ {
+ $sel_branch_entry = '';
+ if ($branch_entry['id']==$selected)
+ {
+ $sel_branch_entry = 'selected';
+ }
+
+ $branch_list[] = array
+ (
+ 'id' => $branch_entry['id'],
+ 'name' =>
$branch_entry['name'],
+ 'selected' => $sel_branch_entry
+ );
+ }
+
+ for ($i=0;$i<count($branch_list);$i++)
+ {
+ if ($branch_list[$i]['selected'] != 'selected')
+ {
+ unset($branch_list[$i]['selected']);
+ }
+ }
+
+ return $branch_list;
+ }
+
+ function get_agreement_group_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $agreement_groups=
$this->so->get_agreement_group_list();
+
+ while (is_array($agreement_groups) &&
list(,$agreement_group_entry) = each($agreement_groups))
+ {
+ $sel_agreement_group_entry = '';
+ if ($agreement_group_entry['id']==$selected)
+ {
+ $sel_agreement_group_entry = 'selected';
+ }
+
+ $agreement_group_list[] = array
+ (
+ 'cat_id' =>
$agreement_group_entry['id'],
+ 'name' =>
$agreement_group_entry['name'],
+ 'selected' =>
$sel_agreement_group_entry
+ );
+ }
+
+ for ($i=0;$i<count($agreement_group_list);$i++)
+ {
+ if ($agreement_group_list[$i]['selected'] !=
'selected')
+ {
+
unset($agreement_group_list[$i]['selected']);
+ }
+ }
+
+ return $agreement_group_list;
+ }
+
+
+ function check_activity_num($num='',$agreement_group_id='')
+ {
+ return
$this->so->check_activity_num($num,$agreement_group_id);
+ }
+
+ function save_activity($values,$action='')
+ {
+ if ($action=='edit')
+ {
+ $receipt = $this->so->edit_activity($values);
+ }
+ else
+ {
+
$values['activity_id']=$this->socommon->next_id('fm_activities');
+ $receipt = $this->so->add_activity($values);
+ }
+ return $receipt;
+ }
+
+ function check_agreement_group_num($num='')
+ {
+ return $this->so->check_agreement_group_num($num);
+ }
+
+ function save_agreement_group($values,$action='')
+ {
+ if ($action=='edit')
+ {
+ $receipt =
$this->so->edit_agreement_group($values);
+ }
+ else
+ {
+
$values['agreement_group_id']=$this->socommon->next_id('fm_agreement_group');
+ $receipt =
$this->so->add_agreement_group($values);
+ }
+ return $receipt;
+ }
+
+ function delete_activity_vendor($activity_id,$vendor_id)
+ {
+
$this->so->delete_activity_vendor($activity_id,$vendor_id);
+ }
+
+ function delete_activity($activity_id)
+ {
+ $this->so->delete_activity($activity_id);
+ }
+
+ function
delete_prize_index($activity_id,$vendor_id,$index_count)
+ {
+
$this->so->delete_prize_index($activity_id,$vendor_id,$index_count);
+ }
+
+ function delete_agreement_group($agreement_group_id)
+ {
+ $this->so->delete_agreement_group($agreement_group_id);
+ }
+ }
+?>
Index: property/inc/class.boproject.inc.php
diff -u property/inc/class.boproject.inc.php:1.13
property/inc/class.boproject.inc.php:1.14
--- property/inc/class.boproject.inc.php:1.13 Fri Jan 27 14:05:43 2006
+++ property/inc/class.boproject.inc.php Fri Feb 3 12:05:49 2006
@@ -1,575 +1,575 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.boproject.inc.php,v 1.13 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boproject
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function boproject($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.soproject');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->solocation =
CreateObject($this->currentapp.'.solocation');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $status_id =
get_var('status_id',array('POST','GET'));
- $wo_hour_cat_id =
get_var('wo_hour_cat_id',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(isset($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($status_id))
- {
- $this->status_id = $status_id;
- }
- if(isset($wo_hour_cat_id))
- {
- $this->wo_hour_cat_id = $wo_hour_cat_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','project',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','project');
-
- $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->status_id = $data['status_id'];
- $this->wo_hour_cat_id = $data['wo_hour_cat_id'];
- }
-
- function select_status_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
- break;
- }
-
- $status_entries= $this->so->select_status_list();
-
- while (is_array($status_entries) && list(,$status) =
each($status_entries))
- {
- $sel_status = '';
- if ($status['id']==$selected)
- {
- $sel_status = 'selected';
- }
-
- $status_list[] = array
- (
- 'id' => $status['id'],
- 'name' => $status['name'],
- 'selected' => $sel_status
- );
- }
-
- for ($i=0;$i<count($status_list);$i++)
- {
- if ($status_list[$i]['selected'] != 'selected')
- {
- unset($status_list[$i]['selected']);
- }
- }
-
- return $status_list;
- }
-
- function select_branch_list($selected='')
- {
-
- $branch_entries= $this->so->select_branch_list();
-
- while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
- {
- $sel_branch = '';
- if ($branch['id']==$selected)
- {
- $sel_branch = 'selected';
- }
-
- $branch_list[] = array
- (
- 'id' => $branch['id'],
- 'name' => $branch['name'],
- 'selected' => $sel_branch
- );
- }
-
- for ($i=0;$i<count($branch_list);$i++)
- {
- if ($branch_list[$i]['selected'] != 'selected')
- {
- unset($branch_list[$i]['selected']);
- }
- }
-
- return $branch_list;
- }
-
- function select_branch_p_list($project_id='')
- {
-
- $selected =
$this->so->branch_p_list($project_id);
- $branch_entries = $this->so->select_branch_list();
-
- $j=0;
- while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
- {
- $branch_list[$j]['id'] = $branch['id'];
- $branch_list[$j]['name'] = $branch['name'];
-
- for ($i=0;$i<count($selected);$i++)
- {
- if($selected[$i]['branch_id'] ==
$branch['id'])
- {
- $branch_list[$j]['selected'] =
'selected';
- }
- }
- $j++;
- }
-
- for ($i=0;$i<count($branch_list);$i++)
- {
- if ($branch_list[$i]['selected'] != 'selected')
- {
- unset($branch_list[$i]['selected']);
- }
- }
-
- return $branch_list;
- }
-
-
- function select_key_location_list($selected='')
- {
-
- $key_location_entries=
$this->so->select_key_location_list();
-
- while (is_array($key_location_entries) &&
list(,$key_location) = each($key_location_entries))
- {
- $sel_key_location = '';
- if ($key_location['id']==$selected)
- {
- $sel_key_location = 'selected';
- }
-
- $key_location_list[] = array
- (
- 'id' => $key_location['id'],
- 'name' =>
$key_location['name'],
- 'selected' => $sel_key_location
- );
- }
-
- for ($i=0;$i<count($key_location_list);$i++)
- {
- if ($key_location_list[$i]['selected'] !=
'selected')
- {
-
unset($key_location_list[$i]['selected']);
- }
- }
-
- return $key_location_list;
- }
-
- function select_category_project_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories=
$this->so->select_category_workorder_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
-
- function read($start_date='',$end_date='',$allrows='')
- {
- $start_date =
$this->bocommon->date_to_timestamp($start_date);
- $end_date =
$this->bocommon->date_to_timestamp($end_date);
-
- $project = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,'wo_hour_cat_id' => $this->wo_hour_cat_id,
-
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$allrows));
- $this->total_records = $this->so->total_records;
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $this->uicols = $this->so->uicols;
- $this->uicols['input_type'][] = 'link';
- $this->uicols['name'][] = 'ticket_id';
- $this->uicols['descr'][] =
lang('ticket');
- $this->uicols['statustext'][] = false;
-
-// $cols_extra = $this->so->cols_extra;
-
- for ($i=0; $i<count($project); $i++)
- {
- $project[$i]['start_date'] =
$GLOBALS['phpgw']->common->show_date($project[$i]['start_date'],$dateformat);
- $project[$i]['ticket_id'] =
$this->so->get_ticket($project[$i]['project_id']);
-
-/*
$location_data=$this->solocation->read_single($project[$i]['location_code']);
-
- for ($j=0;$j<count($cols_extra);$j++)
- {
- $project[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
- }
-*/
- }
-
-//_debug_array($project);
-
- return $project;
- }
-
- function read_single($project_id)
- {
- $contacts =
CreateObject($this->currentapp.'.soactor');
- $contacts->role='vendor';
-
- $config =
CreateObject('phpgwapi.config');
- $config->read_repository();
- $tax = 1+($config->config_data['fm_tax'])/100;
-
- $project
= $this->so->read_single($project_id);
- $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $project['start_date'] =
$GLOBALS['phpgw']->common->show_date($project['start_date'],$dateformat);
- $project['end_date'] =
$GLOBALS['phpgw']->common->show_date($project['end_date'],$dateformat);
- $workorder_data =
$this->so->project_workorder_data($project_id);
-
- for ($i=0;$i<count($workorder_data);$i++)
- {
- $sum_workorder_budget=
$sum_workorder_budget+$workorder_data[$i]['budget'];
- $sum_deviation=
$sum_deviation+$workorder_data[$i]['deviation'];
- $sum_workorder_calculation=
$sum_workorder_calculation+$workorder_data[$i]['calculation'];
- $sum_workorder_actual_cost=
$sum_workorder_actual_cost+$workorder_data[$i]['act_mtrl_cost']+$workorder_data[$i]['act_vendor_cost'];
-
-
$project['workorder_budget'][$i]['workorder_id']=$workorder_data[$i]['workorder_id'];
-
$project['workorder_budget'][$i]['budget']=number_format($workorder_data[$i]['budget'],
2, ',', '');
-
$project['workorder_budget'][$i]['calculation']=number_format($workorder_data[$i]['calculation']*$tax,
2, ',', '');
-
$project['workorder_budget'][$i]['charge_tenant'] =
$workorder_data[$i]['charge_tenant'];
- $vendor =
$contacts->read_single(array('actor_id'=>(int)$workorder_data[$i]['vendor_id']));
- if(is_array($vendor))
- {
- foreach($vendor['attributes'] as
$attribute)
- {
-
if($attribute['name']=='org_name')
- {
-
$project['workorder_budget'][$i]['vendor_name']=$attribute['value'];
- break;
- }
- }
- }
- }
- if($workorder_data)
- {
- $project['sum_workorder_budget']=
number_format($sum_workorder_budget, 2, ',', '');
- $project['deviation']= $sum_deviation;
- $project['sum_workorder_calculation']=
number_format($sum_workorder_calculation*$tax, 2, ',', '');
- $project['sum_workorder_actual_cost']=
number_format($sum_workorder_actual_cost, 2, ',', '');
- }
-
- if($project['location_code'])
- {
- $project['location_data']
=$this->solocation->read_single($project['location_code']);
- }
-
- if($project['tenant_id']>0)
- {
-
$tenant_data=$this->bocommon->read_single_tenant($project['tenant_id']);
- $project['location_data']['tenant_id']=
$project['tenant_id'];
- $project['location_data']['contact_phone']=
$tenant_data['contact_phone'];
- $project['location_data']['last_name'] =
$tenant_data['last_name'];
- $project['location_data']['first_name'] =
$tenant_data['first_name'];
- }
- else
- {
- unset($project['location_data']['tenant_id']);
-
unset($project['location_data']['contact_phone']);
- unset($project['location_data']['last_name']);
- unset($project['location_data']['first_name']);
- }
-
- if($project['p_num'])
- {
- $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
- $category =
$soadmin_entity->read_single_category($project['p_entity_id'],$project['p_cat_id']);
-
-
$project['p'][$project['p_entity_id']]['p_num']=$project['p_num'];
-
$project['p'][$project['p_entity_id']]['p_entity_id']=$project['p_entity_id'];
-
$project['p'][$project['p_entity_id']]['p_cat_id']=$project['p_cat_id'];
-
$project['p'][$project['p_entity_id']]['p_cat_name'] = $category['name'];
- }
-
-
-//_debug_array($project);
- return $project;
- }
-
- function read_single_mini($project_id)
- {
- $project
= $this->so->read_single($project_id);
- $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $project['start_date'] =
$GLOBALS['phpgw']->common->show_date($project['start_date'],$dateformat);
- $project['end_date'] =
$GLOBALS['phpgw']->common->show_date($project['end_date'],$dateformat);
-
- if($project['location_code'])
- {
- $project['location_data']
=$this->solocation->read_single($project['location_code']);
- }
-
- if($project['tenant_id']>0)
- {
-
$tenant_data=$this->bocommon->read_single_tenant($project['tenant_id']);
- $project['location_data']['tenant_id']=
$project['tenant_id'];
- $project['location_data']['contact_phone']=
$tenant_data['contact_phone'];
- $project['location_data']['last_name'] =
$tenant_data['last_name'];
- $project['location_data']['first_name'] =
$tenant_data['first_name'];
- }
- else
- {
- unset($project['location_data']['tenant_id']);
-
unset($project['location_data']['contact_phone']);
- unset($project['location_data']['last_name']);
- unset($project['location_data']['first_name']);
- }
-
-//_debug_array($project);
- return $project;
- }
-
-
- function read_record_history($id)
- {
- $historylog =
CreateObject($this->currentapp.'.historylog','project');
- $history_array =
$historylog->return_array(array('O'),array(),'','',$id);
- $i=0;
- while (is_array($history_array) && list(,$value) =
each($history_array))
- {
-
- $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
- $record_history[$i]['value_user'] =
$value['owner'];
-
- switch ($value['status'])
- {
- case 'R': $type = lang('Re-opened');
break;
- case 'X': $type = lang('Closed');
break;
- case 'O': $type = lang('Opened');
break;
- case 'A': $type = lang('Re-assigned');
break;
- case 'P': $type = lang('Priority
changed'); break;
- case 'CO': $type = lang('Initial
Coordinator'); break;
- case 'C': $type = lang('Coordinator
changed'); break;
- case 'TO': $type = lang('Initial
Category'); break;
- case 'T': $type = lang('Category
changed'); break;
- case 'SO': $type = lang('Initial
Status'); break;
- case 'S': $type = lang('Status
changed'); break;
- default: break;
- }
-
-
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
-
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
-
-
- $record_history[$i]['value_action'] =
$type?$type:'';
- unset($type);
-
- if ($value['status'] == 'A')
- {
- if (! $value['new_value'])
- {
-
$record_history[$i]['value_new_value'] = lang('None');
- }
- else
- {
-
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- }
- else if ($value['status'] == 'C' ||
$value['status'] == 'CO')
- {
- $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
- {
- $record_history[$i]['value_new_value']
= $this->so->read_single_project_category($value['new_value']);
- }
- else if ($value['status'] != 'O' &&
$value['new_value'])
- {
- $record_history[$i]['value_new_value']
= $value['new_value'];
- }
- else
- {
- $record_history[$i]['value_new_value']
= '';
- }
-
- $i++;
- }
-
- return $record_history;
- }
-
-
- function next_project_id()
- {
- return $this->so->next_project_id();
- }
-
- function save($project,$action='')
- {
-
-//_debug_array($project);
- while (is_array($project['location']) && list(,$value)
= each($project['location']))
- {
- if($value)
- {
- $location[] = $value;
- }
- }
-
- $project['location_code']=implode("-", $location);
-
- $start_date =
$this->bocommon->date_array($project['start_date']);
- $end_date =
$this->bocommon->date_array($project['end_date']);
-
- $project['start_date'] = mktime
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
- $project['end_date'] = mktime
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
-
-
- if ($action=='edit')
- {
- $receipt = $this->so->edit($project);
- }
- else
- {
- $receipt = $this->so->add($project);
- }
- return $receipt;
- }
-
- function add_request($add_request,$id)
- {
-
- return $this->so->add_request($add_request,$id);
- }
-
- function delete($project_id)
- {
- $this->so->delete($project_id);
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.boproject.inc.php,v 1.14 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boproject
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function boproject($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.soproject');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->solocation =
CreateObject($this->currentapp.'.solocation');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $status_id =
get_var('status_id',array('POST','GET'));
+ $wo_hour_cat_id =
get_var('wo_hour_cat_id',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(isset($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($status_id))
+ {
+ $this->status_id = $status_id;
+ }
+ if(isset($wo_hour_cat_id))
+ {
+ $this->wo_hour_cat_id = $wo_hour_cat_id;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','project',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','project');
+
+ $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->status_id = $data['status_id'];
+ $this->wo_hour_cat_id = $data['wo_hour_cat_id'];
+ }
+
+ function select_status_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
+ break;
+ }
+
+ $status_entries= $this->so->select_status_list();
+
+ while (is_array($status_entries) && list(,$status) =
each($status_entries))
+ {
+ $sel_status = '';
+ if ($status['id']==$selected)
+ {
+ $sel_status = 'selected';
+ }
+
+ $status_list[] = array
+ (
+ 'id' => $status['id'],
+ 'name' => $status['name'],
+ 'selected' => $sel_status
+ );
+ }
+
+ for ($i=0;$i<count($status_list);$i++)
+ {
+ if ($status_list[$i]['selected'] != 'selected')
+ {
+ unset($status_list[$i]['selected']);
+ }
+ }
+
+ return $status_list;
+ }
+
+ function select_branch_list($selected='')
+ {
+
+ $branch_entries= $this->so->select_branch_list();
+
+ while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
+ {
+ $sel_branch = '';
+ if ($branch['id']==$selected)
+ {
+ $sel_branch = 'selected';
+ }
+
+ $branch_list[] = array
+ (
+ 'id' => $branch['id'],
+ 'name' => $branch['name'],
+ 'selected' => $sel_branch
+ );
+ }
+
+ for ($i=0;$i<count($branch_list);$i++)
+ {
+ if ($branch_list[$i]['selected'] != 'selected')
+ {
+ unset($branch_list[$i]['selected']);
+ }
+ }
+
+ return $branch_list;
+ }
+
+ function select_branch_p_list($project_id='')
+ {
+
+ $selected =
$this->so->branch_p_list($project_id);
+ $branch_entries = $this->so->select_branch_list();
+
+ $j=0;
+ while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
+ {
+ $branch_list[$j]['id'] = $branch['id'];
+ $branch_list[$j]['name'] = $branch['name'];
+
+ for ($i=0;$i<count($selected);$i++)
+ {
+ if($selected[$i]['branch_id'] ==
$branch['id'])
+ {
+ $branch_list[$j]['selected'] =
'selected';
+ }
+ }
+ $j++;
+ }
+
+ for ($i=0;$i<count($branch_list);$i++)
+ {
+ if ($branch_list[$i]['selected'] != 'selected')
+ {
+ unset($branch_list[$i]['selected']);
+ }
+ }
+
+ return $branch_list;
+ }
+
+
+ function select_key_location_list($selected='')
+ {
+
+ $key_location_entries=
$this->so->select_key_location_list();
+
+ while (is_array($key_location_entries) &&
list(,$key_location) = each($key_location_entries))
+ {
+ $sel_key_location = '';
+ if ($key_location['id']==$selected)
+ {
+ $sel_key_location = 'selected';
+ }
+
+ $key_location_list[] = array
+ (
+ 'id' => $key_location['id'],
+ 'name' =>
$key_location['name'],
+ 'selected' => $sel_key_location
+ );
+ }
+
+ for ($i=0;$i<count($key_location_list);$i++)
+ {
+ if ($key_location_list[$i]['selected'] !=
'selected')
+ {
+
unset($key_location_list[$i]['selected']);
+ }
+ }
+
+ return $key_location_list;
+ }
+
+ function select_category_project_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories=
$this->so->select_category_workorder_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+
+ function read($start_date='',$end_date='',$allrows='')
+ {
+ $start_date =
$this->bocommon->date_to_timestamp($start_date);
+ $end_date =
$this->bocommon->date_to_timestamp($end_date);
+
+ $project = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,'wo_hour_cat_id' => $this->wo_hour_cat_id,
+
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$allrows));
+ $this->total_records = $this->so->total_records;
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ $this->uicols = $this->so->uicols;
+ $this->uicols['input_type'][] = 'link';
+ $this->uicols['name'][] = 'ticket_id';
+ $this->uicols['descr'][] =
lang('ticket');
+ $this->uicols['statustext'][] = false;
+
+// $cols_extra = $this->so->cols_extra;
+
+ for ($i=0; $i<count($project); $i++)
+ {
+ $project[$i]['start_date'] =
$GLOBALS['phpgw']->common->show_date($project[$i]['start_date'],$dateformat);
+ $project[$i]['ticket_id'] =
$this->so->get_ticket($project[$i]['project_id']);
+
+/*
$location_data=$this->solocation->read_single($project[$i]['location_code']);
+
+ for ($j=0;$j<count($cols_extra);$j++)
+ {
+ $project[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
+ }
+*/
+ }
+
+//_debug_array($project);
+
+ return $project;
+ }
+
+ function read_single($project_id)
+ {
+ $contacts =
CreateObject($this->currentapp.'.soactor');
+ $contacts->role='vendor';
+
+ $config =
CreateObject('phpgwapi.config');
+ $config->read_repository();
+ $tax = 1+($config->config_data['fm_tax'])/100;
+
+ $project
= $this->so->read_single($project_id);
+ $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $project['start_date'] =
$GLOBALS['phpgw']->common->show_date($project['start_date'],$dateformat);
+ $project['end_date'] =
$GLOBALS['phpgw']->common->show_date($project['end_date'],$dateformat);
+ $workorder_data =
$this->so->project_workorder_data($project_id);
+
+ for ($i=0;$i<count($workorder_data);$i++)
+ {
+ $sum_workorder_budget=
$sum_workorder_budget+$workorder_data[$i]['budget'];
+ $sum_deviation=
$sum_deviation+$workorder_data[$i]['deviation'];
+ $sum_workorder_calculation=
$sum_workorder_calculation+$workorder_data[$i]['calculation'];
+ $sum_workorder_actual_cost=
$sum_workorder_actual_cost+$workorder_data[$i]['act_mtrl_cost']+$workorder_data[$i]['act_vendor_cost'];
+
+
$project['workorder_budget'][$i]['workorder_id']=$workorder_data[$i]['workorder_id'];
+
$project['workorder_budget'][$i]['budget']=number_format($workorder_data[$i]['budget'],
2, ',', '');
+
$project['workorder_budget'][$i]['calculation']=number_format($workorder_data[$i]['calculation']*$tax,
2, ',', '');
+
$project['workorder_budget'][$i]['charge_tenant'] =
$workorder_data[$i]['charge_tenant'];
+ $vendor =
$contacts->read_single(array('actor_id'=>(int)$workorder_data[$i]['vendor_id']));
+ if(is_array($vendor))
+ {
+ foreach($vendor['attributes'] as
$attribute)
+ {
+
if($attribute['name']=='org_name')
+ {
+
$project['workorder_budget'][$i]['vendor_name']=$attribute['value'];
+ break;
+ }
+ }
+ }
+ }
+ if($workorder_data)
+ {
+ $project['sum_workorder_budget']=
number_format($sum_workorder_budget, 2, ',', '');
+ $project['deviation']= $sum_deviation;
+ $project['sum_workorder_calculation']=
number_format($sum_workorder_calculation*$tax, 2, ',', '');
+ $project['sum_workorder_actual_cost']=
number_format($sum_workorder_actual_cost, 2, ',', '');
+ }
+
+ if($project['location_code'])
+ {
+ $project['location_data']
=$this->solocation->read_single($project['location_code']);
+ }
+
+ if($project['tenant_id']>0)
+ {
+
$tenant_data=$this->bocommon->read_single_tenant($project['tenant_id']);
+ $project['location_data']['tenant_id']=
$project['tenant_id'];
+ $project['location_data']['contact_phone']=
$tenant_data['contact_phone'];
+ $project['location_data']['last_name'] =
$tenant_data['last_name'];
+ $project['location_data']['first_name'] =
$tenant_data['first_name'];
+ }
+ else
+ {
+ unset($project['location_data']['tenant_id']);
+
unset($project['location_data']['contact_phone']);
+ unset($project['location_data']['last_name']);
+ unset($project['location_data']['first_name']);
+ }
+
+ if($project['p_num'])
+ {
+ $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
+ $category =
$soadmin_entity->read_single_category($project['p_entity_id'],$project['p_cat_id']);
+
+
$project['p'][$project['p_entity_id']]['p_num']=$project['p_num'];
+
$project['p'][$project['p_entity_id']]['p_entity_id']=$project['p_entity_id'];
+
$project['p'][$project['p_entity_id']]['p_cat_id']=$project['p_cat_id'];
+
$project['p'][$project['p_entity_id']]['p_cat_name'] = $category['name'];
+ }
+
+
+//_debug_array($project);
+ return $project;
+ }
+
+ function read_single_mini($project_id)
+ {
+ $project
= $this->so->read_single($project_id);
+ $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $project['start_date'] =
$GLOBALS['phpgw']->common->show_date($project['start_date'],$dateformat);
+ $project['end_date'] =
$GLOBALS['phpgw']->common->show_date($project['end_date'],$dateformat);
+
+ if($project['location_code'])
+ {
+ $project['location_data']
=$this->solocation->read_single($project['location_code']);
+ }
+
+ if($project['tenant_id']>0)
+ {
+
$tenant_data=$this->bocommon->read_single_tenant($project['tenant_id']);
+ $project['location_data']['tenant_id']=
$project['tenant_id'];
+ $project['location_data']['contact_phone']=
$tenant_data['contact_phone'];
+ $project['location_data']['last_name'] =
$tenant_data['last_name'];
+ $project['location_data']['first_name'] =
$tenant_data['first_name'];
+ }
+ else
+ {
+ unset($project['location_data']['tenant_id']);
+
unset($project['location_data']['contact_phone']);
+ unset($project['location_data']['last_name']);
+ unset($project['location_data']['first_name']);
+ }
+
+//_debug_array($project);
+ return $project;
+ }
+
+
+ function read_record_history($id)
+ {
+ $historylog =
CreateObject($this->currentapp.'.historylog','project');
+ $history_array =
$historylog->return_array(array('O'),array(),'','',$id);
+ $i=0;
+ while (is_array($history_array) && list(,$value) =
each($history_array))
+ {
+
+ $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
+ $record_history[$i]['value_user'] =
$value['owner'];
+
+ switch ($value['status'])
+ {
+ case 'R': $type = lang('Re-opened');
break;
+ case 'X': $type = lang('Closed');
break;
+ case 'O': $type = lang('Opened');
break;
+ case 'A': $type = lang('Re-assigned');
break;
+ case 'P': $type = lang('Priority
changed'); break;
+ case 'CO': $type = lang('Initial
Coordinator'); break;
+ case 'C': $type = lang('Coordinator
changed'); break;
+ case 'TO': $type = lang('Initial
Category'); break;
+ case 'T': $type = lang('Category
changed'); break;
+ case 'SO': $type = lang('Initial
Status'); break;
+ case 'S': $type = lang('Status
changed'); break;
+ default: break;
+ }
+
+
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
+
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
+
+
+ $record_history[$i]['value_action'] =
$type?$type:'';
+ unset($type);
+
+ if ($value['status'] == 'A')
+ {
+ if (! $value['new_value'])
+ {
+
$record_history[$i]['value_new_value'] = lang('None');
+ }
+ else
+ {
+
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ }
+ else if ($value['status'] == 'C' ||
$value['status'] == 'CO')
+ {
+ $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
+ {
+ $record_history[$i]['value_new_value']
= $this->so->read_single_project_category($value['new_value']);
+ }
+ else if ($value['status'] != 'O' &&
$value['new_value'])
+ {
+ $record_history[$i]['value_new_value']
= $value['new_value'];
+ }
+ else
+ {
+ $record_history[$i]['value_new_value']
= '';
+ }
+
+ $i++;
+ }
+
+ return $record_history;
+ }
+
+
+ function next_project_id()
+ {
+ return $this->so->next_project_id();
+ }
+
+ function save($project,$action='')
+ {
+
+//_debug_array($project);
+ while (is_array($project['location']) && list(,$value)
= each($project['location']))
+ {
+ if($value)
+ {
+ $location[] = $value;
+ }
+ }
+
+ $project['location_code']=implode("-", $location);
+
+ $start_date =
$this->bocommon->date_array($project['start_date']);
+ $end_date =
$this->bocommon->date_array($project['end_date']);
+
+ $project['start_date'] = mktime
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
+ $project['end_date'] = mktime
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
+
+
+ if ($action=='edit')
+ {
+ $receipt = $this->so->edit($project);
+ }
+ else
+ {
+ $receipt = $this->so->add($project);
+ }
+ return $receipt;
+ }
+
+ function add_request($add_request,$id)
+ {
+
+ return $this->so->add_request($add_request,$id);
+ }
+
+ function delete($project_id)
+ {
+ $this->so->delete($project_id);
+ }
+
+ }
+?>
Index: property/inc/class.borequest.inc.php
diff -u property/inc/class.borequest.inc.php:1.9
property/inc/class.borequest.inc.php:1.10
--- property/inc/class.borequest.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.borequest.inc.php Fri Feb 3 12:05:49 2006
@@ -1,610 +1,610 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.borequest.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class borequest
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function borequest($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sorequest');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->solocation =
CreateObject($this->currentapp.'.solocation');
- $this->historylog =
CreateObject($this->currentapp.'.historylog','request');
- $this->vfs =
CreateObject('phpgwapi.vfs');
- $this->rootdir = $this->vfs->basedir;
- $this->fakebase = $this->vfs->fakebase;
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $status_id =
get_var('status_id',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(isset($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($status_id))
- {
- $this->status_id = $status_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','request',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','request');
-
- $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->status_id = $data['status_id'];
- }
-
-
- function create_home_dir($receipt='')
- {
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
'request',
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
-
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
'request',
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'request');
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'request');
- }
- $this->vfs->override_acl = 0;
- }
-
- return $receipt;
- }
-
- function create_document_dir($location_code='',$id='')
- {
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
'request' . SEP . $location_code,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
'request' . SEP . $location_code,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $location_code);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $location_code);
- }
- $this->vfs->override_acl = 0;
- }
-
-
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
'request' . SEP . $location_code . SEP . $id,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
'request' . SEP . $location_code . SEP . $id,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $location_code . SEP . $id);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $location_code . SEP . $id);
- }
- $this->vfs->override_acl = 0;
- }
-
-//_debug_array($receipt);
- return $receipt;
- }
-
-
- function
select_degree_list($degree_value='',$degreedefault_type='')
- {
- if ($degree_value)
- {
- $selected=$degree_value;
- }
- else
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp][$degreedefault_type];
- }
-
- $degree_comment[0]=' - '.lang('None');
- $degree_comment[1]=' - '.lang('Minor');
- $degree_comment[2]=' - '.lang('Medium');
- $degree_comment[3]=' - '.lang('Serious');
- for ($i=0; $i<=3; $i++)
- {
- $degree_list[$i][id] = $i;
- $degree_list[$i]['name'] = $i .
$degree_comment[$i];
- if ($i==$selected)
- {
- $degree_list[$i]['selected']=
'selected';
- }
- }
-
- return $degree_list;
- }
-
- function select_probability_list($probability_value='')
- {
- $selected=$probability_value;
-
- $probability_comment[1]=' - '.lang('Small');
- $probability_comment[2]=' - '.lang('Medium');
- $probability_comment[3]=' - '.lang('Large');
- for ($i=1; $i<=3; $i++)
- {
- $probability_list[$i][id] = $i;
- $probability_list[$i]['name'] = $i .
$probability_comment[$i];
- if ($i==$selected)
- {
- $probability_list[$i]['selected']=
'selected';
- }
- }
-
- return $probability_list;
- }
-
- function select_conditions($request_id='')
- {
- $condition_type_list =
$this->so->select_condition_type_list();
-
- if($request_id)
- {
- $conditions =
$this->so->select_conditions($request_id,$condition_type_list);
- }
-
- for ($i=0;$i<count($condition_type_list);$i++)
- {
- $conditions[$i]['degree'] =
$this->select_degree_list($conditions[$i]['degree']);
- $conditions[$i]['probability'] =
$this->select_probability_list($conditions[$i]['probability']);
- $conditions[$i]['consequence'] =
$this->select_consequence_list($conditions[$i]['consequence']);
- $conditions[$i]['condition_type'] =
$condition_type_list[$i]['id'];
- $conditions[$i]['condition_type_name'] =
$condition_type_list[$i]['name'];
- }
-
- return $conditions;
- }
-
- function
select_consequence_list($consequence_value='',$consequencedefault_type='')
- {
- if ($consequence_value)
- {
- $selected=$consequence_value;
- }
- else
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp][$consequencedefault_type];
- }
-
- $consequence_comment[0]=' - '.lang('None Consequences');
- $consequence_comment[1]=' - '.lang('Minor
Consequences');
- $consequence_comment[2]=' - '.lang('Medium
Consequences');
- $consequence_comment[3]=' - '.lang('Serious
Consequences');
- for ($i=0; $i<=3; $i++)
- {
- $consequence_list[$i][id] = $i;
- $consequence_list[$i]['name'] = $i .
$consequence_comment[$i];
- if ($i==$selected)
- {
- $consequence_list[$i]['selected']=
'selected';
- }
- }
-
- return $consequence_list;
- }
-
-
- function select_status_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
- break;
- }
-
- $status_entries= $this->so->select_status_list();
-
- while (is_array($status_entries) && list(,$status) =
each($status_entries))
- {
- $sel_status = '';
- if ($status['id']==$selected)
- {
- $sel_status = 'selected';
- }
-
- $status_list[] = array
- (
- 'id' => $status['id'],
- 'name' => $status['name'],
- 'selected' => $sel_status
- );
- }
-
- for ($i=0;$i<count($status_list);$i++)
- {
- if ($status_list[$i]['selected'] != 'selected')
- {
- unset($status_list[$i]['selected']);
- }
- }
-
- return $status_list;
- }
-
-
- function select_category_request_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories=
$this->so->select_category_workorder_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function read_priority_key()
- {
- return $this->so->read_priority_key();
- }
-
- function update_priority_key($values)
- {
- return $this->so->update_priority_key($values);
- }
-
- function read($project_id)
- {
- $request = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,'project_id' => $project_id));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
- $cols_extra = $this->so->cols_extra;
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- for ($i=0; $i<count($request); $i++)
- {
- $request[$i]['coordinator'] =
$GLOBALS['phpgw']->accounts->id2name($request[$i]['coordinator']);
- $request[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($request[$i]['entry_date'],$dateformat);
-
$location_data=$this->solocation->read_single($request[$i]['location_code']);
-
- for ($j=0;$j<count($cols_extra);$j++)
- {
- $request[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
- }
- }
-
- return $request;
- }
-
- function read_single($request_id)
- {
- $request
= $this->so->read_single($request_id);
- $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $request['start_date'] =
$GLOBALS['phpgw']->common->show_date($request['start_date'],$dateformat);
- $request['end_date'] =
$GLOBALS['phpgw']->common->show_date($request['end_date'],$dateformat);
-
- if($request['location_code'])
- {
- $request['location_data']
=$this->solocation->read_single($request['location_code']);
- }
-
- if($request['tenant_id']>0)
- {
-
$tenant_data=$this->bocommon->read_single_tenant($request['tenant_id']);
- $request['location_data']['tenant_id']=
$request['tenant_id'];
- $request['location_data']['contact_phone']=
$tenant_data['contact_phone'];
- $request['location_data']['last_name'] =
$tenant_data['last_name'];
- $request['location_data']['first_name'] =
$tenant_data['first_name'];
- }
- else
- {
- unset($request['location_data']['tenant_id']);
-
unset($request['location_data']['contact_phone']);
- unset($request['location_data']['last_name']);
- unset($request['location_data']['first_name']);
- }
-
- if($request['p_num'])
- {
- $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
- $category =
$soadmin_entity->read_single_category($request['p_entity_id'],$request['p_cat_id']);
-
-
$request['p'][$request['p_entity_id']]['p_num']=$request['p_num'];
-
$request['p'][$request['p_entity_id']]['p_entity_id']=$request['p_entity_id'];
-
$request['p'][$request['p_entity_id']]['p_cat_id']=$request['p_cat_id'];
-
$request['p'][$request['p_entity_id']]['p_cat_name'] = $category['name'];
- }
-
- $this->vfs->override_acl = 1;
-
- $request['files'] = $this->vfs->ls (array(
- 'string' => $this->fakebase. '/' . 'request' . '/'
. $request['location_code'] . '/' . $request_id,
- 'relatives' => array(RELATIVE_NONE)));
-
- $this->vfs->override_acl = 0;
-
- if(!$request['files'][0]['file_id'])
- {
- unset($request['files']);
- }
-
- return $request;
- }
-
-
- function read_record_history($id)
- {
- $history_array =
$this->historylog->return_array(array('O'),array(),'','',$id);
- $i=0;
- while (is_array($history_array) && list(,$value) =
each($history_array))
- {
-
- $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
- $record_history[$i]['value_user'] =
$value['owner'];
-
- switch ($value['status'])
- {
- case 'R': $type = lang('Re-opened');
break;
- case 'X': $type = lang('Closed');
break;
- case 'O': $type = lang('Opened');
break;
- case 'A': $type = lang('Re-assigned');
break;
- case 'P': $type = lang('Priority
changed'); break;
- case 'CO': $type = lang('Initial
Coordinator'); break;
- case 'C': $type = lang('Coordinator
changed'); break;
- case 'TO': $type = lang('Initial
Category'); break;
- case 'T': $type = lang('Category
changed'); break;
- case 'SO': $type = lang('Initial
Status'); break;
- case 'S': $type = lang('Status
changed'); break;
- default: break;
- }
-
-
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
-
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
-
-
- $record_history[$i]['value_action'] =
$type?$type:'';
- unset($type);
-
- if ($value['status'] == 'A')
- {
- if (! $value['new_value'])
- {
-
$record_history[$i]['value_new_value'] = lang('None');
- }
- else
- {
-
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- }
- else if ($value['status'] == 'C' ||
$value['status'] == 'CO')
- {
- $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
- {
- $record_history[$i]['value_new_value']
= $this->so->read_single_request_category($value['new_value']);
- }
- else if ($value['status'] != 'O' &&
$value['new_value'])
- {
- $record_history[$i]['value_new_value']
= $value['new_value'];
- }
- else
- {
- $record_history[$i]['value_new_value']
= '';
- }
-
- $i++;
- }
-
- return $record_history;
- }
-
-
- function next_id()
- {
- return $this->so->next_id();
- }
-
- function save($request,$action='')
- {
- while (is_array($request['location']) && list(,$value)
= each($request['location']))
- {
- if($value)
- {
- $location[] = $value;
- }
- }
-
- $request['location_code']=implode("-", $location);
- $start_date =
$this->bocommon->date_array($request['start_date']);
- $end_date =
$this->bocommon->date_array($request['end_date']);
-
- $request['start_date'] = mktime
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
- $request['end_date'] = mktime
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
-
- if ($action=='edit')
- {
- $receipt = $this->so->edit($request);
-
- if($request['delete_file'])
- {
- for
($i=0;$i<count($request['delete_file']);$i++)
- {
- $file = $this->fakebase. SEP .
'request' . SEP . $request['location_code'] . SEP . $request['request_id'] .
SEP . $request['delete_file'][$i];
-
-
if($this->vfs->file_exists(array(
- 'string' =>
$file,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
- {
-
$this->vfs->override_acl = 1;
-
- if(!$this->vfs->rm
(array(
- 'string' =>
$file,
- 'relatives' =>
array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $request['location_code']. SEP .
$request['request_id'] . SEP .$request['delete_file'][$i]);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $request['location_code']. SEP .
$request['request_id'] . SEP . $request['delete_file'][$i]);
- }
-
$this->vfs->override_acl = 0;
- }
- }
- }
-
- }
- else
- {
- $receipt = $this->so->add($request);
- }
- return $receipt;
- }
-
- function delete($request_id)
- {
- $this->so->delete($request_id);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.borequest.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class borequest
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function borequest($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sorequest');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->solocation =
CreateObject($this->currentapp.'.solocation');
+ $this->historylog =
CreateObject($this->currentapp.'.historylog','request');
+ $this->vfs =
CreateObject('phpgwapi.vfs');
+ $this->rootdir = $this->vfs->basedir;
+ $this->fakebase = $this->vfs->fakebase;
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $status_id =
get_var('status_id',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(isset($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($status_id))
+ {
+ $this->status_id = $status_id;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','request',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','request');
+
+ $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->status_id = $data['status_id'];
+ }
+
+
+ function create_home_dir($receipt='')
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'request',
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'request',
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'request');
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'request');
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+ return $receipt;
+ }
+
+ function create_document_dir($location_code='',$id='')
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'request' . SEP . $location_code,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'request' . SEP . $location_code,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $location_code);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $location_code);
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'request' . SEP . $location_code . SEP . $id,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'request' . SEP . $location_code . SEP . $id,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $location_code . SEP . $id);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $location_code . SEP . $id);
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+//_debug_array($receipt);
+ return $receipt;
+ }
+
+
+ function
select_degree_list($degree_value='',$degreedefault_type='')
+ {
+ if ($degree_value)
+ {
+ $selected=$degree_value;
+ }
+ else
+ {
+
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp][$degreedefault_type];
+ }
+
+ $degree_comment[0]=' - '.lang('None');
+ $degree_comment[1]=' - '.lang('Minor');
+ $degree_comment[2]=' - '.lang('Medium');
+ $degree_comment[3]=' - '.lang('Serious');
+ for ($i=0; $i<=3; $i++)
+ {
+ $degree_list[$i][id] = $i;
+ $degree_list[$i]['name'] = $i .
$degree_comment[$i];
+ if ($i==$selected)
+ {
+ $degree_list[$i]['selected']=
'selected';
+ }
+ }
+
+ return $degree_list;
+ }
+
+ function select_probability_list($probability_value='')
+ {
+ $selected=$probability_value;
+
+ $probability_comment[1]=' - '.lang('Small');
+ $probability_comment[2]=' - '.lang('Medium');
+ $probability_comment[3]=' - '.lang('Large');
+ for ($i=1; $i<=3; $i++)
+ {
+ $probability_list[$i][id] = $i;
+ $probability_list[$i]['name'] = $i .
$probability_comment[$i];
+ if ($i==$selected)
+ {
+ $probability_list[$i]['selected']=
'selected';
+ }
+ }
+
+ return $probability_list;
+ }
+
+ function select_conditions($request_id='')
+ {
+ $condition_type_list =
$this->so->select_condition_type_list();
+
+ if($request_id)
+ {
+ $conditions =
$this->so->select_conditions($request_id,$condition_type_list);
+ }
+
+ for ($i=0;$i<count($condition_type_list);$i++)
+ {
+ $conditions[$i]['degree'] =
$this->select_degree_list($conditions[$i]['degree']);
+ $conditions[$i]['probability'] =
$this->select_probability_list($conditions[$i]['probability']);
+ $conditions[$i]['consequence'] =
$this->select_consequence_list($conditions[$i]['consequence']);
+ $conditions[$i]['condition_type'] =
$condition_type_list[$i]['id'];
+ $conditions[$i]['condition_type_name'] =
$condition_type_list[$i]['name'];
+ }
+
+ return $conditions;
+ }
+
+ function
select_consequence_list($consequence_value='',$consequencedefault_type='')
+ {
+ if ($consequence_value)
+ {
+ $selected=$consequence_value;
+ }
+ else
+ {
+
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp][$consequencedefault_type];
+ }
+
+ $consequence_comment[0]=' - '.lang('None Consequences');
+ $consequence_comment[1]=' - '.lang('Minor
Consequences');
+ $consequence_comment[2]=' - '.lang('Medium
Consequences');
+ $consequence_comment[3]=' - '.lang('Serious
Consequences');
+ for ($i=0; $i<=3; $i++)
+ {
+ $consequence_list[$i][id] = $i;
+ $consequence_list[$i]['name'] = $i .
$consequence_comment[$i];
+ if ($i==$selected)
+ {
+ $consequence_list[$i]['selected']=
'selected';
+ }
+ }
+
+ return $consequence_list;
+ }
+
+
+ function select_status_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
+ break;
+ }
+
+ $status_entries= $this->so->select_status_list();
+
+ while (is_array($status_entries) && list(,$status) =
each($status_entries))
+ {
+ $sel_status = '';
+ if ($status['id']==$selected)
+ {
+ $sel_status = 'selected';
+ }
+
+ $status_list[] = array
+ (
+ 'id' => $status['id'],
+ 'name' => $status['name'],
+ 'selected' => $sel_status
+ );
+ }
+
+ for ($i=0;$i<count($status_list);$i++)
+ {
+ if ($status_list[$i]['selected'] != 'selected')
+ {
+ unset($status_list[$i]['selected']);
+ }
+ }
+
+ return $status_list;
+ }
+
+
+ function select_category_request_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories=
$this->so->select_category_workorder_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function read_priority_key()
+ {
+ return $this->so->read_priority_key();
+ }
+
+ function update_priority_key($values)
+ {
+ return $this->so->update_priority_key($values);
+ }
+
+ function read($project_id)
+ {
+ $request = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,'project_id' => $project_id));
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+ $cols_extra = $this->so->cols_extra;
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ for ($i=0; $i<count($request); $i++)
+ {
+ $request[$i]['coordinator'] =
$GLOBALS['phpgw']->accounts->id2name($request[$i]['coordinator']);
+ $request[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($request[$i]['entry_date'],$dateformat);
+
$location_data=$this->solocation->read_single($request[$i]['location_code']);
+
+ for ($j=0;$j<count($cols_extra);$j++)
+ {
+ $request[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
+ }
+ }
+
+ return $request;
+ }
+
+ function read_single($request_id)
+ {
+ $request
= $this->so->read_single($request_id);
+ $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $request['start_date'] =
$GLOBALS['phpgw']->common->show_date($request['start_date'],$dateformat);
+ $request['end_date'] =
$GLOBALS['phpgw']->common->show_date($request['end_date'],$dateformat);
+
+ if($request['location_code'])
+ {
+ $request['location_data']
=$this->solocation->read_single($request['location_code']);
+ }
+
+ if($request['tenant_id']>0)
+ {
+
$tenant_data=$this->bocommon->read_single_tenant($request['tenant_id']);
+ $request['location_data']['tenant_id']=
$request['tenant_id'];
+ $request['location_data']['contact_phone']=
$tenant_data['contact_phone'];
+ $request['location_data']['last_name'] =
$tenant_data['last_name'];
+ $request['location_data']['first_name'] =
$tenant_data['first_name'];
+ }
+ else
+ {
+ unset($request['location_data']['tenant_id']);
+
unset($request['location_data']['contact_phone']);
+ unset($request['location_data']['last_name']);
+ unset($request['location_data']['first_name']);
+ }
+
+ if($request['p_num'])
+ {
+ $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
+ $category =
$soadmin_entity->read_single_category($request['p_entity_id'],$request['p_cat_id']);
+
+
$request['p'][$request['p_entity_id']]['p_num']=$request['p_num'];
+
$request['p'][$request['p_entity_id']]['p_entity_id']=$request['p_entity_id'];
+
$request['p'][$request['p_entity_id']]['p_cat_id']=$request['p_cat_id'];
+
$request['p'][$request['p_entity_id']]['p_cat_name'] = $category['name'];
+ }
+
+ $this->vfs->override_acl = 1;
+
+ $request['files'] = $this->vfs->ls (array(
+ 'string' => $this->fakebase. '/' . 'request' . '/'
. $request['location_code'] . '/' . $request_id,
+ 'relatives' => array(RELATIVE_NONE)));
+
+ $this->vfs->override_acl = 0;
+
+ if(!$request['files'][0]['file_id'])
+ {
+ unset($request['files']);
+ }
+
+ return $request;
+ }
+
+
+ function read_record_history($id)
+ {
+ $history_array =
$this->historylog->return_array(array('O'),array(),'','',$id);
+ $i=0;
+ while (is_array($history_array) && list(,$value) =
each($history_array))
+ {
+
+ $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
+ $record_history[$i]['value_user'] =
$value['owner'];
+
+ switch ($value['status'])
+ {
+ case 'R': $type = lang('Re-opened');
break;
+ case 'X': $type = lang('Closed');
break;
+ case 'O': $type = lang('Opened');
break;
+ case 'A': $type = lang('Re-assigned');
break;
+ case 'P': $type = lang('Priority
changed'); break;
+ case 'CO': $type = lang('Initial
Coordinator'); break;
+ case 'C': $type = lang('Coordinator
changed'); break;
+ case 'TO': $type = lang('Initial
Category'); break;
+ case 'T': $type = lang('Category
changed'); break;
+ case 'SO': $type = lang('Initial
Status'); break;
+ case 'S': $type = lang('Status
changed'); break;
+ default: break;
+ }
+
+
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
+
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
+
+
+ $record_history[$i]['value_action'] =
$type?$type:'';
+ unset($type);
+
+ if ($value['status'] == 'A')
+ {
+ if (! $value['new_value'])
+ {
+
$record_history[$i]['value_new_value'] = lang('None');
+ }
+ else
+ {
+
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ }
+ else if ($value['status'] == 'C' ||
$value['status'] == 'CO')
+ {
+ $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
+ {
+ $record_history[$i]['value_new_value']
= $this->so->read_single_request_category($value['new_value']);
+ }
+ else if ($value['status'] != 'O' &&
$value['new_value'])
+ {
+ $record_history[$i]['value_new_value']
= $value['new_value'];
+ }
+ else
+ {
+ $record_history[$i]['value_new_value']
= '';
+ }
+
+ $i++;
+ }
+
+ return $record_history;
+ }
+
+
+ function next_id()
+ {
+ return $this->so->next_id();
+ }
+
+ function save($request,$action='')
+ {
+ while (is_array($request['location']) && list(,$value)
= each($request['location']))
+ {
+ if($value)
+ {
+ $location[] = $value;
+ }
+ }
+
+ $request['location_code']=implode("-", $location);
+ $start_date =
$this->bocommon->date_array($request['start_date']);
+ $end_date =
$this->bocommon->date_array($request['end_date']);
+
+ $request['start_date'] = mktime
(2,0,0,$start_date['month'],$start_date['day'],$start_date['year']);
+ $request['end_date'] = mktime
(2,0,0,$end_date['month'],$end_date['day'],$end_date['year']);
+
+ if ($action=='edit')
+ {
+ $receipt = $this->so->edit($request);
+
+ if($request['delete_file'])
+ {
+ for
($i=0;$i<count($request['delete_file']);$i++)
+ {
+ $file = $this->fakebase. SEP .
'request' . SEP . $request['location_code'] . SEP . $request['request_id'] .
SEP . $request['delete_file'][$i];
+
+
if($this->vfs->file_exists(array(
+ 'string' =>
$file,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
$this->vfs->override_acl = 1;
+
+ if(!$this->vfs->rm
(array(
+ 'string' =>
$file,
+ 'relatives' =>
array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $request['location_code']. SEP .
$request['request_id'] . SEP .$request['delete_file'][$i]);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . 'request' . SEP . $request['location_code']. SEP .
$request['request_id'] . SEP . $request['delete_file'][$i]);
+ }
+
$this->vfs->override_acl = 0;
+ }
+ }
+ }
+
+ }
+ else
+ {
+ $receipt = $this->so->add($request);
+ }
+ return $receipt;
+ }
+
+ function delete($request_id)
+ {
+ $this->so->delete($request_id);
+ }
+ }
+?>
Index: property/inc/class.bos_agreement.inc.php
diff -u property/inc/class.bos_agreement.inc.php:1.11
property/inc/class.bos_agreement.inc.php:1.12
--- property/inc/class.bos_agreement.inc.php:1.11 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bos_agreement.inc.php Fri Feb 3 12:05:49 2006
@@ -1,707 +1,707 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 agreement
- * @version $Id: class.bos_agreement.inc.php,v 1.11 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bos_agreement
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
- var $role;
- var $member_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function bos_agreement($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sos_agreement');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->vfs =
CreateObject('phpgwapi.vfs');
- $this->rootdir = $this->vfs->basedir;
- $this->fakebase = $this->vfs->fakebase;
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $vendor_id =
get_var('vendor_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
- $role = get_var('role',array('POST','GET'));
- $member_id =
get_var('member_id',array('POST','GET'));
-
-
- $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
- {
- unset($this->cat_id);
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- if(isset($member_id))
- {
- $this->member_id = $member_id;
- }
- if(isset($vendor_id))
- {
- $this->vendor_id = $vendor_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement');
-
- //_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->vendor_id= $data['vendor_id'];
- $this->member_id= $data['member_id'];
- $this->allrows = $data['allrows'];
- }
-
- function check_perms($has, $needed)
- {
- return (!!($has & $needed) == True);
- }
-
-
- function select_category_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->select_category_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function select_vendor_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('select_vendor'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_vendor'));
- break;
- }
-
- $input_list= $this->so->select_vendor_list();
- $vendor_list=
$this->bocommon->select_list($selected,$input_list);
-
- return $vendor_list;
- }
-
- function read()
- {
- $s_agreement = $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,
-
'vendor_id'=>$this->vendor_id));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
-
- for ($i=0; $i<count($s_agreement); $i++)
- {
- if($s_agreement[$i]['start_date'])
- {
- $s_agreement[$i]['start_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement[$i]['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
- if($s_agreement[$i]['end_date'])
- {
- $s_agreement[$i]['end_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement[$i]['end_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
- }
- return $s_agreement;
- }
-
- function read_details($id)
- {
- $list = $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,
-
's_agreement_id'=>$id,'detail'=>True));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
-
- for ($i=0; $i<count($list); $i++)
- {
- $list[$i]['index_date'] =
$GLOBALS['phpgw']->common->show_date($list[$i]['index_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
-
- return $list;
- }
-
- function read_prizing($data)
- {
- $list = $this->so->read_prizing($data);
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
-
- for ($i=0; $i<count($list); $i++)
- {
- $list[$i]['index_date'] =
$GLOBALS['phpgw']->common->show_date($list[$i]['index_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
-
- return $list;
- }
-
- function read_event($data)
- {
- $boalarm =
CreateObject($this->currentapp.'.boalarm');
- $event = $this->so->read_single($data);
- $event['alarm_date']=$event['termination_date'];
- $event['alarm'] =
$boalarm->read_alarms($type='s_agreement',$data['s_agreement_id']);
- return $event;
- }
-
- function read_single($data)
- {
- $s_agreement = $this->so->read_single($data);
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $s_agreement['start_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement['start_date'],$dateformat);
- $s_agreement['end_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement['end_date'],$dateformat);
- if($s_agreement['termination_date'])
- {
- $s_agreement['termination_date']=
$GLOBALS['phpgw']->common->show_date($s_agreement['termination_date'],$dateformat);
- }
-
- $s_agreement = $this->convert_attribute($s_agreement);
-
- $this->vfs->override_acl = 1;
-
- $s_agreement['files'] = $this->vfs->ls (array(
- 'string' => $this->fakebase. '/' .
'service_agreement' . '/' . $data['s_agreement_id'],
- 'relatives' => array(RELATIVE_NONE)));
-
- $this->vfs->override_acl = 0;
-
- if(!$s_agreement['files'][0]['file_id'])
- {
- unset($s_agreement['files']);
- }
-
- return $s_agreement;
-
- }
-
- function read_single_item($data)
- {
- $item = $this->so->read_single_item($data);
-//_debug_array($item);
- $item = $this->convert_attribute($item,True);
-
- if($item['location_code'])
- {
- $solocation =
CreateObject($this->currentapp.'.solocation');
- $item['location_data']
=$solocation->read_single($item['location_code']);
- }
-
- if($item['p_num'])
- {
- $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
- $category =
$soadmin_entity->read_single_category($item['p_entity_id'],$item['p_cat_id']);
-
-
$item['p'][$item['p_entity_id']]['p_num']=$item['p_num'];
-
$item['p'][$item['p_entity_id']]['p_entity_id']=$item['p_entity_id'];
-
$item['p'][$item['p_entity_id']]['p_cat_id']=$item['p_cat_id'];
- $item['p'][$item['p_entity_id']]['p_cat_name']
= $category['name'];
- }
-
- return $item;
- }
-
- function convert_attribute($list,$detail='')
- {
- if($detail)
- {
- $this->so->role = 'detail';
- }
- $contacts =
CreateObject('phpgwapi.contacts');
-
- $vendor = CreateObject($this->currentapp.'.soactor');
- $vendor->role = 'vendor';
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $input_type_array = array(
- 'R' => 'radio',
- 'CH' => 'checkbox',
- 'LB' => 'listbox'
- );
-
- $sep = '/';
- $dlarr[strpos($dateformat,'Y')] = 'Y';
- $dlarr[strpos($dateformat,'m')] = 'm';
- $dlarr[strpos($dateformat,'d')] = 'd';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
-//html_print_r($list);
- $m=0;
- for ($i=0;$i<count($list['attributes']);$i++)
- {
- if($list['attributes'][$i]['datatype']=='D' &&
$list['attributes'][$i]['value'])
- {
- $timestamp_date=
mktime(0,0,0,date(m,strtotime($list['attributes'][$i]['value'])),date(d,strtotime($list['attributes'][$i]['value'])),date(y,strtotime($list['attributes'][$i]['value'])));
- $list['attributes'][$i]['value']
= $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
- }
- if($list['attributes'][$i]['datatype']=='AB')
- {
- if($list['attributes'][$i]['value'])
- {
- $contact_data =
$contacts->read_single_entry($list['attributes'][$i]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-
$list['attributes'][$i]['contact_name'] = $contact_data[0]['n_family'] . ', ' .
$contact_data[0]['n_given'];
- }
-
- $insert_record_list[] =
$list['attributes'][$i]['name'];
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $list['attributes'][$i]['name']);
-
- $lookup_functions[$m]['name'] =
'lookup_'. $list['attributes'][$i]['name'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
-
if($list['attributes'][$i]['datatype']=='VENDOR')
- {
- if($list['attributes'][$i]['value'])
- {
- $vendor_data =
$vendor->read_single(array('actor_id'=>$list['attributes'][$i]['value']));
-
- for
($n=0;$n<count($vendor_data['attributes']);$n++)
- {
-
if($vendor_data['attributes'][$n]['name'] == 'org_name')
- {
-
$list['attributes'][$i]['vendor_name']= $vendor_data['attributes'][$n]['value'];
- $n
=count($vendor_data['attributes']);
- }
- }
- }
-
- $insert_record_list[] =
$list['attributes'][$i]['name'];
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $list['attributes'][$i]['name']);
-
- $lookup_functions[$m]['name'] =
'lookup_'. $list['attributes'][$i]['name'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
- if($list['attributes'][$i]['datatype']=='R' ||
$list['attributes'][$i]['datatype']=='CH' ||
$list['attributes'][$i]['datatype']=='LB')
- {
- $list['attributes'][$i]['choice']
= $this->so->read_attrib_choice($list['attributes'][$i]['attrib_id']);
-
$input_type=$input_type_array[$list['attributes'][$i]['datatype']];
-
-
if($list['attributes'][$i]['datatype']=='CH')
- {
-
$list['attributes'][$i]['value']=unserialize($list['attributes'][$i]['value']);
-
$list['attributes'][$i]['choice'] =
$this->bocommon->select_multi_list_2($list['attributes'][$i]['value'],$list['attributes'][$i]['choice'],$input_type);
-
- }
- else
- {
- for
($j=0;$j<count($list['attributes'][$i]['choice']);$j++)
- {
-
$list['attributes'][$i]['choice'][$j]['input_type']=$input_type;
-
if($list['attributes'][$i]['choice'][$j]['id']==$list['attributes'][$i]['value'])
- {
-
$list['attributes'][$i]['choice'][$j]['checked']='checked';
- }
- }
- }
- }
-
- $list['attributes'][$i]['datatype_text'] =
$this->bocommon->translate_datatype($list['attributes'][$i]['datatype']);
- $list['attributes'][$i]['counter'] = $i;
- $list['attributes'][$i]['type_id'] =
$data['type_id'];
- }
-
- for ($j=0;$j<count($lookup_functions);$j++)
- {
- $list['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
- $list['lookup_functions'] .= '{'."\r\n";
- $list['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
- $list['lookup_functions'] .= '}'."\r\n";
- }
-
-
$GLOBALS['phpgw']->session->appsession('insert_record_s_agreement' .
!!$detail,$this->currentapp,$insert_record_list);
-
-//html_print_r($list);
- return $list;
-
- }
-
- function convert_attribute_save($values_attribute='')
- {
-
- for ($i=0;$i<count($values_attribute);$i++)
- {
- if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
- }
- if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
- }
-
- if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
- }
-
- if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
- {
- $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
- }
- }
-
- return $values_attribute;
- }
-
- function save($values,$values_attribute='',$action='')
- {
-
- $values['start_date'] =
$this->bocommon->date_to_timestamp($values['start_date']);
- $values['end_date'] =
$this->bocommon->date_to_timestamp($values['end_date']);
- $values['termination_date'] =
$this->bocommon->date_to_timestamp($values['termination_date']);
-
- $values_attribute =
$this->convert_attribute_save($values_attribute);
-
- if ($action=='edit')
-// if ($values['s_agreement_id'])
- {
- if ($values['s_agreement_id'] != 0)
- {
-
$receipt=$this->so->edit($values,$values_attribute);
-
- if($values['delete_file'])
- {
- for
($i=0;$i<count($values['delete_file']);$i++)
- {
- $file =
$this->fakebase. SEP . 'service_agreement' . SEP . $values['s_agreement_id'] .
SEP . $values['delete_file'][$i];
-
-
if($this->vfs->file_exists(array(
-
'string' => $file,
-
'relatives' => Array(RELATIVE_NONE)
- )))
- {
-
$this->vfs->override_acl = 1;
-
-
if(!$this->vfs->rm (array(
-
'string' => $file,
-
'relatives' => array(
-
RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . 'service_agreement'. SEP . $values['s_agreement_id'] .
SEP .$values['delete_file'][$i]);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . 'service_agreement'. SEP . $values['id'] . SEP .
$values['delete_file'][$i]);
- }
-
$this->vfs->override_acl = 0;
- }
- }
- }
- }
- }
- else
- {
- $receipt =
$this->so->add($values,$values_attribute);
- }
- return $receipt;
- }
-
- function save_item($values,$values_attribute='')
- {
-
- while (is_array($values['location']) && list(,$value) =
each($values['location']))
- {
- if($value)
- {
- $location[] = $value;
- }
- }
-
- $values['location_code'address@hidden("-", $location);
-
- $values_attribute =
$this->convert_attribute_save($values_attribute);
-
- if ($values['id'])
- {
- if ($values['id'] != 0)
- {
-
$receipt=$this->so->edit_item($values,$values_attribute);
- }
- }
- else
- {
- $receipt =
$this->so->add_item($values,$values_attribute);
- }
- return $receipt;
- }
-
-
- function update($values)
- {
- $values['date'] =
$this->bocommon->date_to_timestamp($values['date']);
-
- return $this->so->update($values);
- }
-
- function delete_last_index($s_agreement_id,$id)
- {
- $this->so->delete_last_index($s_agreement_id,$id);
- }
-
-
- function delete_item($s_agreement_id,$item_id)
- {
- $this->so->delete_item($s_agreement_id,$item_id);
- }
-
- function delete($s_agreement_id='',$id='',$attrib='')
- {
- if ($attrib)
- {
- $this->so->delete_attrib($id);
- }
- else
- {
- $this->so->delete($s_agreement_id);
- }
- }
-
- function read_attrib($type_id='')
- {
- $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'allrows'=>$this->allrows));
-
- for ($i=0; $i<count($attrib); $i++)
- {
- $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
- }
-
- $this->total_records = $this->so->total_records;
-
- return $attrib;
- }
-
- function read_single_attrib($id)
- {
- return $this->so->read_single_attrib($id);
- }
-
- function resort_attrib($data)
- {
- $this->so->resort_attrib($data);
- }
-
- function save_attrib($attrib,$action='')
- {
- if ($action=='edit')
- {
- if ($attrib['id'] != '')
- {
-
- $receipt =
$this->so->edit_attrib($attrib);
- }
- }
- else
- {
- $receipt = $this->so->add_attrib($attrib);
- }
- return $receipt;
- }
-
- function column_list($selected='',$allrows='')
- {
- if(!$selected)
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]["s_agreement_columns"];
- }
-
- $columns =
$this->so->read_attrib(array('allrows'=>$allrows,'column_list'=>True));
-
-
$column_list=$this->bocommon->select_multi_list($selected,$columns);
-
- return $column_list;
- }
-
- function request_next_id()
- {
- return $this->so->request_next_id();
- }
-
- function create_home_dir($receipt='')
- {
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
'service_agreement',
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
-
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
'service_agreement',
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'service_agreement');
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'service_agreement');
- }
- $this->vfs->override_acl = 0;
- }
-
- return $receipt;
- }
-
- function create_document_dir($id='')
- {
-
- if(!$this->vfs->file_exists(array(
- 'string' => $this->fakebase. SEP .
'service_agreement' . SEP . $id,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $this->vfs->override_acl = 1;
- if(!$this->vfs->mkdir (array(
- 'string' => $this->fakebase. SEP .
'service_agreement' . SEP . $id,
- 'relatives' => array(
- RELATIVE_NONE
- )
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'service_agreement' . SEP . $id);
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'service_agreement' . SEP . $id);
- }
- $this->vfs->override_acl = 0;
- }
-
-//_debug_array($receipt);
- return $receipt;
- }
-
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 agreement
+ * @version $Id: class.bos_agreement.inc.php,v 1.12 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bos_agreement
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+ var $role;
+ var $member_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function bos_agreement($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sos_agreement');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->vfs =
CreateObject('phpgwapi.vfs');
+ $this->rootdir = $this->vfs->basedir;
+ $this->fakebase = $this->vfs->fakebase;
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $vendor_id =
get_var('vendor_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+ $role = get_var('role',array('POST','GET'));
+ $member_id =
get_var('member_id',array('POST','GET'));
+
+
+ $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
+ {
+ unset($this->cat_id);
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ if(isset($member_id))
+ {
+ $this->member_id = $member_id;
+ }
+ if(isset($vendor_id))
+ {
+ $this->vendor_id = $vendor_id;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement');
+
+ //_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->vendor_id= $data['vendor_id'];
+ $this->member_id= $data['member_id'];
+ $this->allrows = $data['allrows'];
+ }
+
+ function check_perms($has, $needed)
+ {
+ return (!!($has & $needed) == True);
+ }
+
+
+ function select_category_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->select_category_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function select_vendor_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('select_vendor'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_vendor'));
+ break;
+ }
+
+ $input_list= $this->so->select_vendor_list();
+ $vendor_list=
$this->bocommon->select_list($selected,$input_list);
+
+ return $vendor_list;
+ }
+
+ function read()
+ {
+ $s_agreement = $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,
+
'vendor_id'=>$this->vendor_id));
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+
+ for ($i=0; $i<count($s_agreement); $i++)
+ {
+ if($s_agreement[$i]['start_date'])
+ {
+ $s_agreement[$i]['start_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement[$i]['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+ if($s_agreement[$i]['end_date'])
+ {
+ $s_agreement[$i]['end_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement[$i]['end_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+ }
+ return $s_agreement;
+ }
+
+ function read_details($id)
+ {
+ $list = $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,
+
's_agreement_id'=>$id,'detail'=>True));
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+
+ for ($i=0; $i<count($list); $i++)
+ {
+ $list[$i]['index_date'] =
$GLOBALS['phpgw']->common->show_date($list[$i]['index_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+
+ return $list;
+ }
+
+ function read_prizing($data)
+ {
+ $list = $this->so->read_prizing($data);
+ $this->total_records = $this->so->total_records;
+
+ $this->uicols = $this->so->uicols;
+
+ for ($i=0; $i<count($list); $i++)
+ {
+ $list[$i]['index_date'] =
$GLOBALS['phpgw']->common->show_date($list[$i]['index_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+
+ return $list;
+ }
+
+ function read_event($data)
+ {
+ $boalarm =
CreateObject($this->currentapp.'.boalarm');
+ $event = $this->so->read_single($data);
+ $event['alarm_date']=$event['termination_date'];
+ $event['alarm'] =
$boalarm->read_alarms($type='s_agreement',$data['s_agreement_id']);
+ return $event;
+ }
+
+ function read_single($data)
+ {
+ $s_agreement = $this->so->read_single($data);
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $s_agreement['start_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement['start_date'],$dateformat);
+ $s_agreement['end_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement['end_date'],$dateformat);
+ if($s_agreement['termination_date'])
+ {
+ $s_agreement['termination_date']=
$GLOBALS['phpgw']->common->show_date($s_agreement['termination_date'],$dateformat);
+ }
+
+ $s_agreement = $this->convert_attribute($s_agreement);
+
+ $this->vfs->override_acl = 1;
+
+ $s_agreement['files'] = $this->vfs->ls (array(
+ 'string' => $this->fakebase. '/' .
'service_agreement' . '/' . $data['s_agreement_id'],
+ 'relatives' => array(RELATIVE_NONE)));
+
+ $this->vfs->override_acl = 0;
+
+ if(!$s_agreement['files'][0]['file_id'])
+ {
+ unset($s_agreement['files']);
+ }
+
+ return $s_agreement;
+
+ }
+
+ function read_single_item($data)
+ {
+ $item = $this->so->read_single_item($data);
+//_debug_array($item);
+ $item = $this->convert_attribute($item,True);
+
+ if($item['location_code'])
+ {
+ $solocation =
CreateObject($this->currentapp.'.solocation');
+ $item['location_data']
=$solocation->read_single($item['location_code']);
+ }
+
+ if($item['p_num'])
+ {
+ $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
+ $category =
$soadmin_entity->read_single_category($item['p_entity_id'],$item['p_cat_id']);
+
+
$item['p'][$item['p_entity_id']]['p_num']=$item['p_num'];
+
$item['p'][$item['p_entity_id']]['p_entity_id']=$item['p_entity_id'];
+
$item['p'][$item['p_entity_id']]['p_cat_id']=$item['p_cat_id'];
+ $item['p'][$item['p_entity_id']]['p_cat_name']
= $category['name'];
+ }
+
+ return $item;
+ }
+
+ function convert_attribute($list,$detail='')
+ {
+ if($detail)
+ {
+ $this->so->role = 'detail';
+ }
+ $contacts =
CreateObject('phpgwapi.contacts');
+
+ $vendor = CreateObject($this->currentapp.'.soactor');
+ $vendor->role = 'vendor';
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ $input_type_array = array(
+ 'R' => 'radio',
+ 'CH' => 'checkbox',
+ 'LB' => 'listbox'
+ );
+
+ $sep = '/';
+ $dlarr[strpos($dateformat,'Y')] = 'Y';
+ $dlarr[strpos($dateformat,'m')] = 'm';
+ $dlarr[strpos($dateformat,'d')] = 'd';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+//html_print_r($list);
+ $m=0;
+ for ($i=0;$i<count($list['attributes']);$i++)
+ {
+ if($list['attributes'][$i]['datatype']=='D' &&
$list['attributes'][$i]['value'])
+ {
+ $timestamp_date=
mktime(0,0,0,date(m,strtotime($list['attributes'][$i]['value'])),date(d,strtotime($list['attributes'][$i]['value'])),date(y,strtotime($list['attributes'][$i]['value'])));
+ $list['attributes'][$i]['value']
= $GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
+ }
+ if($list['attributes'][$i]['datatype']=='AB')
+ {
+ if($list['attributes'][$i]['value'])
+ {
+ $contact_data =
$contacts->read_single_entry($list['attributes'][$i]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
+
$list['attributes'][$i]['contact_name'] = $contact_data[0]['n_family'] . ', ' .
$contact_data[0]['n_given'];
+ }
+
+ $insert_record_list[] =
$list['attributes'][$i]['name'];
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $list['attributes'][$i]['name']);
+
+ $lookup_functions[$m]['name'] =
'lookup_'. $list['attributes'][$i]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+
if($list['attributes'][$i]['datatype']=='VENDOR')
+ {
+ if($list['attributes'][$i]['value'])
+ {
+ $vendor_data =
$vendor->read_single(array('actor_id'=>$list['attributes'][$i]['value']));
+
+ for
($n=0;$n<count($vendor_data['attributes']);$n++)
+ {
+
if($vendor_data['attributes'][$n]['name'] == 'org_name')
+ {
+
$list['attributes'][$i]['vendor_name']= $vendor_data['attributes'][$n]['value'];
+ $n
=count($vendor_data['attributes']);
+ }
+ }
+ }
+
+ $insert_record_list[] =
$list['attributes'][$i]['name'];
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $list['attributes'][$i]['name']);
+
+ $lookup_functions[$m]['name'] =
'lookup_'. $list['attributes'][$i]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+ if($list['attributes'][$i]['datatype']=='R' ||
$list['attributes'][$i]['datatype']=='CH' ||
$list['attributes'][$i]['datatype']=='LB')
+ {
+ $list['attributes'][$i]['choice']
= $this->so->read_attrib_choice($list['attributes'][$i]['attrib_id']);
+
$input_type=$input_type_array[$list['attributes'][$i]['datatype']];
+
+
if($list['attributes'][$i]['datatype']=='CH')
+ {
+
$list['attributes'][$i]['value']=unserialize($list['attributes'][$i]['value']);
+
$list['attributes'][$i]['choice'] =
$this->bocommon->select_multi_list_2($list['attributes'][$i]['value'],$list['attributes'][$i]['choice'],$input_type);
+
+ }
+ else
+ {
+ for
($j=0;$j<count($list['attributes'][$i]['choice']);$j++)
+ {
+
$list['attributes'][$i]['choice'][$j]['input_type']=$input_type;
+
if($list['attributes'][$i]['choice'][$j]['id']==$list['attributes'][$i]['value'])
+ {
+
$list['attributes'][$i]['choice'][$j]['checked']='checked';
+ }
+ }
+ }
+ }
+
+ $list['attributes'][$i]['datatype_text'] =
$this->bocommon->translate_datatype($list['attributes'][$i]['datatype']);
+ $list['attributes'][$i]['counter'] = $i;
+ $list['attributes'][$i]['type_id'] =
$data['type_id'];
+ }
+
+ for ($j=0;$j<count($lookup_functions);$j++)
+ {
+ $list['lookup_functions'] .= 'function ' .
$lookup_functions[$j]['name'] ."\r\n";
+ $list['lookup_functions'] .= '{'."\r\n";
+ $list['lookup_functions'] .=
$lookup_functions[$j]['action'] ."\r\n";
+ $list['lookup_functions'] .= '}'."\r\n";
+ }
+
+
$GLOBALS['phpgw']->session->appsession('insert_record_s_agreement' .
!!$detail,$this->currentapp,$insert_record_list);
+
+//html_print_r($list);
+ return $list;
+
+ }
+
+ function convert_attribute_save($values_attribute='')
+ {
+
+ for ($i=0;$i<count($values_attribute);$i++)
+ {
+ if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
+ }
+ if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
$values_attribute[$i]['value'][0];
+ }
+
+ if($values_attribute[$i]['datatype']=='N' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
str_replace(",",".",$values_attribute[$i]['value']);
+ }
+
+ if($values_attribute[$i]['datatype']=='D' &&
$values_attribute[$i]['value'])
+ {
+ $values_attribute[$i]['value'] =
date($this->bocommon->dateformat,$this->bocommon->date_to_timestamp($values_attribute[$i]['value']));
+ }
+ }
+
+ return $values_attribute;
+ }
+
+ function save($values,$values_attribute='',$action='')
+ {
+
+ $values['start_date'] =
$this->bocommon->date_to_timestamp($values['start_date']);
+ $values['end_date'] =
$this->bocommon->date_to_timestamp($values['end_date']);
+ $values['termination_date'] =
$this->bocommon->date_to_timestamp($values['termination_date']);
+
+ $values_attribute =
$this->convert_attribute_save($values_attribute);
+
+ if ($action=='edit')
+// if ($values['s_agreement_id'])
+ {
+ if ($values['s_agreement_id'] != 0)
+ {
+
$receipt=$this->so->edit($values,$values_attribute);
+
+ if($values['delete_file'])
+ {
+ for
($i=0;$i<count($values['delete_file']);$i++)
+ {
+ $file =
$this->fakebase. SEP . 'service_agreement' . SEP . $values['s_agreement_id'] .
SEP . $values['delete_file'][$i];
+
+
if($this->vfs->file_exists(array(
+
'string' => $file,
+
'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+
$this->vfs->override_acl = 1;
+
+
if(!$this->vfs->rm (array(
+
'string' => $file,
+
'relatives' => array(
+
RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . 'service_agreement'. SEP . $values['s_agreement_id'] .
SEP .$values['delete_file'][$i]);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . 'service_agreement'. SEP . $values['id'] . SEP .
$values['delete_file'][$i]);
+ }
+
$this->vfs->override_acl = 0;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ $receipt =
$this->so->add($values,$values_attribute);
+ }
+ return $receipt;
+ }
+
+ function save_item($values,$values_attribute='')
+ {
+
+ while (is_array($values['location']) && list(,$value) =
each($values['location']))
+ {
+ if($value)
+ {
+ $location[] = $value;
+ }
+ }
+
+ $values['location_code'address@hidden("-", $location);
+
+ $values_attribute =
$this->convert_attribute_save($values_attribute);
+
+ if ($values['id'])
+ {
+ if ($values['id'] != 0)
+ {
+
$receipt=$this->so->edit_item($values,$values_attribute);
+ }
+ }
+ else
+ {
+ $receipt =
$this->so->add_item($values,$values_attribute);
+ }
+ return $receipt;
+ }
+
+
+ function update($values)
+ {
+ $values['date'] =
$this->bocommon->date_to_timestamp($values['date']);
+
+ return $this->so->update($values);
+ }
+
+ function delete_last_index($s_agreement_id,$id)
+ {
+ $this->so->delete_last_index($s_agreement_id,$id);
+ }
+
+
+ function delete_item($s_agreement_id,$item_id)
+ {
+ $this->so->delete_item($s_agreement_id,$item_id);
+ }
+
+ function delete($s_agreement_id='',$id='',$attrib='')
+ {
+ if ($attrib)
+ {
+ $this->so->delete_attrib($id);
+ }
+ else
+ {
+ $this->so->delete($s_agreement_id);
+ }
+ }
+
+ function read_attrib($type_id='')
+ {
+ $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'allrows'=>$this->allrows));
+
+ for ($i=0; $i<count($attrib); $i++)
+ {
+ $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
+ }
+
+ $this->total_records = $this->so->total_records;
+
+ return $attrib;
+ }
+
+ function read_single_attrib($id)
+ {
+ return $this->so->read_single_attrib($id);
+ }
+
+ function resort_attrib($data)
+ {
+ $this->so->resort_attrib($data);
+ }
+
+ function save_attrib($attrib,$action='')
+ {
+ if ($action=='edit')
+ {
+ if ($attrib['id'] != '')
+ {
+
+ $receipt =
$this->so->edit_attrib($attrib);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add_attrib($attrib);
+ }
+ return $receipt;
+ }
+
+ function column_list($selected='',$allrows='')
+ {
+ if(!$selected)
+ {
+
$selected=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]["s_agreement_columns"];
+ }
+
+ $columns =
$this->so->read_attrib(array('allrows'=>$allrows,'column_list'=>True));
+
+
$column_list=$this->bocommon->select_multi_list($selected,$columns);
+
+ return $column_list;
+ }
+
+ function request_next_id()
+ {
+ return $this->so->request_next_id();
+ }
+
+ function create_home_dir($receipt='')
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'service_agreement',
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'service_agreement',
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'service_agreement');
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'service_agreement');
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+ return $receipt;
+ }
+
+ function create_document_dir($id='')
+ {
+
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'service_agreement' . SEP . $id,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'service_agreement' . SEP . $id,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'service_agreement' . SEP . $id);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'service_agreement' . SEP . $id);
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+//_debug_array($receipt);
+ return $receipt;
+ }
+
+
+ }
+?>
Index: property/inc/class.bostandard_2.inc.php
diff -u property/inc/class.bostandard_2.inc.php:1.6
property/inc/class.bostandard_2.inc.php:1.7
--- property/inc/class.bostandard_2.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bostandard_2.inc.php Fri Feb 3 12:05:49 2006
@@ -1,175 +1,175 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.bostandard_2.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bostandard_2
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 bostandard_2($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sostandard_2');
- $this->socommon =
CreateObject($this->currentapp.'.socommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows= get_var('allrows',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','standard_2',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_2');
-
- $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'];
- }
-
- function read($type='')
- {
- $standard = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'type' => $type,'allrows'=>$this->allrows));
-
- $this->total_records = $this->so->total_records;
-
- return $standard;
- }
-
- function read_single($id,$type)
- {
- return $this->so->read_single($id,$type);
- }
-
- function select_part_of_town($part_of_town_id)
- {
- return
$this->socommon->select_part_of_town($part_of_town_id);
- }
-
- function save($standard,$action='',$type ='')
- {
- if ($action=='edit')
- {
- if ($standard['id'] != '')
- {
-
- $receipt =
$this->so->edit($standard,$type);
- }
- }
- else
- {
- $receipt = $this->so->add($standard,$type);
- }
- return $receipt;
-
- }
-
- function delete($id,$type)
- {
- $this->so->delete($id,$type);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.bostandard_2.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bostandard_2
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 bostandard_2($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sostandard_2');
+ $this->socommon =
CreateObject($this->currentapp.'.socommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows= get_var('allrows',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','standard_2',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_2');
+
+ $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'];
+ }
+
+ function read($type='')
+ {
+ $standard = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'type' => $type,'allrows'=>$this->allrows));
+
+ $this->total_records = $this->so->total_records;
+
+ return $standard;
+ }
+
+ function read_single($id,$type)
+ {
+ return $this->so->read_single($id,$type);
+ }
+
+ function select_part_of_town($part_of_town_id)
+ {
+ return
$this->socommon->select_part_of_town($part_of_town_id);
+ }
+
+ function save($standard,$action='',$type ='')
+ {
+ if ($action=='edit')
+ {
+ if ($standard['id'] != '')
+ {
+
+ $receipt =
$this->so->edit($standard,$type);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($standard,$type);
+ }
+ return $receipt;
+
+ }
+
+ function delete($id,$type)
+ {
+ $this->so->delete($id,$type);
+ }
+ }
+?>
Index: property/inc/class.bostandard_3.inc.php
diff -u property/inc/class.bostandard_3.inc.php:1.6
property/inc/class.bostandard_3.inc.php:1.7
--- property/inc/class.bostandard_3.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bostandard_3.inc.php Fri Feb 3 12:05:49 2006
@@ -1,165 +1,165 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.bostandard_3.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bostandard_3
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 bostandard_3($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sostandard_3');
- $this->socommon =
CreateObject($this->currentapp.'.socommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','standard_3',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_3');
-
- $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'];
- }
-
-
- function read($type='')
- {
- $standard = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'type' => $type));
-
- $this->total_records = $this->so->total_records;
-
- return $standard;
- }
-
- function read_single($id,$type)
- {
- return $this->so->read_single($id,$type);
- }
-
- function save($standard,$action='',$type ='')
- {
- if ($action=='edit')
- {
- if ($standard['id'] != '')
- {
-
- $receipt =
$this->so->edit($standard,$type);
- }
- }
- else
- {
- $receipt = $this->so->add($standard,$type);
- }
- return $receipt;
-
- }
-
- function delete($id,$type)
- {
- $this->so->delete($id,$type);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.bostandard_3.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bostandard_3
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 bostandard_3($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sostandard_3');
+ $this->socommon =
CreateObject($this->currentapp.'.socommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','standard_3',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_3');
+
+ $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'];
+ }
+
+
+ function read($type='')
+ {
+ $standard = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'type' => $type));
+
+ $this->total_records = $this->so->total_records;
+
+ return $standard;
+ }
+
+ function read_single($id,$type)
+ {
+ return $this->so->read_single($id,$type);
+ }
+
+ function save($standard,$action='',$type ='')
+ {
+ if ($action=='edit')
+ {
+ if ($standard['id'] != '')
+ {
+
+ $receipt =
$this->so->edit($standard,$type);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($standard,$type);
+ }
+ return $receipt;
+
+ }
+
+ function delete($id,$type)
+ {
+ $this->so->delete($id,$type);
+ }
+ }
+?>
Index: property/inc/class.bostandard_entity.inc.php
diff -u property/inc/class.bostandard_entity.inc.php:1.6
property/inc/class.bostandard_entity.inc.php:1.7
--- property/inc/class.bostandard_entity.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bostandard_entity.inc.php Fri Feb 3 12:05:49 2006
@@ -1,284 +1,284 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.bostandard_entity.inc.php,v 1.6 2006/01/27
14:05:43 sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bostandard_entity
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 bostandard_entity($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sostandard_entity');
- $this->socommon =
CreateObject($this->currentapp.'.socommon');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
-
- 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))
- {
- $this->cat_id = $cat_id;
- }
- }
-
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','standard_e',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_e');
-
-
- $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'];
- }
-
-
- function read($type='')
- {
- $standard = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'type' => $type));
-
- $this->total_records = $this->so->total_records;
-
-
- return $standard;
- }
-
- function read_single($id,$type)
- {
- return $this->so->read_single($id,$type);
- }
-
- function save($standard,$action='',$type ='')
- {
- if ($action=='edit')
- {
- if ($standard['id'] != '')
- {
-
- $receipt =
$this->so->edit($standard,$type);
- }
- }
- else
- {
- $receipt = $this->so->add($standard,$type);
- }
- return $receipt;
-
- }
-
- function delete($id,$type,$attrib)
- {
- $this->so->delete($id,$type,$attrib);
- }
-
- function read_attrib($type='',$type_id='',$allrows='')
- {
- $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'type' => $type,'type_id' => $type_id,'allrows' => $allrows));
-
- $this->total_records = $this->so->total_records;
-
- for ($i=0; $i<count($attrib); $i++)
- {
- $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
- }
-
- return $attrib;
- }
-
- function read_single_attrib($id,$type)
- {
- return $this->so->read_single_attrib($id,$type);
- }
-
- function save_attrib($attrib,$action='',$type ='')
- {
- if ($action=='edit')
- {
- if ($attrib['id'] != '')
- {
-
- $receipt =
$this->so->edit_attrib($attrib,$type);
- }
- }
- else
- {
- $receipt = $this->so->add_attrib($attrib,$type);
- }
- return $receipt;
- }
-
-
- function select_entity_type($type='',$selected='')
- {
- $entity_types= $this->so->select_entity_type($type);
-
- while (is_array($entity_types) && list(,$type) =
each($entity_types))
- {
- $sel_type = '';
- if ($type['id']==$selected)
- {
- $sel_type = 'selected';
- }
-
- $entity_type_list[] = array
- (
- 'id' => $type['id'],
- 'name' => $type['name'],
- 'selected' => $sel_type
- );
- }
-
- for ($i=0;$i<count($entity_type_list);$i++)
- {
- if ($entity_type_list[$i]['selected'] !=
'selected')
- {
-
unset($entity_type_list[$i]['selected']);
- }
- }
-
- return $entity_type_list;
- }
-
- function select_datatype($selected='')
- {
- $datatypes[0]['id']= 'C';
- $datatypes[0]['name']= lang('Character');
- $datatypes[1]['id']= 'I';
- $datatypes[1]['name']= lang('Integer');
- $datatypes[2]['id']= 'N';
- $datatypes[2]['name']= lang('Decimal');
- $datatypes[3]['id']= 'D';
- $datatypes[3]['name']= lang('Date');
- $datatypes[4]['id']= 'T';
- $datatypes[4]['name']= lang('Memo');
- $datatypes[5]['id']= 'R';
- $datatypes[5]['name']= lang('Multiple radio');
- $datatypes[6]['id']= 'CH';
- $datatypes[6]['name']= lang('Multiple Checkbox');
-
- while (is_array($datatypes) && list(,$type) =
each($datatypes))
- {
- $sel_type = '';
- if ($type['id']==$selected)
- {
- $sel_type = 'selected';
- }
-
- $datatype_list[] = array
- (
- 'id' => $type['id'],
- 'name' => $type['name'],
- 'selected' => $sel_type
- );
- }
-
- for ($i=0;$i<count($datatype_list);$i++)
- {
- if ($datatype_list[$i]['selected'] !=
'selected')
- {
- unset($datatype_list[$i]['selected']);
- }
- }
-
- return $datatype_list;
- }
-
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.bostandard_entity.inc.php,v 1.7 2006/02/03
12:05:49 sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bostandard_entity
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 bostandard_entity($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sostandard_entity');
+ $this->socommon =
CreateObject($this->currentapp.'.socommon');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+
+ 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))
+ {
+ $this->cat_id = $cat_id;
+ }
+ }
+
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','standard_e',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','standard_e');
+
+
+ $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'];
+ }
+
+
+ function read($type='')
+ {
+ $standard = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'type' => $type));
+
+ $this->total_records = $this->so->total_records;
+
+
+ return $standard;
+ }
+
+ function read_single($id,$type)
+ {
+ return $this->so->read_single($id,$type);
+ }
+
+ function save($standard,$action='',$type ='')
+ {
+ if ($action=='edit')
+ {
+ if ($standard['id'] != '')
+ {
+
+ $receipt =
$this->so->edit($standard,$type);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($standard,$type);
+ }
+ return $receipt;
+
+ }
+
+ function delete($id,$type,$attrib)
+ {
+ $this->so->delete($id,$type,$attrib);
+ }
+
+ function read_attrib($type='',$type_id='',$allrows='')
+ {
+ $attrib = $this->so->read_attrib(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'type' => $type,'type_id' => $type_id,'allrows' => $allrows));
+
+ $this->total_records = $this->so->total_records;
+
+ for ($i=0; $i<count($attrib); $i++)
+ {
+ $attrib[$i]['datatype'] =
$this->bocommon->translate_datatype($attrib[$i]['datatype']);
+ }
+
+ return $attrib;
+ }
+
+ function read_single_attrib($id,$type)
+ {
+ return $this->so->read_single_attrib($id,$type);
+ }
+
+ function save_attrib($attrib,$action='',$type ='')
+ {
+ if ($action=='edit')
+ {
+ if ($attrib['id'] != '')
+ {
+
+ $receipt =
$this->so->edit_attrib($attrib,$type);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add_attrib($attrib,$type);
+ }
+ return $receipt;
+ }
+
+
+ function select_entity_type($type='',$selected='')
+ {
+ $entity_types= $this->so->select_entity_type($type);
+
+ while (is_array($entity_types) && list(,$type) =
each($entity_types))
+ {
+ $sel_type = '';
+ if ($type['id']==$selected)
+ {
+ $sel_type = 'selected';
+ }
+
+ $entity_type_list[] = array
+ (
+ 'id' => $type['id'],
+ 'name' => $type['name'],
+ 'selected' => $sel_type
+ );
+ }
+
+ for ($i=0;$i<count($entity_type_list);$i++)
+ {
+ if ($entity_type_list[$i]['selected'] !=
'selected')
+ {
+
unset($entity_type_list[$i]['selected']);
+ }
+ }
+
+ return $entity_type_list;
+ }
+
+ function select_datatype($selected='')
+ {
+ $datatypes[0]['id']= 'C';
+ $datatypes[0]['name']= lang('Character');
+ $datatypes[1]['id']= 'I';
+ $datatypes[1]['name']= lang('Integer');
+ $datatypes[2]['id']= 'N';
+ $datatypes[2]['name']= lang('Decimal');
+ $datatypes[3]['id']= 'D';
+ $datatypes[3]['name']= lang('Date');
+ $datatypes[4]['id']= 'T';
+ $datatypes[4]['name']= lang('Memo');
+ $datatypes[5]['id']= 'R';
+ $datatypes[5]['name']= lang('Multiple radio');
+ $datatypes[6]['id']= 'CH';
+ $datatypes[6]['name']= lang('Multiple Checkbox');
+
+ while (is_array($datatypes) && list(,$type) =
each($datatypes))
+ {
+ $sel_type = '';
+ if ($type['id']==$selected)
+ {
+ $sel_type = 'selected';
+ }
+
+ $datatype_list[] = array
+ (
+ 'id' => $type['id'],
+ 'name' => $type['name'],
+ 'selected' => $sel_type
+ );
+ }
+
+ for ($i=0;$i<count($datatype_list);$i++)
+ {
+ if ($datatype_list[$i]['selected'] !=
'selected')
+ {
+ unset($datatype_list[$i]['selected']);
+ }
+ }
+
+ return $datatype_list;
+ }
+
+
+ }
+?>
Index: property/inc/class.botemplate.inc.php
diff -u property/inc/class.botemplate.inc.php:1.6
property/inc/class.botemplate.inc.php:1.7
--- property/inc/class.botemplate.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.botemplate.inc.php Fri Feb 3 12:05:49 2006
@@ -1,251 +1,251 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.botemplate.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class botemplate
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function botemplate($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sotemplate');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(isset($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','template',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','template');
-
- $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'];
- }
-
-
- function read()
- {
- $template = $this->so->read(array('filter' =>
$this->filter,'start' => $this->start,'query' => $this->query,'sort' =>
$this->sort,'order' => $this->order,
-
'chapter_id' => $this->chapter_id,'allrows'=>$this->allrows,
'template_id'=>$template_id));
- $this->total_records = $this->so->total_records;
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- for ($i=0; $i<count($template); $i++)
- {
- $template[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($template[$i]['owner']);
- $template[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($template[$i]['entry_date'],$dateformat);
- }
-
- return $template;
- }
-
- function read_template_hour($template_id)
- {
- $template = $this->so->read_template_hour(array('start'
=> $this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'chapter_id' => $this->chapter_id,'allrows'=>$this->allrows,
'template_id'=>$template_id));
- $this->total_records = $this->so->total_records;
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- for ($i=0; $i<count($template); $i++)
- {
- $template[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($template[$i]['owner']);
- $template[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($template[$i]['entry_date'],$dateformat);
- }
-
- return $template;
- }
-
-
- function read_single_template($template_id)
- {
- return $this->so->read_single_template($template_id);
- }
-
- function read_single_hour($hour_id)
- {
- return $this->so->read_single_hour($hour_id);
- }
-
- function get_grouping_list($selected='',$template_id)
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('grouping_select'));
-
- $groupings= $this->so->get_grouping_list($template_id);
-
- while (is_array($groupings) && list(,$grouping_entry) =
each($groupings))
- {
- $sel_grouping_entry = '';
- if ($grouping_entry['id']==$selected)
- {
- $sel_grouping_entry = 'selected';
- }
-
- $grouping_list[] = array
- (
- 'id' =>
$grouping_entry['id'],
- 'name' =>
$grouping_entry['name'],
- 'selected' => $sel_grouping_entry
- );
- }
-
- for ($i=0;$i<count($grouping_list);$i++)
- {
- if ($grouping_list[$i]['selected'] !=
'selected')
- {
- unset($grouping_list[$i]['selected']);
- }
- }
-
- return $grouping_list;
- }
-
- function save_template($values)
- {
- if ($values['template_id'])
- {
- if ($values['template_id'] != 0)
- {
- $receipt =
$this->so->edit_template($values);
-
$receipt['template_id']=$values['template_id'];
- }
- }
- else
- {
- $receipt = $this->so->add_template($values);
- }
- return $receipt;
- }
-
- function save_hour($values,$template_id)
- {
- $values['billperae'] =
str_replace(",",".",$values['billperae']);
- $values['quantity'] =
str_replace(",",".",$values['quantity']);
- $values['cost'] =
$values['billperae']*$values['quantity'];
- if($values['ns3420_descr'])
- {
- $values['descr']=$values['ns3420_descr'];
- }
-
- if ($values['hour_id'])
- {
- if ($values['hour_id'] != 0)
- {
- $receipt =
$this->so->edit_hour($values,$template_id);
- }
- }
- else
- {
- $receipt =
$this->so->add_custom_hour($values,$template_id);
- }
- return $receipt;
- }
-
- function delete($params)
- {
- if (is_array($params))
- {
- $this->so->delete($params[0]);
- }
- else
- {
- $this->so->delete($params);
- }
- }
-
- function delete_hour($hour_id,$template_id)
- {
- return $this->so->delete_hour($hour_id,$template_id);
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.botemplate.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class botemplate
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function botemplate($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sotemplate');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(isset($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','template',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','template');
+
+ $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'];
+ }
+
+
+ function read()
+ {
+ $template = $this->so->read(array('filter' =>
$this->filter,'start' => $this->start,'query' => $this->query,'sort' =>
$this->sort,'order' => $this->order,
+
'chapter_id' => $this->chapter_id,'allrows'=>$this->allrows,
'template_id'=>$template_id));
+ $this->total_records = $this->so->total_records;
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ for ($i=0; $i<count($template); $i++)
+ {
+ $template[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($template[$i]['owner']);
+ $template[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($template[$i]['entry_date'],$dateformat);
+ }
+
+ return $template;
+ }
+
+ function read_template_hour($template_id)
+ {
+ $template = $this->so->read_template_hour(array('start'
=> $this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'chapter_id' => $this->chapter_id,'allrows'=>$this->allrows,
'template_id'=>$template_id));
+ $this->total_records = $this->so->total_records;
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ for ($i=0; $i<count($template); $i++)
+ {
+ $template[$i]['owner'] =
$GLOBALS['phpgw']->accounts->id2name($template[$i]['owner']);
+ $template[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($template[$i]['entry_date'],$dateformat);
+ }
+
+ return $template;
+ }
+
+
+ function read_single_template($template_id)
+ {
+ return $this->so->read_single_template($template_id);
+ }
+
+ function read_single_hour($hour_id)
+ {
+ return $this->so->read_single_hour($hour_id);
+ }
+
+ function get_grouping_list($selected='',$template_id)
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('grouping_select'));
+
+ $groupings= $this->so->get_grouping_list($template_id);
+
+ while (is_array($groupings) && list(,$grouping_entry) =
each($groupings))
+ {
+ $sel_grouping_entry = '';
+ if ($grouping_entry['id']==$selected)
+ {
+ $sel_grouping_entry = 'selected';
+ }
+
+ $grouping_list[] = array
+ (
+ 'id' =>
$grouping_entry['id'],
+ 'name' =>
$grouping_entry['name'],
+ 'selected' => $sel_grouping_entry
+ );
+ }
+
+ for ($i=0;$i<count($grouping_list);$i++)
+ {
+ if ($grouping_list[$i]['selected'] !=
'selected')
+ {
+ unset($grouping_list[$i]['selected']);
+ }
+ }
+
+ return $grouping_list;
+ }
+
+ function save_template($values)
+ {
+ if ($values['template_id'])
+ {
+ if ($values['template_id'] != 0)
+ {
+ $receipt =
$this->so->edit_template($values);
+
$receipt['template_id']=$values['template_id'];
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add_template($values);
+ }
+ return $receipt;
+ }
+
+ function save_hour($values,$template_id)
+ {
+ $values['billperae'] =
str_replace(",",".",$values['billperae']);
+ $values['quantity'] =
str_replace(",",".",$values['quantity']);
+ $values['cost'] =
$values['billperae']*$values['quantity'];
+ if($values['ns3420_descr'])
+ {
+ $values['descr']=$values['ns3420_descr'];
+ }
+
+ if ($values['hour_id'])
+ {
+ if ($values['hour_id'] != 0)
+ {
+ $receipt =
$this->so->edit_hour($values,$template_id);
+ }
+ }
+ else
+ {
+ $receipt =
$this->so->add_custom_hour($values,$template_id);
+ }
+ return $receipt;
+ }
+
+ function delete($params)
+ {
+ if (is_array($params))
+ {
+ $this->so->delete($params[0]);
+ }
+ else
+ {
+ $this->so->delete($params);
+ }
+ }
+
+ function delete_hour($hour_id,$template_id)
+ {
+ return $this->so->delete_hour($hour_id,$template_id);
+ }
+
+ }
+?>
Index: property/inc/class.botenant_claim.inc.php
diff -u property/inc/class.botenant_claim.inc.php:1.6
property/inc/class.botenant_claim.inc.php:1.7
--- property/inc/class.botenant_claim.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.botenant_claim.inc.php Fri Feb 3 12:05:49 2006
@@ -1,311 +1,311 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.botenant_claim.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
-
-
- class botenant_claim
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- function botenant_claim($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->so =
CreateObject($this->currentapp.'.sotenant_claim');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $status = get_var('status',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $allrows= get_var('allrows',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(!empty($filter))
- {
- $this->filter = $filter;
- }
- if(isset($status))
- {
- $this->status = $status;
- }
- 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
- {
- unset($this->cat_id);
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim');
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->status = $data['status'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- }
-
- function check_perms($has, $needed)
- {
- return (!!($has & $needed) == True);
- }
-
- function get_status_list($data=0)
- {
- if(is_array($data))
- {
- $format =
(isset($data['format'])?$data['format']:'');
- $selected =
(isset($data['selected'])?$data['selected']:$data['default']);
- }
- else
- {
- return;
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('status_' .
$format));
-
- $status[0][id]='closed';
- $status[0][name]=lang('Closed');
- if($format == "filter")
- {
- $status[1][id]='all';
- $status[1][name]=lang('All');
- }
- else
- {
- $status[1][id]='open';
- $status[1][name]=lang('Open');
- }
-
- while (is_array($status) && list(,$entry) =
each($status))
- {
- $sel_status = '';
- if ($entry['id']==$selected)
- {
- $sel_status = 'selected';
- }
-
- $status_list[] = array
- (
- 'id' => $entry['id'],
- 'name' => $entry['name'],
- 'selected' => $sel_status
- );
- }
-
- for ($i=0;$i<count($status_list);$i++)
- {
- if ($status_list[$i]['selected'] != 'selected')
- {
- unset($status_list[$i]['selected']);
- }
- }
-
- return $status_list;
- }
-
- function read_category_name($cat_id='')
- {
- return $this->so->read_category_name($cat_id);
- }
-
- function select_category_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->select_category_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function read($data=0)
- {
- $claim = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'status' => $this->status,'cat_id' =>
$this->cat_id,
-
'allrows'=>$this->allrows,'project_id' => $data['project_id']));
- $this->total_records = $this->so->total_records;
-
- for ($i=0; $i<count($claim); $i++)
- {
- $claim[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($claim[$i]['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
- return $claim;
- }
-
- function check_claim_project($project_id)
- {
- $claim = $this->so->check_claim_project($project_id);
- $this->total_records = $this->so->total_records;
- return $claim;
- }
-
- function check_claim_workorder($workorder_id)
- {
- $claim =
$this->so->check_claim_workorder($workorder_id);
- $this->total_records = $this->so->total_records;
- return $claim;
- }
-
- function read_single($claim_id)
- {
- return $this->so->read_single($claim_id);
- }
-
- function save($claim)
- {
-
- if ($claim['claim_id'])
- {
- if ($claim['claim_id'] != 0)
- {
- $claim_id = $claim['claim_id'];
- $receipt=$this->so->edit($claim);
- $action = lang('altered');
- }
- }
- else
- {
- $receipt = $this->so->add($claim);
- $action = lang('added');
- }
-
-
- $this->config =
CreateObject('phpgwapi.config',$this->currentapp);
- $this->config->read_repository();
- $claim_notify_mails =
$this->config->config_data['tenant_claim_notify_mails'];
- if ($claim_notify_mails)
- {
- // notify via email
-
$current_user_id=$GLOBALS['phpgw_info']['user']['account_id'];
- $current_prefs_user =
$this->bocommon->create_preferences($this->currentapp,$current_user_id);
- $from=$current_prefs_user['email'];
- $subject = lang("Tenant claim
%1",$receipt['claim_id']) .' ' . $action;
- $body = lang('Reminder');
-
- if(!is_object($GLOBALS['phpgw']->send))
- {
- $GLOBALS['phpgw']->send =
CreateObject('phpgwapi.send');
- }
- $subject =
$GLOBALS['phpgw']->send->encode_subject($subject);
- $notify_mails =
explode(',',$claim_notify_mails);
- foreach($notify_mails as $to)
- {
-
$GLOBALS['phpgw']->send->msg('email',$to,$subject,$body,'','','',$from,$from);
- }
- }
-
- return $receipt;
- }
-
- function delete($params)
- {
- if (is_array($params))
- {
- $this->so->delete($params[0]);
- }
- else
- {
- $this->so->delete($params);
- }
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.botenant_claim.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+
+
+ class botenant_claim
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ function botenant_claim($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->so =
CreateObject($this->currentapp.'.sotenant_claim');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $status = get_var('status',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $allrows= get_var('allrows',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(!empty($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($status))
+ {
+ $this->status = $status;
+ }
+ 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
+ {
+ unset($this->cat_id);
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim');
+
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->filter = $data['filter'];
+ $this->status = $data['status'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
+ $this->cat_id = $data['cat_id'];
+ }
+
+ function check_perms($has, $needed)
+ {
+ return (!!($has & $needed) == True);
+ }
+
+ function get_status_list($data=0)
+ {
+ if(is_array($data))
+ {
+ $format =
(isset($data['format'])?$data['format']:'');
+ $selected =
(isset($data['selected'])?$data['selected']:$data['default']);
+ }
+ else
+ {
+ return;
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('status_' .
$format));
+
+ $status[0][id]='closed';
+ $status[0][name]=lang('Closed');
+ if($format == "filter")
+ {
+ $status[1][id]='all';
+ $status[1][name]=lang('All');
+ }
+ else
+ {
+ $status[1][id]='open';
+ $status[1][name]=lang('Open');
+ }
+
+ while (is_array($status) && list(,$entry) =
each($status))
+ {
+ $sel_status = '';
+ if ($entry['id']==$selected)
+ {
+ $sel_status = 'selected';
+ }
+
+ $status_list[] = array
+ (
+ 'id' => $entry['id'],
+ 'name' => $entry['name'],
+ 'selected' => $sel_status
+ );
+ }
+
+ for ($i=0;$i<count($status_list);$i++)
+ {
+ if ($status_list[$i]['selected'] != 'selected')
+ {
+ unset($status_list[$i]['selected']);
+ }
+ }
+
+ return $status_list;
+ }
+
+ function read_category_name($cat_id='')
+ {
+ return $this->so->read_category_name($cat_id);
+ }
+
+ function select_category_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->select_category_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function read($data=0)
+ {
+ $claim = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'status' => $this->status,'cat_id' =>
$this->cat_id,
+
'allrows'=>$this->allrows,'project_id' => $data['project_id']));
+ $this->total_records = $this->so->total_records;
+
+ for ($i=0; $i<count($claim); $i++)
+ {
+ $claim[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($claim[$i]['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+ return $claim;
+ }
+
+ function check_claim_project($project_id)
+ {
+ $claim = $this->so->check_claim_project($project_id);
+ $this->total_records = $this->so->total_records;
+ return $claim;
+ }
+
+ function check_claim_workorder($workorder_id)
+ {
+ $claim =
$this->so->check_claim_workorder($workorder_id);
+ $this->total_records = $this->so->total_records;
+ return $claim;
+ }
+
+ function read_single($claim_id)
+ {
+ return $this->so->read_single($claim_id);
+ }
+
+ function save($claim)
+ {
+
+ if ($claim['claim_id'])
+ {
+ if ($claim['claim_id'] != 0)
+ {
+ $claim_id = $claim['claim_id'];
+ $receipt=$this->so->edit($claim);
+ $action = lang('altered');
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add($claim);
+ $action = lang('added');
+ }
+
+
+ $this->config =
CreateObject('phpgwapi.config',$this->currentapp);
+ $this->config->read_repository();
+ $claim_notify_mails =
$this->config->config_data['tenant_claim_notify_mails'];
+ if ($claim_notify_mails)
+ {
+ // notify via email
+
$current_user_id=$GLOBALS['phpgw_info']['user']['account_id'];
+ $current_prefs_user =
$this->bocommon->create_preferences($this->currentapp,$current_user_id);
+ $from=$current_prefs_user['email'];
+ $subject = lang("Tenant claim
%1",$receipt['claim_id']) .' ' . $action;
+ $body = lang('Reminder');
+
+ if(!is_object($GLOBALS['phpgw']->send))
+ {
+ $GLOBALS['phpgw']->send =
CreateObject('phpgwapi.send');
+ }
+ $subject =
$GLOBALS['phpgw']->send->encode_subject($subject);
+ $notify_mails =
explode(',',$claim_notify_mails);
+ foreach($notify_mails as $to)
+ {
+
$GLOBALS['phpgw']->send->msg('email',$to,$subject,$body,'','','',$from,$from);
+ }
+ }
+
+ return $receipt;
+ }
+
+ function delete($params)
+ {
+ if (is_array($params))
+ {
+ $this->so->delete($params[0]);
+ }
+ else
+ {
+ $this->so->delete($params);
+ }
+ }
+ }
+?>
Index: property/inc/class.botts.inc.php
diff -u property/inc/class.botts.inc.php:1.15
property/inc/class.botts.inc.php:1.16
--- property/inc/class.botts.inc.php:1.15 Fri Jan 27 14:05:43 2006
+++ property/inc/class.botts.inc.php Fri Feb 3 12:05:49 2006
@@ -1,850 +1,850 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 helpdesk
- * @version $Id: class.botts.inc.php,v 1.15 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class botts
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- 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 botts($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sotts');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->historylog =
CreateObject($this->currentapp.'.historylog','tts');
- $this->config =
CreateObject('phpgwapi.config');
- $this->config->read_repository();
- $this->dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $user_filter =
get_var('user_filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $district_id =
get_var('district_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
- $start_date =
get_var('start_date',array('POST','GET'));
- $end_date =
get_var('end_date',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(array_key_exists('query',$_POST))
- {
- $this->query = $query;
- }
- if(array_key_exists('filter',$_POST))
- {
- $this->filter = $filter;
- }
- if(array_key_exists('user_filter',$_POST))
- {
- $this->user_filter = $user_filter;
- }
- if(array_key_exists('sort',$_POST))
- {
- $this->sort = $sort;
- }
- if(array_key_exists('order',$_POST))
- {
- $this->order = $order;
- }
- if(array_key_exists('cat_id',$_POST))
- {
- $this->cat_id = $cat_id;
- }
- if(array_key_exists('district_id',$_POST))
- {
- $this->district_id = $district_id;
- }
- if(array_key_exists('allrows',$_POST) ||
array_key_exists('allrows',$_GET))
- {
- $this->allrows = $allrows;
- }
- if(array_key_exists('start_date',$_POST))
- {
- $this->start_date = $start_date;
- }
- if(array_key_exists('end_date',$_POST))
- {
- $this->end_date = $end_date;
- }
- }
-
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts');
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->user_filter = $data['user_filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- $this->district_id = $data['district_id'];
- $this->allrows = $data['allrows'];
- $this->start_date = $data['start_date'];
- $this->end_date = $data['end_date'];
- }
-
- function filter($data=0)
- {
- if(is_array($data))
- {
- $format =
(isset($data['format'])?$data['format']:'');
- $selected =
(isset($data['filter'])?$data['filter']:$data['default']);
- }
-
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_filter'));
- break;
- }
-
- $filters[0][id]='closed';
- $filters[0][name]=lang('Closed');
- $filters[1][id]='all';
- $filters[1][name]=lang('All');
-
- while (is_array($filters) && list(,$filter) =
each($filters))
- {
- $sel_filter = '';
- if ($filter['id']==$selected)
- {
- $sel_filter = 'selected';
- }
-
- $filter_list[] = array
- (
- 'id' => $filter['id'],
- 'name' => $filter['name'],
- 'selected' => $sel_filter
- );
- }
-
- for ($i=0;$i<count($filter_list);$i++)
- {
- if ($filter_list[$i]['selected'] != 'selected')
- {
- unset($filter_list[$i]['selected']);
- }
- }
-
- return $filter_list;
- }
-
- function get_status_list($selected)
- {
-
- $filters[0][id]='X';
- $filters[0][name]=lang('Closed');
- $filters[1][id]='O';
- $filters[1][name]=lang('Open');
-
- while (is_array($filters) && list(,$filter) =
each($filters))
- {
- $sel_filter = '';
- if ($filter['id']==$selected)
- {
- $sel_filter = 'selected';
- }
-
- $filter_list[] = array
- (
- 'id' => $filter['id'],
- 'name' => $filter['name'],
- 'selected' => $sel_filter
- );
- }
-
- for ($i=0;$i<count($filter_list);$i++)
- {
- if ($filter_list[$i]['selected'] != 'selected')
- {
- unset($filter_list[$i]['selected']);
- }
- }
-
- return $filter_list;
- }
-
-
- function get_priority_list($selected='')
- {
-
- if(!$selected)
- {
- $selected =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['prioritydefault'];
- }
-
- $priority_comment[1]=' - '.lang('Lowest');
- $priority_comment[5]=' - '.lang('Medium');
- $priority_comment[10]=' - '.lang('Highest');
-
- for ($i=1; $i<=10; $i++)
- {
- $priorities[$i]['id'] =$i;
- $priorities[$i]['name'] =$i .
$priority_comment[$i];
- }
-
- while (is_array($priorities) && list(,$priority) =
each($priorities))
- {
- $sel_priority = '';
- if ($priority['id']==$selected)
- {
- $sel_priority = 'selected';
- }
-
- $priority_list[] = array
- (
- 'id' => $priority['id'],
- 'name' => $priority['name'],
- 'selected' => $sel_priority
- );
- }
-
- for ($i=0;$i<count($priority_list);$i++)
- {
- if ($priority_list[$i]['selected'] !=
'selected')
- {
- unset($priority_list[$i]['selected']);
- }
- }
-
-//_debug_array($priority_list);
- return $priority_list;
- }
-
- function get_category_name($cat_id)
- {
- return $this->so->get_category_name($cat_id);
- }
-
- function select_category_list($format='',$selected='')
- {
-
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->select_category_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
- function read($start_date='',$end_date='')
- {
- $start_date =
$this->bocommon->date_to_timestamp($start_date);
- $end_date =
$this->bocommon->date_to_timestamp($end_date);
-
- $tickets = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id,'district_id' =>
$this->district_id,
-
'start_date'=>$start_date,'end_date'=>$end_date,
-
'allrows'=>$this->allrows,'user_filter' => $this->user_filter));
- $this->total_records = $this->so->total_records;
- $entity = $this->so->get_origin_entity_type();
-
- $this->uicols=$this->so->uicols;
- for ($i=0; $i<count($tickets); $i++)
- {
- if($tickets[$i]['assignedto'])
- {
- $tickets[$i]['assignedto'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['assignedto']);
- }
- else
- {
- $tickets[$i]['assignedto'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['group_id']);
- }
-
- $tickets[$i]['timestampopened'] =
$GLOBALS['phpgw']->common->show_date($tickets[$i]['entry_date'],$this->dateformat);
-
- if($tickets[$i]['finnish_date2'])
- {
-
$tickets[$i]['delay']=($tickets[$i]['finnish_date2']-$tickets[$i]['finnish_date'])/(24*3600);
-
$tickets[$i]['finnish_date']=$tickets[$i]['finnish_date2'];
- }
- $tickets[$i]['finnish_date'] =
(isset($tickets[$i]['finnish_date'])?$GLOBALS['phpgw']->common->show_date($tickets[$i]['finnish_date'],$this->dateformat):'');
-
- if ($tickets[$i]['status'] == 'X')
- {
- $history_values =
$this->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$tickets[$i]['id']);
- $tickets[$i]['timestampclosed'] =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
- }
- if ($tickets[$i]['new_ticket'])
- {
- $tickets[$i]['new_ticket'] =
lang('New');
- }
-
- for ($j=0;$j<count($entity);$j++)
- {
- $tickets[$i]['child_date'][$j] =
$this->so->get_child_date($tickets[$i]['id'],$entity[$j]['type'],$entity[$j]['entity_id'],$entity[$j]['cat_id']);
- }
- }
-
-//_debug_array($tickets);
- return $tickets;
- }
-
- function read_single($id)
- {
-
- $this->so->update_view($id);
-
- $ticket = $this->so->read_single($id);
-
- $ticket['user_lid'] =
$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']);
- $ticket['group_lid'] =
$GLOBALS['phpgw']->accounts->id2name($ticket['group_id']);
-
-
- if($ticket['finnish_date2'])
- {
-
$ticket['finnish_date']=$ticket['finnish_date2'];
- }
-
- if($ticket['finnish_date'])
- {
- $ticket['finnish_date'] =
$GLOBALS['phpgw']->common->show_date($ticket['finnish_date'],$this->dateformat);
- }
-
- if($ticket['location_code'])
- {
- $solocation =
CreateObject($this->currentapp.'.solocation');
- $ticket['location_data'] =
$solocation->read_single($ticket['location_code']);
- }
-//_debug_array($ticket['location_data']);
- if($ticket['p_num'])
- {
- $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
- $category =
$soadmin_entity->read_single_category($ticket['p_entity_id'],$ticket['p_cat_id']);
-
-
$ticket['p'][$ticket['p_entity_id']]['p_num']=$ticket['p_num'];
-
$ticket['p'][$ticket['p_entity_id']]['p_entity_id']=$ticket['p_entity_id'];
-
$ticket['p'][$ticket['p_entity_id']]['p_cat_id']=$ticket['p_cat_id'];
-
$ticket['p'][$ticket['p_entity_id']]['p_cat_name'] = $category['name'];
- }
-
-
- if($ticket['tenant_id']>0)
- {
-
$tenant_data=$this->bocommon->read_single_tenant($ticket['tenant_id']);
- $ticket['location_data']['tenant_id']=
$ticket['tenant_id'];
- $ticket['location_data']['contact_phone']=
$tenant_data['contact_phone'];
- $ticket['location_data']['last_name'] =
$tenant_data['last_name'];
- $ticket['location_data']['first_name'] =
$tenant_data['first_name'];
- }
- else
- {
- unset($ticket['location_data']['tenant_id']);
-
unset($ticket['location_data']['contact_phone']);
- unset($ticket['location_data']['last_name']);
- unset($ticket['location_data']['first_name']);
- }
-
-
- $history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$id);
- $ticket['timestampopened'] =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
- // Figure out when it was opened and last closed
-
- $history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','ASC',$id);
- $ticket['last_opened'] =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime']);
-
- if($ticket['status']=='X')
- {
-
- $history_values =
$this->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$id);
- $ticket['timestampclosed']=
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
- }
-
-
-
- $status_text = array(
- 'R' => 'Re-opened',
- 'X' => 'Closed',
- 'O' => 'Opened',
- 'A' => 'Re-assigned',
- 'G' => 'Re-assigned group',
- 'P' => 'Priority changed',
- 'T' => 'Category changed',
- 'S' => 'Subject changed',
- 'B' => 'Billing rate',
- 'H' => 'Billing hours',
- 'F' => 'finnish date'
- );
-
- $ticket['status_name'] =
lang($status_text[$ticket['status']]);
-
$ticket['assignedto_name']=$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']);
-
$ticket['user_lid']=$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']);
-
$ticket['category_name']=ucfirst($this->get_category_name($ticket['cat_id']));
-
- return $ticket;
- }
-
- function read_additional_notes($id)
- {
- $history_array =
$this->historylog->return_array(array(),array('C'),'','',$id);
- $i=1;
- while (is_array($history_array) && list(,$value) =
each($history_array))
- {
- $additional_notes[] = array
- (
- 'value_count' => $i,
- 'value_date' =>
$GLOBALS['phpgw']->common->show_date($value['datetime']),
- 'value_user' => $value['owner'],
- 'value_note' =>
stripslashes(stripslashes($value['new_value'])),
- );
- $i++;
- }
-
- return $additional_notes;
- }
-
-
- function read_record_history($id)
- {
- $history_array =
$this->historylog->return_array(array('C','O'),array(),'','',$id);
- $i=0;
- while (is_array($history_array) && list(,$value) =
each($history_array))
- {
-
- $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
- $record_history[$i]['value_user'] =
$value['owner'];
-
- switch ($value['status'])
- {
- case 'R': $type = lang('Re-opened');
break;
- case 'X': $type = lang('Closed');
break;
- case 'O': $type = lang('Opened');
break;
- case 'A': $type = lang('Re-assigned');
break;
- case 'G': $type = lang('Re-assigned
group'); break;
- case 'P': $type = lang('Priority
changed'); break;
- case 'T': $type = lang('Category
changed'); break;
- case 'S': $type = lang('Subject
changed'); break;
- case 'H': $type = lang('Billable hours
changed'); break;
- case 'B': $type = lang('Billable rate
changed'); break;
- case 'F': $type = lang('finnish date
changed'); break;
- case 'IF': $type = lang('Initial
finnish date'); break;
- default: break;
- }
-
-
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
-
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
-
-
- $record_history[$i]['value_action'] =
$type?$type:'';
- unset($type);
- if ($value['status'] == 'A' || $value['status']
== 'G')
- {
- if ((int)$value['new_value']>0)
- {
-
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- else
- {
-
$record_history[$i]['value_new_value'] = lang('None');
-
- }
- }
- else if ($value['status'] == 'T')
- {
- $record_history[$i]['value_new_value']
= $this->get_category_name($value['new_value']);
- }
- else if (($value['status'] == 'F') ||
($value['status'] =='IF'))
- {
- $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->common->show_date($value['new_value'],$this->dateformat);
- }
- else if ($value['status'] != 'O' &&
$value['new_value'])
- {
- $record_history[$i]['value_new_value']
= $value['new_value'];
- }
- else
- {
- $record_history[$i]['value_new_value']
= '';
- }
-
- $i++;
- }
-
- return $record_history;
- }
-
- function add($ticket)
- {
- while (is_array($ticket['location']) && list(,$value) =
each($ticket['location']))
- {
- if($value)
- {
- $location[] = $value;
- }
- }
-
- $ticket['finnish_date'] =
$this->bocommon->date_to_timestamp($ticket['finnish_date']);
- $ticket['location_code']=implode("-", $location);
-
- $receipt = $this->so->add($ticket);
-
- $this->config->read_repository();
-
- if ($this->config->config_data['mailnotification'] &&
$ticket['send_mail'])
- {
- $receipt =
$this->mail_ticket($receipt['id'],$fields_updated,$receipt,$ticket['location_code']);
- }
-
- return $receipt;
- }
-
-
- function
mail_ticket($id,$fields_updated,$receipt=0,$location_code='')
- {
- $this->send =
CreateObject('phpgwapi.send');
-
- $members = array();
-
- $ticket = $this->so->read_single($id);
-
- if($ticket['location_code'])
- {
-
- $solocation =
CreateObject($this->currentapp.'.solocation');
- $soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
- $location_data =
$solocation->read_single($ticket['location_code']);
-
-
$type_id=count(explode('-',$ticket['location_code']));
- $fm_location_cols =
$soadmin_location->read_attrib(array('type_id'=>$type_id,'lookup_type'=>$type_id));
- $i=0;
- if (isset($fm_location_cols) AND
is_array($fm_location_cols))
- {
- foreach($fm_location_cols as
$location_entry)
- {
-
if($location_entry['lookup_form'])
- {
-
$address_element[$i]['text']=$location_entry['input_text'];
-
$address_element[$i]['value']=$location_data[$location_entry['column_name']];
- }
- $i++;
- }
- }
- }
-
- $history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$id);
- $timestampopened =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
-
- if($ticket['status']=='X')
- {
- $history_values =
$this->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$id);
- $timestampclosed =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
- }
-
- $history_2 =
$this->historylog->return_array(array('C','O'),array(),'','',$id);
- $m=count($history_2)-1;
- $ticket['status']=$history_2[$m]['status'];
-
- $stat = $ticket['status'];
- $status = array(
- 'R' => 'Re-opened',
- 'X' => 'Closed',
- 'O' => 'Opened',
- 'A' => 'Re-assigned',
- 'G' => 'Re-assigned group',
- 'P' => 'Priority changed',
- 'T' => 'Category changed',
- 'S' => 'Subject changed',
- 'B' => 'Billing rate',
- 'H' => 'Billing hours',
- 'F' => 'finnish date changed'
- );
-
-
- $group_name=
$GLOBALS['phpgw']->accounts->id2name($ticket['group_id']);
-
- // build subject
- $subject = '['.lang('Ticket').' #'.$id.'] : ' .
$location_code .' ' .$this->get_category_name($ticket['cat_id']) . '; '
.$ticket['subject'];
-
-
- // $prefs_user =
$GLOBALS['phpgw']->preferences->create_email_preferences($ticket['user_id']);
- $prefs_user =
$this->bocommon->create_preferences($this->currentapp,$ticket['user_id']);
-
- $from_address=$prefs_user['email'];
-
- //-----------from--------
-
-
$current_user_id=$GLOBALS['phpgw_info']['user']['account_id'];
-
- $current_user_firstname =
$GLOBALS['phpgw_info']['user']['firstname'];
-
- $current_user_lastname
=$GLOBALS['phpgw_info']['user']['lastname'];
-
- $current_user_name= $user_firstname . " "
.$user_lastname ;
-
-// $current_prefs_user =
$GLOBALS['phpgw']->preferences->create_email_preferences($current_user_id);
- $current_prefs_user =
$this->bocommon->create_preferences($this->currentapp,$current_user_id);
- $current_user_address=$current_prefs_user['email'];
-
- $headers = "Return-Path: <". $current_user_address
.">\r\n";
- $headers .= "From: " . $current_user_name . "<" .
$current_user_address .">\r\n";
- $headers .= "Bcc: " . $current_user_name . "<" .
$current_user_address .">\r\n";
- $headers .= "Content-type: text/html;
charset=iso-8859-1\r\n";
- $headers .= "MIME-Version: 1.0\r\n";
-
- //-----------from--------
- // build body
- $body = '';
- $body .= lang('Ticket').' #'.$id."\n";
- $body .= lang('Date Opened').': '.$timestampopened."\n";
- $body .= lang('Category').': '.
$this->get_category_name($ticket['cat_id']) ."\n";
-// $body .= lang('Subject').': '. $ticket['subject'] ."\n";
- $body .= lang('Location').': '.
$ticket['location_code'] ."\n";
- $body .= lang('Address').': '. $ticket['address'] ."\n";
- if (isset($address_element) AND
is_array($address_element))
- {
- foreach($address_element as $address_entry)
- {
- $body .= $address_entry['text'].': '.
$address_entry['value'] ."\n";
- }
- }
-
- if($ticket['tenant_id'])
- {
-
$tenant_data=$this->bocommon->read_single_tenant($ticket['tenant_id']);
- $body .= lang('Tenant').': '.
$tenant_data['first_name'] . ' ' .$tenant_data['last_name'] ."\n";
-
- if($tenant_data['contact_phone'])
- {
- $body .= lang('Contact phone').': '.
$tenant_data['contact_phone'] ."\n";
-
- }
- }
- $body .= lang('Assigned To').':
'.$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto'])."\n";
- $body .= lang('Priority').': '.$ticket['priority']."\n";
- if($group_name)
- {
- $body .= lang('Group').': '. $group_name ."\n";
- }
- $body .= lang('Opened By').': '. $ticket['user_name']
."\n\n";
- $body .= lang('First Note Added').":\n";
- $body .=
stripslashes(strip_tags($ticket['details']))."\n\n";
-
-
/**************************************************************\
- * Display additional notes
*
-
\**************************************************************/
- if($fields_updated)
- {
- $i=1;
-
- $history_array =
$this->historylog->return_array(array(),array('C'),'','',$id);
- while (is_array($history_array) &&
list(,$value) = each($history_array))
- {
- $body .= lang('Date') . ':
'.$GLOBALS['phpgw']->common->show_date($value['datetime'])."\n";
- $body .= lang('User') . ':
'.$value['owner']."\n";
- $body .=lang('Note').': '.
nl2br(stripslashes($value['new_value']))."\n\n";
- $i++;
- }
- $subject.= "-" .$i;
- }
-
-
/**************************************************************\
- * Display record history
*
-
\**************************************************************/
-
- if($timestampclosed)
- {
- $body .= lang('Date Closed').':
'.$timestampclosed."\n\n";
- }
-
- if ($this->config->config_data['groupnotification'])
- {
- // select group recipients
- $members =
$GLOBALS['phpgw']->accounts->member($ticket['group_id']);
- }
-
- if ($this->config->config_data['ownernotification'])
- {
- // add owner to recipients
- $members[] = array('account_id' =>
$ticket['user_id'], 'account_name' =>
$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']));
- }
-
- if ($this->config->config_data['assignednotification'])
- {
- // add assigned to recipients
- $members[] = array('account_id' =>
$ticket['assignedto'], 'account_name' =>
$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']));
- }
-
- $error = Array();
- $toarray = Array();
- $i=0;
- for ($i=0;$i<count($members);$i++)
- {
- if ($members[$i]['account_id'])
- {
- // $prefs =
$GLOBALS['phpgw']->preferences->create_email_preferences($members[$i]['account_id']);
- $prefs =
$this->bocommon->create_preferences($this->currentapp,$members[$i]['account_id']);
- if (strlen($prefs['email'])>
(strlen($members[$i]['account_name'])+1))
- {
- $toarray[$prefs['email']] =
$prefs['email'];
- }
- else
- {
- $receipt['error'][] =
array('msg'=> lang('Your message could not be sent!'));
- $receipt['error'][] =
array('msg'=>lang('This user has not defined an email address !') . ' : ' .
$members[$i]['account_name']);
- }
- }
- }
-
- if(count($toarray) > 1)
- {
- $to = implode(',',$toarray);
- }
- else
- {
- $to = current($toarray);
- }
-
- $mail_method=
$this->config->config_data['fmwrkorder_mail'];
-// echo 'mail_method: '.$mail_method .'<BR>';
-
- if ($mail_method=='smtp'):
- {
- $rc = $this->send->msg('email', $to, $subject,
stripslashes($body), '', $cc,
$bcc,$current_user_address,$current_user_name,'txt');
- }
- elseif ($mail_method=='sendmail'):
- {
- $rc= @mail($to,$subject,stripslashes($body),
$headers);
- }
- else:
- {
- $receipt['error'][] = array('msg'=>
lang('Mailing method is not chosen! (admin section)'));
- }
- endif;
-
- // $rc=1;
- if (!$rc &&
($this->config->config_data['groupnotification'] ||
$this->config->config_data['ownernotification'] ||
$this->config->config_data['groupnotification']))
- {
- $receipt['error'][] = array('msg'=> lang('Your
message could not be sent by mail!'));
- $receipt['error'][] = array('msg'=> lang('The
mail server returned'));
- $receipt['error'][] = array('msg'=> 'From :' .
$current_user_name . '<' . $current_user_address .'>');
- $receipt['error'][] = array('msg'=> 'to: '.$to);
- $receipt['error'][] = array('msg'=> 'subject:
'.$subject);
- $receipt['error'][] = array('msg'=> $body );
- // $receipt['error'][] = array('msg'=> 'cc: ' .
$cc);
- // $receipt['error'][] = array('msg'=> 'bcc:
'.$bcc);
- $receipt['error'][] = array('msg'=> 'group:
'.$group_name);
- $receipt['error'][] = array('msg'=> 'err_code:
'.$this->send->err['code']);
- $receipt['error'][] = array('msg'=> 'err_msg:
'. htmlspecialchars($this->send->err['msg']));
- $receipt['error'][] = array('msg'=> 'err_desc:
'. $GLOBALS['phpgw']->err['desc']);
- }
-
-//_debug_array($receipt);
- return $receipt;
- }
-
-
- function delete($id)
- {
- $this->so->delete($id);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 helpdesk
+ * @version $Id: class.botts.inc.php,v 1.16 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class botts
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ 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 botts($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sotts');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->historylog =
CreateObject($this->currentapp.'.historylog','tts');
+ $this->config =
CreateObject('phpgwapi.config');
+ $this->config->read_repository();
+ $this->dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $user_filter =
get_var('user_filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $district_id =
get_var('district_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+ $start_date =
get_var('start_date',array('POST','GET'));
+ $end_date =
get_var('end_date',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(array_key_exists('query',$_POST))
+ {
+ $this->query = $query;
+ }
+ if(array_key_exists('filter',$_POST))
+ {
+ $this->filter = $filter;
+ }
+ if(array_key_exists('user_filter',$_POST))
+ {
+ $this->user_filter = $user_filter;
+ }
+ if(array_key_exists('sort',$_POST))
+ {
+ $this->sort = $sort;
+ }
+ if(array_key_exists('order',$_POST))
+ {
+ $this->order = $order;
+ }
+ if(array_key_exists('cat_id',$_POST))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(array_key_exists('district_id',$_POST))
+ {
+ $this->district_id = $district_id;
+ }
+ if(array_key_exists('allrows',$_POST) ||
array_key_exists('allrows',$_GET))
+ {
+ $this->allrows = $allrows;
+ }
+ if(array_key_exists('start_date',$_POST))
+ {
+ $this->start_date = $start_date;
+ }
+ if(array_key_exists('end_date',$_POST))
+ {
+ $this->end_date = $end_date;
+ }
+ }
+
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts');
+
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->filter = $data['filter'];
+ $this->user_filter = $data['user_filter'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
+ $this->cat_id = $data['cat_id'];
+ $this->district_id = $data['district_id'];
+ $this->allrows = $data['allrows'];
+ $this->start_date = $data['start_date'];
+ $this->end_date = $data['end_date'];
+ }
+
+ function filter($data=0)
+ {
+ if(is_array($data))
+ {
+ $format =
(isset($data['format'])?$data['format']:'');
+ $selected =
(isset($data['filter'])?$data['filter']:$data['default']);
+ }
+
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('filter_filter'));
+ break;
+ }
+
+ $filters[0][id]='closed';
+ $filters[0][name]=lang('Closed');
+ $filters[1][id]='all';
+ $filters[1][name]=lang('All');
+
+ while (is_array($filters) && list(,$filter) =
each($filters))
+ {
+ $sel_filter = '';
+ if ($filter['id']==$selected)
+ {
+ $sel_filter = 'selected';
+ }
+
+ $filter_list[] = array
+ (
+ 'id' => $filter['id'],
+ 'name' => $filter['name'],
+ 'selected' => $sel_filter
+ );
+ }
+
+ for ($i=0;$i<count($filter_list);$i++)
+ {
+ if ($filter_list[$i]['selected'] != 'selected')
+ {
+ unset($filter_list[$i]['selected']);
+ }
+ }
+
+ return $filter_list;
+ }
+
+ function get_status_list($selected)
+ {
+
+ $filters[0][id]='X';
+ $filters[0][name]=lang('Closed');
+ $filters[1][id]='O';
+ $filters[1][name]=lang('Open');
+
+ while (is_array($filters) && list(,$filter) =
each($filters))
+ {
+ $sel_filter = '';
+ if ($filter['id']==$selected)
+ {
+ $sel_filter = 'selected';
+ }
+
+ $filter_list[] = array
+ (
+ 'id' => $filter['id'],
+ 'name' => $filter['name'],
+ 'selected' => $sel_filter
+ );
+ }
+
+ for ($i=0;$i<count($filter_list);$i++)
+ {
+ if ($filter_list[$i]['selected'] != 'selected')
+ {
+ unset($filter_list[$i]['selected']);
+ }
+ }
+
+ return $filter_list;
+ }
+
+
+ function get_priority_list($selected='')
+ {
+
+ if(!$selected)
+ {
+ $selected =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['prioritydefault'];
+ }
+
+ $priority_comment[1]=' - '.lang('Lowest');
+ $priority_comment[5]=' - '.lang('Medium');
+ $priority_comment[10]=' - '.lang('Highest');
+
+ for ($i=1; $i<=10; $i++)
+ {
+ $priorities[$i]['id'] =$i;
+ $priorities[$i]['name'] =$i .
$priority_comment[$i];
+ }
+
+ while (is_array($priorities) && list(,$priority) =
each($priorities))
+ {
+ $sel_priority = '';
+ if ($priority['id']==$selected)
+ {
+ $sel_priority = 'selected';
+ }
+
+ $priority_list[] = array
+ (
+ 'id' => $priority['id'],
+ 'name' => $priority['name'],
+ 'selected' => $sel_priority
+ );
+ }
+
+ for ($i=0;$i<count($priority_list);$i++)
+ {
+ if ($priority_list[$i]['selected'] !=
'selected')
+ {
+ unset($priority_list[$i]['selected']);
+ }
+ }
+
+//_debug_array($priority_list);
+ return $priority_list;
+ }
+
+ function get_category_name($cat_id)
+ {
+ return $this->so->get_category_name($cat_id);
+ }
+
+ function select_category_list($format='',$selected='')
+ {
+
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->select_category_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+ function read($start_date='',$end_date='')
+ {
+ $start_date =
$this->bocommon->date_to_timestamp($start_date);
+ $end_date =
$this->bocommon->date_to_timestamp($end_date);
+
+ $tickets = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id,'district_id' =>
$this->district_id,
+
'start_date'=>$start_date,'end_date'=>$end_date,
+
'allrows'=>$this->allrows,'user_filter' => $this->user_filter));
+ $this->total_records = $this->so->total_records;
+ $entity = $this->so->get_origin_entity_type();
+
+ $this->uicols=$this->so->uicols;
+ for ($i=0; $i<count($tickets); $i++)
+ {
+ if($tickets[$i]['assignedto'])
+ {
+ $tickets[$i]['assignedto'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['assignedto']);
+ }
+ else
+ {
+ $tickets[$i]['assignedto'] =
$GLOBALS['phpgw']->accounts->id2name($tickets[$i]['group_id']);
+ }
+
+ $tickets[$i]['timestampopened'] =
$GLOBALS['phpgw']->common->show_date($tickets[$i]['entry_date'],$this->dateformat);
+
+ if($tickets[$i]['finnish_date2'])
+ {
+
$tickets[$i]['delay']=($tickets[$i]['finnish_date2']-$tickets[$i]['finnish_date'])/(24*3600);
+
$tickets[$i]['finnish_date']=$tickets[$i]['finnish_date2'];
+ }
+ $tickets[$i]['finnish_date'] =
(isset($tickets[$i]['finnish_date'])?$GLOBALS['phpgw']->common->show_date($tickets[$i]['finnish_date'],$this->dateformat):'');
+
+ if ($tickets[$i]['status'] == 'X')
+ {
+ $history_values =
$this->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$tickets[$i]['id']);
+ $tickets[$i]['timestampclosed'] =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
+ }
+ if ($tickets[$i]['new_ticket'])
+ {
+ $tickets[$i]['new_ticket'] =
lang('New');
+ }
+
+ for ($j=0;$j<count($entity);$j++)
+ {
+ $tickets[$i]['child_date'][$j] =
$this->so->get_child_date($tickets[$i]['id'],$entity[$j]['type'],$entity[$j]['entity_id'],$entity[$j]['cat_id']);
+ }
+ }
+
+//_debug_array($tickets);
+ return $tickets;
+ }
+
+ function read_single($id)
+ {
+
+ $this->so->update_view($id);
+
+ $ticket = $this->so->read_single($id);
+
+ $ticket['user_lid'] =
$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']);
+ $ticket['group_lid'] =
$GLOBALS['phpgw']->accounts->id2name($ticket['group_id']);
+
+
+ if($ticket['finnish_date2'])
+ {
+
$ticket['finnish_date']=$ticket['finnish_date2'];
+ }
+
+ if($ticket['finnish_date'])
+ {
+ $ticket['finnish_date'] =
$GLOBALS['phpgw']->common->show_date($ticket['finnish_date'],$this->dateformat);
+ }
+
+ if($ticket['location_code'])
+ {
+ $solocation =
CreateObject($this->currentapp.'.solocation');
+ $ticket['location_data'] =
$solocation->read_single($ticket['location_code']);
+ }
+//_debug_array($ticket['location_data']);
+ if($ticket['p_num'])
+ {
+ $soadmin_entity =
CreateObject($this->currentapp.'.soadmin_entity');
+ $category =
$soadmin_entity->read_single_category($ticket['p_entity_id'],$ticket['p_cat_id']);
+
+
$ticket['p'][$ticket['p_entity_id']]['p_num']=$ticket['p_num'];
+
$ticket['p'][$ticket['p_entity_id']]['p_entity_id']=$ticket['p_entity_id'];
+
$ticket['p'][$ticket['p_entity_id']]['p_cat_id']=$ticket['p_cat_id'];
+
$ticket['p'][$ticket['p_entity_id']]['p_cat_name'] = $category['name'];
+ }
+
+
+ if($ticket['tenant_id']>0)
+ {
+
$tenant_data=$this->bocommon->read_single_tenant($ticket['tenant_id']);
+ $ticket['location_data']['tenant_id']=
$ticket['tenant_id'];
+ $ticket['location_data']['contact_phone']=
$tenant_data['contact_phone'];
+ $ticket['location_data']['last_name'] =
$tenant_data['last_name'];
+ $ticket['location_data']['first_name'] =
$tenant_data['first_name'];
+ }
+ else
+ {
+ unset($ticket['location_data']['tenant_id']);
+
unset($ticket['location_data']['contact_phone']);
+ unset($ticket['location_data']['last_name']);
+ unset($ticket['location_data']['first_name']);
+ }
+
+
+ $history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$id);
+ $ticket['timestampopened'] =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
+ // Figure out when it was opened and last closed
+
+ $history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','ASC',$id);
+ $ticket['last_opened'] =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime']);
+
+ if($ticket['status']=='X')
+ {
+
+ $history_values =
$this->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$id);
+ $ticket['timestampclosed']=
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
+ }
+
+
+
+ $status_text = array(
+ 'R' => 'Re-opened',
+ 'X' => 'Closed',
+ 'O' => 'Opened',
+ 'A' => 'Re-assigned',
+ 'G' => 'Re-assigned group',
+ 'P' => 'Priority changed',
+ 'T' => 'Category changed',
+ 'S' => 'Subject changed',
+ 'B' => 'Billing rate',
+ 'H' => 'Billing hours',
+ 'F' => 'finnish date'
+ );
+
+ $ticket['status_name'] =
lang($status_text[$ticket['status']]);
+
$ticket['assignedto_name']=$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']);
+
$ticket['user_lid']=$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']);
+
$ticket['category_name']=ucfirst($this->get_category_name($ticket['cat_id']));
+
+ return $ticket;
+ }
+
+ function read_additional_notes($id)
+ {
+ $history_array =
$this->historylog->return_array(array(),array('C'),'','',$id);
+ $i=1;
+ while (is_array($history_array) && list(,$value) =
each($history_array))
+ {
+ $additional_notes[] = array
+ (
+ 'value_count' => $i,
+ 'value_date' =>
$GLOBALS['phpgw']->common->show_date($value['datetime']),
+ 'value_user' => $value['owner'],
+ 'value_note' =>
stripslashes(stripslashes($value['new_value'])),
+ );
+ $i++;
+ }
+
+ return $additional_notes;
+ }
+
+
+ function read_record_history($id)
+ {
+ $history_array =
$this->historylog->return_array(array('C','O'),array(),'','',$id);
+ $i=0;
+ while (is_array($history_array) && list(,$value) =
each($history_array))
+ {
+
+ $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
+ $record_history[$i]['value_user'] =
$value['owner'];
+
+ switch ($value['status'])
+ {
+ case 'R': $type = lang('Re-opened');
break;
+ case 'X': $type = lang('Closed');
break;
+ case 'O': $type = lang('Opened');
break;
+ case 'A': $type = lang('Re-assigned');
break;
+ case 'G': $type = lang('Re-assigned
group'); break;
+ case 'P': $type = lang('Priority
changed'); break;
+ case 'T': $type = lang('Category
changed'); break;
+ case 'S': $type = lang('Subject
changed'); break;
+ case 'H': $type = lang('Billable hours
changed'); break;
+ case 'B': $type = lang('Billable rate
changed'); break;
+ case 'F': $type = lang('finnish date
changed'); break;
+ case 'IF': $type = lang('Initial
finnish date'); break;
+ default: break;
+ }
+
+
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
+
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
+
+
+ $record_history[$i]['value_action'] =
$type?$type:'';
+ unset($type);
+ if ($value['status'] == 'A' || $value['status']
== 'G')
+ {
+ if ((int)$value['new_value']>0)
+ {
+
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ else
+ {
+
$record_history[$i]['value_new_value'] = lang('None');
+
+ }
+ }
+ else if ($value['status'] == 'T')
+ {
+ $record_history[$i]['value_new_value']
= $this->get_category_name($value['new_value']);
+ }
+ else if (($value['status'] == 'F') ||
($value['status'] =='IF'))
+ {
+ $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->common->show_date($value['new_value'],$this->dateformat);
+ }
+ else if ($value['status'] != 'O' &&
$value['new_value'])
+ {
+ $record_history[$i]['value_new_value']
= $value['new_value'];
+ }
+ else
+ {
+ $record_history[$i]['value_new_value']
= '';
+ }
+
+ $i++;
+ }
+
+ return $record_history;
+ }
+
+ function add($ticket)
+ {
+ while (is_array($ticket['location']) && list(,$value) =
each($ticket['location']))
+ {
+ if($value)
+ {
+ $location[] = $value;
+ }
+ }
+
+ $ticket['finnish_date'] =
$this->bocommon->date_to_timestamp($ticket['finnish_date']);
+ $ticket['location_code']=implode("-", $location);
+
+ $receipt = $this->so->add($ticket);
+
+ $this->config->read_repository();
+
+ if ($this->config->config_data['mailnotification'] &&
$ticket['send_mail'])
+ {
+ $receipt =
$this->mail_ticket($receipt['id'],$fields_updated,$receipt,$ticket['location_code']);
+ }
+
+ return $receipt;
+ }
+
+
+ function
mail_ticket($id,$fields_updated,$receipt=0,$location_code='')
+ {
+ $this->send =
CreateObject('phpgwapi.send');
+
+ $members = array();
+
+ $ticket = $this->so->read_single($id);
+
+ if($ticket['location_code'])
+ {
+
+ $solocation =
CreateObject($this->currentapp.'.solocation');
+ $soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
+ $location_data =
$solocation->read_single($ticket['location_code']);
+
+
$type_id=count(explode('-',$ticket['location_code']));
+ $fm_location_cols =
$soadmin_location->read_attrib(array('type_id'=>$type_id,'lookup_type'=>$type_id));
+ $i=0;
+ if (isset($fm_location_cols) AND
is_array($fm_location_cols))
+ {
+ foreach($fm_location_cols as
$location_entry)
+ {
+
if($location_entry['lookup_form'])
+ {
+
$address_element[$i]['text']=$location_entry['input_text'];
+
$address_element[$i]['value']=$location_data[$location_entry['column_name']];
+ }
+ $i++;
+ }
+ }
+ }
+
+ $history_values =
$this->historylog->return_array(array(),array('O'),'history_timestamp','DESC',$id);
+ $timestampopened =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
+
+ if($ticket['status']=='X')
+ {
+ $history_values =
$this->historylog->return_array(array(),array('X'),'history_timestamp','DESC',$id);
+ $timestampclosed =
$GLOBALS['phpgw']->common->show_date($history_values[0]['datetime'],$this->dateformat);
+ }
+
+ $history_2 =
$this->historylog->return_array(array('C','O'),array(),'','',$id);
+ $m=count($history_2)-1;
+ $ticket['status']=$history_2[$m]['status'];
+
+ $stat = $ticket['status'];
+ $status = array(
+ 'R' => 'Re-opened',
+ 'X' => 'Closed',
+ 'O' => 'Opened',
+ 'A' => 'Re-assigned',
+ 'G' => 'Re-assigned group',
+ 'P' => 'Priority changed',
+ 'T' => 'Category changed',
+ 'S' => 'Subject changed',
+ 'B' => 'Billing rate',
+ 'H' => 'Billing hours',
+ 'F' => 'finnish date changed'
+ );
+
+
+ $group_name=
$GLOBALS['phpgw']->accounts->id2name($ticket['group_id']);
+
+ // build subject
+ $subject = '['.lang('Ticket').' #'.$id.'] : ' .
$location_code .' ' .$this->get_category_name($ticket['cat_id']) . '; '
.$ticket['subject'];
+
+
+ // $prefs_user =
$GLOBALS['phpgw']->preferences->create_email_preferences($ticket['user_id']);
+ $prefs_user =
$this->bocommon->create_preferences($this->currentapp,$ticket['user_id']);
+
+ $from_address=$prefs_user['email'];
+
+ //-----------from--------
+
+
$current_user_id=$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $current_user_firstname =
$GLOBALS['phpgw_info']['user']['firstname'];
+
+ $current_user_lastname
=$GLOBALS['phpgw_info']['user']['lastname'];
+
+ $current_user_name= $user_firstname . " "
.$user_lastname ;
+
+// $current_prefs_user =
$GLOBALS['phpgw']->preferences->create_email_preferences($current_user_id);
+ $current_prefs_user =
$this->bocommon->create_preferences($this->currentapp,$current_user_id);
+ $current_user_address=$current_prefs_user['email'];
+
+ $headers = "Return-Path: <". $current_user_address
.">\r\n";
+ $headers .= "From: " . $current_user_name . "<" .
$current_user_address .">\r\n";
+ $headers .= "Bcc: " . $current_user_name . "<" .
$current_user_address .">\r\n";
+ $headers .= "Content-type: text/html;
charset=iso-8859-1\r\n";
+ $headers .= "MIME-Version: 1.0\r\n";
+
+ //-----------from--------
+ // build body
+ $body = '';
+ $body .= lang('Ticket').' #'.$id."\n";
+ $body .= lang('Date Opened').': '.$timestampopened."\n";
+ $body .= lang('Category').': '.
$this->get_category_name($ticket['cat_id']) ."\n";
+// $body .= lang('Subject').': '. $ticket['subject'] ."\n";
+ $body .= lang('Location').': '.
$ticket['location_code'] ."\n";
+ $body .= lang('Address').': '. $ticket['address'] ."\n";
+ if (isset($address_element) AND
is_array($address_element))
+ {
+ foreach($address_element as $address_entry)
+ {
+ $body .= $address_entry['text'].': '.
$address_entry['value'] ."\n";
+ }
+ }
+
+ if($ticket['tenant_id'])
+ {
+
$tenant_data=$this->bocommon->read_single_tenant($ticket['tenant_id']);
+ $body .= lang('Tenant').': '.
$tenant_data['first_name'] . ' ' .$tenant_data['last_name'] ."\n";
+
+ if($tenant_data['contact_phone'])
+ {
+ $body .= lang('Contact phone').': '.
$tenant_data['contact_phone'] ."\n";
+
+ }
+ }
+ $body .= lang('Assigned To').':
'.$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto'])."\n";
+ $body .= lang('Priority').': '.$ticket['priority']."\n";
+ if($group_name)
+ {
+ $body .= lang('Group').': '. $group_name ."\n";
+ }
+ $body .= lang('Opened By').': '. $ticket['user_name']
."\n\n";
+ $body .= lang('First Note Added').":\n";
+ $body .=
stripslashes(strip_tags($ticket['details']))."\n\n";
+
+
/**************************************************************\
+ * Display additional notes
*
+
\**************************************************************/
+ if($fields_updated)
+ {
+ $i=1;
+
+ $history_array =
$this->historylog->return_array(array(),array('C'),'','',$id);
+ while (is_array($history_array) &&
list(,$value) = each($history_array))
+ {
+ $body .= lang('Date') . ':
'.$GLOBALS['phpgw']->common->show_date($value['datetime'])."\n";
+ $body .= lang('User') . ':
'.$value['owner']."\n";
+ $body .=lang('Note').': '.
nl2br(stripslashes($value['new_value']))."\n\n";
+ $i++;
+ }
+ $subject.= "-" .$i;
+ }
+
+
/**************************************************************\
+ * Display record history
*
+
\**************************************************************/
+
+ if($timestampclosed)
+ {
+ $body .= lang('Date Closed').':
'.$timestampclosed."\n\n";
+ }
+
+ if ($this->config->config_data['groupnotification'])
+ {
+ // select group recipients
+ $members =
$GLOBALS['phpgw']->accounts->member($ticket['group_id']);
+ }
+
+ if ($this->config->config_data['ownernotification'])
+ {
+ // add owner to recipients
+ $members[] = array('account_id' =>
$ticket['user_id'], 'account_name' =>
$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']));
+ }
+
+ if ($this->config->config_data['assignednotification'])
+ {
+ // add assigned to recipients
+ $members[] = array('account_id' =>
$ticket['assignedto'], 'account_name' =>
$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']));
+ }
+
+ $error = Array();
+ $toarray = Array();
+ $i=0;
+ for ($i=0;$i<count($members);$i++)
+ {
+ if ($members[$i]['account_id'])
+ {
+ // $prefs =
$GLOBALS['phpgw']->preferences->create_email_preferences($members[$i]['account_id']);
+ $prefs =
$this->bocommon->create_preferences($this->currentapp,$members[$i]['account_id']);
+ if (strlen($prefs['email'])>
(strlen($members[$i]['account_name'])+1))
+ {
+ $toarray[$prefs['email']] =
$prefs['email'];
+ }
+ else
+ {
+ $receipt['error'][] =
array('msg'=> lang('Your message could not be sent!'));
+ $receipt['error'][] =
array('msg'=>lang('This user has not defined an email address !') . ' : ' .
$members[$i]['account_name']);
+ }
+ }
+ }
+
+ if(count($toarray) > 1)
+ {
+ $to = implode(',',$toarray);
+ }
+ else
+ {
+ $to = current($toarray);
+ }
+
+ $mail_method=
$this->config->config_data['fmwrkorder_mail'];
+// echo 'mail_method: '.$mail_method .'<BR>';
+
+ if ($mail_method=='smtp'):
+ {
+ $rc = $this->send->msg('email', $to, $subject,
stripslashes($body), '', $cc,
$bcc,$current_user_address,$current_user_name,'txt');
+ }
+ elseif ($mail_method=='sendmail'):
+ {
+ $rc= @mail($to,$subject,stripslashes($body),
$headers);
+ }
+ else:
+ {
+ $receipt['error'][] = array('msg'=>
lang('Mailing method is not chosen! (admin section)'));
+ }
+ endif;
+
+ // $rc=1;
+ if (!$rc &&
($this->config->config_data['groupnotification'] ||
$this->config->config_data['ownernotification'] ||
$this->config->config_data['groupnotification']))
+ {
+ $receipt['error'][] = array('msg'=> lang('Your
message could not be sent by mail!'));
+ $receipt['error'][] = array('msg'=> lang('The
mail server returned'));
+ $receipt['error'][] = array('msg'=> 'From :' .
$current_user_name . '<' . $current_user_address .'>');
+ $receipt['error'][] = array('msg'=> 'to: '.$to);
+ $receipt['error'][] = array('msg'=> 'subject:
'.$subject);
+ $receipt['error'][] = array('msg'=> $body );
+ // $receipt['error'][] = array('msg'=> 'cc: ' .
$cc);
+ // $receipt['error'][] = array('msg'=> 'bcc:
'.$bcc);
+ $receipt['error'][] = array('msg'=> 'group:
'.$group_name);
+ $receipt['error'][] = array('msg'=> 'err_code:
'.$this->send->err['code']);
+ $receipt['error'][] = array('msg'=> 'err_msg:
'. htmlspecialchars($this->send->err['msg']));
+ $receipt['error'][] = array('msg'=> 'err_desc:
'. $GLOBALS['phpgw']->err['desc']);
+ }
+
+//_debug_array($receipt);
+ return $receipt;
+ }
+
+
+ function delete($id)
+ {
+ $this->so->delete($id);
+ }
+ }
+?>
Index: property/inc/class.bowo_hour.inc.php
diff -u property/inc/class.bowo_hour.inc.php:1.8
property/inc/class.bowo_hour.inc.php:1.9
--- property/inc/class.bowo_hour.inc.php:1.8 Fri Jan 27 14:05:43 2006
+++ property/inc/class.bowo_hour.inc.php Fri Feb 3 12:05:49 2006
@@ -1,487 +1,487 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.bowo_hour.inc.php,v 1.8 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class bowo_hour
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function bowo_hour($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.sowo_hour');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $chapter_id =
get_var('chapter_id',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(isset($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- if(isset($chapter_id))
- {
- $this->chapter_id = $chapter_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','wo_hour',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','wo_hour');
-
- $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'];
- $this->chapter_id = $data['chapter_id'];
- }
-
- function get_chapter_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('chapter_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('chapter_filter'));
- break;
- }
-
- $chapters= $this->so->get_chapter_list();
-
- while (is_array($chapters) && list(,$chapter_entry) =
each($chapters))
- {
- $sel_chapter_entry = '';
- if ($chapter_entry['id']==$selected)
- {
- $sel_chapter_entry = 'selected';
- }
-
- $chapter_list[] = array
- (
- 'id' => $chapter_entry['id'],
- 'name' =>
$chapter_entry['name'],
- 'selected' => $sel_chapter_entry
- );
- }
-
- for ($i=0;$i<count($chapter_list);$i++)
- {
- if ($chapter_list[$i]['selected'] != 'selected')
- {
- unset($chapter_list[$i]['selected']);
- }
- }
-
- return $chapter_list;
- }
-
- function get_tolerance_list($selected='')
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('tolerance_select'));
-
- $tolerances[0]['id']= 1;
- $tolerances[1]['id']= 2;
- $tolerances[2]['id']= 3;
-
- while (is_array($tolerances) && list(,$tolerance_entry)
= each($tolerances))
- {
- $sel_tolerance_entry = '';
- if ($tolerance_entry['id']==$selected)
- {
- $sel_tolerance_entry = 'selected';
- }
-
- $tolerance_list[] = array
- (
- 'id' =>
$tolerance_entry['id'],
- 'name' =>
$tolerance_entry['id'],
- 'selected' => $sel_tolerance_entry
- );
- }
-
- for ($i=0;$i<count($tolerance_list);$i++)
- {
- if ($tolerance_list[$i]['selected'] !=
'selected')
- {
- unset($tolerance_list[$i]['selected']);
- }
- }
-
- return $tolerance_list;
- }
-
- function get_grouping_list($selected='',$workorder_id)
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('grouping_select'));
-
- $groupings= $this->so->get_grouping_list($workorder_id);
-
- while (is_array($groupings) && list(,$grouping_entry) =
each($groupings))
- {
- $sel_grouping_entry = '';
- if ($grouping_entry['id']==$selected)
- {
- $sel_grouping_entry = 'selected';
- }
-
- $grouping_list[] = array
- (
- 'id' =>
$grouping_entry['id'],
- 'name' =>
$grouping_entry['name'],
- 'selected' => $sel_grouping_entry
- );
- }
-
- for ($i=0;$i<count($grouping_list);$i++)
- {
- if ($grouping_list[$i]['selected'] !=
'selected')
- {
- unset($grouping_list[$i]['selected']);
- }
- }
-
- return $grouping_list;
- }
-
- function get_building_part_list($selected='')
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('building_part_select'));
-
- $building_parts= $this->so->get_building_part_list();
-
- while (is_array($building_parts) &&
list(,$building_part_entry) = each($building_parts))
- {
- $sel_building_part_entry = '';
- if ($building_part_entry['id']==$selected)
- {
- $sel_building_part_entry = 'selected';
- }
-
- $building_part_list[] = array
- (
- 'id' =>
$building_part_entry['id'],
- 'name' => '[ ' .
$building_part_entry['id'] . ' ] ' . $building_part_entry['name'],
- 'selected' =>
$sel_building_part_entry
- );
- }
-
- for ($i=0;$i<count($building_part_list);$i++)
- {
- if ($building_part_list[$i]['selected'] !=
'selected')
- {
-
unset($building_part_list[$i]['selected']);
- }
- }
-
- return $building_part_list;
- }
-
- function read($workorder_id='')
- {
- $hour = $this->so->read(array('workorder_id' =>
$workorder_id));
- $this->total_records = $this->so->total_records;
- return $hour;
- }
-
- function read_deviation($data)
- {
- $deviation =
$this->so->read_deviation(array('workorder_id' =>
$data['workorder_id'],'hour_id' => $data['hour_id']));
- $this->total_records = $this->so->total_records;
- return $deviation;
- }
-
- function read_single_deviation($data)
- {
- return $this->so->read_single_deviation($data);
- }
-
- function update_deviation($data)
- {
- $this->so->update_deviation($data);
- }
-
- function update_calculation($data)
- {
- $this->so->update_calculation($data);
- }
-
- function save_deviation($values,$action='')
- {
- if ($action=='edit')
- {
- if ($values['id'] != '')
- {
- $receipt =
$this->so->edit_deviation($values);
- }
- }
- else
- {
- $receipt = $this->so->add_deviation($values);
- }
- return $receipt;
- }
-
- function add_template($values,$workorder_id)
- {
- return $this->so->add_template($values,$workorder_id);
- }
-
- function add_hour($values,$workorder_id)
- {
-
-//_debug_array($values);
-
- foreach($values['select'] as $n)
- {
-
- if(!$values['quantity'][$n])
- {
- $values['quantity'][$n]=1;
- }
-
- $values['quantity'][$n] =
str_replace(",",".",$values['quantity'][$n]);
-
-
$cost=($values['total_cost'][$n]*$values['quantity'][$n]);
-
- $hour[]=array(
- 'activity_id' =>
$values['activity_id'][$n],
- 'activity_num' =>
$values['activity_num'][$n],
- 'hours_descr' =>
$values['descr'][$n],
- 'unit' =>
$values['unit'][$n],
- 'cost' => $cost,
- 'quantity' =>
$values['quantity'][$n],
- 'billperae' =>
$values['total_cost'][$n],
- 'ns3420_id' =>
$values['ns3420_id'][$n],
- 'dim_d' =>
$values['dim_d'][$n],
- 'workorder_id' =>
$workorder_id,
- 'wo_hour_cat' =>
$values['wo_hour_cat'][$n]
- );
-
- }
-//_debug_array($hour);
-
- if($hour)
- {
- $receipt = $this->so->add_hour($hour);
- }
- else
- {
- $receipt['message'][] =
array('msg'=>lang('Nothing to do!'));
- }
-
- return $receipt;
-
- }
-
- function add_hour_from_template($values,$workorder_id)
- {
-
-//_debug_array($values);
-
- foreach($values['select'] as $n)
- {
- if(!$values['quantity'][$n])
- {
- $values['quantity'][$n]=1;
- }
-
- $values['quantity'][$n] =
str_replace(",",".",$values['quantity'][$n]);
-
$cost=($values['billperae'][$n]*$values['quantity'][$n]);
-
- $hour[]=array(
- 'chapter_id' =>
$values['chapter_id'][$n],
- 'activity_id' =>
$values['activity_id'][$n],
- 'activity_num' =>
$values['activity_num'][$n],
- 'hours_descr' =>
$values['hours_descr'][$n],
- 'remark' =>
$values['remark'][$n],
- 'unit' =>
$values['unit'][$n],
- 'cost' =>
$cost,
- 'quantity' =>
$values['quantity'][$n],
- 'new_grouping' =>
$values['grouping_descr'][$n],
- 'billperae' =>
$values['billperae'][$n],
- 'ns3420_id' =>
$values['ns3420_id'][$n],
- 'tolerance' =>
$values['tolerance'][$n],
- 'building_part' =>
$values['building_part'][$n],
- 'dim_d' =>
$values['dim_d'][$n],
- 'workorder_id' =>
$workorder_id,
- );
-
- }
-//_debug_array($hour);
-
- if($hour)
- {
- $receipt =
$this->so->add_hour_from_template($hour,$workorder_id);
- }
- else
- {
- $receipt['message'][] =
array('msg'=>lang('Nothing to do!'));
- }
-
- return $receipt;
-
- }
-
- function read_single_hour($hour_id)
- {
- $hour = $this->so->read_single_hour($hour_id);
- return $hour;
- }
-
- function save_hour($values,$workorder_id)
- {
- $values['billperae'] =
str_replace(",",".",$values['billperae']);
- $values['quantity'] =
str_replace(",",".",$values['quantity']);
- $values['cost'] =
$values['billperae']*$values['quantity'];
- if($values['ns3420_descr'])
- {
- $values['descr']=$values['ns3420_descr'];
- }
-
- if ($values['hour_id'])
- {
- if ($values['hour_id'] != 0)
- {
- $receipt =
$this->so->edit($values,$workorder_id);
- }
- }
- else
- {
-//_debug_array($values);
- $receipt =
$this->so->add_custom_hour($values,$workorder_id);
- }
- return $receipt;
- }
-
- function get_email($to_email,$vendor_id)
- {
- $selected = $to_email;
-
- $email_ist = $this->so->get_email($vendor_id);
-
- while (is_array($email_ist) && list(,$email_entry) =
each($email_ist))
- {
- $sel_email = '';
- if ($email_entry['email']==$selected)
- {
- $sel_email = 'selected';
- }
-
- $email_list[] = array
- (
- 'email' =>
$email_entry['email'],
- 'selected' => $sel_email
- );
- }
-
- for ($i=0;$i<count($email_list);$i++)
- {
- if ($email_list[$i]['selected'] != 'selected')
- {
- unset($email_list[$i]['selected']);
- }
- }
-
- return $email_list;
- }
-
-
- function update_email($to_email,$workorder_id)
- {
- $this->so->update_email($to_email,$workorder_id);
- }
-
-
- function delete($hour_id,$workorder_id)
- {
- return $this->so->delete($hour_id,$workorder_id);
- }
-
- function delete_deviation($workorder_id,$hour_id,$id)
- {
- return
$this->so->delete_deviation($workorder_id,$hour_id,$id);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.bowo_hour.inc.php,v 1.9 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class bowo_hour
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function bowo_hour($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.sowo_hour');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $chapter_id =
get_var('chapter_id',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(isset($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ if(isset($chapter_id))
+ {
+ $this->chapter_id = $chapter_id;
+ }
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','wo_hour',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','wo_hour');
+
+ $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'];
+ $this->chapter_id = $data['chapter_id'];
+ }
+
+ function get_chapter_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('chapter_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('chapter_filter'));
+ break;
+ }
+
+ $chapters= $this->so->get_chapter_list();
+
+ while (is_array($chapters) && list(,$chapter_entry) =
each($chapters))
+ {
+ $sel_chapter_entry = '';
+ if ($chapter_entry['id']==$selected)
+ {
+ $sel_chapter_entry = 'selected';
+ }
+
+ $chapter_list[] = array
+ (
+ 'id' => $chapter_entry['id'],
+ 'name' =>
$chapter_entry['name'],
+ 'selected' => $sel_chapter_entry
+ );
+ }
+
+ for ($i=0;$i<count($chapter_list);$i++)
+ {
+ if ($chapter_list[$i]['selected'] != 'selected')
+ {
+ unset($chapter_list[$i]['selected']);
+ }
+ }
+
+ return $chapter_list;
+ }
+
+ function get_tolerance_list($selected='')
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('tolerance_select'));
+
+ $tolerances[0]['id']= 1;
+ $tolerances[1]['id']= 2;
+ $tolerances[2]['id']= 3;
+
+ while (is_array($tolerances) && list(,$tolerance_entry)
= each($tolerances))
+ {
+ $sel_tolerance_entry = '';
+ if ($tolerance_entry['id']==$selected)
+ {
+ $sel_tolerance_entry = 'selected';
+ }
+
+ $tolerance_list[] = array
+ (
+ 'id' =>
$tolerance_entry['id'],
+ 'name' =>
$tolerance_entry['id'],
+ 'selected' => $sel_tolerance_entry
+ );
+ }
+
+ for ($i=0;$i<count($tolerance_list);$i++)
+ {
+ if ($tolerance_list[$i]['selected'] !=
'selected')
+ {
+ unset($tolerance_list[$i]['selected']);
+ }
+ }
+
+ return $tolerance_list;
+ }
+
+ function get_grouping_list($selected='',$workorder_id)
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('grouping_select'));
+
+ $groupings= $this->so->get_grouping_list($workorder_id);
+
+ while (is_array($groupings) && list(,$grouping_entry) =
each($groupings))
+ {
+ $sel_grouping_entry = '';
+ if ($grouping_entry['id']==$selected)
+ {
+ $sel_grouping_entry = 'selected';
+ }
+
+ $grouping_list[] = array
+ (
+ 'id' =>
$grouping_entry['id'],
+ 'name' =>
$grouping_entry['name'],
+ 'selected' => $sel_grouping_entry
+ );
+ }
+
+ for ($i=0;$i<count($grouping_list);$i++)
+ {
+ if ($grouping_list[$i]['selected'] !=
'selected')
+ {
+ unset($grouping_list[$i]['selected']);
+ }
+ }
+
+ return $grouping_list;
+ }
+
+ function get_building_part_list($selected='')
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('building_part_select'));
+
+ $building_parts= $this->so->get_building_part_list();
+
+ while (is_array($building_parts) &&
list(,$building_part_entry) = each($building_parts))
+ {
+ $sel_building_part_entry = '';
+ if ($building_part_entry['id']==$selected)
+ {
+ $sel_building_part_entry = 'selected';
+ }
+
+ $building_part_list[] = array
+ (
+ 'id' =>
$building_part_entry['id'],
+ 'name' => '[ ' .
$building_part_entry['id'] . ' ] ' . $building_part_entry['name'],
+ 'selected' =>
$sel_building_part_entry
+ );
+ }
+
+ for ($i=0;$i<count($building_part_list);$i++)
+ {
+ if ($building_part_list[$i]['selected'] !=
'selected')
+ {
+
unset($building_part_list[$i]['selected']);
+ }
+ }
+
+ return $building_part_list;
+ }
+
+ function read($workorder_id='')
+ {
+ $hour = $this->so->read(array('workorder_id' =>
$workorder_id));
+ $this->total_records = $this->so->total_records;
+ return $hour;
+ }
+
+ function read_deviation($data)
+ {
+ $deviation =
$this->so->read_deviation(array('workorder_id' =>
$data['workorder_id'],'hour_id' => $data['hour_id']));
+ $this->total_records = $this->so->total_records;
+ return $deviation;
+ }
+
+ function read_single_deviation($data)
+ {
+ return $this->so->read_single_deviation($data);
+ }
+
+ function update_deviation($data)
+ {
+ $this->so->update_deviation($data);
+ }
+
+ function update_calculation($data)
+ {
+ $this->so->update_calculation($data);
+ }
+
+ function save_deviation($values,$action='')
+ {
+ if ($action=='edit')
+ {
+ if ($values['id'] != '')
+ {
+ $receipt =
$this->so->edit_deviation($values);
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add_deviation($values);
+ }
+ return $receipt;
+ }
+
+ function add_template($values,$workorder_id)
+ {
+ return $this->so->add_template($values,$workorder_id);
+ }
+
+ function add_hour($values,$workorder_id)
+ {
+
+//_debug_array($values);
+
+ foreach($values['select'] as $n)
+ {
+
+ if(!$values['quantity'][$n])
+ {
+ $values['quantity'][$n]=1;
+ }
+
+ $values['quantity'][$n] =
str_replace(",",".",$values['quantity'][$n]);
+
+
$cost=($values['total_cost'][$n]*$values['quantity'][$n]);
+
+ $hour[]=array(
+ 'activity_id' =>
$values['activity_id'][$n],
+ 'activity_num' =>
$values['activity_num'][$n],
+ 'hours_descr' =>
$values['descr'][$n],
+ 'unit' =>
$values['unit'][$n],
+ 'cost' => $cost,
+ 'quantity' =>
$values['quantity'][$n],
+ 'billperae' =>
$values['total_cost'][$n],
+ 'ns3420_id' =>
$values['ns3420_id'][$n],
+ 'dim_d' =>
$values['dim_d'][$n],
+ 'workorder_id' =>
$workorder_id,
+ 'wo_hour_cat' =>
$values['wo_hour_cat'][$n]
+ );
+
+ }
+//_debug_array($hour);
+
+ if($hour)
+ {
+ $receipt = $this->so->add_hour($hour);
+ }
+ else
+ {
+ $receipt['message'][] =
array('msg'=>lang('Nothing to do!'));
+ }
+
+ return $receipt;
+
+ }
+
+ function add_hour_from_template($values,$workorder_id)
+ {
+
+//_debug_array($values);
+
+ foreach($values['select'] as $n)
+ {
+ if(!$values['quantity'][$n])
+ {
+ $values['quantity'][$n]=1;
+ }
+
+ $values['quantity'][$n] =
str_replace(",",".",$values['quantity'][$n]);
+
$cost=($values['billperae'][$n]*$values['quantity'][$n]);
+
+ $hour[]=array(
+ 'chapter_id' =>
$values['chapter_id'][$n],
+ 'activity_id' =>
$values['activity_id'][$n],
+ 'activity_num' =>
$values['activity_num'][$n],
+ 'hours_descr' =>
$values['hours_descr'][$n],
+ 'remark' =>
$values['remark'][$n],
+ 'unit' =>
$values['unit'][$n],
+ 'cost' =>
$cost,
+ 'quantity' =>
$values['quantity'][$n],
+ 'new_grouping' =>
$values['grouping_descr'][$n],
+ 'billperae' =>
$values['billperae'][$n],
+ 'ns3420_id' =>
$values['ns3420_id'][$n],
+ 'tolerance' =>
$values['tolerance'][$n],
+ 'building_part' =>
$values['building_part'][$n],
+ 'dim_d' =>
$values['dim_d'][$n],
+ 'workorder_id' =>
$workorder_id,
+ );
+
+ }
+//_debug_array($hour);
+
+ if($hour)
+ {
+ $receipt =
$this->so->add_hour_from_template($hour,$workorder_id);
+ }
+ else
+ {
+ $receipt['message'][] =
array('msg'=>lang('Nothing to do!'));
+ }
+
+ return $receipt;
+
+ }
+
+ function read_single_hour($hour_id)
+ {
+ $hour = $this->so->read_single_hour($hour_id);
+ return $hour;
+ }
+
+ function save_hour($values,$workorder_id)
+ {
+ $values['billperae'] =
str_replace(",",".",$values['billperae']);
+ $values['quantity'] =
str_replace(",",".",$values['quantity']);
+ $values['cost'] =
$values['billperae']*$values['quantity'];
+ if($values['ns3420_descr'])
+ {
+ $values['descr']=$values['ns3420_descr'];
+ }
+
+ if ($values['hour_id'])
+ {
+ if ($values['hour_id'] != 0)
+ {
+ $receipt =
$this->so->edit($values,$workorder_id);
+ }
+ }
+ else
+ {
+//_debug_array($values);
+ $receipt =
$this->so->add_custom_hour($values,$workorder_id);
+ }
+ return $receipt;
+ }
+
+ function get_email($to_email,$vendor_id)
+ {
+ $selected = $to_email;
+
+ $email_ist = $this->so->get_email($vendor_id);
+
+ while (is_array($email_ist) && list(,$email_entry) =
each($email_ist))
+ {
+ $sel_email = '';
+ if ($email_entry['email']==$selected)
+ {
+ $sel_email = 'selected';
+ }
+
+ $email_list[] = array
+ (
+ 'email' =>
$email_entry['email'],
+ 'selected' => $sel_email
+ );
+ }
+
+ for ($i=0;$i<count($email_list);$i++)
+ {
+ if ($email_list[$i]['selected'] != 'selected')
+ {
+ unset($email_list[$i]['selected']);
+ }
+ }
+
+ return $email_list;
+ }
+
+
+ function update_email($to_email,$workorder_id)
+ {
+ $this->so->update_email($to_email,$workorder_id);
+ }
+
+
+ function delete($hour_id,$workorder_id)
+ {
+ return $this->so->delete($hour_id,$workorder_id);
+ }
+
+ function delete_deviation($workorder_id,$hour_id,$id)
+ {
+ return
$this->so->delete_deviation($workorder_id,$hour_id,$id);
+ }
+ }
+?>
Index: property/inc/class.boworkorder.inc.php
diff -u property/inc/class.boworkorder.inc.php:1.9
property/inc/class.boworkorder.inc.php:1.10
--- property/inc/class.boworkorder.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.boworkorder.inc.php Fri Feb 3 12:05:49 2006
@@ -1,476 +1,476 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.boworkorder.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class boworkorder
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
-
- var $public_functions = array
- (
- 'read' => True,
- 'read_single' => True,
- 'save' => True,
- 'delete' => True,
- 'check_perms' => True
- );
-
- function boworkorder($session=False)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'.soworkorder');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start = get_var('start',array('POST','GET'));
- $query = get_var('query',array('POST','GET'));
- $sort = get_var('sort',array('POST','GET'));
- $order = get_var('order',array('POST','GET'));
- $filter = get_var('filter',array('POST','GET'));
- $cat_id = get_var('cat_id',array('POST','GET'));
- $status_id =
get_var('status_id',array('POST','GET'));
- $search_vendor =
get_var('search_vendor',array('POST','GET'));
- $wo_hour_cat_id =
get_var('wo_hour_cat_id',array('POST','GET'));
- $start_date =
get_var('start_date',array('POST','GET'));
- $end_date =
get_var('end_date',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(array_key_exists('query',$_POST) ||
array_key_exists('query',$_GET) )
- {
- $this->query = $query;
- }
- if(array_key_exists('filter',$_POST))
- {
- $this->filter = $filter;
- }
- if(array_key_exists('sort',$_POST))
- {
- $this->sort = $sort;
- }
- if(array_key_exists('order',$_POST))
- {
- $this->order = $order;
- }
- if(array_key_exists('cat_id',$_POST))
- {
- $this->cat_id = $cat_id;
- }
- if(array_key_exists('status_id',$_POST))
- {
- $this->status_id = $status_id;
- }
- if(array_key_exists('search_vendor',$_POST))
- {
- $this->search_vendor = $search_vendor;
- }
- if(array_key_exists('wo_hour_cat_id',$_POST))
- {
- $this->wo_hour_cat_id = $wo_hour_cat_id;
- }
- if(array_key_exists('start_date',$_POST))
- {
- $this->start_date = $start_date;
- }
- if(array_key_exists('end_date',$_POST))
- {
- $this->end_date = $end_date;
- }
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','workorder');
-
- $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->search_vendor = $data['search_vendor'];
- $this->status_id = $data['status_id'];
- $this->wo_hour_cat_id = $data['wo_hour_cat_id'];
- $this->start_date = $data['start_date'];
- $this->end_date = $data['end_date'];
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','workorder',$data);
- }
- }
-
- function next_id()
- {
- return $this->so->next_id();
- }
-
- function select_status_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
- break;
- }
-
- $status_entries= $this->so->select_status_list();
-
- while (is_array($status_entries) && list(,$status) =
each($status_entries))
- {
- $sel_status = '';
- if ($status['id']==$selected)
- {
- $sel_status = 'selected';
- }
-
- $status_list[] = array
- (
- 'id' => $status['id'],
- 'name' => $status['name'],
- 'selected' => $sel_status
- );
- }
-
- for ($i=0;$i<count($status_list);$i++)
- {
- if ($status_list[$i]['selected'] != 'selected')
- {
- unset($status_list[$i]['selected']);
- }
- }
-
- return $status_list;
- }
-
- function select_branch_list($selected='')
- {
-
- $branch_entries= $this->so->select_branch_list();
-
- while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
- {
- $sel_branch = '';
- if ($branch['id']==$selected)
- {
- $sel_branch = 'selected';
- }
-
- $branch_list[] = array
- (
- 'id' => $branch['id'],
- 'name' => $branch['name'],
- 'selected' => $sel_branch
- );
- }
-
- for ($i=0;$i<count($branch_list);$i++)
- {
- if ($branch_list[$i]['selected'] != 'selected')
- {
- unset($branch_list[$i]['selected']);
- }
- }
-
- return $branch_list;
- }
-
- function select_branch_p_list($project_id='')
- {
-
- $selected =
$this->so->branch_p_list($project_id);
- $branch_entries = $this->so->select_branch_list();
-
- $j=0;
- while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
- {
- $branch_list[$j]['id'] = $branch['id'];
- $branch_list[$j]['name'] = $branch['name'];
-
- for ($i=0;$i<count($selected);$i++)
- {
- if($selected[$i]['branch_id'] ==
$branch['id'])
- {
- $branch_list[$j]['selected'] =
'selected';
- }
- }
- $j++;
- }
-
- for ($i=0;$i<count($branch_list);$i++)
- {
- if ($branch_list[$i]['selected'] != 'selected')
- {
- unset($branch_list[$i]['selected']);
- }
- }
-
- return $branch_list;
- }
-
-
- function select_key_location_list($selected='')
- {
-
- $key_location_entries=
$this->so->select_key_location_list();
-
- while (is_array($key_location_entries) &&
list(,$key_location) = each($key_location_entries))
- {
- $sel_key_location = '';
- if ($key_location['id']==$selected)
- {
- $sel_key_location = 'selected';
- }
-
- $key_location_list[] = array
- (
- 'id' => $key_location['id'],
- 'name' =>
$key_location['name'],
- 'selected' => $sel_key_location
- );
- }
-
- for ($i=0;$i<count($key_location_list);$i++)
- {
- if ($key_location_list[$i]['selected'] !=
'selected')
- {
-
unset($key_location_list[$i]['selected']);
- }
- }
-
- return $key_location_list;
- }
-
- function select_category_workorder_list($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
- break;
- case 'filter':
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- break;
- }
-
- $categories=
$this->so->select_category_workorder_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['name'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
-
- function read($start_date='',$end_date='',$allrows='')
- {
- $start_date =
$this->bocommon->date_to_timestamp($start_date);
- $end_date =
$this->bocommon->date_to_timestamp($end_date);
-
- $workorder = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,
-
'search_vendor' => $this->search_vendor,'wo_hour_cat_id' =>
$this->wo_hour_cat_id,
-
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$allrows));
- $this->total_records = $this->so->total_records;
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $this->uicols = $this->so->uicols;
-
- for ($i=0; $i<count($workorder); $i++)
- {
- $workorder[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($workorder[$i]['entry_date'],$dateformat);
- }
-
- return $workorder;
- }
-
- function read_single($workorder_id)
- {
- $contacts =
CreateObject($this->currentapp.'.soactor');
- $contacts->role='vendor';
- $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);
- $workorder['end_date'] =
$GLOBALS['phpgw']->common->show_date($workorder['end_date'],$dateformat);
- $vendor
= $contacts->read_single(array('actor_id'=>(int)$workorder['vendor_id']));
- if(is_array($vendor))
- {
- foreach($vendor['attributes'] as $attribute)
- {
- if($attribute['name']=='org_name')
- {
-
$workorder['vendor_name']=$attribute['value'];
- }
- if($attribute['name']=='email')
- {
-
$workorder['vendor_email']=$attribute['value'];
- }
- }
- }
-
- $workorder['b_account_name'] =
$this->so->get_b_account_name($workorder['b_account_id']);
-
- $config =
CreateObject('phpgwapi.config');
- $config->read_repository();
- $tax = 1+($config->config_data['fm_tax'])/100;
- $workorder['calculation']
=number_format($workorder['calculation']*$tax, 2, ',', '');
- $workorder['actual_cost']
=number_format(($workorder['act_mtrl_cost']+$workorder['act_vendor_cost']), 2,
',', '');
-
- return $workorder;
- }
-
- function read_record_history($id)
- {
- $historylog =
CreateObject($this->currentapp.'.historylog','workorder');
- $history_array =
$historylog->return_array(array('O'),array(),'','',$id);
- $i=0;
- while (is_array($history_array) && list(,$value) =
each($history_array))
- {
-
- $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
- $record_history[$i]['value_user'] =
$value['owner'];
-
- switch ($value['status'])
- {
- case 'R': $type = lang('Re-opened');
break;
- case 'X': $type = lang('Closed');
break;
- case 'O': $type = lang('Opened');
break;
- case 'A': $type = lang('Re-assigned');
break;
- case 'P': $type = lang('Priority
changed'); break;
- case 'M': $type = lang('Sendt by email
to'); break;
- case 'B': $type = lang('Budget
changed'); break;
- case 'CO': $type = lang('Initial
Coordinator'); break;
- case 'C': $type = lang('Coordinator
changed'); break;
- case 'TO': $type = lang('Initial
Category'); break;
- case 'T': $type = lang('Category
changed'); break;
- case 'SO': $type = lang('Initial
Status'); break;
- case 'S': $type = lang('Status
changed'); break;
- default: break;
- }
-
-
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
-
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
-
-
- $record_history[$i]['value_action'] =
$type?$type:'';
- unset($type);
-
- if ($value['status'] == 'A')
- {
- if (! $value['new_value'])
- {
-
$record_history[$i]['value_new_value'] = lang('None');
- }
- else
- {
-
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- }
- else if ($value['status'] == 'C' ||
$value['status'] == 'CO')
- {
- $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
- }
- else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
- {
- $record_history[$i]['value_new_value']
= $this->so->read_single_project_category($value['new_value']);
- }
- else if ($value['status'] != 'O' &&
$value['new_value'])
- {
- $record_history[$i]['value_new_value']
= $value['new_value'];
- }
- else if ($value['status'] != 'B' &&
$value['new_value'])
- {
- $record_history[$i]['value_new_value']
= $value['new_value'];
- }
- else
- {
- $record_history[$i]['value_new_value']
= '';
- }
-
- $i++;
- }
-
- return $record_history;
- }
-
- function save($workorder,$action='')
- {
- $workorder['start_date'] =
$this->bocommon->date_to_timestamp($workorder['start_date']);
- $workorder['end_date'] =
$this->bocommon->date_to_timestamp($workorder['end_date']);
-
- if ($action=='edit')
- {
- $receipt = $this->so->edit($workorder);
- }
- else
- {
- $receipt = $this->so->add($workorder);
- }
- return $receipt;
- }
-
- function delete($workorder_id)
- {
- $this->so->delete($workorder_id);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.boworkorder.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class boworkorder
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+
+ var $public_functions = array
+ (
+ 'read' => True,
+ 'read_single' => True,
+ 'save' => True,
+ 'delete' => True,
+ 'check_perms' => True
+ );
+
+ function boworkorder($session=False)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'.soworkorder');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start = get_var('start',array('POST','GET'));
+ $query = get_var('query',array('POST','GET'));
+ $sort = get_var('sort',array('POST','GET'));
+ $order = get_var('order',array('POST','GET'));
+ $filter = get_var('filter',array('POST','GET'));
+ $cat_id = get_var('cat_id',array('POST','GET'));
+ $status_id =
get_var('status_id',array('POST','GET'));
+ $search_vendor =
get_var('search_vendor',array('POST','GET'));
+ $wo_hour_cat_id =
get_var('wo_hour_cat_id',array('POST','GET'));
+ $start_date =
get_var('start_date',array('POST','GET'));
+ $end_date =
get_var('end_date',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(array_key_exists('query',$_POST) ||
array_key_exists('query',$_GET) )
+ {
+ $this->query = $query;
+ }
+ if(array_key_exists('filter',$_POST))
+ {
+ $this->filter = $filter;
+ }
+ if(array_key_exists('sort',$_POST))
+ {
+ $this->sort = $sort;
+ }
+ if(array_key_exists('order',$_POST))
+ {
+ $this->order = $order;
+ }
+ if(array_key_exists('cat_id',$_POST))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(array_key_exists('status_id',$_POST))
+ {
+ $this->status_id = $status_id;
+ }
+ if(array_key_exists('search_vendor',$_POST))
+ {
+ $this->search_vendor = $search_vendor;
+ }
+ if(array_key_exists('wo_hour_cat_id',$_POST))
+ {
+ $this->wo_hour_cat_id = $wo_hour_cat_id;
+ }
+ if(array_key_exists('start_date',$_POST))
+ {
+ $this->start_date = $start_date;
+ }
+ if(array_key_exists('end_date',$_POST))
+ {
+ $this->end_date = $end_date;
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data','workorder');
+
+ $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->search_vendor = $data['search_vendor'];
+ $this->status_id = $data['status_id'];
+ $this->wo_hour_cat_id = $data['wo_hour_cat_id'];
+ $this->start_date = $data['start_date'];
+ $this->end_date = $data['end_date'];
+ }
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','workorder',$data);
+ }
+ }
+
+ function next_id()
+ {
+ return $this->so->next_id();
+ }
+
+ function select_status_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('status_filter'));
+ break;
+ }
+
+ $status_entries= $this->so->select_status_list();
+
+ while (is_array($status_entries) && list(,$status) =
each($status_entries))
+ {
+ $sel_status = '';
+ if ($status['id']==$selected)
+ {
+ $sel_status = 'selected';
+ }
+
+ $status_list[] = array
+ (
+ 'id' => $status['id'],
+ 'name' => $status['name'],
+ 'selected' => $sel_status
+ );
+ }
+
+ for ($i=0;$i<count($status_list);$i++)
+ {
+ if ($status_list[$i]['selected'] != 'selected')
+ {
+ unset($status_list[$i]['selected']);
+ }
+ }
+
+ return $status_list;
+ }
+
+ function select_branch_list($selected='')
+ {
+
+ $branch_entries= $this->so->select_branch_list();
+
+ while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
+ {
+ $sel_branch = '';
+ if ($branch['id']==$selected)
+ {
+ $sel_branch = 'selected';
+ }
+
+ $branch_list[] = array
+ (
+ 'id' => $branch['id'],
+ 'name' => $branch['name'],
+ 'selected' => $sel_branch
+ );
+ }
+
+ for ($i=0;$i<count($branch_list);$i++)
+ {
+ if ($branch_list[$i]['selected'] != 'selected')
+ {
+ unset($branch_list[$i]['selected']);
+ }
+ }
+
+ return $branch_list;
+ }
+
+ function select_branch_p_list($project_id='')
+ {
+
+ $selected =
$this->so->branch_p_list($project_id);
+ $branch_entries = $this->so->select_branch_list();
+
+ $j=0;
+ while (is_array($branch_entries) && list(,$branch) =
each($branch_entries))
+ {
+ $branch_list[$j]['id'] = $branch['id'];
+ $branch_list[$j]['name'] = $branch['name'];
+
+ for ($i=0;$i<count($selected);$i++)
+ {
+ if($selected[$i]['branch_id'] ==
$branch['id'])
+ {
+ $branch_list[$j]['selected'] =
'selected';
+ }
+ }
+ $j++;
+ }
+
+ for ($i=0;$i<count($branch_list);$i++)
+ {
+ if ($branch_list[$i]['selected'] != 'selected')
+ {
+ unset($branch_list[$i]['selected']);
+ }
+ }
+
+ return $branch_list;
+ }
+
+
+ function select_key_location_list($selected='')
+ {
+
+ $key_location_entries=
$this->so->select_key_location_list();
+
+ while (is_array($key_location_entries) &&
list(,$key_location) = each($key_location_entries))
+ {
+ $sel_key_location = '';
+ if ($key_location['id']==$selected)
+ {
+ $sel_key_location = 'selected';
+ }
+
+ $key_location_list[] = array
+ (
+ 'id' => $key_location['id'],
+ 'name' =>
$key_location['name'],
+ 'selected' => $sel_key_location
+ );
+ }
+
+ for ($i=0;$i<count($key_location_list);$i++)
+ {
+ if ($key_location_list[$i]['selected'] !=
'selected')
+ {
+
unset($key_location_list[$i]['selected']);
+ }
+ }
+
+ return $key_location_list;
+ }
+
+ function select_category_workorder_list($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories=
$this->so->select_category_workorder_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['name'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+
+ function read($start_date='',$end_date='',$allrows='')
+ {
+ $start_date =
$this->bocommon->date_to_timestamp($start_date);
+ $end_date =
$this->bocommon->date_to_timestamp($end_date);
+
+ $workorder = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'filter' => $this->filter,'cat_id' => $this->cat_id,'status_id' =>
$this->status_id,
+
'search_vendor' => $this->search_vendor,'wo_hour_cat_id' =>
$this->wo_hour_cat_id,
+
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$allrows));
+ $this->total_records = $this->so->total_records;
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ $this->uicols = $this->so->uicols;
+
+ for ($i=0; $i<count($workorder); $i++)
+ {
+ $workorder[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($workorder[$i]['entry_date'],$dateformat);
+ }
+
+ return $workorder;
+ }
+
+ function read_single($workorder_id)
+ {
+ $contacts =
CreateObject($this->currentapp.'.soactor');
+ $contacts->role='vendor';
+ $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);
+ $workorder['end_date'] =
$GLOBALS['phpgw']->common->show_date($workorder['end_date'],$dateformat);
+ $vendor
= $contacts->read_single(array('actor_id'=>(int)$workorder['vendor_id']));
+ if(is_array($vendor))
+ {
+ foreach($vendor['attributes'] as $attribute)
+ {
+ if($attribute['name']=='org_name')
+ {
+
$workorder['vendor_name']=$attribute['value'];
+ }
+ if($attribute['name']=='email')
+ {
+
$workorder['vendor_email']=$attribute['value'];
+ }
+ }
+ }
+
+ $workorder['b_account_name'] =
$this->so->get_b_account_name($workorder['b_account_id']);
+
+ $config =
CreateObject('phpgwapi.config');
+ $config->read_repository();
+ $tax = 1+($config->config_data['fm_tax'])/100;
+ $workorder['calculation']
=number_format($workorder['calculation']*$tax, 2, ',', '');
+ $workorder['actual_cost']
=number_format(($workorder['act_mtrl_cost']+$workorder['act_vendor_cost']), 2,
',', '');
+
+ return $workorder;
+ }
+
+ function read_record_history($id)
+ {
+ $historylog =
CreateObject($this->currentapp.'.historylog','workorder');
+ $history_array =
$historylog->return_array(array('O'),array(),'','',$id);
+ $i=0;
+ while (is_array($history_array) && list(,$value) =
each($history_array))
+ {
+
+ $record_history[$i]['value_date'] =
$GLOBALS['phpgw']->common->show_date($value['datetime']);
+ $record_history[$i]['value_user'] =
$value['owner'];
+
+ switch ($value['status'])
+ {
+ case 'R': $type = lang('Re-opened');
break;
+ case 'X': $type = lang('Closed');
break;
+ case 'O': $type = lang('Opened');
break;
+ case 'A': $type = lang('Re-assigned');
break;
+ case 'P': $type = lang('Priority
changed'); break;
+ case 'M': $type = lang('Sendt by email
to'); break;
+ case 'B': $type = lang('Budget
changed'); break;
+ case 'CO': $type = lang('Initial
Coordinator'); break;
+ case 'C': $type = lang('Coordinator
changed'); break;
+ case 'TO': $type = lang('Initial
Category'); break;
+ case 'T': $type = lang('Category
changed'); break;
+ case 'SO': $type = lang('Initial
Status'); break;
+ case 'S': $type = lang('Status
changed'); break;
+ default: break;
+ }
+
+
if($value['new_value']=='O'){$value['new_value']=lang('Opened');}
+
if($value['new_value']=='X'){$value['new_value']=lang('Closed');}
+
+
+ $record_history[$i]['value_action'] =
$type?$type:'';
+ unset($type);
+
+ if ($value['status'] == 'A')
+ {
+ if (! $value['new_value'])
+ {
+
$record_history[$i]['value_new_value'] = lang('None');
+ }
+ else
+ {
+
$record_history[$i]['value_new_value'] =
$GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ }
+ else if ($value['status'] == 'C' ||
$value['status'] == 'CO')
+ {
+ $record_history[$i]['value_new_value']
= $GLOBALS['phpgw']->accounts->id2name($value['new_value']);
+ }
+ else if ($value['status'] == 'T' ||
$value['status'] == 'TO')
+ {
+ $record_history[$i]['value_new_value']
= $this->so->read_single_project_category($value['new_value']);
+ }
+ else if ($value['status'] != 'O' &&
$value['new_value'])
+ {
+ $record_history[$i]['value_new_value']
= $value['new_value'];
+ }
+ else if ($value['status'] != 'B' &&
$value['new_value'])
+ {
+ $record_history[$i]['value_new_value']
= $value['new_value'];
+ }
+ else
+ {
+ $record_history[$i]['value_new_value']
= '';
+ }
+
+ $i++;
+ }
+
+ return $record_history;
+ }
+
+ function save($workorder,$action='')
+ {
+ $workorder['start_date'] =
$this->bocommon->date_to_timestamp($workorder['start_date']);
+ $workorder['end_date'] =
$this->bocommon->date_to_timestamp($workorder['end_date']);
+
+ if ($action=='edit')
+ {
+ $receipt = $this->so->edit($workorder);
+ }
+ else
+ {
+ $receipt = $this->so->add($workorder);
+ }
+ return $receipt;
+ }
+
+ function delete($workorder_id)
+ {
+ $this->so->delete($workorder_id);
+ }
+ }
+?>
Index: property/inc/class.custom_functions.inc.php
diff -u property/inc/class.custom_functions.inc.php:1.5
property/inc/class.custom_functions.inc.php:1.6
--- property/inc/class.custom_functions.inc.php:1.5 Fri Jan 27 14:05:43 2006
+++ property/inc/class.custom_functions.inc.php Fri Feb 3 12:05:49 2006
@@ -1,64 +1,64 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 core
- * @version $Id: class.custom_functions.inc.php,v 1.5 2006/01/27
14:05:43 sigurdne Exp $
- */
-
- /**
- * This is a class used to gain access to custom classes stored in
/inc/custom to be run as cron jobs
- * or from the admin interface.
- * @package property
- */
-
- class custom_functions
- {
-
- var $public_functions = array(
- 'index' => True
- );
-
- function custom_functions ()
- {
- $GLOBALS['phpgw_info']['flags']['noheader'] = True;
- $GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
-
-
- $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
-
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->config =
CreateObject('phpgwapi.config',$this->currentapp);
-
- }
-
- /**
- * @param mixed $data
- * If $data is an array - then the process is run as cron - and
will look for $data['function'] to
- * determine which custom class to load
- */
-
- function index($data='')
- {
- if(is_array($data))
- {
- $function = $data['function'];
- }
- else
- {
- $function =
get_var('function',array('POST','GET'));
- }
-
-
include_once(PHPGW_SERVER_ROOT.'/'.'property'.'/inc/custom/' . $function .
'.php');
- $custom = new $function;
- $custom->pre_run($data);
- }
-
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 core
+ * @version $Id: class.custom_functions.inc.php,v 1.6 2006/02/03
12:05:49 sigurdne Exp $
+ */
+
+ /**
+ * This is a class used to gain access to custom classes stored in
/inc/custom to be run as cron jobs
+ * or from the admin interface.
+ * @package property
+ */
+
+ class custom_functions
+ {
+
+ var $public_functions = array(
+ 'index' => True
+ );
+
+ function custom_functions ()
+ {
+ $GLOBALS['phpgw_info']['flags']['noheader'] = True;
+ $GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
+
+
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
+
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->config =
CreateObject('phpgwapi.config',$this->currentapp);
+
+ }
+
+ /**
+ * @param mixed $data
+ * If $data is an array - then the process is run as cron - and
will look for $data['function'] to
+ * determine which custom class to load
+ */
+
+ function index($data='')
+ {
+ if(is_array($data))
+ {
+ $function = $data['function'];
+ }
+ else
+ {
+ $function =
get_var('function',array('POST','GET'));
+ }
+
+
include_once(PHPGW_SERVER_ROOT.'/'.'property'.'/inc/custom/' . $function .
'.php');
+ $custom = new $function;
+ $custom->pre_run($data);
+ }
+
+
+ }
+?>
Index: property/inc/class.excel.inc.php
diff -u property/inc/class.excel.inc.php:1.6
property/inc/class.excel.inc.php:1.7
--- property/inc/class.excel.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.excel.inc.php Fri Feb 3 12:05:49 2006
@@ -1,15 +1,15 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 Excel
- * @version $Id: class.excel.inc.php,v 1.6 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
- require_once(PHPGW_APP_INC . '/excel/Worksheet.php');
- require_once(PHPGW_APP_INC . '/excel/Workbook.php');
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 Excel
+ * @version $Id: class.excel.inc.php,v 1.7 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ require_once(PHPGW_APP_INC . '/excel/Worksheet.php');
+ require_once(PHPGW_APP_INC . '/excel/Workbook.php');
+?>
Index: property/inc/class.historylog.inc.php
diff -u property/inc/class.historylog.inc.php:1.7
property/inc/class.historylog.inc.php:1.8
--- property/inc/class.historylog.inc.php:1.7 Fri Jan 27 14:05:43 2006
+++ property/inc/class.historylog.inc.php Fri Feb 3 12:05:49 2006
@@ -1,128 +1,128 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 core
- * @version $Id: class.historylog.inc.php,v 1.7 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class historylog
- {
- var $db;
- var $appname;
- var $table;
- var $types = array(
- 'C' => 'Created',
- 'D' => 'Deleted',
- 'E' => 'Edited'
- );
- var $alternate_handlers = array();
-
- function historylog($appname)
- {
- if (! $appname)
- {
- $appname =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- }
-
- switch($appname)
- {
- case 'request':
- $this->table='fm_request_history';
- break;
- case 'workorder':
- $this->table='fm_workorder_history';
- break;
- case 'project':
- $this->table='fm_project_history';
- break;
- case 'tts':
- $this->table='fm_tts_history';
- break;
- case 'document':
- $this->table='fm_document_history';
- break;
- }
-
-
- $this->appname = $appname;
- $this->db = $GLOBALS['phpgw']->db;
- }
-
- function delete($record_id)
- {
- $this->db->query("delete from $this->table where
history_record_id='$record_id' and "
- . "history_appname='" . $this->appname .
"'",__LINE__,__FILE__);
- }
-
- function add($status,$record_id,$new_value)
- {
- $this->db->query("insert into $this->table
(history_record_id,"
- .
"history_appname,history_owner,history_status,history_new_value,history_timestamp)
"
- . "values ('$record_id','" . $this->appname .
"','"
- . $GLOBALS['phpgw_info']['user']['account_id']
. "','$status','"
- . $this->db->db_addslashes($new_value) . "','"
. $this->db->to_timestamp(time())
- . "')",__LINE__,__FILE__);
- }
-
- // array $filter_out
- function return_array($filter_out,$only_show,$_orderby =
'',$sort = '', $record_id)
- {
-
- if (! $sort || ! $_orderby)
- {
- $orderby = 'order by
history_timestamp,history_id';
- }
- else
- {
- $orderby = "order by $_orderby $sort";
- }
-
- while (is_array($filter_out) && list(,$_filter) =
each($filter_out))
- {
- $filtered[] = "history_status != '$_filter'";
- }
-
- if (is_array($filtered))
- {
- $filter = ' and ' . implode(' and ',$filtered);
- }
-
- while (is_array($only_show) && list(,$_filter) =
each($only_show))
- {
- $_only_show[] = "history_status='$_filter'";
- }
-
- if (is_array($_only_show))
- {
- $only_show_filter = ' and (' . implode(' or
',$_only_show) . ')';
- }
-
- $this->db->query("select * from $this->table where
history_appname='"
- . $this->appname . "' and
history_record_id='$record_id' $filter $only_show_filter "
- . "$orderby",__LINE__,__FILE__);
- while ($this->db->next_record())
- {
- $return_values[] = array(
- 'id' =>
$this->db->f('history_id'),
- 'record_id' =>
$this->db->f('history_record_id'),
- 'owner' =>
$GLOBALS['phpgw']->accounts->id2name($this->db->f('history_owner')),
-// 'status' =>
lang($this->types[$this->db->f('history_status')]),
- 'status' => ereg_replace('
','',$this->db->f('history_status')),
- 'new_value' =>
$this->db->f('history_new_value'),
- 'datetime' =>
$this->db->from_timestamp($this->db->f('history_timestamp'))
- );
- }
- return $return_values;
- }
- }
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 core
+ * @version $Id: class.historylog.inc.php,v 1.8 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class historylog
+ {
+ var $db;
+ var $appname;
+ var $table;
+ var $types = array(
+ 'C' => 'Created',
+ 'D' => 'Deleted',
+ 'E' => 'Edited'
+ );
+ var $alternate_handlers = array();
+
+ function historylog($appname)
+ {
+ if (! $appname)
+ {
+ $appname =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ }
+
+ switch($appname)
+ {
+ case 'request':
+ $this->table='fm_request_history';
+ break;
+ case 'workorder':
+ $this->table='fm_workorder_history';
+ break;
+ case 'project':
+ $this->table='fm_project_history';
+ break;
+ case 'tts':
+ $this->table='fm_tts_history';
+ break;
+ case 'document':
+ $this->table='fm_document_history';
+ break;
+ }
+
+
+ $this->appname = $appname;
+ $this->db = $GLOBALS['phpgw']->db;
+ }
+
+ function delete($record_id)
+ {
+ $this->db->query("delete from $this->table where
history_record_id='$record_id' and "
+ . "history_appname='" . $this->appname .
"'",__LINE__,__FILE__);
+ }
+
+ function add($status,$record_id,$new_value)
+ {
+ $this->db->query("insert into $this->table
(history_record_id,"
+ .
"history_appname,history_owner,history_status,history_new_value,history_timestamp)
"
+ . "values ('$record_id','" . $this->appname .
"','"
+ . $GLOBALS['phpgw_info']['user']['account_id']
. "','$status','"
+ . $this->db->db_addslashes($new_value) . "','"
. $this->db->to_timestamp(time())
+ . "')",__LINE__,__FILE__);
+ }
+
+ // array $filter_out
+ function return_array($filter_out,$only_show,$_orderby =
'',$sort = '', $record_id)
+ {
+
+ if (! $sort || ! $_orderby)
+ {
+ $orderby = 'order by
history_timestamp,history_id';
+ }
+ else
+ {
+ $orderby = "order by $_orderby $sort";
+ }
+
+ while (is_array($filter_out) && list(,$_filter) =
each($filter_out))
+ {
+ $filtered[] = "history_status != '$_filter'";
+ }
+
+ if (is_array($filtered))
+ {
+ $filter = ' and ' . implode(' and ',$filtered);
+ }
+
+ while (is_array($only_show) && list(,$_filter) =
each($only_show))
+ {
+ $_only_show[] = "history_status='$_filter'";
+ }
+
+ if (is_array($_only_show))
+ {
+ $only_show_filter = ' and (' . implode(' or
',$_only_show) . ')';
+ }
+
+ $this->db->query("select * from $this->table where
history_appname='"
+ . $this->appname . "' and
history_record_id='$record_id' $filter $only_show_filter "
+ . "$orderby",__LINE__,__FILE__);
+ while ($this->db->next_record())
+ {
+ $return_values[] = array(
+ 'id' =>
$this->db->f('history_id'),
+ 'record_id' =>
$this->db->f('history_record_id'),
+ 'owner' =>
$GLOBALS['phpgw']->accounts->id2name($this->db->f('history_owner')),
+// 'status' =>
lang($this->types[$this->db->f('history_status')]),
+ 'status' => ereg_replace('
','',$this->db->f('history_status')),
+ 'new_value' =>
$this->db->f('history_new_value'),
+ 'datetime' =>
$this->db->from_timestamp($this->db->f('history_timestamp'))
+ );
+ }
+ return $return_values;
+ }
+ }
Index: property/inc/class.menu.inc.php
diff -u property/inc/class.menu.inc.php:1.16
property/inc/class.menu.inc.php:1.17
--- property/inc/class.menu.inc.php:1.16 Tue Jan 31 07:21:46 2006
+++ property/inc/class.menu.inc.php Fri Feb 3 12:05:49 2006
@@ -1,467 +1,467 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 core
- * @version $Id: class.menu.inc.php,v 1.16 2006/01/31 07:21:46 sigurdne
Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class menu
- {
- var $sub;
-
- var $public_functions = array
- (
- 'links' => True,
- );
-
- function menu($sub='')
- {
- $this->sub = $sub;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- }
-
- function links($page='',$page_2='')
- {
- $currentapp=$this->currentapp;
- $sub = $this->sub;
-// $menu =
$GLOBALS['phpgw']->session->appsession('menu',$currentapp.$sub);
-//_debug_array($page);
- if(!$menu)
- {
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
-
- $i=0;
- if($sub=='location')
- {
- $menu['module'][$i]['this']=True;
- }
- $menu['module'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&type_id=1');
- $menu['module'][$i]['name'] =
lang('Property');
- $menu['module'][$i]['statustext'] =
lang('Property');
- $i++;
-
- if($sub=='ticket')
- {
- $menu['module'][$i]['this']=True;
- }
- $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitts.index');
- $menu['module'][$i]['name']
= lang('Helpdesk');
- $menu['module'][$i]['statustext'] =
lang('Helpdesk');
- $i++;
- if($sub=='project')
- {
- $menu['module'][$i]['this']=True;
- }
- $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
- $menu['module'][$i]['name']
= lang('Project');
- $menu['module'][$i]['statustext'] =
lang('Project');
- $i++;
- if($sub=='invoice')
- {
- $menu['module'][$i]['this']=True;
- }
- $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index');
- $menu['module'][$i]['name']
= lang('Invoice');
- $menu['module'][$i]['statustext'] =
lang('Invoice');
-
-/* $i++;
- if($sub=='pricebook')
- {
- $menu['module'][$i]['this']=True;
- }
- $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiagreement.index');
- $menu['module'][$i]['name']
= lang('Pricebook');
- $menu['module'][$i]['statustext'] =
lang('Pricebook');
-*/
-//--------------------
- $i++;
- if($sub=='agreement')
- {
- $menu['module'][$i]['this']=True;
- }
- $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiagreement.index');
- $menu['module'][$i]['name']
= lang('Agreement');
- $menu['module'][$i]['statustext'] =
lang('Agreement');
-//----------------------
- $i++;
- if($sub=='document')
- {
- $menu['module'][$i]['this']=True;
- }
- $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index');
- $menu['module'][$i]['name']
= lang('Documentation');
- $menu['module'][$i]['statustext'] =
lang('Documentation');
- $i++;
- if($sub=='custom')
- {
- $menu['module'][$i]['this']=True;
- }
- $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uicustom.index');
- $menu['module'][$i]['name']
= lang('Custom');
- $menu['module'][$i]['statustext'] =
lang('Custom queries');
-
- $entity =
CreateObject($this->currentapp.'.soadmin_entity');
- $entity_list =
$entity->read(array('allrows'=>True));
-
- if (isset($entity_list) AND
is_array($entity_list))
- {
- foreach($entity_list as $entry)
- {
- $i++;
- if($sub=='entity_' .
$entry['id'])
- {
-
$menu['module'][$i]['this']=True;
- }
- $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uientity.index&entity_id='
.$entry['id']);
- $menu['module'][$i]['name']
= $entry['name'];
-
$menu['module'][$i]['statustext'] = $entry['descr'];
- }
- }
-
- unset($entity);
-
- if ($sub == 'location')
- {
- $soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
- $location =
$soadmin_location->select_location_type();
- $location_count=count($location);
- for ($j=0; $j<$location_count; $j++)
- {
- $i++;
-
if($page=='location'.$location[$j]['id'].'_')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&type_id='
.$location[$j]['id'] );
- $menu['sub_menu'][$i]['name'] =
$location[$j]['name'];
-
$menu['sub_menu'][$i]['statustext'] = $location[$j]['descr'];
- }
-
- $config_tenant =
$soadmin_location->read_config_single('tenant_id');
-
- $i++;
- if(substr($page,-2)=='_1')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&lookup_tenant=1&type_id='
. $config_tenant);
- $menu['sub_menu'][$i]['name']
= lang('Tenant');
- $menu['sub_menu'][$i]['statustext']
= lang('Tenant');
-
- $i++;
- if($page=='gab')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uigab.index');
- $menu['sub_menu'][$i]['name']
= lang('gabnr');
- $menu['sub_menu'][$i]['statustext']
= lang('gabnr');
- $i++;
- if($page=='summary')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.summary');
- $menu['sub_menu'][$i]['name']
= lang('Summary');
- $menu['sub_menu'][$i]['statustext']
= lang('Summary');
- }
-
- if ($sub == 'invoice')
- {
- $i++;
- if($page=='invoice_')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index');
- $menu['sub_menu'][$i]['name']
= lang('Invoice');
- $menu['sub_menu'][$i]['statustext']
= lang('Invoice');
- $i++;
- if($page=='invoice_1')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index&paid=true');
- $menu['sub_menu'][$i]['name']
= lang('Paid');
- $menu['sub_menu'][$i]['statustext']
= lang('Paid');
- $i++;
- if($page=='consume')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.consume');
- $menu['sub_menu'][$i]['name']
= lang('consume');
- $menu['sub_menu'][$i]['statustext']
= lang('consume');
-
- $i++;
- if($page=='b_account')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uib_account.index');
- $menu['sub_menu'][$i]['name']
= lang('b_account');
- $menu['sub_menu'][$i]['statustext']
= lang('b_account');
-
- $i++;
- if($page=='vendor')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiactor.index&role=vendor');
- $menu['sub_menu'][$i]['name']
= lang('Vendor');
- $menu['sub_menu'][$i]['statustext']
= lang('Vendor');
-
- $i++;
- if($page=='tenant')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiactor.index&role=tenant');
- $menu['sub_menu'][$i]['name']
= lang('Tenant');
- $menu['sub_menu'][$i]['statustext']
= lang('Tenant');
-
- if ($this->acl2->check('.invoice',16))
- {
- $i++;
- if($page=='investment')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvestment.index');
- $menu['sub_menu'][$i]['name']
= lang('Investment value');
-
$menu['sub_menu'][$i]['statustext'] = lang('Investment
value');
- $i++;
- if($page=='import_inv')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiXport.import');
- $menu['sub_menu'][$i]['name']
= lang('Import invoice');
-
$menu['sub_menu'][$i]['statustext'] = lang('Import invoice');
- $i++;
- if($page=='export_inv')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiXport.export');
- $menu['sub_menu'][$i]['name']
= lang('Export invoice');
-
$menu['sub_menu'][$i]['statustext'] = lang('Export invoice');
- }
- if ($this->acl2->check('.invoice',2))
- {
- $i++;
- if($page=='add_inv')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.add');
- $menu['sub_menu'][$i]['name']
= lang('Add');
-
$menu['sub_menu'][$i]['statustext'] = lang('Add invoice');
- }
- }
-
- if ($sub == 'pricebook' &&
$this->acl2->check('.pricebook',16))
- {
- $i++;
- if($page=='agreement_group')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.agreement_group');
- $menu['sub_menu'][$i]['name']
= lang('Agreement group');
- $menu['sub_menu'][$i]['statustext']
= lang('Agreement group');
- $i++;
- if($page=='activity')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.activity');
- $menu['sub_menu'][$i]['name']
= lang('Activities');
- $menu['sub_menu'][$i]['statustext']
= lang('Activities');
- $i++;
- if($page=='agreement')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiagreement.index');
- $menu['sub_menu'][$i]['name']
= lang('Agreement');
- $menu['sub_menu'][$i]['statustext']
= lang('Agreement');
- }
-//--------------
- if ($sub == 'agreement')
- {
- $i++;
- if($page=='agreement')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiagreement.index');
- $menu['sub_menu'][$i]['name']
= lang('Pricebook');
- $menu['sub_menu'][$i]['statustext']
= lang('Pricebook');
-
- $i++;
- if($page=='s_agreement')
- {
-
$menu['sub_menu'][$i]['this']=True;
-
- }
-
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uis_agreement.index');
- $menu['sub_menu'][$i]['name']
= lang('Service');
- $menu['sub_menu'][$i]['statustext']
= lang('service agreement');
-
-
- if($this->acl2->check('.pricebook',16))
- {
- $j=0;
- if($page_2=='agreement_group')
- {
-
$menu['sub_menu_2'][$j]['this']=True;
- }
- $menu['sub_menu_2'][$j]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.agreement_group');
- $menu['sub_menu_2'][$j]['name']
= lang('Agreement group');
-
$menu['sub_menu_2'][$j]['statustext'] = lang('Agreement group');
- $j++;
- if($page_2=='activity')
- {
-
$menu['sub_menu_2'][$j]['this']=True;
- }
- $menu['sub_menu_2'][$j]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.activity');
- $menu['sub_menu_2'][$j]['name']
= lang('Activities');
-
$menu['sub_menu_2'][$j]['statustext'] = lang('Activities');
- $j++;
- if($page_2=='agreement')
- {
-
$menu['sub_menu_2'][$j]['this']=True;
- }
- $menu['sub_menu_2'][$j]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiagreement.index');
- $menu['sub_menu_2'][$j]['name']
= lang('Agreement');
-
$menu['sub_menu_2'][$j]['statustext'] = lang('Agreement');
- }
- }
-
-//---------------
- if ($sub == 'project')
- {
- $i++;
- if($page=='project')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
- $menu['sub_menu'][$i]['name']
= lang('Project');
- $menu['sub_menu'][$i]['statustext']
= lang('Project');
- $i++;
- if($page=='workorder')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiworkorder.index');
- $menu['sub_menu'][$i]['name']
= lang('Workorder');
- $menu['sub_menu'][$i]['statustext']
= lang('Workorder');
-
-/* $i++;
- if($page=='s_agreement')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uis_agreement.index');
- $menu['sub_menu'][$i]['name']
= lang('Service');
- $menu['sub_menu'][$i]['statustext']
= lang('service agreement');
-*/ $i++;
-
- if($page=='request')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uirequest.index');
- $menu['sub_menu'][$i]['name']
= lang('Request');
- $menu['sub_menu'][$i]['statustext']
= lang('Request');
- $i++;
- if($page=='template')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitemplate.index');
- $menu['sub_menu'][$i]['name']
= lang('template');
- $menu['sub_menu'][$i]['statustext']
= lang('Workorder template');
-
- $i++;
- if($page=='tenant_claim')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitenant_claim.index');
- $menu['sub_menu'][$i]['name']
= lang('Tenant claim');
- $menu['sub_menu'][$i]['statustext']
= lang('Tenant claim');
- }
-
- if ($sub == adm_loc &&
$this->acl2->check('.location',16))
- {
- $i++;
- if($page=='loc_type')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiadmin_location.index');
- $menu['sub_menu'][$i]['name']
= lang('Location type');
- $menu['sub_menu'][$i]['statustext']
= lang('Location type');
- $i++;
- if($page=='loc_config')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiadmin_location.config');
- $menu['sub_menu'][$i]['name']
= lang('Config');
- $menu['sub_menu'][$i]['statustext']
= lang('Location Config');
- }
-
- if ($sub == 'document')
- {
- $i++;
- if($page=='document_')
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
- $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index');
- $menu['sub_menu'][$i]['name']
= lang('location');
- $menu['sub_menu'][$i]['statustext']
= lang('Documentation for locations');
-
- if (isset($entity_list) AND
is_array($entity_list))
- {
- foreach($entity_list as $entry)
- {
-
if($entry['documentation'])
- {
- $i++;
-
if($page=='document_'.$entry['id'])
- {
-
$menu['sub_menu'][$i]['this']=True;
- }
-
$menu['sub_menu'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index&entity_id='
.$entry['id']);
-
$menu['sub_menu'][$i]['name'] = $entry['name'];
-
$menu['sub_menu'][$i]['statustext'] = $entry['descr'];
- }
- }
- }
-
- }
-
- $menu =
$GLOBALS['phpgw']->session->appsession('menu',$currentapp.$sub,$menu);
- }
-
- return $menu;
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 core
+ * @version $Id: class.menu.inc.php,v 1.17 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class menu
+ {
+ var $sub;
+
+ var $public_functions = array
+ (
+ 'links' => True,
+ );
+
+ function menu($sub='')
+ {
+ $this->sub = $sub;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ }
+
+ function links($page='',$page_2='')
+ {
+ $currentapp=$this->currentapp;
+ $sub = $this->sub;
+// $menu =
$GLOBALS['phpgw']->session->appsession('menu',$currentapp.$sub);
+//_debug_array($page);
+ if(!$menu)
+ {
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+
+ $i=0;
+ if($sub=='location')
+ {
+ $menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&type_id=1');
+ $menu['module'][$i]['name'] =
lang('Property');
+ $menu['module'][$i]['statustext'] =
lang('Property');
+ $i++;
+
+ if($sub=='ticket')
+ {
+ $menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitts.index');
+ $menu['module'][$i]['name']
= lang('Helpdesk');
+ $menu['module'][$i]['statustext'] =
lang('Helpdesk');
+ $i++;
+ if($sub=='project')
+ {
+ $menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
+ $menu['module'][$i]['name']
= lang('Project');
+ $menu['module'][$i]['statustext'] =
lang('Project');
+ $i++;
+ if($sub=='invoice')
+ {
+ $menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index');
+ $menu['module'][$i]['name']
= lang('Invoice');
+ $menu['module'][$i]['statustext'] =
lang('Invoice');
+
+/* $i++;
+ if($sub=='pricebook')
+ {
+ $menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiagreement.index');
+ $menu['module'][$i]['name']
= lang('Pricebook');
+ $menu['module'][$i]['statustext'] =
lang('Pricebook');
+*/
+//--------------------
+ $i++;
+ if($sub=='agreement')
+ {
+ $menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiagreement.index');
+ $menu['module'][$i]['name']
= lang('Agreement');
+ $menu['module'][$i]['statustext'] =
lang('Agreement');
+//----------------------
+ $i++;
+ if($sub=='document')
+ {
+ $menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index');
+ $menu['module'][$i]['name']
= lang('Documentation');
+ $menu['module'][$i]['statustext'] =
lang('Documentation');
+ $i++;
+ if($sub=='custom')
+ {
+ $menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uicustom.index');
+ $menu['module'][$i]['name']
= lang('Custom');
+ $menu['module'][$i]['statustext'] =
lang('Custom queries');
+
+ $entity =
CreateObject($this->currentapp.'.soadmin_entity');
+ $entity_list =
$entity->read(array('allrows'=>True));
+
+ if (isset($entity_list) AND
is_array($entity_list))
+ {
+ foreach($entity_list as $entry)
+ {
+ $i++;
+ if($sub=='entity_' .
$entry['id'])
+ {
+
$menu['module'][$i]['this']=True;
+ }
+ $menu['module'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uientity.index&entity_id='
.$entry['id']);
+ $menu['module'][$i]['name']
= $entry['name'];
+
$menu['module'][$i]['statustext'] = $entry['descr'];
+ }
+ }
+
+ unset($entity);
+
+ if ($sub == 'location')
+ {
+ $soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
+ $location =
$soadmin_location->select_location_type();
+ $location_count=count($location);
+ for ($j=0; $j<$location_count; $j++)
+ {
+ $i++;
+
if($page=='location'.$location[$j]['id'].'_')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&type_id='
.$location[$j]['id'] );
+ $menu['sub_menu'][$i]['name'] =
$location[$j]['name'];
+
$menu['sub_menu'][$i]['statustext'] = $location[$j]['descr'];
+ }
+
+ $config_tenant =
$soadmin_location->read_config_single('tenant_id');
+
+ $i++;
+ if(substr($page,-2)=='_1')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.index&lookup_tenant=1&type_id='
. $config_tenant);
+ $menu['sub_menu'][$i]['name']
= lang('Tenant');
+ $menu['sub_menu'][$i]['statustext']
= lang('Tenant');
+
+ $i++;
+ if($page=='gab')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uigab.index');
+ $menu['sub_menu'][$i]['name']
= lang('gabnr');
+ $menu['sub_menu'][$i]['statustext']
= lang('gabnr');
+ $i++;
+ if($page=='summary')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uilocation.summary');
+ $menu['sub_menu'][$i]['name']
= lang('Summary');
+ $menu['sub_menu'][$i]['statustext']
= lang('Summary');
+ }
+
+ if ($sub == 'invoice')
+ {
+ $i++;
+ if($page=='invoice_')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index');
+ $menu['sub_menu'][$i]['name']
= lang('Invoice');
+ $menu['sub_menu'][$i]['statustext']
= lang('Invoice');
+ $i++;
+ if($page=='invoice_1')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.index&paid=true');
+ $menu['sub_menu'][$i]['name']
= lang('Paid');
+ $menu['sub_menu'][$i]['statustext']
= lang('Paid');
+ $i++;
+ if($page=='consume')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.consume');
+ $menu['sub_menu'][$i]['name']
= lang('consume');
+ $menu['sub_menu'][$i]['statustext']
= lang('consume');
+
+ $i++;
+ if($page=='b_account')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uib_account.index');
+ $menu['sub_menu'][$i]['name']
= lang('b_account');
+ $menu['sub_menu'][$i]['statustext']
= lang('b_account');
+
+ $i++;
+ if($page=='vendor')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiactor.index&role=vendor');
+ $menu['sub_menu'][$i]['name']
= lang('Vendor');
+ $menu['sub_menu'][$i]['statustext']
= lang('Vendor');
+
+ $i++;
+ if($page=='tenant')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiactor.index&role=tenant');
+ $menu['sub_menu'][$i]['name']
= lang('Tenant');
+ $menu['sub_menu'][$i]['statustext']
= lang('Tenant');
+
+ if ($this->acl2->check('.invoice',16))
+ {
+ $i++;
+ if($page=='investment')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvestment.index');
+ $menu['sub_menu'][$i]['name']
= lang('Investment value');
+
$menu['sub_menu'][$i]['statustext'] = lang('Investment
value');
+ $i++;
+ if($page=='import_inv')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiXport.import');
+ $menu['sub_menu'][$i]['name']
= lang('Import invoice');
+
$menu['sub_menu'][$i]['statustext'] = lang('Import invoice');
+ $i++;
+ if($page=='export_inv')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiXport.export');
+ $menu['sub_menu'][$i]['name']
= lang('Export invoice');
+
$menu['sub_menu'][$i]['statustext'] = lang('Export invoice');
+ }
+ if ($this->acl2->check('.invoice',2))
+ {
+ $i++;
+ if($page=='add_inv')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiinvoice.add');
+ $menu['sub_menu'][$i]['name']
= lang('Add');
+
$menu['sub_menu'][$i]['statustext'] = lang('Add invoice');
+ }
+ }
+
+ if ($sub == 'pricebook' &&
$this->acl2->check('.pricebook',16))
+ {
+ $i++;
+ if($page=='agreement_group')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.agreement_group');
+ $menu['sub_menu'][$i]['name']
= lang('Agreement group');
+ $menu['sub_menu'][$i]['statustext']
= lang('Agreement group');
+ $i++;
+ if($page=='activity')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.activity');
+ $menu['sub_menu'][$i]['name']
= lang('Activities');
+ $menu['sub_menu'][$i]['statustext']
= lang('Activities');
+ $i++;
+ if($page=='agreement')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiagreement.index');
+ $menu['sub_menu'][$i]['name']
= lang('Agreement');
+ $menu['sub_menu'][$i]['statustext']
= lang('Agreement');
+ }
+//--------------
+ if ($sub == 'agreement')
+ {
+ $i++;
+ if($page=='agreement')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiagreement.index');
+ $menu['sub_menu'][$i]['name']
= lang('Pricebook');
+ $menu['sub_menu'][$i]['statustext']
= lang('Pricebook');
+
+ $i++;
+ if($page=='s_agreement')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+
+ }
+
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uis_agreement.index');
+ $menu['sub_menu'][$i]['name']
= lang('Service');
+ $menu['sub_menu'][$i]['statustext']
= lang('service agreement');
+
+
+ if($this->acl2->check('.pricebook',16))
+ {
+ $j=0;
+ if($page_2=='agreement_group')
+ {
+
$menu['sub_menu_2'][$j]['this']=True;
+ }
+ $menu['sub_menu_2'][$j]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.agreement_group');
+ $menu['sub_menu_2'][$j]['name']
= lang('Agreement group');
+
$menu['sub_menu_2'][$j]['statustext'] = lang('Agreement group');
+ $j++;
+ if($page_2=='activity')
+ {
+
$menu['sub_menu_2'][$j]['this']=True;
+ }
+ $menu['sub_menu_2'][$j]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.activity');
+ $menu['sub_menu_2'][$j]['name']
= lang('Activities');
+
$menu['sub_menu_2'][$j]['statustext'] = lang('Activities');
+ $j++;
+ if($page_2=='agreement')
+ {
+
$menu['sub_menu_2'][$j]['this']=True;
+ }
+ $menu['sub_menu_2'][$j]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiagreement.index');
+ $menu['sub_menu_2'][$j]['name']
= lang('Agreement');
+
$menu['sub_menu_2'][$j]['statustext'] = lang('Agreement');
+ }
+ }
+
+//---------------
+ if ($sub == 'project')
+ {
+ $i++;
+ if($page=='project')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiproject.index');
+ $menu['sub_menu'][$i]['name']
= lang('Project');
+ $menu['sub_menu'][$i]['statustext']
= lang('Project');
+ $i++;
+ if($page=='workorder')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiworkorder.index');
+ $menu['sub_menu'][$i]['name']
= lang('Workorder');
+ $menu['sub_menu'][$i]['statustext']
= lang('Workorder');
+
+/* $i++;
+ if($page=='s_agreement')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uis_agreement.index');
+ $menu['sub_menu'][$i]['name']
= lang('Service');
+ $menu['sub_menu'][$i]['statustext']
= lang('service agreement');
+*/ $i++;
+
+ if($page=='request')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uirequest.index');
+ $menu['sub_menu'][$i]['name']
= lang('Request');
+ $menu['sub_menu'][$i]['statustext']
= lang('Request');
+ $i++;
+ if($page=='template')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitemplate.index');
+ $menu['sub_menu'][$i]['name']
= lang('template');
+ $menu['sub_menu'][$i]['statustext']
= lang('Workorder template');
+
+ $i++;
+ if($page=='tenant_claim')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitenant_claim.index');
+ $menu['sub_menu'][$i]['name']
= lang('Tenant claim');
+ $menu['sub_menu'][$i]['statustext']
= lang('Tenant claim');
+ }
+
+ if ($sub == adm_loc &&
$this->acl2->check('.location',16))
+ {
+ $i++;
+ if($page=='loc_type')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiadmin_location.index');
+ $menu['sub_menu'][$i]['name']
= lang('Location type');
+ $menu['sub_menu'][$i]['statustext']
= lang('Location type');
+ $i++;
+ if($page=='loc_config')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uiadmin_location.config');
+ $menu['sub_menu'][$i]['name']
= lang('Config');
+ $menu['sub_menu'][$i]['statustext']
= lang('Location Config');
+ }
+
+ if ($sub == 'document')
+ {
+ $i++;
+ if($page=='document_')
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+ $menu['sub_menu'][$i]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index');
+ $menu['sub_menu'][$i]['name']
= lang('location');
+ $menu['sub_menu'][$i]['statustext']
= lang('Documentation for locations');
+
+ if (isset($entity_list) AND
is_array($entity_list))
+ {
+ foreach($entity_list as $entry)
+ {
+
if($entry['documentation'])
+ {
+ $i++;
+
if($page=='document_'.$entry['id'])
+ {
+
$menu['sub_menu'][$i]['this']=True;
+ }
+
$menu['sub_menu'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uidocument.index&entity_id='
.$entry['id']);
+
$menu['sub_menu'][$i]['name'] = $entry['name'];
+
$menu['sub_menu'][$i]['statustext'] = $entry['descr'];
+ }
+ }
+ }
+
+ }
+
+ $menu =
$GLOBALS['phpgw']->session->appsession('menu',$currentapp.$sub,$menu);
+ }
+
+ return $menu;
+ }
+ }
+?>
Index: property/inc/class.pdf.inc.php
diff -u property/inc/class.pdf.inc.php:1.6 property/inc/class.pdf.inc.php:1.7
--- property/inc/class.pdf.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/class.pdf.inc.php Fri Feb 3 12:05:49 2006
@@ -1,15 +1,15 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 Cpdf
- * @version $Id: class.pdf.inc.php,v 1.6 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
- include (PHPGW_APP_INC . '/pdf/class.pdf.php');
- include (PHPGW_APP_INC . '/pdf/class.ezpdf.php');
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 Cpdf
+ * @version $Id: class.pdf.inc.php,v 1.7 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ include (PHPGW_APP_INC . '/pdf/class.pdf.php');
+ include (PHPGW_APP_INC . '/pdf/class.ezpdf.php');
+?>
Index: property/inc/class.soXport.inc.php
diff -u property/inc/class.soXport.inc.php:1.21
property/inc/class.soXport.inc.php:1.22
--- property/inc/class.soXport.inc.php:1.21 Mon Jan 30 22:14:19 2006
+++ property/inc/class.soXport.inc.php Fri Feb 3 12:05:49 2006
@@ -1 +1,545 @@
-<?php
/**
* phpGroupWare - property: a Facilities Management System.
*
* @author Sigurd Nes <address@hidden>
* @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
* @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: class.soXport.inc.php,v 1.21 2006/01/30 22:14:19
sigurdne Exp $
*/
/**
* Description
* @package property
*/
class soXport
{
var $db = '';
var $account_id = 0;
var $total_records = 0;
function soXport($useacl=True)
{
$GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
$this->db = $this->bocommon->new_db();
$this->db2 = $this->bocommon->new_db();
$this->join =
$this->bocommon->join;
$this->left_join =
$this->bocommon->left_join;
$this->datetimeformat =
$this->bocommon->datetimeformat;
$this->like =
$this->bocommon->like;
$this->account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
}
function auto_tax($dima='')
{
if(!$dima)
{
return;
}
$sql = "select mva as tax_code from fm_location1 where
loc1=" . substr($dima,0,4);
$this->db->query($sql);
$this->db->next_record();
return $this->db->f('tax_code');
}
function tax_b_account_override($mvakode='',$b_account_id='')
{
if(!$b_account_id)
{
return $mvakode;
}
$sql = "select mva as tax_code from fm_b_account where
id='$b_account_id'";
$this->db->query($sql);
$this->db->next_record();
if($this->db->f('tax_code'))
{
return $this->db->f('tax_code');
}
else
{
return $mvakode;
}
}
function tax_vendor_override($mvakode='',$vendor_id='')
{
if(!$vendor_id)
{
return $mvakode;
}
$sql = "select mva as tax_code from fm_vendor where
id='$vendor_id'";
$this->db->query($sql);
$this->db->next_record();
if($this->db->f('tax_code'))
{
return $this->db->f('tax_code');
}
else
{
return $mvakode;
}
}
function get_kostra_id($dima='')
{
if(!$dima)
{
return;
}
$sql = "select kostra_id from fm_location1 where loc1="
. substr($dima,0,4);
$this->db->query($sql);
$this->db->next_record();
return $this->db->f('kostra_id');
}
function anleggsnr_to_objekt($anleggsnr,$meter_table)
{
$this->db->query("select
$meter_table.ext_meter_id,$meter_table.loc1,$meter_table.loc2,$meter_table.loc3,fm_part_of_town.district_id
"
. " from $meter_table $this->join fm_location1 ON
$meter_table.loc1 = fm_location1.loc1 $this->join "
. " fm_part_of_town ON fm_location1.part_of_town_id =
fm_part_of_town.part_of_town_id where $meter_table.ext_system_id='$anleggsnr'");
$this->db->next_record();
// $location = split("-",
$this->db->f('location_code'));
$loc1 = $this->db->f('loc1');
$loc2 = $this->db->f('loc2');
$loc3 = $this->db->f('loc3');
$dima=$loc1.$loc2.$loc3;
$maalerinfo['loc1']=$loc1;
$maalerinfo['dima']=$dima;
$maalerinfo['maalernr']=$this->db->f('ext_meter_id');
$maalerinfo['district']=$this->db->f('district_id');
return $maalerinfo;
}
function gabnr_to_objekt($Gnr,$Bnr,$sekjonnr)
{
//Finn dima fra Boei
$sql = "select fm_gab_location.loc1,
fm_gab_location.loc2, fm_gab_location.loc3 from fm_gab_location, fm_location1,
fm_owner "
. "where substring(fm_gab_location.gab_id,5,5)='$Gnr'
and "
. " substring(fm_gab_location.gab_id,10,4)='$Bnr'
and "
. "
substring(fm_gab_location.gab_id,18,3)='$sekjonnr' and "
. " fm_gab_location.loc1=fm_location1.loc1 and "
. " fm_location1.owner_id=fm_owner.id ";
// . " and (fm_owner.category=0 or
fm_owner.category=2)";
$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
$GLOBALS['phpgw']->db->next_record();
$gabinfo['loc1']=$GLOBALS['phpgw']->db->f('loc1');
$gabinfo['dima']=$GLOBALS['phpgw']->db->f('loc1').$GLOBALS['phpgw']->db->f('loc2').$GLOBALS['phpgw']->db->f('loc3');
return $gabinfo;
}
function dima_to_address($dima)
{
$loc1=substr($dima,0,4);
$loc2=substr($dima,4,2);
$loc3=substr($dima,6,2);
$sql = "select loc3_name from fm_location3 where loc1 =
'$loc1' and loc2= '$loc2' and loc3 = '$loc3' ";
$GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
$GLOBALS['phpgw']->db->next_record();
$address=$GLOBALS['phpgw']->db->f('loc3_name');
return $address;
}
function check_order($id)
{
$this->db->query("select id,type from fm_orders where
id='$id'");
$this->db->next_record();
return $this->db->f('type');
}
function get_project($id)
{
$this->db->query("select project_id from fm_workorder
where id='$id'");
$this->db->next_record();
return $this->db->f('project_id');
}
function check_spbudact_code($id)
{
$this->db->query("select count(*) from fm_b_account
where id='$id'");
$this->db->next_record();
return $this->db->f(0);
}
function add($buffer)
{
$this->db->transaction_begin();
$num=0;
foreach ($buffer as $fields)
{
if(abs($fields['belop'])>0)
{
$values= array(
$fields['project_id'],
$fields['kostra_id'],
$fields['pmwrkord_code'],
$fields['bilagsnr'],
$fields['splitt'],
$fields['kildeid'],
$fields['kidnr'],
$fields['typeid'],
$fields['fakturadato'],
$fields['forfallsdato'],
$fields['regtid'],
$fields['artid'],
$fields['spvend_code'],
$fields['dimb'],
$fields['oppsynsmannid'],
$fields['saksbehandlerid'],
$fields['budsjettansvarligid'],
$fields['fakturanr'],
$fields['spbudact_code'],
$fields['loc1'],
$fields['dima'],
$fields['dimd'],
$fields['mvakode'],
$fields['periode'],
$this->db->db_addslashes($fields['merknad']),
False,
False,
False,
False,
$fields['item_type'],
$fields['item_id']
);
$bilagsnr = $fields['bilagsnr'];
$values =
$this->bocommon->validate_db_insert($values);
$sql= "INSERT INTO fm_ecobilag
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,fakturadato,"
. "
forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,saksbehandlerid,budsjettansvarligid,"
. "
fakturanr,spbudact_code,loc1,dima,dimd,mvakode,periode,merknad,oppsynsigndato,saksigndato,"
. "
budsjettsigndato,utbetalingsigndato,item_type,item_id,belop,godkjentbelop)"
. " VALUES ($values," .
$this->bocommon->moneyformat($fields['belop']) . "," .
$this->bocommon->moneyformat($fields['godkjentbelop']) . ")";
$this->db->query($sql,__LINE__,__FILE__);
$num++;
}
}
$this->db->query("UPDATE fm_idgenerator set value
=$bilagsnr WHERE name = 'Bilagsnummer'");
$this->db->transaction_commit();
return $num;
}
function add_OverfBilag ($data)
{
$values= array(
$data['id'],
$data['bilagsnr'],
$data['kidnr'],
$data['typeid'],
$data['kildeid'],
$data['project_id'],
$data['kostra_id'],
$data['pmwrkord_code'],
$data['fakturadato'],
$data['periode'],
$data['forfallsdato'],
$data['fakturanr'],
$data['spbudact_code'],
$data['regtid'],
$data['artid'],
$data['spvend_code'],
$data['dima'],
$data['loc1'],
$data['dimb'],
$data['mvakode'],
$data['dimd'],
$data['oppsynsmannid'],
$data['saksbehandlerid'],
$data['budsjettansvarligid'],
$data['oppsynsigndato'],
$data['saksigndato'],
$data['budsjettsigndato'],
$this->db->db_addslashes($data['merknad']),
$data['splitt'],
$data['utbetalingid'],
$data['utbetalingsigndato'],
$data['filnavn'],
date("Y-m-d G:i:s"),
$data['item_type'],
$data['item_id'],
);
$values = $this->bocommon->validate_db_insert($values);
$sql="INSERT INTO fm_ecobilagoverf
(id,bilagsnr,kidnr,typeid,kildeid,project_id,kostra_id,pmwrkord_code,fakturadato,"
. "
periode,forfallsdato,fakturanr,spbudact_code,regtid,artid,spvend_code,dima,loc1,"
. "
dimb,mvakode,dimd,oppsynsmannid,saksbehandlerid,budsjettansvarligid,oppsynsigndato,saksigndato,"
. "
budsjettsigndato,merknad,splitt,utbetalingid,utbetalingsigndato,filnavn,overftid,item_type,item_id,"
. " belop,godkjentbelop,ordrebelop)"
. "values ($values, "
. $this->bocommon->moneyformat($data['belop'])
. ","
.
$this->bocommon->moneyformat($data['godkjentbelop']) . ","
.
$this->bocommon->moneyformat($data['ordrebelop']) . ")";
$this->db->query($sql,__LINE__,__FILE__);
//echo 'sql ' . $sql.'<br>';
}
function delete_from_fm_ecobilag($id)
{
$sql="delete from fm_ecobilag where id=$id";
$this->db->query($sql,__LINE__,__FILE__);
}
// Velg ut alle hoved bilag som skal overføres
function hoved_bilag ($periode,$pre_transfer='')
{
if($pre_transfer)
{
$sql= "SELECT sum(belop) as belop, bilagsnr
from fm_ecobilag WHERE periode='$periode' AND utbetalingsigndato IS NULL GROUP
BY bilagsnr ";
}
else
{
$sql="select sum(belop) as belop, bilagsnr from
fm_ecobilag where periode='$periode' AND budsjettsigndato is not NULL AND (
saksigndato is not NULL OR oppsynsigndato is not NULL ) AND
utbetalingsigndato is not NULL group by bilagsnr";
}
$this->db->query($sql,__LINE__,__FILE__);
$i = 0;
while ($this->db->next_record())
{
$hoved_bilag_temp[$i]['belop'] =
$this->db->f('belop');
$hoved_bilag_temp[$i]['bilagsnr'] =
$this->db->f('bilagsnr');
$i++;
}
//_debug_array($hoved_bilag_temp);
if ($hoved_bilag_temp)
{
$i = 0;
while(each($hoved_bilag_temp))
{
$bilagsnr =
$hoved_bilag_temp[$i]['bilagsnr'];
$sql= "select
fm_ecobilag.*,fm_ecouser.initials as saksbehandler from fm_ecobilag $this->join
fm_ecouser on fm_ecobilag.budsjettansvarligid=fm_ecouser.lid where
bilagsnr=$bilagsnr ";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
$hoved_bilag[$i]['id']
= $this->db->f('id');
$hoved_bilag[$i]['bilagsnr']
= $bilagsnr;
$hoved_bilag[$i]['kidnr']
= $this->db->f('kidnr');
$hoved_bilag[$i]['typeid']
= $this->db->f('typeid');
$hoved_bilag[$i]['kildeid']
= $this->db->f('kildeid');
$hoved_bilag[$i]['pmwrkord_code']
= $this->db->f('pmwrkord_code');
$hoved_bilag[$i]['belop']
= $hoved_bilag_temp[$i]['belop'];
$hoved_bilag[$i]['fakturadato']
= $this->db->f('fakturadato');
$hoved_bilag[$i]['periode']
= $this->db->f('periode');
$hoved_bilag[$i]['forfallsdato']
= $this->db->f('forfallsdato');
$hoved_bilag[$i]['fakturanr']
= $this->db->f('fakturanr');
$hoved_bilag[$i]['spbudact_code']
= $this->db->f('spbudact_code');
$hoved_bilag[$i]['regtid']
= $this->db->f('regtid');
$hoved_bilag[$i]['artid']
= $this->db->f('artid');
$hoved_bilag[$i]['godkjentbelop']
= $hoved_bilag_temp[$i]['belop'];
$hoved_bilag[$i]['spvend_code']
= $this->db->f('spvend_code');
$hoved_bilag[$i]['dima']
= $this->db->f('dima');
$hoved_bilag[$i]['dimb']
= $this->db->f('dimb');
$hoved_bilag[$i]['mvakode']
= $this->db->f('mvakode');
$hoved_bilag[$i]['dimd']
= $this->db->f('dimd');
if($this->db->f('oppsynsmannid'))
{
$hoved_bilag[$i]['oppsynsmannid'] = $this->db->f('oppsynsmannid');
}
if($this->db->f('saksbehandlerid'))
{
$hoved_bilag[$i]['saksbehandlerid'] = $this->db->f('saksbehandlerid');
}
$hoved_bilag[$i]['budsjettansvarligid']
= $this->db->f('budsjettansvarligid');
if($this->db->f('oppsynsigndato'))
{
$hoved_bilag[$i]['oppsynsigndato'] = $this->db->f('oppsynsigndato');
}
if($this->db->f('saksigndato'))
{
$hoved_bilag[$i]['saksigndato']
= $this->db->f('saksigndato');
}
$hoved_bilag[$i]['budsjettsigndato']
= $this->db->f('budsjettsigndato');
$hoved_bilag[$i]['merknad']
= $this->db->f('merknad');
$hoved_bilag[$i]['splitt']
= $this->db->f('splitt');
$hoved_bilag[$i]['utbetalingid']
= $this->db->f('utbetalingid');
$hoved_bilag[$i]['utbetalingsigndato']
= $this->db->f('utbetalingsigndato');
$hoved_bilag[$i]['saksbehandler']
= $this->db->f('saksbehandler');
$i++;
}
}
//_debug_array($hoved_bilag);
return $hoved_bilag;
}
//Velg ut alle underbilag
function select_underbilag ($bilagsnr)
{
$sql= "SELECT fm_ecobilag.*
,fm_part_of_town.district_id FROM (fm_location1 $this->join fm_part_of_town ON
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id) $this->join
fm_ecobilag ON fm_location1.loc1 = fm_ecobilag.loc1 WHERE bilagsnr='$bilagsnr'";
$this->db->query($sql,__LINE__,__FILE__);
$i = 0;
while ($this->db->next_record())
{
$underbilag[$i]['id'] = $this->db->f('id');
$underbilag[$i]['bilagsnr'] =
$this->db->f('bilagsnr');
$underbilag[$i]['kidnr'] =
$this->db->f('kidnr');
$underbilag[$i]['typeid'] =
$this->db->f('typeid');
$underbilag[$i]['kildeid'] =
$this->db->f('kildeid');
$underbilag[$i]['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
$underbilag[$i]['belop'] =
$this->db->f('belop');
$underbilag[$i]['fakturadato'] =
$this->db->f('fakturadato');
$underbilag[$i]['periode'] =
$this->db->f('periode');
$underbilag[$i]['forfallsdato'] =
$this->db->f('forfallsdato');
$underbilag[$i]['fakturanr'] =
$this->db->f('fakturanr');
$underbilag[$i]['spbudact_code'] =
$this->db->f('spbudact_code');
$underbilag[$i]['regtid'] =
$this->db->f('regtid');
$underbilag[$i]['artid'] =
$this->db->f('artid');
$underbilag[$i]['godkjentbelop'] =
$this->db->f('godkjentbelop');
$underbilag[$i]['spvend_code'] =
$this->db->f('spvend_code');
$underbilag[$i]['dima'] = $this->db->f('dima');
$underbilag[$i]['loc1'] = $this->db->f('loc1');
$underbilag[$i]['dimb'] = $this->db->f('dimb');
$underbilag[$i]['mvakode'] =
$this->db->f('mvakode');
$underbilag[$i]['dimd'] = $this->db->f('dimd');
$underbilag[$i]['project_id'] =
$this->db->f('project_id');
$underbilag[$i]['kostra_id'] =
$this->db->f('kostra_id');
if($this->db->f('oppsynsmannid'))
{
$underbilag[$i]['oppsynsmannid']
= $this->db->f('oppsynsmannid');
}
if($this->db->f('saksbehandlerid'))
{
$underbilag[$i]['saksbehandlerid']
= $this->db->f('saksbehandlerid');
}
$underbilag[$i]['budsjettansvarligid'] =
$this->db->f('budsjettansvarligid');
if($this->db->f('oppsynsigndato'))
{
$underbilag[$i]['oppsynsigndato']
= $this->db->f('oppsynsigndato');
}
if($this->db->f('saksigndato'))
{
$underbilag[$i]['saksigndato'] =
$this->db->f('saksigndato');
}
$underbilag[$i]['budsjettsigndato'] =
$this->db->f('budsjettsigndato');
$underbilag[$i]['merknad'] =
$this->db->f('merknad');
$underbilag[$i]['splitt'] =
$this->db->f('splitt');
$underbilag[$i]['utbetalingid'] =
$this->db->f('utbetalingid');
$underbilag[$i]['utbetalingsigndato'] =
$this->db->f('utbetalingsigndato');
$underbilag[$i]['district_id'] =
$this->db->f('district_id');
$underbilag[$i]['item_type'] =
$this->db->f('item_type');
$underbilag[$i]['item_id'] =
$this->db->f('item_id');
$i++;
}
return $underbilag;
}
/* function update_avvik($avvik)
{
}
*/
function log_to_deviation_table($oRsBilag)
{
$bilagsnr=$oRsBilag['bilagsnr'];
$fakturadato=$oRsBilag['fakturadato'];
$forfallsdato=$oRsBilag['forfallsdato'];
$oppsynsmannid=$oRsBilag['oppsynsmannid'];
$oppsynsigndato=$oRsBilag['oppsynsigndato'];
$saksbehandlerid=$oRsBilag['saksbehandlerid'];
$saksigndato=$oRsBilag['saksigndato'];
$budsjettansvarligid=$oRsBilag['budsjettansvarligid'];
$budsjettsigndato=$oRsBilag['budsjettsigndato'];
$artid=$oRsBilag['artid'];
$spvend_code=$oRsBilag['spvend_code'];
$belop=$oRsBilag['belop'];
$godkjentbelop=$oRsBilag['godkjentbelop'];
$sql="INSERT INTO fm_ecoavvik
(bilagsnr,fakturadato,forfallsdato,oppsynsmannid,oppsynsigndato,saksbehandlerid,saksigndato,budsjettansvarligid,budsjettsigndato,artid,spvend_code,belop,godkjentbelop)
values "
.
"($bilagsnr','$fakturadato','$forfallsdato','$oppsynsmannid','$oppsynsigndato','$saksbehandlerid','$saksigndato','$budsjettansvarligid','$budsjettsigndato','$artid','$spvend_code','$belop','$godkjentbelop')";
$this->db->query($sql,__LINE__,__FILE__);
}
function delete_avvik($bilagsnr)
{
$sql="delete from fm_ecoavvik where
bilagsnr='$bilagsnr'";
$this->db->query($sql,__LINE__,__FILE__);
}
function delete_invoice($bilagsnr)
{
$sql="delete from fm_ecobilagoverf where
bilagsnr='$bilagsnr'";
$this->db->query($sql,__LINE__,__FILE__);
}
//Logg transaksjon
function log_transaction($batchid,$bilagid,$message='')
{
$tid=date($this->datetimeformat);
$sql= "insert into fm_ecologg
(batchid,ecobilagid,melding,tid) values ('$batchid','$bilagid'
,'$message','$tid')";
$this->db->query($sql,__LINE__,__FILE__);
}
function increment_batchid()
{
$this->db->query("update fm_idgenerator set value =
value + 1 where name = 'Ecobatchid'");
$this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'");
$this->db->next_record();
$bilagsnr = $this->db->f('value');
return $bilagsnr;
}
function next_batchid()
{
$this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'");
$this->db->next_record();
$batchid = $this->db->f('value')+1;
return $batchid;
}
function get_responsible($b_abbount_id)
{
$this->db->query("select account_lid from fm_b_account
$this->join phpgw_accounts on fm_b_account.responsible =
phpgw_accounts.account_id where fm_b_account.id = '$b_abbount_id'");
$this->db->next_record();
$responsible = $this->db->f('account_lid');
return $responsible;
}
}
?>
\ No newline at end of file
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.soXport.inc.php,v 1.22 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class soXport
+ {
+ var $db = '';
+ var $account_id = 0;
+ var $total_records = 0;
+
+ function soXport($useacl=True)
+ {
+
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->db = $this->bocommon->new_db();
+ $this->db2 = $this->bocommon->new_db();
+ $this->join =
$this->bocommon->join;
+ $this->left_join =
$this->bocommon->left_join;
+ $this->datetimeformat =
$this->bocommon->datetimeformat;
+ $this->like =
$this->bocommon->like;
+ $this->account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
+ }
+
+
+ function auto_tax($dima='')
+ {
+ if(!$dima)
+ {
+ return;
+ }
+ $sql = "select mva as tax_code from fm_location1 where
loc1=" . substr($dima,0,4);
+ $this->db->query($sql);
+ $this->db->next_record();
+
+ return $this->db->f('tax_code');
+ }
+
+ function tax_b_account_override($mvakode='',$b_account_id='')
+ {
+ if(!$b_account_id)
+ {
+ return $mvakode;
+ }
+ $sql = "select mva as tax_code from fm_b_account where
id='$b_account_id'";
+ $this->db->query($sql);
+ $this->db->next_record();
+
+ if($this->db->f('tax_code'))
+ {
+ return $this->db->f('tax_code');
+ }
+ else
+ {
+ return $mvakode;
+ }
+
+ }
+
+ function tax_vendor_override($mvakode='',$vendor_id='')
+ {
+ if(!$vendor_id)
+ {
+ return $mvakode;
+ }
+ $sql = "select mva as tax_code from fm_vendor where
id='$vendor_id'";
+ $this->db->query($sql);
+ $this->db->next_record();
+
+ if($this->db->f('tax_code'))
+ {
+ return $this->db->f('tax_code');
+ }
+ else
+ {
+ return $mvakode;
+ }
+
+ }
+
+ function get_kostra_id($dima='')
+ {
+ if(!$dima)
+ {
+ return;
+ }
+ $sql = "select kostra_id from fm_location1 where loc1="
. substr($dima,0,4);
+ $this->db->query($sql);
+ $this->db->next_record();
+
+ return $this->db->f('kostra_id');
+ }
+
+ function anleggsnr_to_objekt($anleggsnr,$meter_table)
+ {
+ $this->db->query("select
$meter_table.ext_meter_id,$meter_table.loc1,$meter_table.loc2,$meter_table.loc3,fm_part_of_town.district_id
"
+ . " from $meter_table $this->join fm_location1 ON
$meter_table.loc1 = fm_location1.loc1 $this->join "
+ . " fm_part_of_town ON fm_location1.part_of_town_id =
fm_part_of_town.part_of_town_id where $meter_table.ext_system_id='$anleggsnr'");
+
+ $this->db->next_record();
+
+// $location = split("-",
$this->db->f('location_code'));
+
+ $loc1 = $this->db->f('loc1');
+ $loc2 = $this->db->f('loc2');
+ $loc3 = $this->db->f('loc3');
+ $dima=$loc1.$loc2.$loc3;
+
+ $maalerinfo['loc1']=$loc1;
+ $maalerinfo['dima']=$dima;
+ $maalerinfo['maalernr']=$this->db->f('ext_meter_id');
+ $maalerinfo['district']=$this->db->f('district_id');
+ return $maalerinfo;
+
+ }
+
+ function gabnr_to_objekt($Gnr,$Bnr,$sekjonnr)
+ {
+ //Finn dima fra Boei
+ $sql = "select fm_gab_location.loc1,
fm_gab_location.loc2, fm_gab_location.loc3 from fm_gab_location, fm_location1,
fm_owner "
+ . "where substring(fm_gab_location.gab_id,5,5)='$Gnr'
and "
+ . " substring(fm_gab_location.gab_id,10,4)='$Bnr'
and "
+ . "
substring(fm_gab_location.gab_id,18,3)='$sekjonnr' and "
+ . " fm_gab_location.loc1=fm_location1.loc1 and "
+ . " fm_location1.owner_id=fm_owner.id ";
+ // . " and (fm_owner.category=0 or
fm_owner.category=2)";
+
+ $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+
+ $gabinfo['loc1']=$GLOBALS['phpgw']->db->f('loc1');
+
$gabinfo['dima']=$GLOBALS['phpgw']->db->f('loc1').$GLOBALS['phpgw']->db->f('loc2').$GLOBALS['phpgw']->db->f('loc3');
+
+ return $gabinfo;
+ }
+
+
+ function dima_to_address($dima)
+ {
+ $loc1=substr($dima,0,4);
+ $loc2=substr($dima,4,2);
+ $loc3=substr($dima,6,2);
+ $sql = "select loc3_name from fm_location3 where loc1 =
'$loc1' and loc2= '$loc2' and loc3 = '$loc3' ";
+ $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+ $address=$GLOBALS['phpgw']->db->f('loc3_name');
+ return $address;
+
+ }
+
+ function check_order($id)
+ {
+ $this->db->query("select id,type from fm_orders where
id='$id'");
+ $this->db->next_record();
+ return $this->db->f('type');
+ }
+
+ function get_project($id)
+ {
+ $this->db->query("select project_id from fm_workorder
where id='$id'");
+ $this->db->next_record();
+ return $this->db->f('project_id');
+ }
+
+ function check_spbudact_code($id)
+ {
+
+ $this->db->query("select count(*) from fm_b_account
where id='$id'");
+ $this->db->next_record();
+ return $this->db->f(0);
+ }
+
+ function add($buffer)
+ {
+ $this->db->transaction_begin();
+
+ $num=0;
+ foreach ($buffer as $fields)
+ {
+ if(abs($fields['belop'])>0)
+ {
+ $values= array(
+ $fields['project_id'],
+ $fields['kostra_id'],
+ $fields['pmwrkord_code'],
+ $fields['bilagsnr'],
+ $fields['splitt'],
+ $fields['kildeid'],
+ $fields['kidnr'],
+ $fields['typeid'],
+ $fields['fakturadato'],
+ $fields['forfallsdato'],
+ $fields['regtid'],
+ $fields['artid'],
+ $fields['spvend_code'],
+ $fields['dimb'],
+ $fields['oppsynsmannid'],
+ $fields['saksbehandlerid'],
+ $fields['budsjettansvarligid'],
+ $fields['fakturanr'],
+ $fields['spbudact_code'],
+ $fields['loc1'],
+ $fields['dima'],
+ $fields['dimd'],
+ $fields['mvakode'],
+ $fields['periode'],
+
$this->db->db_addslashes($fields['merknad']),
+ False,
+ False,
+ False,
+ False,
+ $fields['item_type'],
+ $fields['item_id']
+ );
+
+ $bilagsnr = $fields['bilagsnr'];
+
+ $values =
$this->bocommon->validate_db_insert($values);
+
+ $sql= "INSERT INTO fm_ecobilag
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,fakturadato,"
+ . "
forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,saksbehandlerid,budsjettansvarligid,"
+ . "
fakturanr,spbudact_code,loc1,dima,dimd,mvakode,periode,merknad,oppsynsigndato,saksigndato,"
+ . "
budsjettsigndato,utbetalingsigndato,item_type,item_id,belop,godkjentbelop)"
+ . " VALUES ($values," .
$this->bocommon->moneyformat($fields['belop']) . "," .
$this->bocommon->moneyformat($fields['godkjentbelop']) . ")";
+
+
$this->db->query($sql,__LINE__,__FILE__);
+
+ $num++;
+ }
+ }
+
+ $this->db->query("UPDATE fm_idgenerator set value
=$bilagsnr WHERE name = 'Bilagsnummer'");
+
+ $this->db->transaction_commit();
+
+ return $num;
+ }
+
+ function add_OverfBilag ($data)
+ {
+ $values= array(
+ $data['id'],
+ $data['bilagsnr'],
+ $data['kidnr'],
+ $data['typeid'],
+ $data['kildeid'],
+ $data['project_id'],
+ $data['kostra_id'],
+ $data['pmwrkord_code'],
+ $data['fakturadato'],
+ $data['periode'],
+ $data['forfallsdato'],
+ $data['fakturanr'],
+ $data['spbudact_code'],
+ $data['regtid'],
+ $data['artid'],
+ $data['spvend_code'],
+ $data['dima'],
+ $data['loc1'],
+ $data['dimb'],
+ $data['mvakode'],
+ $data['dimd'],
+ $data['oppsynsmannid'],
+ $data['saksbehandlerid'],
+ $data['budsjettansvarligid'],
+ $data['oppsynsigndato'],
+ $data['saksigndato'],
+ $data['budsjettsigndato'],
+ $this->db->db_addslashes($data['merknad']),
+ $data['splitt'],
+ $data['utbetalingid'],
+ $data['utbetalingsigndato'],
+ $data['filnavn'],
+ date("Y-m-d G:i:s"),
+ $data['item_type'],
+ $data['item_id'],
+ );
+
+ $values = $this->bocommon->validate_db_insert($values);
+
+ $sql="INSERT INTO fm_ecobilagoverf
(id,bilagsnr,kidnr,typeid,kildeid,project_id,kostra_id,pmwrkord_code,fakturadato,"
+ . "
periode,forfallsdato,fakturanr,spbudact_code,regtid,artid,spvend_code,dima,loc1,"
+ . "
dimb,mvakode,dimd,oppsynsmannid,saksbehandlerid,budsjettansvarligid,oppsynsigndato,saksigndato,"
+ . "
budsjettsigndato,merknad,splitt,utbetalingid,utbetalingsigndato,filnavn,overftid,item_type,item_id,"
+ . " belop,godkjentbelop,ordrebelop)"
+ . "values ($values, "
+ . $this->bocommon->moneyformat($data['belop'])
. ","
+ .
$this->bocommon->moneyformat($data['godkjentbelop']) . ","
+ .
$this->bocommon->moneyformat($data['ordrebelop']) . ")";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+//echo 'sql ' . $sql.'<br>';
+ }
+
+ function delete_from_fm_ecobilag($id)
+ {
+ $sql="delete from fm_ecobilag where id=$id";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ // Velg ut alle hoved bilag som skal overføres
+ function hoved_bilag ($periode,$pre_transfer='')
+ {
+ if($pre_transfer)
+ {
+ $sql= "SELECT sum(belop) as belop, bilagsnr
from fm_ecobilag WHERE periode='$periode' AND utbetalingsigndato IS NULL GROUP
BY bilagsnr ";
+ }
+ else
+ {
+ $sql="select sum(belop) as belop, bilagsnr from
fm_ecobilag where periode='$periode' AND budsjettsigndato is not NULL AND (
saksigndato is not NULL OR oppsynsigndato is not NULL ) AND
utbetalingsigndato is not NULL group by bilagsnr";
+ }
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ $i = 0;
+ while ($this->db->next_record())
+ {
+ $hoved_bilag_temp[$i]['belop'] =
$this->db->f('belop');
+ $hoved_bilag_temp[$i]['bilagsnr'] =
$this->db->f('bilagsnr');
+ $i++;
+ }
+
+//_debug_array($hoved_bilag_temp);
+
+ if ($hoved_bilag_temp)
+ {
+ $i = 0;
+ while(each($hoved_bilag_temp))
+ {
+ $bilagsnr =
$hoved_bilag_temp[$i]['bilagsnr'];
+
+ $sql= "select
fm_ecobilag.*,fm_ecouser.initials as saksbehandler from fm_ecobilag $this->join
fm_ecouser on fm_ecobilag.budsjettansvarligid=fm_ecouser.lid where
bilagsnr=$bilagsnr ";
+
$this->db->query($sql,__LINE__,__FILE__);
+
+ $this->db->next_record();
+
+ $hoved_bilag[$i]['id']
= $this->db->f('id');
+ $hoved_bilag[$i]['bilagsnr']
= $bilagsnr;
+ $hoved_bilag[$i]['kidnr']
= $this->db->f('kidnr');
+ $hoved_bilag[$i]['typeid']
= $this->db->f('typeid');
+ $hoved_bilag[$i]['kildeid']
= $this->db->f('kildeid');
+ $hoved_bilag[$i]['pmwrkord_code']
= $this->db->f('pmwrkord_code');
+ $hoved_bilag[$i]['belop']
= $hoved_bilag_temp[$i]['belop'];
+ $hoved_bilag[$i]['fakturadato']
= $this->db->f('fakturadato');
+ $hoved_bilag[$i]['periode']
= $this->db->f('periode');
+ $hoved_bilag[$i]['forfallsdato']
= $this->db->f('forfallsdato');
+ $hoved_bilag[$i]['fakturanr']
= $this->db->f('fakturanr');
+ $hoved_bilag[$i]['spbudact_code']
= $this->db->f('spbudact_code');
+ $hoved_bilag[$i]['regtid']
= $this->db->f('regtid');
+ $hoved_bilag[$i]['artid']
= $this->db->f('artid');
+ $hoved_bilag[$i]['godkjentbelop']
= $hoved_bilag_temp[$i]['belop'];
+ $hoved_bilag[$i]['spvend_code']
= $this->db->f('spvend_code');
+ $hoved_bilag[$i]['dima']
= $this->db->f('dima');
+ $hoved_bilag[$i]['dimb']
= $this->db->f('dimb');
+ $hoved_bilag[$i]['mvakode']
= $this->db->f('mvakode');
+ $hoved_bilag[$i]['dimd']
= $this->db->f('dimd');
+ if($this->db->f('oppsynsmannid'))
+ {
+
$hoved_bilag[$i]['oppsynsmannid'] = $this->db->f('oppsynsmannid');
+ }
+ if($this->db->f('saksbehandlerid'))
+ {
+
$hoved_bilag[$i]['saksbehandlerid'] = $this->db->f('saksbehandlerid');
+ }
+
+ $hoved_bilag[$i]['budsjettansvarligid']
= $this->db->f('budsjettansvarligid');
+
+ if($this->db->f('oppsynsigndato'))
+ {
+
$hoved_bilag[$i]['oppsynsigndato'] = $this->db->f('oppsynsigndato');
+ }
+ if($this->db->f('saksigndato'))
+ {
+ $hoved_bilag[$i]['saksigndato']
= $this->db->f('saksigndato');
+ }
+
+ $hoved_bilag[$i]['budsjettsigndato']
= $this->db->f('budsjettsigndato');
+ $hoved_bilag[$i]['merknad']
= $this->db->f('merknad');
+ $hoved_bilag[$i]['splitt']
= $this->db->f('splitt');
+ $hoved_bilag[$i]['utbetalingid']
= $this->db->f('utbetalingid');
+ $hoved_bilag[$i]['utbetalingsigndato']
= $this->db->f('utbetalingsigndato');
+ $hoved_bilag[$i]['saksbehandler']
= $this->db->f('saksbehandler');
+ $i++;
+ }
+ }
+//_debug_array($hoved_bilag);
+
+ return $hoved_bilag;
+ }
+
+ //Velg ut alle underbilag
+
+ function select_underbilag ($bilagsnr)
+ {
+ $sql= "SELECT fm_ecobilag.*
,fm_part_of_town.district_id FROM (fm_location1 $this->join fm_part_of_town ON
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id) $this->join
fm_ecobilag ON fm_location1.loc1 = fm_ecobilag.loc1 WHERE bilagsnr='$bilagsnr'";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ $i = 0;
+ while ($this->db->next_record())
+ {
+ $underbilag[$i]['id'] = $this->db->f('id');
+ $underbilag[$i]['bilagsnr'] =
$this->db->f('bilagsnr');
+ $underbilag[$i]['kidnr'] =
$this->db->f('kidnr');
+ $underbilag[$i]['typeid'] =
$this->db->f('typeid');
+ $underbilag[$i]['kildeid'] =
$this->db->f('kildeid');
+ $underbilag[$i]['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
+ $underbilag[$i]['belop'] =
$this->db->f('belop');
+ $underbilag[$i]['fakturadato'] =
$this->db->f('fakturadato');
+ $underbilag[$i]['periode'] =
$this->db->f('periode');
+ $underbilag[$i]['forfallsdato'] =
$this->db->f('forfallsdato');
+ $underbilag[$i]['fakturanr'] =
$this->db->f('fakturanr');
+ $underbilag[$i]['spbudact_code'] =
$this->db->f('spbudact_code');
+ $underbilag[$i]['regtid'] =
$this->db->f('regtid');
+ $underbilag[$i]['artid'] =
$this->db->f('artid');
+ $underbilag[$i]['godkjentbelop'] =
$this->db->f('godkjentbelop');
+ $underbilag[$i]['spvend_code'] =
$this->db->f('spvend_code');
+ $underbilag[$i]['dima'] = $this->db->f('dima');
+ $underbilag[$i]['loc1'] = $this->db->f('loc1');
+ $underbilag[$i]['dimb'] = $this->db->f('dimb');
+ $underbilag[$i]['mvakode'] =
$this->db->f('mvakode');
+ $underbilag[$i]['dimd'] = $this->db->f('dimd');
+ $underbilag[$i]['project_id'] =
$this->db->f('project_id');
+ $underbilag[$i]['kostra_id'] =
$this->db->f('kostra_id');
+ if($this->db->f('oppsynsmannid'))
+ {
+ $underbilag[$i]['oppsynsmannid']
= $this->db->f('oppsynsmannid');
+ }
+ if($this->db->f('saksbehandlerid'))
+ {
+ $underbilag[$i]['saksbehandlerid']
= $this->db->f('saksbehandlerid');
+ }
+
+ $underbilag[$i]['budsjettansvarligid'] =
$this->db->f('budsjettansvarligid');
+
+ if($this->db->f('oppsynsigndato'))
+ {
+ $underbilag[$i]['oppsynsigndato']
= $this->db->f('oppsynsigndato');
+ }
+ if($this->db->f('saksigndato'))
+ {
+ $underbilag[$i]['saksigndato'] =
$this->db->f('saksigndato');
+ }
+
+ $underbilag[$i]['budsjettsigndato'] =
$this->db->f('budsjettsigndato');
+ $underbilag[$i]['merknad'] =
$this->db->f('merknad');
+ $underbilag[$i]['splitt'] =
$this->db->f('splitt');
+ $underbilag[$i]['utbetalingid'] =
$this->db->f('utbetalingid');
+ $underbilag[$i]['utbetalingsigndato'] =
$this->db->f('utbetalingsigndato');
+ $underbilag[$i]['district_id'] =
$this->db->f('district_id');
+ $underbilag[$i]['item_type'] =
$this->db->f('item_type');
+ $underbilag[$i]['item_id'] =
$this->db->f('item_id');
+ $i++;
+ }
+
+ return $underbilag;
+ }
+
+/* function update_avvik($avvik)
+ {
+ }
+
+*/
+ function log_to_deviation_table($oRsBilag)
+ {
+ $bilagsnr=$oRsBilag['bilagsnr'];
+ $fakturadato=$oRsBilag['fakturadato'];
+ $forfallsdato=$oRsBilag['forfallsdato'];
+ $oppsynsmannid=$oRsBilag['oppsynsmannid'];
+ $oppsynsigndato=$oRsBilag['oppsynsigndato'];
+ $saksbehandlerid=$oRsBilag['saksbehandlerid'];
+ $saksigndato=$oRsBilag['saksigndato'];
+ $budsjettansvarligid=$oRsBilag['budsjettansvarligid'];
+ $budsjettsigndato=$oRsBilag['budsjettsigndato'];
+ $artid=$oRsBilag['artid'];
+ $spvend_code=$oRsBilag['spvend_code'];
+ $belop=$oRsBilag['belop'];
+ $godkjentbelop=$oRsBilag['godkjentbelop'];
+
+ $sql="INSERT INTO fm_ecoavvik
(bilagsnr,fakturadato,forfallsdato,oppsynsmannid,oppsynsigndato,saksbehandlerid,saksigndato,budsjettansvarligid,budsjettsigndato,artid,spvend_code,belop,godkjentbelop)
values "
+ .
"($bilagsnr','$fakturadato','$forfallsdato','$oppsynsmannid','$oppsynsigndato','$saksbehandlerid','$saksigndato','$budsjettansvarligid','$budsjettsigndato','$artid','$spvend_code','$belop','$godkjentbelop')";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ function delete_avvik($bilagsnr)
+ {
+ $sql="delete from fm_ecoavvik where
bilagsnr='$bilagsnr'";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ function delete_invoice($bilagsnr)
+ {
+ $sql="delete from fm_ecobilagoverf where
bilagsnr='$bilagsnr'";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ //Logg transaksjon
+ function log_transaction($batchid,$bilagid,$message='')
+ {
+ $tid=date($this->datetimeformat);
+ $sql= "insert into fm_ecologg
(batchid,ecobilagid,melding,tid) values ('$batchid','$bilagid'
,'$message','$tid')";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ function increment_batchid()
+ {
+ $this->db->query("update fm_idgenerator set value =
value + 1 where name = 'Ecobatchid'");
+ $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'");
+ $this->db->next_record();
+ $bilagsnr = $this->db->f('value');
+ return $bilagsnr;
+ }
+
+ function next_batchid()
+ {
+
+ $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'");
+ $this->db->next_record();
+ $batchid = $this->db->f('value')+1;
+
+ return $batchid;
+ }
+
+ function get_responsible($b_abbount_id)
+ {
+ $this->db->query("select account_lid from fm_b_account
$this->join phpgw_accounts on fm_b_account.responsible =
phpgw_accounts.account_id where fm_b_account.id = '$b_abbount_id'");
+ $this->db->next_record();
+ $responsible = $this->db->f('account_lid');
+ return $responsible;
+ }
+ }
+?>
Index: property/inc/class.sogab.inc.php
diff -u property/inc/class.sogab.inc.php:1.13
property/inc/class.sogab.inc.php:1.14
--- property/inc/class.sogab.inc.php:1.13 Fri Jan 27 14:05:43 2006
+++ property/inc/class.sogab.inc.php Fri Feb 3 12:05:49 2006
@@ -1,482 +1,482 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 location
- * @version $Id: class.sogab.inc.php,v 1.13 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class sogab
- {
- var $gab_insert_level;
-
- function sogab($gab_insert_level)
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->db = $this->bocommon->new_db();
- $this->db2 = $this->bocommon->new_db();
- $this->join = $this->bocommon->join;
- $this->like = $this->bocommon->like;
-
- $this->gab_insert_level = $gab_insert_level;
- }
-
- function read($data)
- {
- if(is_array($data))
- {
- if ($data['start'])
- {
- $start=$data['start'];
- }
- else
- {
- $start=0;
- }
- $sort =
(isset($data['sort'])?$data['sort']:'DESC');
- $order =
(isset($data['order'])?$data['order']:'');
- $cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
- $loc1 = (isset($data['loc1'])?$data['loc1']:'');
- $gaards_nr =
(isset($data['gaards_nr'])?$data['gaards_nr']:'');
- $bruksnr =
(isset($data['bruksnr'])?$data['bruksnr']:'');
- $feste_nr =
(isset($data['feste_nr'])?$data['feste_nr']:'');
- $seksjons_nr =
(isset($data['seksjons_nr'])?$data['seksjons_nr']:'');
- $allrows =
(isset($data['allrows'])?$data['allrows']:'');
- $address =
(isset($data['address'])?$data['address']:'');
- }
-
- if ($order)
- {
- $ordermethod = " order by
fm_gab_location.$order $sort";
- }
- else
- {
- $ordermethod = ' order by gab_id ASC';
- }
-
- $where = 'WHERE';
-
- if ($cat_id > 0)
- {
- $filtermethod .= " $where
fm_gab_location.category='$cat_id' ";
- $where = 'AND';
- }
-
- if ($status_id)
- {
- $filtermethod .= " $where
fm_gab_location.status='$status_id' ";
- $where = 'AND';
- }
-
- if ($address)
- {
- $filtermethod .= " $where
fm_gab_location.address $this->like '%$address%' ";
- $where = 'AND';
- }
- if ($loc1)
- {
- $filtermethod .= " $where
fm_gab_location.loc1='$loc1' ";
- $where = 'AND';
- }
-
- if ($gaards_nr)
- {
- $filtermethod .= " $where SUBSTRING(gab_id,5,5)
$this->like '%$gaards_nr%' ";
- $where = 'AND';
- }
- if ($bruksnr)
- {
- $filtermethod .= " $where
SUBSTRING(gab_id,10,4) $this->like '%$bruksnr%' ";
- $where = 'AND';
- }
- if ($feste_nr)
- {
- $filtermethod .= " $where
SUBSTRING(gab_id,14,4) $this->like '%$feste_nr%' ";
- $where = 'AND';
- }
- if ($seksjons_nr)
- {
- $filtermethod .= " $where
SUBSTRING(gab_id,18,3) $this->like '%$seksjons_nr%' ";
- $where = 'AND';
- }
-
-
- $j = $this->gab_insert_level;
- $joinmethod .= " $this->join fm_location". ($j);
- $on = 'ON';
- for ($i=($j); $i>0; $i--)
- {
- $joinmethod .= " $on (fm_gab_location.loc" .
($i). " = fm_location" . ($j) . ".loc" . ($i) . ")";
- $on = 'AND';
- }
-
- $sql = "SELECT gab_id,count(gab_id) as hits, loc" . $j
. "_name as address ,fm_gab_location.location_code, fm_gab_location.owner as
owner FROM fm_gab_location $joinmethod $filtermethod GROUP BY
gab_id,fm_gab_location.location_code,loc" . $j . "_name,owner ";
-
- $this->db2->query($sql,__LINE__,__FILE__);
- $this->total_records = $this->db2->num_rows();
-
- if(!$allrows)
- {
- $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
- }
- else
- {
- $this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
- }
-
- while ($this->db->next_record())
- {
- $gab_list[] = array
- (
- 'gab_id' =>
$this->db->f('gab_id'),
- 'location_code' =>
$this->db->f('location_code'),
- 'address' =>
stripslashes($this->db->f('address')),
- 'hits' =>
$this->db->f('hits'),
- 'owner' =>
$this->db->f('owner')
- );
- }
- return $gab_list;
- }
-
- function read_detail($data)
- {
- if(is_array($data))
- {
- if ($data['start'])
- {
- $start=$data['start'];
- }
- else
- {
- $start=0;
- }
- $sort =
(isset($data['sort'])?$data['sort']:'DESC');
- $order =
(isset($data['order'])?$data['order']:'');
- $cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
- $gab_id =
(isset($data['gab_id'])?$data['gab_id']:'0');
- $allrows =
(isset($data['allrows'])?$data['allrows']:'');
- }
-
-
- $entity_table = 'fm_gab_location';
-
- $cols .= $entity_table . '.location_code,';
- $cols .= $entity_table . '.owner';
-
- $cols_return[] = 'location_code';
- $cols .= ',gab_id';
- $cols_return[] = 'gab_id';
- $cols_return[] = 'owner';
-
-
- $sql =
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
-
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query));
-
-
- if ($order)
- {
- $ordermethod = " order by $order $sort";
- }
- else
- {
- $ordermethod = ' order by
fm_gab_location.location_code ASC';
- }
-
- $filtermethod = " WHERE
fm_gab_location.gab_id='$gab_id'";
-
- if ($cat_id > 0)
- {
- $filtermethod .= " AND
fm_gab_location.category='$cat_id' ";
- }
-
- if ($status_id)
- {
- $filtermethod .= " AND
fm_gab_location.status='$status_id' ";
- }
-
- $sql .= " $filtermethod ";
-//echo $sql;
- $this->uicols = $this->bocommon->uicols;
- $cols_return = $this->bocommon->cols_return;
- $type_id =
$this->bocommon->type_id;
- $this->cols_extra = $this->bocommon->cols_extra;
-
-
- $this->db2->query($sql,__LINE__,__FILE__);
- $this->total_records = $this->db2->num_rows();
-
- if(!$allrows)
- {
- $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
- }
- else
- {
- $this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
- }
-
- $j=0;
- while ($this->db->next_record())
- {
- for ($i=0;$i<count($cols_return);$i++)
- {
- $gab_list[$j][$cols_return[$i]] =
$this->db->f($cols_return[$i]);
- }
-
- $location_code= $this->db->f('location_code');
- $location = split('-',$location_code);
- for ($m=0;$m<count($location);$m++)
- {
- $gab_list[$j]['loc' . ($m+1)] =
$location[$m];
- $gab_list[$j]['query_location']['loc' .
($m+1)]=implode("-", array_slice($location, 0, ($m+1)));
- }
-
- $j++;
- }
- return $gab_list;
- }
-
- function read_single($gab_id='',$location_code='')
- {
- $sql = "SELECT * from fm_gab_location where
gab_id='$gab_id' and location_code='$location_code' ";
-
- $this->db->query($sql,__LINE__,__FILE__);
-
- if ($this->db->next_record())
- {
- $gab['location_code'] =
$location_code;
- $gab['remark'] =
$this->db->f('remark');
- $gab['owner'] =
$this->db->f('owner');
- }
-
-//_debug_array($gab);
- return $gab;
- }
-
- function exist_gab_location($gab_id='',$location_code='')
- {
- $this->db2->query("SELECT count(*) FROM fm_gab_location
where gab_id='$gab_id' and location_code='$location_code'");
-
- $this->db2->next_record();
-
- if ( $this->db2->f(0))
- {
- return True;
- }
- }
-
-
- function add($gab)
- {
- $location = explode('-', $gab['location_code']);
- $next_type = count($location)+1;
-
-//_debug_array($gab);
-
- $where= 'WHERE';
- for ($i=0;$i<count($location);$i++)
- {
- $where_condition .= " $where loc" . ($i+1) .
"='" . $location[$i] . "'";
- $where= 'AND';
- }
-
- $gab['remark'] =
$this->db->db_addslashes($gab['remark']);
-
- if(!$gab['owner'])
- {
- $gab['owner']='no';
- }
-
-
- $gab_id= $gab['kommune_nr'] .
sprintf("%05s",$gab['gaards_nr']) . sprintf("%04s",$gab['bruks_nr']) .
sprintf("%04s",$gab['feste_nr']) . sprintf("%03s",$gab['seksjons_nr']);
-
- if($gab['propagate'] && ($next_type <
($this->gab_insert_level+1)))
- {
-
- $sql = 'SELECT location_code,loc' .
$this->gab_insert_level . '_name as location_name FROM fm_location' .
$this->gab_insert_level . " $where_condition ";
-
- $this->db->query($sql,__LINE__,__FILE__);
-
- while ($this->db->next_record())
- {
-
if(!$this->exist_gab_location($gab_id,$this->db->f('location_code')))
- {
- $gab_insert[] =
array('location_code' => $this->db->f('location_code'),
-
'gab_id' => $gab_id,
-
'location_name' => $this->db->f('location_name'),
-
'remark' => $gab['remark'],
-
'owner' => $gab['owner']);
- }
- else
- {
- $gab_update[] =
array('location_code' => $this->db->f('location_code'),
-
'gab_id' => $gab_id,
-
'location_name' => $this->db->f('location_name'),
-
'remark' => $gab['remark'],
-
'owner' => $gab['owner']);
- }
- }
- }
- else
- {
- if(count($location)==$this->gab_insert_level)
- {
- $gab_insert[] = array('location_code'=>
$gab['location_code'],
-
'gab_id' => $gab_id,
-
'street_name' => $gab['street_name'],
-
'street_number' => $gab['street_number'],
-
'location_name' => $gab['location_name'],
-
'remark' => $gab['remark'],
-
'owner' => $gab['owner']);
- }
- }
-
- if($gab_insert)
- {
- $receipt = $this->insert($gab_insert);
- }
- else
- {
- $receipt['error'][] = array('msg'=>lang('Could
not find any location to save to!'));
- }
-
- if($gab_update)
- {
- $receipt = $this->update($gab_update,$receipt);
- }
-
- $receipt['gab_id'] = $gab_id;
-
- return $receipt;
- }
-
-
- function insert($gab_insert)
- {
- $receipt['message'][] = array('msg'=>lang('gab %1 has
been added',$gab_insert[0]['gab_id']));
-
- for ($i=0;$i<count($gab_insert);$i++)
- {
- $location = explode('-',
$gab_insert[$i]['location_code']);
-
- while (is_array($location) &&
list($input_name,$value) = each($location))
- {
- if($value)
- {
- $col[] = 'loc' .
($input_name+1);
- $val[] = $value;
- }
- }
-
- if($col)
- {
- $cols = "," . implode(",", $col);
- $vals = ",'" . implode("','", $val) .
"'";
- }
-
- if($gab_insert[$i]['street_name'])
- {
- $address[]=
$gab_insert[$i]['street_name'];
- $address[]=
$gab_insert[$i]['street_number'];
- $address =
$this->db->db_addslashes(implode(" ", $address));
- }
-
- if(!$address)
- {
- $address =
$this->db->db_addslashes($gab_insert[$i]['location_name']);
- }
-
- $this->db->query("INSERT INTO fm_gab_location
(location_code,gab_id,remark,owner,entry_date,user_id,address $cols) "
- . "VALUES ('"
- . $gab_insert[$i]['location_code'].
"','"
- . $gab_insert[$i]['gab_id']. "','"
- . $gab_insert[$i]['remark']. "','"
- . $gab_insert[$i]['owner']. "','"
- . time() . "','"
- . $this->account. "','"
- . $address . "' $vals
)",__LINE__,__FILE__);
-
- $receipt['message'][] =
array('msg'=>lang('at location %1',$gab_insert[$i]['location_code']));
-
- unset($location);
- unset($col);
- unset($val);
- unset($cols);
- unset($vals);
- unset($address);
-
- }
-
-
- return $receipt;
- }
-
- function update($gab_update,$receipt)
- {
- $receipt['message'][] = array('msg'=>lang('gab %1 has
been updated',$gab_update[0]['gab_id']));
-
- for ($i=0;$i<count($gab_update);$i++)
- {
- $this->db->query("UPDATE fm_gab_location set
- remark ='" .
$gab_update[$i]['remark'] . "',
- owner ='" .
$gab_update[$i]['owner'] . "',
- entry_date ='" .
time() . "',
- user_id ='" .
$this->account
- . "' WHERE location_code = '" .
$gab_update[$i]['location_code'] ."' AND gab_id= '" . $gab_update[$i]['gab_id']
. "'",__LINE__,__FILE__);
-
- $receipt['message'][] =
array('msg'=>lang('at location %1',$gab_update[$i]['location_code']));
- }
-
- return $receipt;
- }
-
- function edit($gab)
- {
- $location = explode('-', $gab['location_code']);
-
-//_debug_array($gab);
-
- if(!$gab['owner'])
- {
- $gab['owner']='no';
- }
-
- if(count($location)==$this->gab_insert_level)
- {
-
- $this->db->query("UPDATE fm_gab_location set
- remark ='" .
$gab['remark'] . "',
- owner ='" .
$gab['owner'] . "',
- entry_date ='" .
time() . "',
- user_id ='" .
$this->account
- . "' WHERE location_code= '" .
$gab['location_code'] ."' and gab_id= '" . $gab['gab_id']
."'",__LINE__,__FILE__);
-
- $receipt['message'][] = array('msg'=>lang('gab
%1 has been edited',"'".$gab['gab_id']."'"));
- $receipt['message'][] = array('msg'=>lang('at
location %1',$gab['location_code']));
- }
- else
- {
- $receipt['error'][] =
array('msg'=>lang('Nothing to do !'));
- }
- $receipt['gab_id'] = $gab['gab_id'];
- return $receipt;
-
- }
-
- function delete($gab_id='',$location_code='')
- {
- $this->db->query("DELETE FROM fm_gab_location WHERE
gab_id='$gab_id' and location_code='$location_code'",__LINE__,__FILE__);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 location
+ * @version $Id: class.sogab.inc.php,v 1.14 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class sogab
+ {
+ var $gab_insert_level;
+
+ function sogab($gab_insert_level)
+ {
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->db = $this->bocommon->new_db();
+ $this->db2 = $this->bocommon->new_db();
+ $this->join = $this->bocommon->join;
+ $this->like = $this->bocommon->like;
+
+ $this->gab_insert_level = $gab_insert_level;
+ }
+
+ function read($data)
+ {
+ if(is_array($data))
+ {
+ if ($data['start'])
+ {
+ $start=$data['start'];
+ }
+ else
+ {
+ $start=0;
+ }
+ $sort =
(isset($data['sort'])?$data['sort']:'DESC');
+ $order =
(isset($data['order'])?$data['order']:'');
+ $cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
+ $loc1 = (isset($data['loc1'])?$data['loc1']:'');
+ $gaards_nr =
(isset($data['gaards_nr'])?$data['gaards_nr']:'');
+ $bruksnr =
(isset($data['bruksnr'])?$data['bruksnr']:'');
+ $feste_nr =
(isset($data['feste_nr'])?$data['feste_nr']:'');
+ $seksjons_nr =
(isset($data['seksjons_nr'])?$data['seksjons_nr']:'');
+ $allrows =
(isset($data['allrows'])?$data['allrows']:'');
+ $address =
(isset($data['address'])?$data['address']:'');
+ }
+
+ if ($order)
+ {
+ $ordermethod = " order by
fm_gab_location.$order $sort";
+ }
+ else
+ {
+ $ordermethod = ' order by gab_id ASC';
+ }
+
+ $where = 'WHERE';
+
+ if ($cat_id > 0)
+ {
+ $filtermethod .= " $where
fm_gab_location.category='$cat_id' ";
+ $where = 'AND';
+ }
+
+ if ($status_id)
+ {
+ $filtermethod .= " $where
fm_gab_location.status='$status_id' ";
+ $where = 'AND';
+ }
+
+ if ($address)
+ {
+ $filtermethod .= " $where
fm_gab_location.address $this->like '%$address%' ";
+ $where = 'AND';
+ }
+ if ($loc1)
+ {
+ $filtermethod .= " $where
fm_gab_location.loc1='$loc1' ";
+ $where = 'AND';
+ }
+
+ if ($gaards_nr)
+ {
+ $filtermethod .= " $where SUBSTRING(gab_id,5,5)
$this->like '%$gaards_nr%' ";
+ $where = 'AND';
+ }
+ if ($bruksnr)
+ {
+ $filtermethod .= " $where
SUBSTRING(gab_id,10,4) $this->like '%$bruksnr%' ";
+ $where = 'AND';
+ }
+ if ($feste_nr)
+ {
+ $filtermethod .= " $where
SUBSTRING(gab_id,14,4) $this->like '%$feste_nr%' ";
+ $where = 'AND';
+ }
+ if ($seksjons_nr)
+ {
+ $filtermethod .= " $where
SUBSTRING(gab_id,18,3) $this->like '%$seksjons_nr%' ";
+ $where = 'AND';
+ }
+
+
+ $j = $this->gab_insert_level;
+ $joinmethod .= " $this->join fm_location". ($j);
+ $on = 'ON';
+ for ($i=($j); $i>0; $i--)
+ {
+ $joinmethod .= " $on (fm_gab_location.loc" .
($i). " = fm_location" . ($j) . ".loc" . ($i) . ")";
+ $on = 'AND';
+ }
+
+ $sql = "SELECT gab_id,count(gab_id) as hits, loc" . $j
. "_name as address ,fm_gab_location.location_code, fm_gab_location.owner as
owner FROM fm_gab_location $joinmethod $filtermethod GROUP BY
gab_id,fm_gab_location.location_code,loc" . $j . "_name,owner ";
+
+ $this->db2->query($sql,__LINE__,__FILE__);
+ $this->total_records = $this->db2->num_rows();
+
+ if(!$allrows)
+ {
+ $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
+ }
+ else
+ {
+ $this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
+ }
+
+ while ($this->db->next_record())
+ {
+ $gab_list[] = array
+ (
+ 'gab_id' =>
$this->db->f('gab_id'),
+ 'location_code' =>
$this->db->f('location_code'),
+ 'address' =>
stripslashes($this->db->f('address')),
+ 'hits' =>
$this->db->f('hits'),
+ 'owner' =>
$this->db->f('owner')
+ );
+ }
+ return $gab_list;
+ }
+
+ function read_detail($data)
+ {
+ if(is_array($data))
+ {
+ if ($data['start'])
+ {
+ $start=$data['start'];
+ }
+ else
+ {
+ $start=0;
+ }
+ $sort =
(isset($data['sort'])?$data['sort']:'DESC');
+ $order =
(isset($data['order'])?$data['order']:'');
+ $cat_id =
(isset($data['cat_id'])?$data['cat_id']:0);
+ $gab_id =
(isset($data['gab_id'])?$data['gab_id']:'0');
+ $allrows =
(isset($data['allrows'])?$data['allrows']:'');
+ }
+
+
+ $entity_table = 'fm_gab_location';
+
+ $cols .= $entity_table . '.location_code,';
+ $cols .= $entity_table . '.owner';
+
+ $cols_return[] = 'location_code';
+ $cols .= ',gab_id';
+ $cols_return[] = 'gab_id';
+ $cols_return[] = 'owner';
+
+
+ $sql =
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
+
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query));
+
+
+ if ($order)
+ {
+ $ordermethod = " order by $order $sort";
+ }
+ else
+ {
+ $ordermethod = ' order by
fm_gab_location.location_code ASC';
+ }
+
+ $filtermethod = " WHERE
fm_gab_location.gab_id='$gab_id'";
+
+ if ($cat_id > 0)
+ {
+ $filtermethod .= " AND
fm_gab_location.category='$cat_id' ";
+ }
+
+ if ($status_id)
+ {
+ $filtermethod .= " AND
fm_gab_location.status='$status_id' ";
+ }
+
+ $sql .= " $filtermethod ";
+//echo $sql;
+ $this->uicols = $this->bocommon->uicols;
+ $cols_return = $this->bocommon->cols_return;
+ $type_id =
$this->bocommon->type_id;
+ $this->cols_extra = $this->bocommon->cols_extra;
+
+
+ $this->db2->query($sql,__LINE__,__FILE__);
+ $this->total_records = $this->db2->num_rows();
+
+ if(!$allrows)
+ {
+ $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
+ }
+ else
+ {
+ $this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
+ }
+
+ $j=0;
+ while ($this->db->next_record())
+ {
+ for ($i=0;$i<count($cols_return);$i++)
+ {
+ $gab_list[$j][$cols_return[$i]] =
$this->db->f($cols_return[$i]);
+ }
+
+ $location_code= $this->db->f('location_code');
+ $location = split('-',$location_code);
+ for ($m=0;$m<count($location);$m++)
+ {
+ $gab_list[$j]['loc' . ($m+1)] =
$location[$m];
+ $gab_list[$j]['query_location']['loc' .
($m+1)]=implode("-", array_slice($location, 0, ($m+1)));
+ }
+
+ $j++;
+ }
+ return $gab_list;
+ }
+
+ function read_single($gab_id='',$location_code='')
+ {
+ $sql = "SELECT * from fm_gab_location where
gab_id='$gab_id' and location_code='$location_code' ";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ if ($this->db->next_record())
+ {
+ $gab['location_code'] =
$location_code;
+ $gab['remark'] =
$this->db->f('remark');
+ $gab['owner'] =
$this->db->f('owner');
+ }
+
+//_debug_array($gab);
+ return $gab;
+ }
+
+ function exist_gab_location($gab_id='',$location_code='')
+ {
+ $this->db2->query("SELECT count(*) FROM fm_gab_location
where gab_id='$gab_id' and location_code='$location_code'");
+
+ $this->db2->next_record();
+
+ if ( $this->db2->f(0))
+ {
+ return True;
+ }
+ }
+
+
+ function add($gab)
+ {
+ $location = explode('-', $gab['location_code']);
+ $next_type = count($location)+1;
+
+//_debug_array($gab);
+
+ $where= 'WHERE';
+ for ($i=0;$i<count($location);$i++)
+ {
+ $where_condition .= " $where loc" . ($i+1) .
"='" . $location[$i] . "'";
+ $where= 'AND';
+ }
+
+ $gab['remark'] =
$this->db->db_addslashes($gab['remark']);
+
+ if(!$gab['owner'])
+ {
+ $gab['owner']='no';
+ }
+
+
+ $gab_id= $gab['kommune_nr'] .
sprintf("%05s",$gab['gaards_nr']) . sprintf("%04s",$gab['bruks_nr']) .
sprintf("%04s",$gab['feste_nr']) . sprintf("%03s",$gab['seksjons_nr']);
+
+ if($gab['propagate'] && ($next_type <
($this->gab_insert_level+1)))
+ {
+
+ $sql = 'SELECT location_code,loc' .
$this->gab_insert_level . '_name as location_name FROM fm_location' .
$this->gab_insert_level . " $where_condition ";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ while ($this->db->next_record())
+ {
+
if(!$this->exist_gab_location($gab_id,$this->db->f('location_code')))
+ {
+ $gab_insert[] =
array('location_code' => $this->db->f('location_code'),
+
'gab_id' => $gab_id,
+
'location_name' => $this->db->f('location_name'),
+
'remark' => $gab['remark'],
+
'owner' => $gab['owner']);
+ }
+ else
+ {
+ $gab_update[] =
array('location_code' => $this->db->f('location_code'),
+
'gab_id' => $gab_id,
+
'location_name' => $this->db->f('location_name'),
+
'remark' => $gab['remark'],
+
'owner' => $gab['owner']);
+ }
+ }
+ }
+ else
+ {
+ if(count($location)==$this->gab_insert_level)
+ {
+ $gab_insert[] = array('location_code'=>
$gab['location_code'],
+
'gab_id' => $gab_id,
+
'street_name' => $gab['street_name'],
+
'street_number' => $gab['street_number'],
+
'location_name' => $gab['location_name'],
+
'remark' => $gab['remark'],
+
'owner' => $gab['owner']);
+ }
+ }
+
+ if($gab_insert)
+ {
+ $receipt = $this->insert($gab_insert);
+ }
+ else
+ {
+ $receipt['error'][] = array('msg'=>lang('Could
not find any location to save to!'));
+ }
+
+ if($gab_update)
+ {
+ $receipt = $this->update($gab_update,$receipt);
+ }
+
+ $receipt['gab_id'] = $gab_id;
+
+ return $receipt;
+ }
+
+
+ function insert($gab_insert)
+ {
+ $receipt['message'][] = array('msg'=>lang('gab %1 has
been added',$gab_insert[0]['gab_id']));
+
+ for ($i=0;$i<count($gab_insert);$i++)
+ {
+ $location = explode('-',
$gab_insert[$i]['location_code']);
+
+ while (is_array($location) &&
list($input_name,$value) = each($location))
+ {
+ if($value)
+ {
+ $col[] = 'loc' .
($input_name+1);
+ $val[] = $value;
+ }
+ }
+
+ if($col)
+ {
+ $cols = "," . implode(",", $col);
+ $vals = ",'" . implode("','", $val) .
"'";
+ }
+
+ if($gab_insert[$i]['street_name'])
+ {
+ $address[]=
$gab_insert[$i]['street_name'];
+ $address[]=
$gab_insert[$i]['street_number'];
+ $address =
$this->db->db_addslashes(implode(" ", $address));
+ }
+
+ if(!$address)
+ {
+ $address =
$this->db->db_addslashes($gab_insert[$i]['location_name']);
+ }
+
+ $this->db->query("INSERT INTO fm_gab_location
(location_code,gab_id,remark,owner,entry_date,user_id,address $cols) "
+ . "VALUES ('"
+ . $gab_insert[$i]['location_code'].
"','"
+ . $gab_insert[$i]['gab_id']. "','"
+ . $gab_insert[$i]['remark']. "','"
+ . $gab_insert[$i]['owner']. "','"
+ . time() . "','"
+ . $this->account. "','"
+ . $address . "' $vals
)",__LINE__,__FILE__);
+
+ $receipt['message'][] =
array('msg'=>lang('at location %1',$gab_insert[$i]['location_code']));
+
+ unset($location);
+ unset($col);
+ unset($val);
+ unset($cols);
+ unset($vals);
+ unset($address);
+
+ }
+
+
+ return $receipt;
+ }
+
+ function update($gab_update,$receipt)
+ {
+ $receipt['message'][] = array('msg'=>lang('gab %1 has
been updated',$gab_update[0]['gab_id']));
+
+ for ($i=0;$i<count($gab_update);$i++)
+ {
+ $this->db->query("UPDATE fm_gab_location set
+ remark ='" .
$gab_update[$i]['remark'] . "',
+ owner ='" .
$gab_update[$i]['owner'] . "',
+ entry_date ='" .
time() . "',
+ user_id ='" .
$this->account
+ . "' WHERE location_code = '" .
$gab_update[$i]['location_code'] ."' AND gab_id= '" . $gab_update[$i]['gab_id']
. "'",__LINE__,__FILE__);
+
+ $receipt['message'][] =
array('msg'=>lang('at location %1',$gab_update[$i]['location_code']));
+ }
+
+ return $receipt;
+ }
+
+ function edit($gab)
+ {
+ $location = explode('-', $gab['location_code']);
+
+//_debug_array($gab);
+
+ if(!$gab['owner'])
+ {
+ $gab['owner']='no';
+ }
+
+ if(count($location)==$this->gab_insert_level)
+ {
+
+ $this->db->query("UPDATE fm_gab_location set
+ remark ='" .
$gab['remark'] . "',
+ owner ='" .
$gab['owner'] . "',
+ entry_date ='" .
time() . "',
+ user_id ='" .
$this->account
+ . "' WHERE location_code= '" .
$gab['location_code'] ."' and gab_id= '" . $gab['gab_id']
."'",__LINE__,__FILE__);
+
+ $receipt['message'][] = array('msg'=>lang('gab
%1 has been edited',"'".$gab['gab_id']."'"));
+ $receipt['message'][] = array('msg'=>lang('at
location %1',$gab['location_code']));
+ }
+ else
+ {
+ $receipt['error'][] =
array('msg'=>lang('Nothing to do !'));
+ }
+ $receipt['gab_id'] = $gab['gab_id'];
+ return $receipt;
+
+ }
+
+ function delete($gab_id='',$location_code='')
+ {
+ $this->db->query("DELETE FROM fm_gab_location WHERE
gab_id='$gab_id' and location_code='$location_code'",__LINE__,__FILE__);
+ }
+ }
+?>
Index: property/inc/class.uiXport.inc.php
diff -u property/inc/class.uiXport.inc.php:1.15
property/inc/class.uiXport.inc.php:1.16
--- property/inc/class.uiXport.inc.php:1.15 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uiXport.inc.php Fri Feb 3 12:05:49 2006
@@ -1,697 +1,697 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uiXport.inc.php,v 1.15 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uiXport
- {
- var $public_functions = array(
- 'import' => True,
- 'export' => True,
- 'rollback' => True
- );
-
- var $start;
- var $limit;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $cat_id;
-
- function uiXport()
- {
-
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->bo =
CreateObject($this->currentapp.'.boXport',True);
- $this->invoice =
CreateObject($this->currentapp.'.boinvoice');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
- $this->contacts =
CreateObject($this->currentapp.'.soactor');
- $this->contacts->role = 'vendor';
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.invoice';
- $this->acl_read =
$this->acl2->check('.invoice',1);
- $this->acl_add =
$this->acl2->check('.invoice',2);
- $this->acl_edit =
$this->acl2->check('.invoice',4);
- $this->acl_delete =
$this->acl2->check('.invoice',8);
- $this->acl_manage =
$this->acl2->check('.invoice',16);
-
- $this->start = $this->bo->start;
- $this->limit = $this->bo->limit;
- $this->query = $this->bo->query;
- $this->sort = $this->bo->sort;
- $this->order = $this->bo->order;
- $this->filter = $this->bo->filter;
- $this->cat_id = $this->bo->cat_id;
- $this->menu->sub ='invoice';
- }
-
- function import()
- {
- if(!$this->acl_add)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt');
-
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt','');
-
- $art =
get_var('art',array('POST','GET'));
- $type =
get_var('type',array('POST','GET'));
- $dim_b =
get_var('dim_b',array('POST','GET'));
- $invoice_num =
get_var('invoice_num',array('POST','GET'));
- $kid_nr =
get_var('kid_nr',array('POST','GET'));
- $vendor_id =
get_var('vendor_id',array('POST','GET'));
- $vendor_name =
get_var('vendor_name',array('POST','GET'));
- $janitor =
get_var('janitor',array('POST','GET'));
- $supervisor =
get_var('supervisor',array('POST','GET'));
- $budget_responsible =
get_var('budget_responsible',array('POST','GET'));
- $invoice_date =
urldecode(get_var('invoice_date',array('POST','GET')));
- $num_days =
get_var('num_days',array('POST','GET'));
- $payment_date =
urldecode(get_var('payment_date',array('POST','GET')));
- $cancel =
get_var('cancel',array('POST','GET'));
- $convert =
get_var('convert',array('POST','GET'));
- $conv_type =
get_var('conv_type',array('POST','GET'));
- $sday =
get_var('sday',array('POST','GET'));
- $smonth =
get_var('smonth',array('POST','GET'));
- $syear =
get_var('syear',array('POST','GET'));
- $eday =
get_var('eday',array('POST','GET'));
- $emonth =
get_var('emonth',array('POST','GET'));
- $eyear =
get_var('eyear',array('POST','GET'));
- $download =
get_var('download',array('POST','GET'));
- $auto_tax =
get_var('auto_tax',array('POST','GET'));
-
- $tsvfile = $_FILES['tsvfile']['tmp_name'];
-
- if(!$tsvfile)
- {
- $tsvfile =
get_var('tsvfile',array('POST','GET'));
- }
-
- $links = $this->menu->links('import_inv');
-
- if ($cancel && $tsvfile)
- {
- unlink ($tsvfile);
- }
-
- if ($convert)
- {
- unset($receipt);
-
- if ($conv_type=='')
- {
- $receipt['error'][] =
array('msg'=>lang('Please - select a import format !'));
- }
-
- if (!$tsvfile)
- {
- $receipt['error'][] =
array('msg'=>lang('Please - select a file to import from !'));
- }
-
- if (!$art)
- {
- $receipt['error'][] =
array('msg'=>lang('Please - select type invoice!'));
- }
- if (!$vendor_id)
- {
- $receipt['error'][] =
array('msg'=>lang('Please - select Vendor!'));
- }
-
- if (!$type)
- {
- $receipt['error'][] =
array('msg'=>lang('Please - select type order!'));
- }
-
- if (!$budget_responsible)
- {
- $receipt['error'][] =
array('msg'=>lang('Please - select budget responsible!'));
- }
-
- if (!$this->invoice->check_vendor($vendor_id))
- {
- $receipt['error'][] =
array('msg'=>lang('That Vendor ID is not valid !'). ' : ' . $vendor_id);
- }
-
- if (!$payment_date && !$num_days)
- {
- $receipt['error'][] =
array('msg'=>lang('Please - select either payment date or number of days from
invoice date !'));
- }
-
- if (!file_exists($tsvfile))
- {
- $receipt['error'][] =
array('msg'=>lang('The file is empty or removed!'));
- }
- if (!is_array($receipt['error']))
- {
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $dateformat =
str_replace(".","",$dateformat);
- $dateformat =
str_replace("-","",$dateformat);
- $dateformat =
str_replace("/","",$dateformat);
- $y=strpos($dateformat,'y');
- $d=strpos($dateformat,'d');
- $m=strpos($dateformat,'m');
-
- if($invoice_date)
- {
- $dateparts = explode('/',
$invoice_date);
- $sday = $dateparts[$d];
- $smonth = $dateparts[$m];
- $syear = $dateparts[$y];
-
- $dateparts = explode('/',
$payment_date);
- $eday = $dateparts[$d];
- $emonth = $dateparts[$m];
- $eyear = $dateparts[$y];
- }
-
- $old = $tsvfile;
- $tsvfile =
$GLOBALS['phpgw_info']['server']['temp_dir'].'/invoice_import_'.basename($tsvfile);
- rename($old,$tsvfile);
-
- $invoice_common=array(
- 'bilagsnr'
=> $this->invoice->next_bilagsnr(),
- 'art'
=> $art,
- 'type'
=> $type,
- 'dim_b'
=> $dim_b,
- 'invoice_num'
=> $invoice_num,
- 'kid_nr'
=> $kid_nr,
- 'vendor_id'
=> $vendor_id,
- 'vendor_name'
=> $vendor_name,
- 'janitor'
=> $janitor,
- 'supervisor'
=> $supervisor,
-
'budget_responsible' => $budget_responsible,
- 'num_days'
=> $num_days,
- 'sday'
=> $sday,
- 'smonth'
=> $smonth,
- 'syear'
=> $syear,
- 'eday'
=> $eday,
- 'emonth'
=> $emonth,
- 'eyear'
=> $eyear,
- 'tsvfile'
=> $tsvfile,
- 'conv_type'
=> $conv_type,
- 'invoice_date'
=> $invoice_date,
- 'payment_date'
=> $payment_date,
- 'auto_tax'
=> $auto_tax
- );
-
- $buffer =
$this->bo->import($invoice_common,$download);
-
- if(!$download)
- {
- $receipt = $buffer;
-
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt',$receipt);
- unlink ($tsvfile);
- unset($invoice_common);
- unset($art);
- unset($type);
- unset($dim_b);
- unset($invoice_num);
- unset($kid_nr);
- unset($vendor_id);
- unset($vendor_name);
- unset($janitor);
- unset($supervisor);
- unset($budget_responsible);
- unset($invoice_date);
- unset($num_days);
- unset($payment_date);
- unset($conv_type);
- unset($auto_tax);
-//
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiXport.import');
- }
- else
- {
-
$this->debug_import($buffer,$invoice_common);
- return;
- }
- }
- }
-
-
- set_time_limit(0);
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiXport.import',
- 'sub' => $sub
- );
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup_invoice'
=> "Calendar.setup({inputField : 'invoice_date',ifFormat : '" . $jsDateFormat
. "',button : 'invoice_date-trigger'});",
- 'calendar_setup_payment'
=> "Calendar.setup({inputField : 'payment_date',ifFormat : '" . $jsDateFormat
. "',button : 'payment_date-trigger'});",
-
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'cancel_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvoice.index&sub='.$sub),
- 'lang_cancel'
=> lang('Cancel'),
- 'lang_cancel_statustext' =>
lang('cancel the import'),
- 'action_url'
=> $GLOBALS['phpgw']->link('/index.php','menuaction='. $this->currentapp
.'.uiXport.import'),
- 'tsvfilename'
=> '',
-
- 'lang_debug'
=> lang('Debug output in browser'),
- 'lang_debug_statustext' =>
lang('Check this to have the output to screen before import (recommended)'),
- 'value_debug'
=> $download,
-
- 'lang_import'
=> lang('Import'),
- 'lang_import_statustext' =>
lang('Klick this button to start the import'),
-
- 'lang_invoice_date'
=> lang('invoice date'),
- 'lang_payment_date'
=> lang('Payment date'),
- 'lang_no_of_days'
=> lang('Days'),
- 'lang_invoice_number' =>
lang('Invoice Number'),
- 'lang_invoice_num_statustext' => lang('Enter
Invoice Number'),
-
-
- 'lang_select'
=> lang('Select per button !'),
- 'lang_kidnr'
=> lang('KID nr'),
- 'lang_kid_nr_statustext' =>
lang('Enter Kid nr'),
-
-
- 'lang_vendor'
=> lang('Vendor'),
- 'addressbook_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor'),
-
- 'lang_invoice_date_statustext' => lang('Enter
the invoice date'),
- 'lang_num_days_statustext' =>
lang('Enter the payment date or the payment delay'),
- 'lang_payment_date_statustext' => lang('Enter
the payment date or the payment delay'),
- 'lang_file_statustext' =>
lang('Select the file to import from'),
- 'lang_vendor_statustext'
=> lang('Select the vendor by klicking the button'),
- 'lang_vendor_name_statustext' => lang('Select
the vendor by klicking the button'),
- 'lang_select_vendor_statustext' => lang('Select
the vendor by klicking this button'),
-
-
- 'value_invoice_date' =>
$invoice_date,
- 'value_payment_date' =>
$payment_date,
- 'value_belop'
=> $belop,
- 'value_vendor_id'
=> $vendor_id,
- 'value_vendor_name'
=> $vendor_name,
- 'value_kid_nr'
=> $kid_nr,
- 'value_dim_b'
=> $dim_b,
- 'value_invoice_num'
=> $invoice_num,
- 'value_merknad'
=> $merknad,
- 'value_num_days'
=> $num_days,
-// 'value_tsvfile'
=> $tsvfile,
-
- 'lang_file'
=> lang('File'),
- 'lang_conv'
=> lang('Conversion'),
- 'conv_list'
=> $this->bo->select_import_conv($conv_type),
- 'select_conv'
=> 'conv_type',
- 'lang_select_conversion' =>
lang('Select the type of conversion:'),
- 'lang_conv_statustext' =>
lang('You have to select the Conversion for this import'),
-
- 'lang_auto_tax'
=> lang('Auto TAX'),
- 'lang_auto_tax_statustext' =>
lang('Set tax during import'),
-
- 'lang_art'
=> lang('Art'),
- 'art_list'
=> $this->invoice->get_lisfm_ecoart($art),
- 'select_art'
=> 'art',
- 'lang_select_art'
=> lang('Select Invoice Type'),
- 'lang_art_statustext' =>
lang('You have to select type of invoice'),
-
- 'lang_type'
=> lang('Type invoice II'),
- 'type_list'
=> $this->invoice->get_type_list($type),
- 'select_type'
=> 'type',
- 'lang_no_type'
=> lang('No type'),
- 'lang_type_statustext' =>
lang('Select the type invoice. To do not use type - select NO TYPE'),
-
- 'lang_dimb'
=> lang('Dim B'),
- 'dimb_list'
=> $this->invoice->select_dimb_list($dim_b),
- 'select_dimb'
=> 'dim_b',
- 'lang_no_dimb'
=> lang('No Dim B'),
- 'lang_dimb_statustext' =>
lang('Select the Dim B for this invoice. To do not use Dim B - select NO DIM
B'),
-
- 'lang_janitor'
=> lang('Janitor'),
- 'janitor_list'
=> $this->bocommon->get_user_list_right(32,$janitor,'.invoice'),
- 'select_janitor'
=> 'janitor',
- 'lang_no_janitor'
=> lang('No janitor'),
- 'lang_janitor_statustext' =>
lang('Select the janitor responsible for this invoice. To do not use janitor -
select NO JANITOR'),
-
- 'lang_supervisor'
=> lang('Supervisor'),
- 'supervisor_list'
=> $this->bocommon->get_user_list_right(64,$supervisor,'.invoice'),
- 'select_supervisor'
=> 'supervisor',
- 'lang_no_supervisor' =>
lang('No supervisor'),
- 'lang_supervisor_statustext' =>
lang('Select the supervisor responsible for this invoice. To do not use
supervisor - select NO SUPERVISOR'),
-
- 'lang_budget_responsible' =>
lang('B - responsible'),
- 'budget_responsible_list' =>
$this->bocommon->get_user_list_right(128,$budget_responsible,'.invoice'),
- 'select_budget_responsible' =>
'budget_responsible',
- 'lang_select_budget_responsible'=> lang('Select
B-Responsible'),
- 'lang_budget_responsible_statustext'
=> lang('You have to select a budget responsible for this invoice in order to
make the import')
- );
-
-//_debug_array($data);
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','menu'));
-
- $appname
= lang('Invoice');
- $function_msg =
lang('Import from CSV');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('import' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function debug_import($buffer='',$invoice_common='')
- {
- $table = $buffer['table'];
- $header = $buffer['header'];
- $import = $buffer['import'];
-
- $sum=0;
-
- $import_count = count($import);
- $table_count = count($table)+1;
- for ($i=1; $i<$table_count; $i++)
- {
- for ($k=0; $k<$import_count; $k++)
- {
- $content[$i]['row'][$k]['value']
= $table[$i][$import[$header[$k]]];
- if ($import[$header[$k]]=='belop')
- {
-
$content[$i]['row'][$k]['align'] = 'right';
-
$sum=$sum+$table[$i][$import[$header[$k]]];
-
$content[$i]['row'][$k]['value'] =
number_format($table[$i][$import[$header[$k]]], 2, ',', '');
- }
- }
- }
-
- for ($k=0; $k<count($header); $k++)
- {
- $table_header[$k]['header'] = $header[$k];
- $table_header[$k]['width'] = '5%';
- $table_header[$k]['align'] =
'center';
- }
-
-
- $link_data_add = array
- (
- 'menuaction' =>
$this->currentapp.'.uiXport.import',
- 'convert' => 'true'
- );
-
- $link_data_cancel = array
- (
- 'menuaction' =>
$this->currentapp.'.uiXport.import',
- 'cancel' => True
-
- );
-
- $link_data_add = $link_data_add +
$invoice_common;
- $link_data_cancel = $link_data_cancel
+ $invoice_common;
-
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('Import'),
- 'lang_add_statustext' => lang('Import this
invoice'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_add),
- 'lang_cancel' =>
lang('cancel'),
- 'lang_cancel_statustext'=> lang('Do not import
this invoice'),
- 'cancel_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_cancel)
-
- );
-
- $vendor =
$this->contacts->read_single(array('actor_id'=>$table[1]['spvend_code']));
- if(is_array($vendor))
- {
- foreach($vendor['attributes'] as $attribute)
- {
- if($attribute['name']=='org_name')
- {
-
$vendor_name=$attribute['value'];
- break;
- }
- }
- }
-
- $data = array
- (
- 'artid'
=> $table[1]['artid'],
- 'lang_type'
=> lang('Type'),
- 'artid'
=> $table[1]['artid'],
- 'lang_bilagsnr'
=> lang('bilagsnr'),
- 'bilagsnr'
=> $table[1]['bilagsnr'],
- 'lang_vendor'
=> lang('Vendor'),
- 'vendor_name'
=> $vendor_name,
- 'spvend_code'
=> $table[1]['spvend_code'],
- 'lang_fakturadato'
=> lang('invoice date'),
- 'fakturadato'
=> $table[1]['fakturadato'],
- 'lang_forfallsdato'
=> lang('Payment date'),
- 'forfallsdato'
=> $table[1]['forfallsdato'],
- 'lang_janitor'
=> lang('Janitor'),
- 'oppsynsmannid'
=> $table[1]['oppsynsmannid'],
- 'lang_supervisor'
=> lang('Supervisor'),
- 'saksbehandlerid'
=> $table[1]['saksbehandlerid'],
- 'lang_budget_responsible' =>
lang('Budget Responsible'),
- 'budsjettansvarligid' =>
$table[1]['budsjettansvarligid'],
- 'lang_sum'
=> lang('Sum'),
- 'sum'
=> number_format($sum, 2, ',', ''),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- unset($content);
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','table_header'));
- $appname
= lang('Invoice');
- $function_msg =
lang('Debug');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('debug' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function export()
- {
- if(!$this->acl_manage)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','menu',
-
'search_field'));
-
- $values = get_var('values',array('POST','GET'));
- $date = get_var('date',array('POST','GET'));
-
- $links = $this->menu->links('export_inv');
-
- if($values['submit'])
- {
- if (!$values['conv_type'] && !$values['file'] ):
- {
-
- $receipt['error'][] = array('msg'=>
lang('No conversion type could be located.') . ' - ' . lang('Please choose a
conversion type from the list'));
- }
- elseif($values['conv_type'] &&
!$values['file']):
- {
- $receipt =
$this->bo->export(array('conv_type'=>$values['conv_type'],'download'=>$values['download'],'force_period_year'=>$values['force_period_year']));
- if(!$values['download'])
- {
-
$GLOBALS['phpgw_info']['flags'][noheader] = True;
-
$GLOBALS['phpgw_info']['flags'][nofooter] = True;
-
$GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
-
$GLOBALS['phpgw_info']['flags']['noframework'] = True;
- echo '<pre>' .
$receipt['message'][0]['msg'] . '</pre>';
- echo ' <a
href="'.$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiXport.export')
. '">' . lang('Back') . '</a>';
- }
- }
- endif;
- }
- else
- {
- $date =
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
-//_debug_array($receipt);
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiXport.export',
- 'invoice_id' => $invoice_id,
- 'sub' => $sub);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $force_period_year= array(
- 'id' => date(Y) -1
- );
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'force_period_year'
=> $force_period_year,
- 'lang_force_period_year' =>
lang('Force year for period'),
- 'lang_force_period_year_statustext'
=> lang('Force year for period'),
- 'lang_select_year'
=> lang('select year'),
- 'links'
=> $links,
- 'lang_select_conv'
=> lang('Select conversion'),
- 'conv_list'
=> $this->bo->select_export_conv($values['conv_type']),
- 'select_conv'
=> 'values[conv_type]',
- 'lang_conv_statustext' =>
lang('Select conversion'),
-
- 'lang_rollback_file' =>
lang('Roll back'),
- 'link_rollback_file' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiXport.rollback'),
-
- 'lang_export_to_file' =>
lang('Export to file'),
- 'value_debug'
=> $values['debug'],
- 'lang_debug_statustext' =>
lang('Uncheck to debug the result'),
-
- 'lang_submit'
=> lang('Submit'),
- 'lang_cancel'
=> lang('Cancel'),
-
- 'message'
=> $message,
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_save'
=> lang('save')
- );
-
-//_debug_array($data);
- $appname
= lang('Invoice');
- $function_msg =
lang('Export invoice');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('export' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function rollback()
- {
- if(!$this->acl_manage)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','menu',
-
'search_field'));
-
- $values = get_var('values',array('POST','GET'));
- $date = get_var('date',array('POST','GET'));
-//_debug_array($values);
-
- $links = $this->menu->links('export_inv');
-
- if($values['submit'])
- {
- if (!$values['conv_type'])
- {
- $receipt['error'][] = array('msg'=>
lang('No conversion type could be located.') .' - ' . lang('Please choose a
conversion type from the list'));
- }
-
- if(!$values['file'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please choose a file'));
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->rollback($values['conv_type'],$values['file'],$date);
- }
- }
- else
- {
- $date =
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
-
- $link_data = array('menuaction' =>
$this->currentapp.'.uiXport.rollback');
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
-//_debug_array($receipt);
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup'
=> "Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
-
- 'lang_select_conv'
=> lang('Select conversion'),
- 'conv_list'
=> $this->bo->select_export_conv($values['conv_type']),
- 'select_conv'
=> 'values[conv_type]',
- 'lang_conv_statustext' =>
lang('Select conversion'),
-
- 'lang_select_file'
=> lang('Select file to roll back'),
- 'lang_no_file'
=> lang('No file selected'),
- 'lang_file_statustext' =>
lang('Select file to roll back'),
- 'select_file'
=> 'values[file]',
-
- 'rollback_file_list' =>
$this->bo->select_rollback_file($values['file']),
- 'lang_export_to_file' =>
lang('Export to file'),
- 'value_debug'
=> $values['debug'],
-
- 'value_date'
=> $date,
- 'lang_date'
=> lang('Export date'),
- 'lang_date_statustext' =>
lang('Select date for the file to roll back'),
-
- 'lang_submit'
=> lang('Submit'),
- 'lang_cancel'
=> lang('Cancel'),
-
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_save'
=> lang('save')
- );
-
-//_debug_array($data);
-
- $appname
= lang('Invoice');
- $function_msg =
lang('Rollback invoice');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('rollback' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uiXport.inc.php,v 1.16 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uiXport
+ {
+ var $public_functions = array(
+ 'import' => True,
+ 'export' => True,
+ 'rollback' => True
+ );
+
+ var $start;
+ var $limit;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $cat_id;
+
+ function uiXport()
+ {
+
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->bo =
CreateObject($this->currentapp.'.boXport',True);
+ $this->invoice =
CreateObject($this->currentapp.'.boinvoice');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+ $this->contacts =
CreateObject($this->currentapp.'.soactor');
+ $this->contacts->role = 'vendor';
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.invoice';
+ $this->acl_read =
$this->acl2->check('.invoice',1);
+ $this->acl_add =
$this->acl2->check('.invoice',2);
+ $this->acl_edit =
$this->acl2->check('.invoice',4);
+ $this->acl_delete =
$this->acl2->check('.invoice',8);
+ $this->acl_manage =
$this->acl2->check('.invoice',16);
+
+ $this->start = $this->bo->start;
+ $this->limit = $this->bo->limit;
+ $this->query = $this->bo->query;
+ $this->sort = $this->bo->sort;
+ $this->order = $this->bo->order;
+ $this->filter = $this->bo->filter;
+ $this->cat_id = $this->bo->cat_id;
+ $this->menu->sub ='invoice';
+ }
+
+ function import()
+ {
+ if(!$this->acl_add)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt');
+
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt','');
+
+ $art =
get_var('art',array('POST','GET'));
+ $type =
get_var('type',array('POST','GET'));
+ $dim_b =
get_var('dim_b',array('POST','GET'));
+ $invoice_num =
get_var('invoice_num',array('POST','GET'));
+ $kid_nr =
get_var('kid_nr',array('POST','GET'));
+ $vendor_id =
get_var('vendor_id',array('POST','GET'));
+ $vendor_name =
get_var('vendor_name',array('POST','GET'));
+ $janitor =
get_var('janitor',array('POST','GET'));
+ $supervisor =
get_var('supervisor',array('POST','GET'));
+ $budget_responsible =
get_var('budget_responsible',array('POST','GET'));
+ $invoice_date =
urldecode(get_var('invoice_date',array('POST','GET')));
+ $num_days =
get_var('num_days',array('POST','GET'));
+ $payment_date =
urldecode(get_var('payment_date',array('POST','GET')));
+ $cancel =
get_var('cancel',array('POST','GET'));
+ $convert =
get_var('convert',array('POST','GET'));
+ $conv_type =
get_var('conv_type',array('POST','GET'));
+ $sday =
get_var('sday',array('POST','GET'));
+ $smonth =
get_var('smonth',array('POST','GET'));
+ $syear =
get_var('syear',array('POST','GET'));
+ $eday =
get_var('eday',array('POST','GET'));
+ $emonth =
get_var('emonth',array('POST','GET'));
+ $eyear =
get_var('eyear',array('POST','GET'));
+ $download =
get_var('download',array('POST','GET'));
+ $auto_tax =
get_var('auto_tax',array('POST','GET'));
+
+ $tsvfile = $_FILES['tsvfile']['tmp_name'];
+
+ if(!$tsvfile)
+ {
+ $tsvfile =
get_var('tsvfile',array('POST','GET'));
+ }
+
+ $links = $this->menu->links('import_inv');
+
+ if ($cancel && $tsvfile)
+ {
+ unlink ($tsvfile);
+ }
+
+ if ($convert)
+ {
+ unset($receipt);
+
+ if ($conv_type=='')
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please - select a import format !'));
+ }
+
+ if (!$tsvfile)
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please - select a file to import from !'));
+ }
+
+ if (!$art)
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please - select type invoice!'));
+ }
+ if (!$vendor_id)
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please - select Vendor!'));
+ }
+
+ if (!$type)
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please - select type order!'));
+ }
+
+ if (!$budget_responsible)
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please - select budget responsible!'));
+ }
+
+ if (!$this->invoice->check_vendor($vendor_id))
+ {
+ $receipt['error'][] =
array('msg'=>lang('That Vendor ID is not valid !'). ' : ' . $vendor_id);
+ }
+
+ if (!$payment_date && !$num_days)
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please - select either payment date or number of days from
invoice date !'));
+ }
+
+ if (!file_exists($tsvfile))
+ {
+ $receipt['error'][] =
array('msg'=>lang('The file is empty or removed!'));
+ }
+ if (!is_array($receipt['error']))
+ {
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $dateformat =
str_replace(".","",$dateformat);
+ $dateformat =
str_replace("-","",$dateformat);
+ $dateformat =
str_replace("/","",$dateformat);
+ $y=strpos($dateformat,'y');
+ $d=strpos($dateformat,'d');
+ $m=strpos($dateformat,'m');
+
+ if($invoice_date)
+ {
+ $dateparts = explode('/',
$invoice_date);
+ $sday = $dateparts[$d];
+ $smonth = $dateparts[$m];
+ $syear = $dateparts[$y];
+
+ $dateparts = explode('/',
$payment_date);
+ $eday = $dateparts[$d];
+ $emonth = $dateparts[$m];
+ $eyear = $dateparts[$y];
+ }
+
+ $old = $tsvfile;
+ $tsvfile =
$GLOBALS['phpgw_info']['server']['temp_dir'].'/invoice_import_'.basename($tsvfile);
+ rename($old,$tsvfile);
+
+ $invoice_common=array(
+ 'bilagsnr'
=> $this->invoice->next_bilagsnr(),
+ 'art'
=> $art,
+ 'type'
=> $type,
+ 'dim_b'
=> $dim_b,
+ 'invoice_num'
=> $invoice_num,
+ 'kid_nr'
=> $kid_nr,
+ 'vendor_id'
=> $vendor_id,
+ 'vendor_name'
=> $vendor_name,
+ 'janitor'
=> $janitor,
+ 'supervisor'
=> $supervisor,
+
'budget_responsible' => $budget_responsible,
+ 'num_days'
=> $num_days,
+ 'sday'
=> $sday,
+ 'smonth'
=> $smonth,
+ 'syear'
=> $syear,
+ 'eday'
=> $eday,
+ 'emonth'
=> $emonth,
+ 'eyear'
=> $eyear,
+ 'tsvfile'
=> $tsvfile,
+ 'conv_type'
=> $conv_type,
+ 'invoice_date'
=> $invoice_date,
+ 'payment_date'
=> $payment_date,
+ 'auto_tax'
=> $auto_tax
+ );
+
+ $buffer =
$this->bo->import($invoice_common,$download);
+
+ if(!$download)
+ {
+ $receipt = $buffer;
+
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt',$receipt);
+ unlink ($tsvfile);
+ unset($invoice_common);
+ unset($art);
+ unset($type);
+ unset($dim_b);
+ unset($invoice_num);
+ unset($kid_nr);
+ unset($vendor_id);
+ unset($vendor_name);
+ unset($janitor);
+ unset($supervisor);
+ unset($budget_responsible);
+ unset($invoice_date);
+ unset($num_days);
+ unset($payment_date);
+ unset($conv_type);
+ unset($auto_tax);
+//
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiXport.import');
+ }
+ else
+ {
+
$this->debug_import($buffer,$invoice_common);
+ return;
+ }
+ }
+ }
+
+
+ set_time_limit(0);
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiXport.import',
+ 'sub' => $sub
+ );
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup_invoice'
=> "Calendar.setup({inputField : 'invoice_date',ifFormat : '" . $jsDateFormat
. "',button : 'invoice_date-trigger'});",
+ 'calendar_setup_payment'
=> "Calendar.setup({inputField : 'payment_date',ifFormat : '" . $jsDateFormat
. "',button : 'payment_date-trigger'});",
+
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'cancel_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvoice.index&sub='.$sub),
+ 'lang_cancel'
=> lang('Cancel'),
+ 'lang_cancel_statustext' =>
lang('cancel the import'),
+ 'action_url'
=> $GLOBALS['phpgw']->link('/index.php','menuaction='. $this->currentapp
.'.uiXport.import'),
+ 'tsvfilename'
=> '',
+
+ 'lang_debug'
=> lang('Debug output in browser'),
+ 'lang_debug_statustext' =>
lang('Check this to have the output to screen before import (recommended)'),
+ 'value_debug'
=> $download,
+
+ 'lang_import'
=> lang('Import'),
+ 'lang_import_statustext' =>
lang('Klick this button to start the import'),
+
+ 'lang_invoice_date'
=> lang('invoice date'),
+ 'lang_payment_date'
=> lang('Payment date'),
+ 'lang_no_of_days'
=> lang('Days'),
+ 'lang_invoice_number' =>
lang('Invoice Number'),
+ 'lang_invoice_num_statustext' => lang('Enter
Invoice Number'),
+
+
+ 'lang_select'
=> lang('Select per button !'),
+ 'lang_kidnr'
=> lang('KID nr'),
+ 'lang_kid_nr_statustext' =>
lang('Enter Kid nr'),
+
+
+ 'lang_vendor'
=> lang('Vendor'),
+ 'addressbook_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor'),
+
+ 'lang_invoice_date_statustext' => lang('Enter
the invoice date'),
+ 'lang_num_days_statustext' =>
lang('Enter the payment date or the payment delay'),
+ 'lang_payment_date_statustext' => lang('Enter
the payment date or the payment delay'),
+ 'lang_file_statustext' =>
lang('Select the file to import from'),
+ 'lang_vendor_statustext'
=> lang('Select the vendor by klicking the button'),
+ 'lang_vendor_name_statustext' => lang('Select
the vendor by klicking the button'),
+ 'lang_select_vendor_statustext' => lang('Select
the vendor by klicking this button'),
+
+
+ 'value_invoice_date' =>
$invoice_date,
+ 'value_payment_date' =>
$payment_date,
+ 'value_belop'
=> $belop,
+ 'value_vendor_id'
=> $vendor_id,
+ 'value_vendor_name'
=> $vendor_name,
+ 'value_kid_nr'
=> $kid_nr,
+ 'value_dim_b'
=> $dim_b,
+ 'value_invoice_num'
=> $invoice_num,
+ 'value_merknad'
=> $merknad,
+ 'value_num_days'
=> $num_days,
+// 'value_tsvfile'
=> $tsvfile,
+
+ 'lang_file'
=> lang('File'),
+ 'lang_conv'
=> lang('Conversion'),
+ 'conv_list'
=> $this->bo->select_import_conv($conv_type),
+ 'select_conv'
=> 'conv_type',
+ 'lang_select_conversion' =>
lang('Select the type of conversion:'),
+ 'lang_conv_statustext' =>
lang('You have to select the Conversion for this import'),
+
+ 'lang_auto_tax'
=> lang('Auto TAX'),
+ 'lang_auto_tax_statustext' =>
lang('Set tax during import'),
+
+ 'lang_art'
=> lang('Art'),
+ 'art_list'
=> $this->invoice->get_lisfm_ecoart($art),
+ 'select_art'
=> 'art',
+ 'lang_select_art'
=> lang('Select Invoice Type'),
+ 'lang_art_statustext' =>
lang('You have to select type of invoice'),
+
+ 'lang_type'
=> lang('Type invoice II'),
+ 'type_list'
=> $this->invoice->get_type_list($type),
+ 'select_type'
=> 'type',
+ 'lang_no_type'
=> lang('No type'),
+ 'lang_type_statustext' =>
lang('Select the type invoice. To do not use type - select NO TYPE'),
+
+ 'lang_dimb'
=> lang('Dim B'),
+ 'dimb_list'
=> $this->invoice->select_dimb_list($dim_b),
+ 'select_dimb'
=> 'dim_b',
+ 'lang_no_dimb'
=> lang('No Dim B'),
+ 'lang_dimb_statustext' =>
lang('Select the Dim B for this invoice. To do not use Dim B - select NO DIM
B'),
+
+ 'lang_janitor'
=> lang('Janitor'),
+ 'janitor_list'
=> $this->bocommon->get_user_list_right(32,$janitor,'.invoice'),
+ 'select_janitor'
=> 'janitor',
+ 'lang_no_janitor'
=> lang('No janitor'),
+ 'lang_janitor_statustext' =>
lang('Select the janitor responsible for this invoice. To do not use janitor -
select NO JANITOR'),
+
+ 'lang_supervisor'
=> lang('Supervisor'),
+ 'supervisor_list'
=> $this->bocommon->get_user_list_right(64,$supervisor,'.invoice'),
+ 'select_supervisor'
=> 'supervisor',
+ 'lang_no_supervisor' =>
lang('No supervisor'),
+ 'lang_supervisor_statustext' =>
lang('Select the supervisor responsible for this invoice. To do not use
supervisor - select NO SUPERVISOR'),
+
+ 'lang_budget_responsible' =>
lang('B - responsible'),
+ 'budget_responsible_list' =>
$this->bocommon->get_user_list_right(128,$budget_responsible,'.invoice'),
+ 'select_budget_responsible' =>
'budget_responsible',
+ 'lang_select_budget_responsible'=> lang('Select
B-Responsible'),
+ 'lang_budget_responsible_statustext'
=> lang('You have to select a budget responsible for this invoice in order to
make the import')
+ );
+
+//_debug_array($data);
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','menu'));
+
+ $appname
= lang('Invoice');
+ $function_msg =
lang('Import from CSV');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('import' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function debug_import($buffer='',$invoice_common='')
+ {
+ $table = $buffer['table'];
+ $header = $buffer['header'];
+ $import = $buffer['import'];
+
+ $sum=0;
+
+ $import_count = count($import);
+ $table_count = count($table)+1;
+ for ($i=1; $i<$table_count; $i++)
+ {
+ for ($k=0; $k<$import_count; $k++)
+ {
+ $content[$i]['row'][$k]['value']
= $table[$i][$import[$header[$k]]];
+ if ($import[$header[$k]]=='belop')
+ {
+
$content[$i]['row'][$k]['align'] = 'right';
+
$sum=$sum+$table[$i][$import[$header[$k]]];
+
$content[$i]['row'][$k]['value'] =
number_format($table[$i][$import[$header[$k]]], 2, ',', '');
+ }
+ }
+ }
+
+ for ($k=0; $k<count($header); $k++)
+ {
+ $table_header[$k]['header'] = $header[$k];
+ $table_header[$k]['width'] = '5%';
+ $table_header[$k]['align'] =
'center';
+ }
+
+
+ $link_data_add = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiXport.import',
+ 'convert' => 'true'
+ );
+
+ $link_data_cancel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiXport.import',
+ 'cancel' => True
+
+ );
+
+ $link_data_add = $link_data_add +
$invoice_common;
+ $link_data_cancel = $link_data_cancel
+ $invoice_common;
+
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('Import'),
+ 'lang_add_statustext' => lang('Import this
invoice'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_add),
+ 'lang_cancel' =>
lang('cancel'),
+ 'lang_cancel_statustext'=> lang('Do not import
this invoice'),
+ 'cancel_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_cancel)
+
+ );
+
+ $vendor =
$this->contacts->read_single(array('actor_id'=>$table[1]['spvend_code']));
+ if(is_array($vendor))
+ {
+ foreach($vendor['attributes'] as $attribute)
+ {
+ if($attribute['name']=='org_name')
+ {
+
$vendor_name=$attribute['value'];
+ break;
+ }
+ }
+ }
+
+ $data = array
+ (
+ 'artid'
=> $table[1]['artid'],
+ 'lang_type'
=> lang('Type'),
+ 'artid'
=> $table[1]['artid'],
+ 'lang_bilagsnr'
=> lang('bilagsnr'),
+ 'bilagsnr'
=> $table[1]['bilagsnr'],
+ 'lang_vendor'
=> lang('Vendor'),
+ 'vendor_name'
=> $vendor_name,
+ 'spvend_code'
=> $table[1]['spvend_code'],
+ 'lang_fakturadato'
=> lang('invoice date'),
+ 'fakturadato'
=> $table[1]['fakturadato'],
+ 'lang_forfallsdato'
=> lang('Payment date'),
+ 'forfallsdato'
=> $table[1]['forfallsdato'],
+ 'lang_janitor'
=> lang('Janitor'),
+ 'oppsynsmannid'
=> $table[1]['oppsynsmannid'],
+ 'lang_supervisor'
=> lang('Supervisor'),
+ 'saksbehandlerid'
=> $table[1]['saksbehandlerid'],
+ 'lang_budget_responsible' =>
lang('Budget Responsible'),
+ 'budsjettansvarligid' =>
$table[1]['budsjettansvarligid'],
+ 'lang_sum'
=> lang('Sum'),
+ 'sum'
=> number_format($sum, 2, ',', ''),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ unset($content);
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','table_header'));
+ $appname
= lang('Invoice');
+ $function_msg =
lang('Debug');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('debug' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function export()
+ {
+ if(!$this->acl_manage)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','menu',
+
'search_field'));
+
+ $values = get_var('values',array('POST','GET'));
+ $date = get_var('date',array('POST','GET'));
+
+ $links = $this->menu->links('export_inv');
+
+ if($values['submit'])
+ {
+ if (!$values['conv_type'] && !$values['file'] ):
+ {
+
+ $receipt['error'][] = array('msg'=>
lang('No conversion type could be located.') . ' - ' . lang('Please choose a
conversion type from the list'));
+ }
+ elseif($values['conv_type'] &&
!$values['file']):
+ {
+ $receipt =
$this->bo->export(array('conv_type'=>$values['conv_type'],'download'=>$values['download'],'force_period_year'=>$values['force_period_year']));
+ if(!$values['download'])
+ {
+
$GLOBALS['phpgw_info']['flags'][noheader] = True;
+
$GLOBALS['phpgw_info']['flags'][nofooter] = True;
+
$GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
+
$GLOBALS['phpgw_info']['flags']['noframework'] = True;
+ echo '<pre>' .
$receipt['message'][0]['msg'] . '</pre>';
+ echo ' <a
href="'.$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiXport.export')
. '">' . lang('Back') . '</a>';
+ }
+ }
+ endif;
+ }
+ else
+ {
+ $date =
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+//_debug_array($receipt);
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiXport.export',
+ 'invoice_id' => $invoice_id,
+ 'sub' => $sub);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $force_period_year= array(
+ 'id' => date(Y) -1
+ );
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'force_period_year'
=> $force_period_year,
+ 'lang_force_period_year' =>
lang('Force year for period'),
+ 'lang_force_period_year_statustext'
=> lang('Force year for period'),
+ 'lang_select_year'
=> lang('select year'),
+ 'links'
=> $links,
+ 'lang_select_conv'
=> lang('Select conversion'),
+ 'conv_list'
=> $this->bo->select_export_conv($values['conv_type']),
+ 'select_conv'
=> 'values[conv_type]',
+ 'lang_conv_statustext' =>
lang('Select conversion'),
+
+ 'lang_rollback_file' =>
lang('Roll back'),
+ 'link_rollback_file' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiXport.rollback'),
+
+ 'lang_export_to_file' =>
lang('Export to file'),
+ 'value_debug'
=> $values['debug'],
+ 'lang_debug_statustext' =>
lang('Uncheck to debug the result'),
+
+ 'lang_submit'
=> lang('Submit'),
+ 'lang_cancel'
=> lang('Cancel'),
+
+ 'message'
=> $message,
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_save'
=> lang('save')
+ );
+
+//_debug_array($data);
+ $appname
= lang('Invoice');
+ $function_msg =
lang('Export invoice');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('export' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function rollback()
+ {
+ if(!$this->acl_manage)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','menu',
+
'search_field'));
+
+ $values = get_var('values',array('POST','GET'));
+ $date = get_var('date',array('POST','GET'));
+//_debug_array($values);
+
+ $links = $this->menu->links('export_inv');
+
+ if($values['submit'])
+ {
+ if (!$values['conv_type'])
+ {
+ $receipt['error'][] = array('msg'=>
lang('No conversion type could be located.') .' - ' . lang('Please choose a
conversion type from the list'));
+ }
+
+ if(!$values['file'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please choose a file'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->rollback($values['conv_type'],$values['file'],$date);
+ }
+ }
+ else
+ {
+ $date =
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+
+ $link_data = array('menuaction' =>
$this->currentapp.'.uiXport.rollback');
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+//_debug_array($receipt);
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup'
=> "Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+
+ 'lang_select_conv'
=> lang('Select conversion'),
+ 'conv_list'
=> $this->bo->select_export_conv($values['conv_type']),
+ 'select_conv'
=> 'values[conv_type]',
+ 'lang_conv_statustext' =>
lang('Select conversion'),
+
+ 'lang_select_file'
=> lang('Select file to roll back'),
+ 'lang_no_file'
=> lang('No file selected'),
+ 'lang_file_statustext' =>
lang('Select file to roll back'),
+ 'select_file'
=> 'values[file]',
+
+ 'rollback_file_list' =>
$this->bo->select_rollback_file($values['file']),
+ 'lang_export_to_file' =>
lang('Export to file'),
+ 'value_debug'
=> $values['debug'],
+
+ 'value_date'
=> $date,
+ 'lang_date'
=> lang('Export date'),
+ 'lang_date_statustext' =>
lang('Select date for the file to roll back'),
+
+ 'lang_submit'
=> lang('Submit'),
+ 'lang_cancel'
=> lang('Cancel'),
+
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_save'
=> lang('save')
+ );
+
+//_debug_array($data);
+
+ $appname
= lang('Invoice');
+ $function_msg =
lang('Rollback invoice');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('rollback' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uiactor.inc.php
diff -u property/inc/class.uiactor.inc.php:1.12
property/inc/class.uiactor.inc.php:1.13
--- property/inc/class.uiactor.inc.php:1.12 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uiactor.inc.php Fri Feb 3 12:05:49 2006
@@ -1,921 +1,921 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uiactor.inc.php,v 1.12 2006/01/27 14:05:43
sigurdne Exp $
- */
-
-
- /**
- * uiactor class
- *
- * uiactor is the ui-class for three set of actors, separarated by
their roles:
- * - Tenant
- * - Vendor
- * - Owner
- * @package property
- */
-
- class uiactor
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'list_attribute'=> True,
- 'edit_attrib' => True,
- 'columns' => True
- );
-
- function uiactor()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.boactor',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->role = $this->bo->role;
-
- $this->cats =
CreateObject('phpgwapi.categories');
- $this->cats->app_name = 'fm_' . $this->role;
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location= '.' . $this->role;
-
- $this->acl_read =
$this->acl2->check($this->acl2_location,1);
- $this->acl_add =
$this->acl2->check($this->acl2_location,2);
- $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
- $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
-
- $this->start = $this->bo->start;
- $this->query = $this->bo->query;
- $this->sort = $this->bo->sort;
- $this->order = $this->bo->order;
- $this->filter = $this->bo->filter;
- $this->cat_id = $this->bo->cat_id;
- $this->allrows = $this->bo->allrows;
- $this->member_id = $this->bo->member_id;
-
- $valid_role = array(
- 'tenant'=>True,
- 'owner' =>True,
- 'vendor'=>True
- );
- if(!$valid_role[$this->role])
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.index');
- }
- }
-
- function save_sessiondata()
- {
- $data = 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
- );
- $this->bo->save_sessiondata($data);
- }
-
- function columns()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
-
-
- $GLOBALS['phpgw_info']['flags']['noframework'] = True;
-
- $values =
get_var('values',array('POST','GET'));
-
- if ($values['save'])
- {
-
-
$GLOBALS['phpgw']->preferences->account_id=$this->account;
-
$GLOBALS['phpgw']->preferences->read_repository();
-
$GLOBALS['phpgw']->preferences->add($this->currentapp,'actor_columns_'
.$this->role,$values['columns'],'user');
-
$GLOBALS['phpgw']->preferences->save_repository();
-
- $receipt['message'][] = array('msg' =>
lang('columns is updated'));
- }
-
- $function_msg = lang('Select Column');
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiactor.columns',
- 'role' => $this->role
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'column_list' =>
$this->bo->column_list($values['columns'],$allrows=True),
- 'function_msg' => $function_msg,
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_columns' => lang('columns'),
- 'lang_none' => lang('None'),
- 'lang_save' => lang('save'),
- 'select_name' => 'period'
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
$function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
-
- function index()
- {
- $menu_sub = array(
- 'tenant'=>'invoice',
- 'owner' =>'admin',
- 'vendor'=>'invoice'
- );
-
- $this->menu->sub = $menu_sub[$this->role];
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('actor',
-
'menu',
-
'receipt',
-
'search_field',
-
'nextmatchs',
-
'filter_member_of'));
-
- $links = $this->menu->links($this->role);
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data',$this->role . '_receipt');
-
$GLOBALS['phpgw']->session->appsession('session_data',$this->role .
'_receipt','');
-
- $list = $this->bo->read();
-
- $uicols = $this->bo->uicols;
-
- $j=0;
-
- if (isset($list) AND is_array($list))
- {
- foreach($list as $entry)
- {
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
- }
- }
-
- if($this->acl_read)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
- $content[$j]['row'][$i]['text']
= lang('view');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.view&actor_id='
. $entry['id'] .'&role=' . $this->role);
- }
- if($this->acl_edit)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('edit the
actor');
- $content[$j]['row'][$i]['text']
= lang('edit');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.edit&actor_id='
. $entry['id'] .'&role=' . $this->role);
- }
- if($this->acl_delete)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('delete the
actor');
- $content[$j]['row'][$i]['text']
= lang('delete');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.delete&actor_id='
. $entry['id'] .'&role=' . $this->role);
- }
-
- $j++;
- }
- }
-
-//html_print_r($content);
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['datatype'][$i]!='T' &&
$uicols['datatype'][$i]!='CH')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
- (
- 'sort' =>
$this->sort,
- 'var' =>
$uicols['name'][$i],
- 'order' =>
$this->order,
- 'extra'
=> array('menuaction' => $this->currentapp.'.uiactor.index',
-
'query' =>$this->query,
-
'lookup' =>$lookup,
-
'district_id' => $this->district_id,
-
'start_date' => $start_date,
-
'role' => $this->role,
-
'member_id' => $this->member_id,
-
'end_date'=>$end_date)
- ));
- }
- }
- }
-
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
-
- if($this->acl_add)
- {
- $table_add = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
actor'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.edit&role='
. $this->role)
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiactor.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'role' =>
$this->role,
- 'member_id' =>
$this->member_id
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $link_columns = array
- (
- 'menuaction' =>
$this->currentapp.'.uiactor.columns',
- 'role' =>
$this->role
- );
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True, 'link_data' =>$link_data));
-
- $data = array
- (
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
- 'lang_columns'
=> lang('columns'),
- 'link_columns'
=> $GLOBALS['phpgw']->link('/index.php',$link_columns),
- 'lang_columns_help'
=> lang('Choose columns'),
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
- 'allow_allrows'
=> false,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the actor belongs to. To do not use a category select
NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_no_member'
=> lang('no member'),
- 'member_of_name'
=> 'member_id',
- 'member_of_list'
=> $member_of_data['cat_list'],
-
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
- $this->save_sessiondata();
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('actor') . ': ' . lang('list ' . $this->role);
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function edit()
- {
- $actor_id =
get_var('actor_id',array('POST','GET'));
- $values = get_var('values',array('POST'));
- $values_attribute =
get_var('values_attribute',array('POST'));
-
- $insert_record_actor =
$GLOBALS['phpgw']->session->appsession('insert_record_actor',$this->currentapp);
-
-//_debug_array($insert_record_actor);
- for ($j=0;$j<count($insert_record_actor);$j++)
- {
-
$insert_record['extra'][$insert_record_actor[$j]] =
$insert_record_actor[$j];
- }
-
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('actor','attributes_form'));
-
- if (is_array($values))
- {
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
-//_debug_array($values);
-
- if ($values['save'] || $values['apply'])
- {
-
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- }
-
- if(!$values['last_name'])
- {
-//
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
- }
-
- if(!$receipt['error'])
- {
- $values['actor_id'] =
$actor_id;
- $receipt =
$this->bo->save($values,$values_attribute);
- $actor_id =
$receipt['actor_id'];
- $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','actor_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiactor.index&role='
. $this->role);
- }
- }
- }
- else
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiactor.index&role='
. $this->role);
- }
- }
-
-
- $actor =
$this->bo->read_single(array('actor_id'=>$actor_id));
-
- if ($actor_id)
- {
- $this->cat_id =
($actor['cat_id']?$actor['cat_id']:$this->cat_id);
- $this->member_id =
($actor['member_of']?$actor['member_of']:$this->member_id);
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiactor.edit',
- 'actor_id' => $actor_id,
- 'role' => $this->role
- );
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- switch(substr($dateformat,0,1))
- {
- case 'M':
- $dateformat_validate=
"javascript:vDateType='1'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
- $onBlur =
"DateFormat(this,this.value,event,true,'1')";
- break;
- case 'y':
-
$dateformat_validate="javascript:vDateType='2'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
- $onBlur =
"DateFormat(this,this.value,event,true,'2')";
- break;
- case 'D':
-
$dateformat_validate="javascript:vDateType='3'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
- $onBlur =
"DateFormat(this,this.value,event,true,'3')";
- break;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True, 'link_data' =>array()));
-
-//_debug_array($member_of_data);
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_actor_id'
=> lang($this->role) . ' ID',
- 'value_actor_id'
=> $actor_id,
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'value_cat'
=> $actor['cat'],
- 'lang_id_statustext' =>
lang('Choose an ID'),
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the actor untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the actor and return back to the list'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the actor belongs to. To do not use a category select
NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
-
- 'lang_member_of'
=> lang('member of'),
- 'member_of_name'
=> 'member_id',
- 'member_of_list'
=> $member_of_data['cat_list'],
-
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp'
=> $onKeyUp,
- 'onBlur'
=> $onBlur,
- 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
- 'lang_attributes'
=> lang('Attributes'),
- 'attributes_header'
=> $attributes_header,
- 'attributes_values'
=> $actor['attributes'],
- 'lookup_functions'
=> $actor['lookup_functions'],
- 'dateformat'
=> $dateformat,
- );
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('actor') . ': ' . ($actor_id?lang('edit') . ' ' .
lang($this->role):lang('add') . ' ' . lang($this->role));
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function delete()
- {
- $attrib = get_var('attrib',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $actor_id =
get_var('actor_id',array('POST','GET'));
- $delete = get_var('delete',array('POST'));
- $confirm = get_var('confirm',array('POST'));
-
-
- if($attrib)
- {
- $function='list_attribute';
- }
- else
- {
- $function='index';
- }
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiactor.'.$function,
- 'role' => $this->role
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($actor_id,$id,$attrib);
-// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
-
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.delete&actor_id='
. $actor_id. '&id=' . $id . '&attrib=' . $attrib . '&role=' . $this->role),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('actor');
- $function_msg =
lang('delete') . ' ' . lang($this->role);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
-
- function view()
- {
- $actor_id = get_var('actor_id',array('GET'));
- $action = get_var('action',array('GET'));
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('actor') . ': ' . lang('view') . ' ' . lang($this->role);
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('actor','attributes_view'));
-
- $actor =
$this->bo->read_single(array('actor_id'=>$actor_id));
-
- $attributes_values=$actor['attributes'];
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' =>
$actor['member_of'],'globals' => True, 'link_data' =>array()));
-
- $data = array
- (
- 'lang_actor_id' =>
lang($this->role) . ' ID',
- 'value_actor_id' =>
$actor_id,
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.index&role='
. $this->role),
- 'lang_category' =>
lang('category'),
- 'lang_time_created' =>
lang('time created'),
- 'lang_done'
=> lang('done'),
- 'cat_list'
=> $this->bo->select_category_list('',$actor['cat_id']),
- 'lang_member_of' =>
lang('member of'),
- 'member_of_list' =>
$member_of_data['cat_list'],
-
- 'value_date' =>
$GLOBALS['phpgw']->common->show_date($actor['entry_date']),
- 'lang_dateformat' =>
lang(strtolower($dateformat)),
- 'lang_attributes' =>
lang('Attributes'),
- 'attributes_view' =>
$attributes_values,
- 'dateformat' =>
$dateformat
- );
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function list_attribute()
- {
- $id = get_var('id',array('POST','GET'));
- $resort = get_var('resort',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array(
- 'actor',
- 'nextmatchs',
-
'search_field'));
-
- if($resort)
- {
-
$this->bo->resort_attrib(array('resort'=>$resort,'id'=>$id));
- }
-
- $attrib_list = $this->bo->read_attrib();
-
- while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
- {
- $content[] = array
- (
- 'name'
=> $attrib['name'],
- 'type_name'
=> $attrib['type_name'],
- 'datatype'
=> $attrib['datatype'],
- 'column_name'
=> $attrib['column_name'],
- 'input_text'
=> $attrib['input_text'],
- 'sorting'
=> $attrib['attrib_sort'],
- 'search'
=> $attrib['search'],
- 'link_up'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.list_attribute&resort=up&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
- 'link_down'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.list_attribute&resort=down&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.edit_attrib&id='
. $attrib['id'] . '&role=' . $this->role),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.delete&id='
. $attrib['id'].'&attrib=true&role=' . $this->role),
- 'lang_view_attribtext' =>
lang('view the attrib'),
- 'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang('location'),
- 'lang_edit_attribtext' =>
lang('edit the attrib'),
- 'lang_delete_attribtext' =>
lang('delete the attrib'),
- 'text_attribute'
=> lang('Attributes'),
- 'text_up'
=> lang('up'),
- 'text_down'
=> lang('down'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
- //html_print_r($content);
-
- $table_header[] = array
- (
- 'lang_descr' => lang('Descr'),
- 'lang_datatype' => lang('Datatype'),
- 'lang_sorting' => lang('sorting'),
- 'lang_search' => lang('search'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_sorting' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'attrib_sort',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiactor.list_attribute',
-
'allrows'=>$this->allrows,
-
'role' => $this->role)
-
)),
-
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'column_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiactor.list_attribute',
-
'allrows'=>$this->allrows,
-
'role' => $this->role)
-
)),
- 'lang_name' => lang('Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_attribtext' => lang('add a attrib'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.edit_attrib&role='
. $this->role),
- 'lang_done' =>
lang('done'),
- 'lang_done_attribtext' => lang('back to
admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php'),
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiactor.list_attribute',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'query'
=>$this->query,
- 'role' =>
$this->role
-
- );
-
- $data = array
- (
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($attrib_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_attribtext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_attrib' =>
$table_header,
- 'values_attrib'
=> $content,
- 'table_add2'
=> $table_add
- );
-
- $appname
= lang('actor');
- $function_msg =
lang('list attribute') . ': ' . lang($this->role);
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function edit_attrib()
- {
- $id =
get_var('id',array('POST','GET'));
- $values = get_var('values',array('POST'));
- // $GLOBALS['phpgw']->common->msgbox(lang('Altering
ColumnName OR Datatype - deletes your data in this Column'));
- //html_print_r($values);
-
$GLOBALS['phpgw']->xslttpl->add_file(array('actor','choice',));
-
- if ($values['save'])
- {
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- $type_id =
$values['type_id'];
-
- if (!$values['column_name'])
- {
- $receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
- }
-
- if (!$values['input_text'])
- {
- $receipt['error'][] =
array('msg'=>lang('Input text not entered!'));
- }
- if (!$values['statustext'])
- {
- $receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
- }
-
- if (!$values['column_info']['type'])
- {
- $receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
- }
-
-
if(!ctype_digit($values['column_info']['precision']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
-
unset($values['column_info']['precision']);
- }
-
-
if(!ctype_digit($values['column_info']['scale']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
- unset($values['column_info']['scale']);
- }
-
- if (!$values['column_info']['nullable'])
- {
- $receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
- }
-
-
- if (!$receipt['error'])
- {
- $receipt =
$this->bo->save_attrib($values,$action);
-
- if(!$id)
- {
- $id=$receipt['id'];
- }
- }
- else
- {
- $receipt['error'][] = array('msg'
=> lang('Attribute has NOT been saved'));
- }
-
- }
-
- if ($id)
- {
- $values = $this->bo->read_single_attrib($id);
- $function_msg = lang('edit attribute') . ': ' .
lang($this->role);
- $action='edit';
- }
- else
- {
- $function_msg = lang('add attribute') . ': ' .
lang($this->role);
- $action='add';
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiactor.edit_attrib',
- 'id' => $id,
- 'role' => $this->role
-
- );
- //html_print_r($values);
-
- if($values['column_info']['type']=='R' ||
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
- {
- $multiple_choice= True;
- }
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'lang_choice' =>
lang('Choice'),
- 'lang_new_value' =>
lang('New value'),
- 'lang_new_value_statustext' => lang('New
value for mulitple choice'),
- 'multiple_choice' =>
$multiple_choice,
- 'value_choice' =>
$values['choice'],
- 'lang_delete_value' =>
lang('Delete value'),
- 'lang_value' =>
lang('value'),
- 'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
- //'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.list_attribute&type_id='.$type_id
. '&role=' . $this->role),
- 'lang_id'
=> lang('Attribute ID'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
-
- 'lang_column_name'
=> lang('Column name'),
- 'value_column_name'
=> $values['column_name'],
- 'lang_column_name_statustext' => lang('enter
the name for the column'),
-
- 'lang_input_text'
=> lang('input text'),
- 'value_input_text'
=> $values['input_text'],
- 'lang_input_name_statustext' => lang('enter
the input text for records'),
-
- 'lang_id_attribtext' => lang('Enter
the attribute ID'),
- 'lang_entity_statustext' => lang('Select
a actor type'),
-
- 'lang_statustext' =>
lang('Statustext'),
- 'lang_statustext_attribtext'=> lang('Enter a
statustext for the inputfield in forms'),
- 'value_statustext' =>
$values['statustext'],
-
- 'lang_done_attribtext' => lang('Back
to the list'),
- 'lang_save_attribtext' => lang('Save
the attribute'),
-
- 'lang_datatype' =>
lang('Datatype'),
- 'lang_datatype_statustext' => lang('Select
a datatype'),
- 'lang_no_datatype' =>
lang('No datatype'),
- 'datatype_list' =>
$this->bocommon->select_datatype($values['column_info']['type']),
-
- 'lang_precision' =>
lang('Precision'),
- 'lang_precision_statustext' => lang('enter
the record length'),
- 'value_precision' =>
$values['column_info']['precision'],
-
- 'lang_scale' =>
lang('scale'),
- 'lang_scale_statustext' => lang('enter
the scale if type is decimal'),
- 'value_scale' =>
$values['column_info']['scale'],
-
- 'lang_default' =>
lang('default'),
- 'lang_default_statustext' => lang('enter
the default value'),
- 'value_default' =>
$values['column_info']['default'],
-
- 'lang_nullable' =>
lang('Nullable'),
- 'lang_nullable_statustext' => lang('Chose
if this column is nullable'),
- 'lang_select_nullable' => lang('Select
nullable'),
- 'nullable_list' =>
$this->bocommon->select_nullable($values['column_info']['nullable']),
-
- 'value_list' =>
$values['list'],
- 'lang_list'
=> lang('show in list'),
- 'lang_list_statustext' => lang('check
to show this attribute in location list'),
-
- 'value_search' =>
$values['search'],
- 'lang_include_search' =>
lang('Include in search'),
- 'lang_include_search_statustext'=> lang('check
to show this attribute in location list'),
-
-
- );
- //html_print_r($data);
-
- $appname
= lang('actor');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
\ No newline at end of file
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uiactor.inc.php,v 1.13 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+
+ /**
+ * uiactor class
+ *
+ * uiactor is the ui-class for three set of actors, separarated by
their roles:
+ * - Tenant
+ * - Vendor
+ * - Owner
+ * @package property
+ */
+
+ class uiactor
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'list_attribute'=> True,
+ 'edit_attrib' => True,
+ 'columns' => True
+ );
+
+ function uiactor()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.boactor',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->role = $this->bo->role;
+
+ $this->cats =
CreateObject('phpgwapi.categories');
+ $this->cats->app_name = 'fm_' . $this->role;
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location= '.' . $this->role;
+
+ $this->acl_read =
$this->acl2->check($this->acl2_location,1);
+ $this->acl_add =
$this->acl2->check($this->acl2_location,2);
+ $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
+ $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
+
+ $this->start = $this->bo->start;
+ $this->query = $this->bo->query;
+ $this->sort = $this->bo->sort;
+ $this->order = $this->bo->order;
+ $this->filter = $this->bo->filter;
+ $this->cat_id = $this->bo->cat_id;
+ $this->allrows = $this->bo->allrows;
+ $this->member_id = $this->bo->member_id;
+
+ $valid_role = array(
+ 'tenant'=>True,
+ 'owner' =>True,
+ 'vendor'=>True
+ );
+ if(!$valid_role[$this->role])
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.index');
+ }
+ }
+
+ function save_sessiondata()
+ {
+ $data = 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
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function columns()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
+
+
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+
+ $values =
get_var('values',array('POST','GET'));
+
+ if ($values['save'])
+ {
+
+
$GLOBALS['phpgw']->preferences->account_id=$this->account;
+
$GLOBALS['phpgw']->preferences->read_repository();
+
$GLOBALS['phpgw']->preferences->add($this->currentapp,'actor_columns_'
.$this->role,$values['columns'],'user');
+
$GLOBALS['phpgw']->preferences->save_repository();
+
+ $receipt['message'][] = array('msg' =>
lang('columns is updated'));
+ }
+
+ $function_msg = lang('Select Column');
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiactor.columns',
+ 'role' => $this->role
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'column_list' =>
$this->bo->column_list($values['columns'],$allrows=True),
+ 'function_msg' => $function_msg,
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_columns' => lang('columns'),
+ 'lang_none' => lang('None'),
+ 'lang_save' => lang('save'),
+ 'select_name' => 'period'
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
$function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+
+ function index()
+ {
+ $menu_sub = array(
+ 'tenant'=>'invoice',
+ 'owner' =>'admin',
+ 'vendor'=>'invoice'
+ );
+
+ $this->menu->sub = $menu_sub[$this->role];
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('actor',
+
'menu',
+
'receipt',
+
'search_field',
+
'nextmatchs',
+
'filter_member_of'));
+
+ $links = $this->menu->links($this->role);
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('session_data',$this->role . '_receipt');
+
$GLOBALS['phpgw']->session->appsession('session_data',$this->role .
'_receipt','');
+
+ $list = $this->bo->read();
+
+ $uicols = $this->bo->uicols;
+
+ $j=0;
+
+ if (isset($list) AND is_array($list))
+ {
+ foreach($list as $entry)
+ {
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+ }
+ }
+
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
+ $content[$j]['row'][$i]['text']
= lang('view');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.view&actor_id='
. $entry['id'] .'&role=' . $this->role);
+ }
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('edit the
actor');
+ $content[$j]['row'][$i]['text']
= lang('edit');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.edit&actor_id='
. $entry['id'] .'&role=' . $this->role);
+ }
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('delete the
actor');
+ $content[$j]['row'][$i]['text']
= lang('delete');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.delete&actor_id='
. $entry['id'] .'&role=' . $this->role);
+ }
+
+ $j++;
+ }
+ }
+
+//html_print_r($content);
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['datatype'][$i]!='T' &&
$uicols['datatype'][$i]!='CH')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+ (
+ 'sort' =>
$this->sort,
+ 'var' =>
$uicols['name'][$i],
+ 'order' =>
$this->order,
+ 'extra'
=> array('menuaction' => $this->currentapp.'.uiactor.index',
+
'query' =>$this->query,
+
'lookup' =>$lookup,
+
'district_id' => $this->district_id,
+
'start_date' => $start_date,
+
'role' => $this->role,
+
'member_id' => $this->member_id,
+
'end_date'=>$end_date)
+ ));
+ }
+ }
+ }
+
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+
+ if($this->acl_add)
+ {
+ $table_add = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
actor'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.edit&role='
. $this->role)
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiactor.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'role' =>
$this->role,
+ 'member_id' =>
$this->member_id
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $link_columns = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiactor.columns',
+ 'role' =>
$this->role
+ );
+
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True, 'link_data' =>$link_data));
+
+ $data = array
+ (
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+ 'lang_columns'
=> lang('columns'),
+ 'link_columns'
=> $GLOBALS['phpgw']->link('/index.php',$link_columns),
+ 'lang_columns_help'
=> lang('Choose columns'),
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'allow_allrows'
=> false,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the actor belongs to. To do not use a category select
NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_no_member'
=> lang('no member'),
+ 'member_of_name'
=> 'member_id',
+ 'member_of_list'
=> $member_of_data['cat_list'],
+
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+ $this->save_sessiondata();
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('actor') . ': ' . lang('list ' . $this->role);
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function edit()
+ {
+ $actor_id =
get_var('actor_id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+ $values_attribute =
get_var('values_attribute',array('POST'));
+
+ $insert_record_actor =
$GLOBALS['phpgw']->session->appsession('insert_record_actor',$this->currentapp);
+
+//_debug_array($insert_record_actor);
+ for ($j=0;$j<count($insert_record_actor);$j++)
+ {
+
$insert_record['extra'][$insert_record_actor[$j]] =
$insert_record_actor[$j];
+ }
+
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('actor','attributes_form'));
+
+ if (is_array($values))
+ {
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+//_debug_array($values);
+
+ if ($values['save'] || $values['apply'])
+ {
+
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ }
+
+ if(!$values['last_name'])
+ {
+//
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $values['actor_id'] =
$actor_id;
+ $receipt =
$this->bo->save($values,$values_attribute);
+ $actor_id =
$receipt['actor_id'];
+ $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','actor_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiactor.index&role='
. $this->role);
+ }
+ }
+ }
+ else
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiactor.index&role='
. $this->role);
+ }
+ }
+
+
+ $actor =
$this->bo->read_single(array('actor_id'=>$actor_id));
+
+ if ($actor_id)
+ {
+ $this->cat_id =
($actor['cat_id']?$actor['cat_id']:$this->cat_id);
+ $this->member_id =
($actor['member_of']?$actor['member_of']:$this->member_id);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiactor.edit',
+ 'actor_id' => $actor_id,
+ 'role' => $this->role
+ );
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+
$dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+
$dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True, 'link_data' =>array()));
+
+//_debug_array($member_of_data);
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_actor_id'
=> lang($this->role) . ' ID',
+ 'value_actor_id'
=> $actor_id,
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_apply'
=> lang('apply'),
+ 'value_cat'
=> $actor['cat'],
+ 'lang_id_statustext' =>
lang('Choose an ID'),
+ 'lang_apply_statustext' =>
lang('Apply the values'),
+ 'lang_cancel_statustext' =>
lang('Leave the actor untouched and return back to the list'),
+ 'lang_save_statustext' =>
lang('Save the actor and return back to the list'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the actor belongs to. To do not use a category select
NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
+
+ 'lang_member_of'
=> lang('member of'),
+ 'member_of_name'
=> 'member_id',
+ 'member_of_list'
=> $member_of_data['cat_list'],
+
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
+ 'lang_attributes'
=> lang('Attributes'),
+ 'attributes_header'
=> $attributes_header,
+ 'attributes_values'
=> $actor['attributes'],
+ 'lookup_functions'
=> $actor['lookup_functions'],
+ 'dateformat'
=> $dateformat,
+ );
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('actor') . ': ' . ($actor_id?lang('edit') . ' ' .
lang($this->role):lang('add') . ' ' . lang($this->role));
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function delete()
+ {
+ $attrib = get_var('attrib',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $actor_id =
get_var('actor_id',array('POST','GET'));
+ $delete = get_var('delete',array('POST'));
+ $confirm = get_var('confirm',array('POST'));
+
+
+ if($attrib)
+ {
+ $function='list_attribute';
+ }
+ else
+ {
+ $function='index';
+ }
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiactor.'.$function,
+ 'role' => $this->role
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($actor_id,$id,$attrib);
+// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.delete&actor_id='
. $actor_id. '&id=' . $id . '&attrib=' . $attrib . '&role=' . $this->role),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('actor');
+ $function_msg =
lang('delete') . ' ' . lang($this->role);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+
+ function view()
+ {
+ $actor_id = get_var('actor_id',array('GET'));
+ $action = get_var('action',array('GET'));
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('actor') . ': ' . lang('view') . ' ' . lang($this->role);
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('actor','attributes_view'));
+
+ $actor =
$this->bo->read_single(array('actor_id'=>$actor_id));
+
+ $attributes_values=$actor['attributes'];
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' =>
$actor['member_of'],'globals' => True, 'link_data' =>array()));
+
+ $data = array
+ (
+ 'lang_actor_id' =>
lang($this->role) . ' ID',
+ 'value_actor_id' =>
$actor_id,
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.index&role='
. $this->role),
+ 'lang_category' =>
lang('category'),
+ 'lang_time_created' =>
lang('time created'),
+ 'lang_done'
=> lang('done'),
+ 'cat_list'
=> $this->bo->select_category_list('',$actor['cat_id']),
+ 'lang_member_of' =>
lang('member of'),
+ 'member_of_list' =>
$member_of_data['cat_list'],
+
+ 'value_date' =>
$GLOBALS['phpgw']->common->show_date($actor['entry_date']),
+ 'lang_dateformat' =>
lang(strtolower($dateformat)),
+ 'lang_attributes' =>
lang('Attributes'),
+ 'attributes_view' =>
$attributes_values,
+ 'dateformat' =>
$dateformat
+ );
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function list_attribute()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $resort = get_var('resort',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array(
+ 'actor',
+ 'nextmatchs',
+
'search_field'));
+
+ if($resort)
+ {
+
$this->bo->resort_attrib(array('resort'=>$resort,'id'=>$id));
+ }
+
+ $attrib_list = $this->bo->read_attrib();
+
+ while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
+ {
+ $content[] = array
+ (
+ 'name'
=> $attrib['name'],
+ 'type_name'
=> $attrib['type_name'],
+ 'datatype'
=> $attrib['datatype'],
+ 'column_name'
=> $attrib['column_name'],
+ 'input_text'
=> $attrib['input_text'],
+ 'sorting'
=> $attrib['attrib_sort'],
+ 'search'
=> $attrib['search'],
+ 'link_up'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.list_attribute&resort=up&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
+ 'link_down'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.list_attribute&resort=down&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.edit_attrib&id='
. $attrib['id'] . '&role=' . $this->role),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.delete&id='
. $attrib['id'].'&attrib=true&role=' . $this->role),
+ 'lang_view_attribtext' =>
lang('view the attrib'),
+ 'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang('location'),
+ 'lang_edit_attribtext' =>
lang('edit the attrib'),
+ 'lang_delete_attribtext' =>
lang('delete the attrib'),
+ 'text_attribute'
=> lang('Attributes'),
+ 'text_up'
=> lang('up'),
+ 'text_down'
=> lang('down'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+ //html_print_r($content);
+
+ $table_header[] = array
+ (
+ 'lang_descr' => lang('Descr'),
+ 'lang_datatype' => lang('Datatype'),
+ 'lang_sorting' => lang('sorting'),
+ 'lang_search' => lang('search'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_sorting' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'attrib_sort',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiactor.list_attribute',
+
'allrows'=>$this->allrows,
+
'role' => $this->role)
+
)),
+
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'column_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiactor.list_attribute',
+
'allrows'=>$this->allrows,
+
'role' => $this->role)
+
)),
+ 'lang_name' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_attribtext' => lang('add a attrib'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.edit_attrib&role='
. $this->role),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_attribtext' => lang('back to
admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php'),
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiactor.list_attribute',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'query'
=>$this->query,
+ 'role' =>
$this->role
+
+ );
+
+ $data = array
+ (
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($attrib_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_attribtext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_attrib' =>
$table_header,
+ 'values_attrib'
=> $content,
+ 'table_add2'
=> $table_add
+ );
+
+ $appname
= lang('actor');
+ $function_msg =
lang('list attribute') . ': ' . lang($this->role);
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function edit_attrib()
+ {
+ $id =
get_var('id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+ // $GLOBALS['phpgw']->common->msgbox(lang('Altering
ColumnName OR Datatype - deletes your data in this Column'));
+ //html_print_r($values);
+
$GLOBALS['phpgw']->xslttpl->add_file(array('actor','choice',));
+
+ if ($values['save'])
+ {
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ $type_id =
$values['type_id'];
+
+ if (!$values['column_name'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
+ }
+
+ if (!$values['input_text'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Input text not entered!'));
+ }
+ if (!$values['statustext'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
+ }
+
+ if (!$values['column_info']['type'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
+ }
+
+
if(!ctype_digit($values['column_info']['precision']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
+
unset($values['column_info']['precision']);
+ }
+
+ if($values['column_info']['scale'] &&
!ctype_digit($values['column_info']['scale']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
+ unset($values['column_info']['scale']);
+ }
+
+ if (!$values['column_info']['nullable'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
+ }
+
+
+ if (!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_attrib($values,$action);
+
+ if(!$id)
+ {
+ $id=$receipt['id'];
+ }
+ }
+ else
+ {
+ $receipt['error'][] = array('msg'
=> lang('Attribute has NOT been saved'));
+ }
+
+ }
+
+ if ($id)
+ {
+ $values = $this->bo->read_single_attrib($id);
+ $function_msg = lang('edit attribute') . ': ' .
lang($this->role);
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add attribute') . ': ' .
lang($this->role);
+ $action='add';
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiactor.edit_attrib',
+ 'id' => $id,
+ 'role' => $this->role
+
+ );
+ //html_print_r($values);
+
+ if($values['column_info']['type']=='R' ||
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
+ {
+ $multiple_choice= True;
+ }
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'lang_choice' =>
lang('Choice'),
+ 'lang_new_value' =>
lang('New value'),
+ 'lang_new_value_statustext' => lang('New
value for mulitple choice'),
+ 'multiple_choice' =>
$multiple_choice,
+ 'value_choice' =>
$values['choice'],
+ 'lang_delete_value' =>
lang('Delete value'),
+ 'lang_value' =>
lang('value'),
+ 'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
+ //'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiactor.list_attribute&type_id='.$type_id
. '&role=' . $this->role),
+ 'lang_id'
=> lang('Attribute ID'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id'
=> $id,
+
+ 'lang_column_name'
=> lang('Column name'),
+ 'value_column_name'
=> $values['column_name'],
+ 'lang_column_name_statustext' => lang('enter
the name for the column'),
+
+ 'lang_input_text'
=> lang('input text'),
+ 'value_input_text'
=> $values['input_text'],
+ 'lang_input_name_statustext' => lang('enter
the input text for records'),
+
+ 'lang_id_attribtext' => lang('Enter
the attribute ID'),
+ 'lang_entity_statustext' => lang('Select
a actor type'),
+
+ 'lang_statustext' =>
lang('Statustext'),
+ 'lang_statustext_attribtext'=> lang('Enter a
statustext for the inputfield in forms'),
+ 'value_statustext' =>
$values['statustext'],
+
+ 'lang_done_attribtext' => lang('Back
to the list'),
+ 'lang_save_attribtext' => lang('Save
the attribute'),
+
+ 'lang_datatype' =>
lang('Datatype'),
+ 'lang_datatype_statustext' => lang('Select
a datatype'),
+ 'lang_no_datatype' =>
lang('No datatype'),
+ 'datatype_list' =>
$this->bocommon->select_datatype($values['column_info']['type']),
+
+ 'lang_precision' =>
lang('Precision'),
+ 'lang_precision_statustext' => lang('enter
the record length'),
+ 'value_precision' =>
$values['column_info']['precision'],
+
+ 'lang_scale' =>
lang('scale'),
+ 'lang_scale_statustext' => lang('enter
the scale if type is decimal'),
+ 'value_scale' =>
$values['column_info']['scale'],
+
+ 'lang_default' =>
lang('default'),
+ 'lang_default_statustext' => lang('enter
the default value'),
+ 'value_default' =>
$values['column_info']['default'],
+
+ 'lang_nullable' =>
lang('Nullable'),
+ 'lang_nullable_statustext' => lang('Chose
if this column is nullable'),
+ 'lang_select_nullable' => lang('Select
nullable'),
+ 'nullable_list' =>
$this->bocommon->select_nullable($values['column_info']['nullable']),
+
+ 'value_list' =>
$values['list'],
+ 'lang_list'
=> lang('show in list'),
+ 'lang_list_statustext' => lang('check
to show this attribute in location list'),
+
+ 'value_search' =>
$values['search'],
+ 'lang_include_search' =>
lang('Include in search'),
+ 'lang_include_search_statustext'=> lang('check
to show this attribute in location list'),
+
+
+ );
+ //html_print_r($data);
+
+ $appname
= lang('actor');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uiadmin.inc.php
diff -u property/inc/class.uiadmin.inc.php:1.10
property/inc/class.uiadmin.inc.php:1.11
--- property/inc/class.uiadmin.inc.php:1.10 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uiadmin.inc.php Fri Feb 3 12:05:49 2006
@@ -1,690 +1,690 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uiadmin.inc.php,v 1.10 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uiadmin
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $submodule_id;
- var $permission;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'list_acl2' => True,
- 'aclprefs' => True,
- 'edit_id' => True,
- 'contact_info' => True
- );
-
- function uiadmin()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.boadmin',true);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->location =
$this->bo->location;
- $this->granting_group =
$this->bo->granting_group;
- $this->allrows =
$this->bo->allrows;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'location' => $this->location,
- 'granting_group' =>
$this->granting_group,
- 'allrows' => $this->allrows
- );
-
- $this->bo->save_sessiondata($data);
- }
-
- function aclprefs()
- {
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('admin','nextmatchs',
-
'search_field'));
-
- $values =
get_var('values',array('POST'));
- $r_processed = get_var('processed',array('POST'));
- $acl_app =
get_var('acl_app',array('GET'));
- $set_permission =
get_var('set_permission',array('POST'));
-
- $app_id =
$GLOBALS['phpgw']->applications->data[$acl_app]['id'];
-
- if($set_permission)
- {
- $receipt =
$this->bo->set_grant($values,$r_processed);
- }
-
- if ($this->location)
- {
- if(!$this->cat_id || $this->cat_id=='accounts')
- {
- $user_list =
$this->bo->get_user_list('accounts',$app_id);
- }
-
- while (is_array($user_list) && list(,$user) =
each($user_list))
- {
- $processed[] = $user['account_id'];
- $users[] = array
- (
- 'account_id'
=> $user['account_id'],
- 'lid'
=> $user['account_lid'],
- 'name'
=> $user['account_firstname'] . ' ' . $user['account_lastname'],
- 'read_right'
=> $user['right'][1],
- 'add_right'
=> $user['right'][2],
- 'edit_right'
=> $user['right'][4],
- 'delete_right'
=> $user['right'][8],
- 'read_mask'
=> $user['mask'][1],
- 'add_mask'
=> $user['mask'][2],
- 'edit_mask'
=> $user['mask'][4],
- 'delete_mask'
=> $user['mask'][8],
- 'read_result'
=> $user['result'][1],
- 'add_result'
=> $user['result'][2],
- 'edit_result'
=> $user['result'][4],
- 'delete_result'
=> $user['result'][8],
- 'lang_right'
=> lang('right'),
- 'lang_mask'
=> lang('mask'),
- 'lang_result'
=> lang('result'),
- 'lang_read'
=> lang('Read'), //1
- 'lang_add'
=> lang('Add'), //2
- 'lang_edit'
=> lang('Edit'), //4
- 'lang_delete'
=> lang('Delete'), //8
- 'type'
=> 'users'
- );
- }
-
- if(!$this->cat_id || $this->cat_id=='groups')
- {
- $group_list =
$this->bo->get_user_list('groups',$app_id);
- }
-
-
- while (is_array($group_list) && list(,$group) =
each($group_list))
- {
- $processed[] = $group['account_id'];
- $groups[] = array
- (
- 'account_id'
=> $group['account_id'],
- 'lid'
=> $group['account_lid'],
- 'name'
=> $group['account_firstname'],
- 'read_right'
=> $group['right'][1],
- 'add_right'
=> $group['right'][2],
- 'edit_right'
=> $group['right'][4],
- 'delete_right'
=> $group['right'][8],
- 'read_mask'
=> $group['mask'][1],
- 'add_mask'
=> $group['mask'][2],
- 'edit_mask'
=> $group['mask'][4],
- 'delete_mask'
=> $group['mask'][8],
- 'read_result'
=> $group['result'][1],
- 'add_result'
=> $group['result'][2],
- 'edit_result'
=> $group['result'][4],
- 'delete_result'
=> $group['result'][8],
- 'lang_right'
=> lang('right'),
- 'lang_mask'
=> lang('mask'),
- 'lang_result'
=> lang('result'),
- 'lang_read'
=> lang('Read'), //1
- 'lang_add'
=> lang('Add'), //2
- 'lang_edit'
=> lang('Edit'), //4
- 'lang_delete'
=> lang('Delete'), //8
- 'type'
=> 'groups'
- );
- }
-
- address@hidden("_", $processed);
- }
-
-
- $table_header[] = array
- (
- 'lang_read'
=> lang('Read'), //1
- 'lang_add'
=> lang('Add'), //2
- 'lang_edit'
=> lang('Edit'), //4
- 'lang_delete' =>
lang('Delete'), //8
- 'lang_manager' =>
lang('Manager') //16
- );
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiadmin.aclprefs',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'module'
=> $this->location,
- 'granting_group' =>
$this->granting_group
- );
-
- if(!$this->location)
- {
- $receipt['error'][] = array('msg' =>
lang('select a location!'));
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=> $GLOBALS['phpgw']->link('/preferences/index.php'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'processed'
=> $processed,
- 'location'
=> $this->location,
- 'links'
=> $links,
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($user_list)+count($group_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.aclprefs'),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-
- 'lang_groups'
=> lang('groups'),
- 'lang_users'
=> lang('users'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the permissions belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'cat_id'
=> $this->cat_id,
- 'permission'
=> False,
- 'grant'
=> 1,
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_permission' =>
$table_header,
- 'values_groups'
=> $groups,
- 'values_users'
=> $users,
- 'lang_no_location'
=> lang('No location'),
- 'lang_location_statustext' =>
lang('Select submodule'),
- 'select_name_location' =>
'module',
- 'location_list'
=> $this->bo->select_location('filter',$this->location,True),
-
- 'is_admin'
=> $GLOBALS['phpgw_info']['user']['apps']['admin'],
- 'lang_group_statustext' =>
lang('Select the granting group. To do not use a granting group select NO
GRANTING GROUP'),
- 'select_group_name'
=> 'granting_group',
- 'lang_no_group'
=> lang('No granting group'),
- 'group_list'
=>
$this->bocommon->get_group_list('filter',$this->granting_group,$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
- );
-
- $appname
= lang('preferences');
- $function_msg =
lang('set grants');
- $owner_name =
$GLOBALS['phpgw']->accounts->id2name($GLOBALS['phpgw']->accounts->account_id);
// get owner name for title
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg . ': ' .
$owner_name;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_permission' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
-
- }
-
- function list_acl2()
- {
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('admin','nextmatchs',
-
'search_field'));
-
- $values =
get_var('values',array('POST'));
- $r_processed = get_var('processed',array('POST'));
- $initials =
get_var('initials',array('POST'));
-
- $set_permission =
get_var('set_permission',array('POST'));
-
- if($set_permission)
- {
- $receipt =
$this->bo->set_permission($values,$r_processed,$initials);
- }
-
- if ($this->location)
- {
- if($this->cat_id=='accounts')
- {
- $user_list =
$this->bo->get_user_list2('accounts',$app_id);
- }
-
- if (isSet($user_list) AND is_array($user_list))
- {
- foreach($user_list as $user)
- {
- $processed[] =
$user['account_id'];
- $users[] = array
- (
- 'account_id'
=> $user['account_id'],
- 'lid'
=> $user['account_lid'],
- 'name'
=> $user['account_firstname'] . ' ' .
$user['account_lastname'] . ' [' . $user['account_lid'] . ']',
- 'read_right'
=> $user['right'][1],
- 'add_right'
=> $user['right'][2],
- 'edit_right'
=> $user['right'][4],
- 'delete_right'
=> $user['right'][8],
- 'manage_right'
=> $user['right'][16],
- 'janitor_right'
=> $user['right'][32],
- 'supervisor_right'
=> $user['right'][64],
-
'budget_responsible_right' => $user['right'][128],
- 'read_mask'
=> $user['mask'][1],
- 'add_mask'
=> $user['mask'][2],
- 'edit_mask'
=> $user['mask'][4],
- 'delete_mask'
=> $user['mask'][8],
- 'manage_mask'
=> $user['mask'][16],
- 'janitor_mask'
=> $user['mask'][32],
- 'supervisor_mask'
=> $user['mask'][64],
-
'budget_responsible_mask' => $user['mask'][128],
- 'read_result'
=> $user['result'][1],
- 'add_result'
=> $user['result'][2],
- 'edit_result'
=> $user['result'][4],
- 'delete_result'
=> $user['result'][8],
- 'manage_result'
=> $user['result'][16],
- 'janitor_result'
=> $user['result'][32],
- 'supervisor_result'
=> $user['result'][64],
-
'budget_responsible_result' => $user['result'][128],
- 'initials'
=> $user['initials'],
- 'lang_right'
=> lang('right'),
- 'lang_mask'
=> lang('mask'),
- 'lang_result'
=> lang('result'),
- 'lang_read'
=> lang('Read'), //1
- 'lang_add'
=> lang('Add'), //2
- 'lang_edit'
=> lang('Edit'), //4
- 'lang_delete'
=> lang('Delete'), //8
- 'lang_manage'
=> lang('Manage'), //16
- 'lang_janitor'
=> lang('Janitor'), //32
- 'lang_supervisor'
=> lang('Supervisor'), //64
-
'lang_budget_responsible' => lang('Budget Responsible'), //128
- 'lang_initials'
=> lang('Initials'),
- 'type'
=> 'users'
- );
- }
- }
-
- if($this->cat_id=='groups')
- {
- $group_list =
$this->bo->get_user_list2('groups',$app_id);
- }
-
- if (isSet($group_list) AND
is_array($group_list))
- {
- foreach($group_list as $group)
- {
- $processed[] =
$group['account_id'];
- $groups[] = array
- (
- 'account_id'
=> $group['account_id'],
- 'lid'
=> $group['account_lid'],
- 'name'
=> $group['account_firstname'],
- 'read_right'
=> $group['right'][1],
- 'add_right'
=> $group['right'][2],
- 'edit_right'
=> $group['right'][4],
- 'delete_right'
=> $group['right'][8],
- 'manage_right'
=> $group['right'][16],
- 'read_mask'
=> $group['mask'][1],
- 'add_mask'
=> $group['mask'][2],
- 'edit_mask'
=> $group['mask'][4],
- 'delete_mask'
=> $group['mask'][8],
- 'manage_mask'
=> $group['mask'][16],
- 'read_result'
=> $group['result'][1],
- 'add_result'
=> $group['result'][2],
- 'edit_result'
=> $group['result'][4],
- 'delete_result'
=> $group['result'][8],
- 'manage_result'
=> $group['result'][16],
- 'initials'
=> $group['initials'],
- 'lang_right'
=> lang('right'),
- 'lang_mask'
=> lang('mask'),
- 'lang_result'
=> lang('result'),
- 'lang_read'
=> lang('Read'), //1
- 'lang_add'
=> lang('Add'), //2
- 'lang_edit'
=> lang('Edit'), //4
- 'lang_delete'
=> lang('Delete'), //8
- 'lang_manage'
=> lang('Manage'), //16
- 'lang_janitor'
=> lang('Janitor'), //32
- 'lang_supervisor'
=> lang('Supervisor'), //64
-
'lang_budget_responsible' => lang('Budget Responsible'), //128
- 'lang_initials'
=> lang('Initials'),
- 'type'
=> 'groups'
- );
- }
- }
-
-
- address@hidden("_", $processed);
- }
-
-
- $table_header[] = array
- (
- 'sort_lid' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'account_lid',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
-
'cat_id'
=>$this->cat_id,
-
'query'
=>$this->query,
-
'module'
=> $this->location,
-
'submodule_id'
=>$this->submodule_id)
-
)),
- 'sort_lastname' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'account_lastname',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
-
'cat_id'
=>$this->cat_id,
-
'query'
=>$this->query,
-
'module'
=> $this->location,
-
'submodule_id'
=>$this->submodule_id)
-
)),
- 'sort_firstname' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'account_firstname',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
-
'cat_id'
=>$this->cat_id,
-
'query'
=>$this->query,
-
'module'
=> $this->location,
-
'submodule_id'
=>$this->submodule_id)
-
)),
-
-
- 'lang_values' =>
lang('values'),
- 'lang_read'
=> lang('Read'), //1
- 'lang_add'
=> lang('Add'), //2
- 'lang_edit'
=> lang('Edit'), //4
- 'lang_delete' =>
lang('Delete'), //8
- 'lang_manager' =>
lang('Manager'), //16
- 'lang_janitor' =>
lang('Janitor'), //32
- 'lang_supervisor' =>
lang('Supervisor'), //64
- 'lang_budget_responsible' => lang('Budget
Responsible'), //128
- 'lang_initials' =>
lang('Initials')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'module' =>
$this->location
-
- );
-
- if(!$this->location)
- {
- $receipt['error'][] = array('msg' =>
lang('select a location!'));
- }
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=> $GLOBALS['phpgw']->link('/admin/index.php'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'processed'
=> $processed,
- 'location'
=> $this->location,
- 'links'
=> $links,
-
- 'num_records'
=> count($user_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the permissions belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'cat_id'
=> $this->cat_id,
- 'permission'
=> 1,
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_permission' =>
$table_header,
- // 'table_header_acl2'
=> $table_header,
- // 'values_acl2'
=> $content,
- 'values_groups'
=> $groups,
- 'values_users'
=> $users,
- 'lang_groups'
=> lang('groups'),
- 'lang_users'
=> lang('users'),
-
- 'lang_no_location'
=> lang('No location'),
- 'lang_location_statustext' =>
lang('Select submodule'),
- 'select_name_location' =>
'module',
- 'location_list'
=> $this->bo->select_location('filter',$this->location,False)
- );
-
- $appname
= lang('permission');
- $function_msg =
lang('set permission');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_permission' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit_id()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('admin'));
-
- $values = get_var('values',array('POST'));
-
- if ($values['select'])
- {
- $receipt = $this->bo->edit_id($values);
- }
-
- $fm_ids = $this->bo->read_fm_id();
-
- for ($i=0;$i<count($fm_ids);$i++)
- {
-
- $content[] = array
- (
- 'descr' => $fm_ids[$i]['descr'],
- 'value' => $fm_ids[$i]['value'],
- 'remark' =>
$fm_ids[$i]['remark'],
- 'key_id' => $i
- );
- }
-
- $table_header[] = array
- (
- 'lang_select' => lang('Select'),
- 'lang_descr' => lang('Descr'),
- 'lang_value' => lang('Value'),
- 'lang_remark' => lang('Remark'),
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.edit_id'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php'),
- 'lang_submit' =>
lang('submit'),
- 'lang_save' =>
lang('Edit'),
- 'lang_add_statustext' => lang('Edit ID'),
- 'lang_done' =>
lang('done'),
- 'lang_done_statustext' => lang('Back to
Admin'),
- 'lang_select' =>
lang('Select'),
- 'lang_descr' =>
lang('Descr'),
- 'lang_value' =>
lang('Value'),
- 'lang_remark' =>
lang('Remark'),
- 'id_table_header' =>
$table_header,
- 'id_values' =>
$content,
- );
-
- $appname
= lang('ID');
- $function_msg =
lang('edit ID');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_id' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function contact_info()
- {
- $GLOBALS['phpgw']->xslttpl->add_file(array('admin'));
-
- $values = get_var('values',array('POST'));
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->preferences->account_id=$this->filter;
-
$GLOBALS['phpgw']->preferences->read_repository();
-
- if ($values['old_email'] != $values['email'])
- {
-
$GLOBALS['phpgw']->preferences->add($this->currentapp,"email",$values['email'],'user');
- $receipt['message'][] = array('msg' =>
lang('Users email is updated'));
- }
- if ($values['old_phone'] != $values['phone'])
- {
-
$GLOBALS['phpgw']->preferences->add($this->currentapp,"cellphone",$values['phone'],'user');
- $receipt['message'][] = array('msg' =>
lang('Users phone is updated'));
- }
- if ($values['old_approval_from'] !=
$values['approval_from'])
- {
-
$GLOBALS['phpgw']->preferences->add($this->currentapp,"approval_from",$values['approval_from'],'user');
- $receipt['message'][] = array('msg' =>
lang('Approval from is updated'));
- }
- if ($values['old_default_vendor_category'] !=
$values['default_vendor_category'])
- {
-
$GLOBALS['phpgw']->preferences->add($this->currentapp,"default_vendor_category",$values['default_vendor_category'],'user');
- $receipt['message'][] = array('msg' =>
lang('default vendor category is updated'));
- }
-
$GLOBALS['phpgw']->preferences->save_repository();
- }
-
- if($this->filter)
- {
- $prefs =
$this->bocommon->create_preferences($this->currentapp,$this->filter);
- }
-
- $cats = CreateObject('phpgwapi.categories');
- $cats->app_name = 'fm_vendor';
-
- $cat_data =
$cats->formatted_xslt_list(array('selected' =>
$prefs['default_vendor_category'],'globals' => True, 'link_data' =>array()));
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.contact_info'),
- 'done_action'
=> $GLOBALS['phpgw']->link('/admin/index.php'),
- 'lang_submit'
=> lang('submit'),
- 'lang_save'
=> lang('Edit'),
- 'lang_add_statustext' =>
lang('Edit ID'),
- 'lang_done'
=> lang('done'),
- 'lang_done_statustext' =>
lang('Back to Admin'),
-
- 'lang_email_statustext' =>
lang('Enter the email-address for this user'),
-
- 'lang_user'
=> lang('User'),
- 'lang_email'
=> lang('Email'),
- 'value_old_email'
=> $prefs['email'],
- 'value_email'
=> $prefs['email'],
-
- 'lang_phone'
=> lang('Phone'),
- 'value_old_phone'
=> $prefs['cellphone'],
- 'value_phone'
=> $prefs['cellphone'],
-
- 'lang_approval_from' =>
lang('Approval from'),
- 'value_old_approval_from' =>
$prefs['approval_from'],
- 'approval_from'
=>
$this->bocommon->get_user_list('select',$prefs['approval_from'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
-
- 'select_user_name'
=> 'approval_from',
- 'lang_approval_from_statustext' => lang('Select
the users supervisor'),
-
- 'lang_default_vendor_category' =>
lang('default vendor category'),
- 'value_old_default_vendor_category' =>
$prefs['default_vendor_category'],
- 'vendor_category'
=> $cat_data['cat_list'],
- 'select_user_name'
=> 'approval_from',
- 'lang_default_vendor_category_statustext'
=> lang('Select default vendor category'),
- 'lang_no_cat'
=> lang('No category'),
-
-
- 'lang_user_statustext' =>
lang('Select the user to edit email'),
- 'select_user_name'
=> 'filter',
- 'lang_no_user'
=> lang('No user'),
- 'value_user_id'
=> $this->filter,
- 'user_list'
=>
$this->bocommon->get_user_list('filter',$this->filter,$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
- );
-
- $appname
= lang('User contact info');
- $function_msg
= lang('edit info');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('contact_info' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uiadmin.inc.php,v 1.11 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uiadmin
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $submodule_id;
+ var $permission;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'list_acl2' => True,
+ 'aclprefs' => True,
+ 'edit_id' => True,
+ 'contact_info' => True
+ );
+
+ function uiadmin()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.boadmin',true);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->location =
$this->bo->location;
+ $this->granting_group =
$this->bo->granting_group;
+ $this->allrows =
$this->bo->allrows;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'location' => $this->location,
+ 'granting_group' =>
$this->granting_group,
+ 'allrows' => $this->allrows
+ );
+
+ $this->bo->save_sessiondata($data);
+ }
+
+ function aclprefs()
+ {
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('admin','nextmatchs',
+
'search_field'));
+
+ $values =
get_var('values',array('POST'));
+ $r_processed = get_var('processed',array('POST'));
+ $acl_app =
get_var('acl_app',array('GET'));
+ $set_permission =
get_var('set_permission',array('POST'));
+
+ $app_id =
$GLOBALS['phpgw']->applications->data[$acl_app]['id'];
+
+ if($set_permission)
+ {
+ $receipt =
$this->bo->set_grant($values,$r_processed);
+ }
+
+ if ($this->location)
+ {
+ if(!$this->cat_id || $this->cat_id=='accounts')
+ {
+ $user_list =
$this->bo->get_user_list('accounts',$app_id);
+ }
+
+ while (is_array($user_list) && list(,$user) =
each($user_list))
+ {
+ $processed[] = $user['account_id'];
+ $users[] = array
+ (
+ 'account_id'
=> $user['account_id'],
+ 'lid'
=> $user['account_lid'],
+ 'name'
=> $user['account_firstname'] . ' ' . $user['account_lastname'],
+ 'read_right'
=> $user['right'][1],
+ 'add_right'
=> $user['right'][2],
+ 'edit_right'
=> $user['right'][4],
+ 'delete_right'
=> $user['right'][8],
+ 'read_mask'
=> $user['mask'][1],
+ 'add_mask'
=> $user['mask'][2],
+ 'edit_mask'
=> $user['mask'][4],
+ 'delete_mask'
=> $user['mask'][8],
+ 'read_result'
=> $user['result'][1],
+ 'add_result'
=> $user['result'][2],
+ 'edit_result'
=> $user['result'][4],
+ 'delete_result'
=> $user['result'][8],
+ 'lang_right'
=> lang('right'),
+ 'lang_mask'
=> lang('mask'),
+ 'lang_result'
=> lang('result'),
+ 'lang_read'
=> lang('Read'), //1
+ 'lang_add'
=> lang('Add'), //2
+ 'lang_edit'
=> lang('Edit'), //4
+ 'lang_delete'
=> lang('Delete'), //8
+ 'type'
=> 'users'
+ );
+ }
+
+ if(!$this->cat_id || $this->cat_id=='groups')
+ {
+ $group_list =
$this->bo->get_user_list('groups',$app_id);
+ }
+
+
+ while (is_array($group_list) && list(,$group) =
each($group_list))
+ {
+ $processed[] = $group['account_id'];
+ $groups[] = array
+ (
+ 'account_id'
=> $group['account_id'],
+ 'lid'
=> $group['account_lid'],
+ 'name'
=> $group['account_firstname'],
+ 'read_right'
=> $group['right'][1],
+ 'add_right'
=> $group['right'][2],
+ 'edit_right'
=> $group['right'][4],
+ 'delete_right'
=> $group['right'][8],
+ 'read_mask'
=> $group['mask'][1],
+ 'add_mask'
=> $group['mask'][2],
+ 'edit_mask'
=> $group['mask'][4],
+ 'delete_mask'
=> $group['mask'][8],
+ 'read_result'
=> $group['result'][1],
+ 'add_result'
=> $group['result'][2],
+ 'edit_result'
=> $group['result'][4],
+ 'delete_result'
=> $group['result'][8],
+ 'lang_right'
=> lang('right'),
+ 'lang_mask'
=> lang('mask'),
+ 'lang_result'
=> lang('result'),
+ 'lang_read'
=> lang('Read'), //1
+ 'lang_add'
=> lang('Add'), //2
+ 'lang_edit'
=> lang('Edit'), //4
+ 'lang_delete'
=> lang('Delete'), //8
+ 'type'
=> 'groups'
+ );
+ }
+
+ address@hidden("_", $processed);
+ }
+
+
+ $table_header[] = array
+ (
+ 'lang_read'
=> lang('Read'), //1
+ 'lang_add'
=> lang('Add'), //2
+ 'lang_edit'
=> lang('Edit'), //4
+ 'lang_delete' =>
lang('Delete'), //8
+ 'lang_manager' =>
lang('Manager') //16
+ );
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiadmin.aclprefs',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'module'
=> $this->location,
+ 'granting_group' =>
$this->granting_group
+ );
+
+ if(!$this->location)
+ {
+ $receipt['error'][] = array('msg' =>
lang('select a location!'));
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=> $GLOBALS['phpgw']->link('/preferences/index.php'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'processed'
=> $processed,
+ 'location'
=> $this->location,
+ 'links'
=> $links,
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($user_list)+count($group_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.aclprefs'),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+
+ 'lang_groups'
=> lang('groups'),
+ 'lang_users'
=> lang('users'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the permissions belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'cat_id'
=> $this->cat_id,
+ 'permission'
=> False,
+ 'grant'
=> 1,
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_permission' =>
$table_header,
+ 'values_groups'
=> $groups,
+ 'values_users'
=> $users,
+ 'lang_no_location'
=> lang('No location'),
+ 'lang_location_statustext' =>
lang('Select submodule'),
+ 'select_name_location' =>
'module',
+ 'location_list'
=> $this->bo->select_location('filter',$this->location,True),
+
+ 'is_admin'
=> $GLOBALS['phpgw_info']['user']['apps']['admin'],
+ 'lang_group_statustext' =>
lang('Select the granting group. To do not use a granting group select NO
GRANTING GROUP'),
+ 'select_group_name'
=> 'granting_group',
+ 'lang_no_group'
=> lang('No granting group'),
+ 'group_list'
=>
$this->bocommon->get_group_list('filter',$this->granting_group,$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
+ );
+
+ $appname
= lang('preferences');
+ $function_msg =
lang('set grants');
+ $owner_name =
$GLOBALS['phpgw']->accounts->id2name($GLOBALS['phpgw']->accounts->account_id);
// get owner name for title
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg . ': ' .
$owner_name;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_permission' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+
+ }
+
+ function list_acl2()
+ {
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('admin','nextmatchs',
+
'search_field'));
+
+ $values =
get_var('values',array('POST'));
+ $r_processed = get_var('processed',array('POST'));
+ $initials =
get_var('initials',array('POST'));
+
+ $set_permission =
get_var('set_permission',array('POST'));
+
+ if($set_permission)
+ {
+ $receipt =
$this->bo->set_permission($values,$r_processed,$initials);
+ }
+
+ if ($this->location)
+ {
+ if($this->cat_id=='accounts')
+ {
+ $user_list =
$this->bo->get_user_list2('accounts',$app_id);
+ }
+
+ if (isSet($user_list) AND is_array($user_list))
+ {
+ foreach($user_list as $user)
+ {
+ $processed[] =
$user['account_id'];
+ $users[] = array
+ (
+ 'account_id'
=> $user['account_id'],
+ 'lid'
=> $user['account_lid'],
+ 'name'
=> $user['account_firstname'] . ' ' .
$user['account_lastname'] . ' [' . $user['account_lid'] . ']',
+ 'read_right'
=> $user['right'][1],
+ 'add_right'
=> $user['right'][2],
+ 'edit_right'
=> $user['right'][4],
+ 'delete_right'
=> $user['right'][8],
+ 'manage_right'
=> $user['right'][16],
+ 'janitor_right'
=> $user['right'][32],
+ 'supervisor_right'
=> $user['right'][64],
+
'budget_responsible_right' => $user['right'][128],
+ 'read_mask'
=> $user['mask'][1],
+ 'add_mask'
=> $user['mask'][2],
+ 'edit_mask'
=> $user['mask'][4],
+ 'delete_mask'
=> $user['mask'][8],
+ 'manage_mask'
=> $user['mask'][16],
+ 'janitor_mask'
=> $user['mask'][32],
+ 'supervisor_mask'
=> $user['mask'][64],
+
'budget_responsible_mask' => $user['mask'][128],
+ 'read_result'
=> $user['result'][1],
+ 'add_result'
=> $user['result'][2],
+ 'edit_result'
=> $user['result'][4],
+ 'delete_result'
=> $user['result'][8],
+ 'manage_result'
=> $user['result'][16],
+ 'janitor_result'
=> $user['result'][32],
+ 'supervisor_result'
=> $user['result'][64],
+
'budget_responsible_result' => $user['result'][128],
+ 'initials'
=> $user['initials'],
+ 'lang_right'
=> lang('right'),
+ 'lang_mask'
=> lang('mask'),
+ 'lang_result'
=> lang('result'),
+ 'lang_read'
=> lang('Read'), //1
+ 'lang_add'
=> lang('Add'), //2
+ 'lang_edit'
=> lang('Edit'), //4
+ 'lang_delete'
=> lang('Delete'), //8
+ 'lang_manage'
=> lang('Manage'), //16
+ 'lang_janitor'
=> lang('Janitor'), //32
+ 'lang_supervisor'
=> lang('Supervisor'), //64
+
'lang_budget_responsible' => lang('Budget Responsible'), //128
+ 'lang_initials'
=> lang('Initials'),
+ 'type'
=> 'users'
+ );
+ }
+ }
+
+ if($this->cat_id=='groups')
+ {
+ $group_list =
$this->bo->get_user_list2('groups',$app_id);
+ }
+
+ if (isSet($group_list) AND
is_array($group_list))
+ {
+ foreach($group_list as $group)
+ {
+ $processed[] =
$group['account_id'];
+ $groups[] = array
+ (
+ 'account_id'
=> $group['account_id'],
+ 'lid'
=> $group['account_lid'],
+ 'name'
=> $group['account_firstname'],
+ 'read_right'
=> $group['right'][1],
+ 'add_right'
=> $group['right'][2],
+ 'edit_right'
=> $group['right'][4],
+ 'delete_right'
=> $group['right'][8],
+ 'manage_right'
=> $group['right'][16],
+ 'read_mask'
=> $group['mask'][1],
+ 'add_mask'
=> $group['mask'][2],
+ 'edit_mask'
=> $group['mask'][4],
+ 'delete_mask'
=> $group['mask'][8],
+ 'manage_mask'
=> $group['mask'][16],
+ 'read_result'
=> $group['result'][1],
+ 'add_result'
=> $group['result'][2],
+ 'edit_result'
=> $group['result'][4],
+ 'delete_result'
=> $group['result'][8],
+ 'manage_result'
=> $group['result'][16],
+ 'initials'
=> $group['initials'],
+ 'lang_right'
=> lang('right'),
+ 'lang_mask'
=> lang('mask'),
+ 'lang_result'
=> lang('result'),
+ 'lang_read'
=> lang('Read'), //1
+ 'lang_add'
=> lang('Add'), //2
+ 'lang_edit'
=> lang('Edit'), //4
+ 'lang_delete'
=> lang('Delete'), //8
+ 'lang_manage'
=> lang('Manage'), //16
+ 'lang_janitor'
=> lang('Janitor'), //32
+ 'lang_supervisor'
=> lang('Supervisor'), //64
+
'lang_budget_responsible' => lang('Budget Responsible'), //128
+ 'lang_initials'
=> lang('Initials'),
+ 'type'
=> 'groups'
+ );
+ }
+ }
+
+
+ address@hidden("_", $processed);
+ }
+
+
+ $table_header[] = array
+ (
+ 'sort_lid' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'account_lid',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
+
'cat_id'
=>$this->cat_id,
+
'query'
=>$this->query,
+
'module'
=> $this->location,
+
'submodule_id'
=>$this->submodule_id)
+
)),
+ 'sort_lastname' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'account_lastname',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
+
'cat_id'
=>$this->cat_id,
+
'query'
=>$this->query,
+
'module'
=> $this->location,
+
'submodule_id'
=>$this->submodule_id)
+
)),
+ 'sort_firstname' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'account_firstname',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
+
'cat_id'
=>$this->cat_id,
+
'query'
=>$this->query,
+
'module'
=> $this->location,
+
'submodule_id'
=>$this->submodule_id)
+
)),
+
+
+ 'lang_values' =>
lang('values'),
+ 'lang_read'
=> lang('Read'), //1
+ 'lang_add'
=> lang('Add'), //2
+ 'lang_edit'
=> lang('Edit'), //4
+ 'lang_delete' =>
lang('Delete'), //8
+ 'lang_manager' =>
lang('Manager'), //16
+ 'lang_janitor' =>
lang('Janitor'), //32
+ 'lang_supervisor' =>
lang('Supervisor'), //64
+ 'lang_budget_responsible' => lang('Budget
Responsible'), //128
+ 'lang_initials' =>
lang('Initials')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiadmin.list_acl2',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'module' =>
$this->location
+
+ );
+
+ if(!$this->location)
+ {
+ $receipt['error'][] = array('msg' =>
lang('select a location!'));
+ }
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=> $GLOBALS['phpgw']->link('/admin/index.php'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'processed'
=> $processed,
+ 'location'
=> $this->location,
+ 'links'
=> $links,
+
+ 'num_records'
=> count($user_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the permissions belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'cat_id'
=> $this->cat_id,
+ 'permission'
=> 1,
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_permission' =>
$table_header,
+ // 'table_header_acl2'
=> $table_header,
+ // 'values_acl2'
=> $content,
+ 'values_groups'
=> $groups,
+ 'values_users'
=> $users,
+ 'lang_groups'
=> lang('groups'),
+ 'lang_users'
=> lang('users'),
+
+ 'lang_no_location'
=> lang('No location'),
+ 'lang_location_statustext' =>
lang('Select submodule'),
+ 'select_name_location' =>
'module',
+ 'location_list'
=> $this->bo->select_location('filter',$this->location,False)
+ );
+
+ $appname
= lang('permission');
+ $function_msg =
lang('set permission');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_permission' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit_id()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('admin'));
+
+ $values = get_var('values',array('POST'));
+
+ if ($values['select'])
+ {
+ $receipt = $this->bo->edit_id($values);
+ }
+
+ $fm_ids = $this->bo->read_fm_id();
+
+ for ($i=0;$i<count($fm_ids);$i++)
+ {
+
+ $content[] = array
+ (
+ 'descr' => $fm_ids[$i]['descr'],
+ 'value' => $fm_ids[$i]['value'],
+ 'remark' =>
$fm_ids[$i]['remark'],
+ 'key_id' => $i
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'lang_select' => lang('Select'),
+ 'lang_descr' => lang('Descr'),
+ 'lang_value' => lang('Value'),
+ 'lang_remark' => lang('Remark'),
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.edit_id'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php'),
+ 'lang_submit' =>
lang('submit'),
+ 'lang_save' =>
lang('Edit'),
+ 'lang_add_statustext' => lang('Edit ID'),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_statustext' => lang('Back to
Admin'),
+ 'lang_select' =>
lang('Select'),
+ 'lang_descr' =>
lang('Descr'),
+ 'lang_value' =>
lang('Value'),
+ 'lang_remark' =>
lang('Remark'),
+ 'id_table_header' =>
$table_header,
+ 'id_values' =>
$content,
+ );
+
+ $appname
= lang('ID');
+ $function_msg =
lang('edit ID');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_id' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function contact_info()
+ {
+ $GLOBALS['phpgw']->xslttpl->add_file(array('admin'));
+
+ $values = get_var('values',array('POST'));
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->preferences->account_id=$this->filter;
+
$GLOBALS['phpgw']->preferences->read_repository();
+
+ if ($values['old_email'] != $values['email'])
+ {
+
$GLOBALS['phpgw']->preferences->add($this->currentapp,"email",$values['email'],'user');
+ $receipt['message'][] = array('msg' =>
lang('Users email is updated'));
+ }
+ if ($values['old_phone'] != $values['phone'])
+ {
+
$GLOBALS['phpgw']->preferences->add($this->currentapp,"cellphone",$values['phone'],'user');
+ $receipt['message'][] = array('msg' =>
lang('Users phone is updated'));
+ }
+ if ($values['old_approval_from'] !=
$values['approval_from'])
+ {
+
$GLOBALS['phpgw']->preferences->add($this->currentapp,"approval_from",$values['approval_from'],'user');
+ $receipt['message'][] = array('msg' =>
lang('Approval from is updated'));
+ }
+ if ($values['old_default_vendor_category'] !=
$values['default_vendor_category'])
+ {
+
$GLOBALS['phpgw']->preferences->add($this->currentapp,"default_vendor_category",$values['default_vendor_category'],'user');
+ $receipt['message'][] = array('msg' =>
lang('default vendor category is updated'));
+ }
+
$GLOBALS['phpgw']->preferences->save_repository();
+ }
+
+ if($this->filter)
+ {
+ $prefs =
$this->bocommon->create_preferences($this->currentapp,$this->filter);
+ }
+
+ $cats = CreateObject('phpgwapi.categories');
+ $cats->app_name = 'fm_vendor';
+
+ $cat_data =
$cats->formatted_xslt_list(array('selected' =>
$prefs['default_vendor_category'],'globals' => True, 'link_data' =>array()));
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin.contact_info'),
+ 'done_action'
=> $GLOBALS['phpgw']->link('/admin/index.php'),
+ 'lang_submit'
=> lang('submit'),
+ 'lang_save'
=> lang('Edit'),
+ 'lang_add_statustext' =>
lang('Edit ID'),
+ 'lang_done'
=> lang('done'),
+ 'lang_done_statustext' =>
lang('Back to Admin'),
+
+ 'lang_email_statustext' =>
lang('Enter the email-address for this user'),
+
+ 'lang_user'
=> lang('User'),
+ 'lang_email'
=> lang('Email'),
+ 'value_old_email'
=> $prefs['email'],
+ 'value_email'
=> $prefs['email'],
+
+ 'lang_phone'
=> lang('Phone'),
+ 'value_old_phone'
=> $prefs['cellphone'],
+ 'value_phone'
=> $prefs['cellphone'],
+
+ 'lang_approval_from' =>
lang('Approval from'),
+ 'value_old_approval_from' =>
$prefs['approval_from'],
+ 'approval_from'
=>
$this->bocommon->get_user_list('select',$prefs['approval_from'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+
+ 'select_user_name'
=> 'approval_from',
+ 'lang_approval_from_statustext' => lang('Select
the users supervisor'),
+
+ 'lang_default_vendor_category' =>
lang('default vendor category'),
+ 'value_old_default_vendor_category' =>
$prefs['default_vendor_category'],
+ 'vendor_category'
=> $cat_data['cat_list'],
+ 'select_user_name'
=> 'approval_from',
+ 'lang_default_vendor_category_statustext'
=> lang('Select default vendor category'),
+ 'lang_no_cat'
=> lang('No category'),
+
+
+ 'lang_user_statustext' =>
lang('Select the user to edit email'),
+ 'select_user_name'
=> 'filter',
+ 'lang_no_user'
=> lang('No user'),
+ 'value_user_id'
=> $this->filter,
+ 'user_list'
=>
$this->bocommon->get_user_list('filter',$this->filter,$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+ );
+
+ $appname
= lang('User contact info');
+ $function_msg
= lang('edit info');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('contact_info' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ }
+?>
Index: property/inc/class.uiadmin_entity.inc.php
diff -u property/inc/class.uiadmin_entity.inc.php:1.13
property/inc/class.uiadmin_entity.inc.php:1.14
--- property/inc/class.uiadmin_entity.inc.php:1.13 Mon Jan 30 22:14:19 2006
+++ property/inc/class.uiadmin_entity.inc.php Fri Feb 3 12:05:49 2006
@@ -10,7 +10,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage admin
- * @version $Id: class.uiadmin_entity.inc.php,v 1.13 2006/01/30 22:14:19
sigurdne Exp $
+ * @version $Id: class.uiadmin_entity.inc.php,v 1.14 2006/02/03 12:05:49
sigurdne Exp $
*/
/**
@@ -1039,6 +1039,10 @@
$cat_id = get_var('cat_id',array('POST','GET'));
$id =
get_var('id',array('POST','GET'));
$values = get_var('values',array('POST'));
+ if(!$values)
+ {
+ $values=array();
+ }
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_entity'));
Index: property/inc/class.uiadmin_location.inc.php
diff -u property/inc/class.uiadmin_location.inc.php:1.10
property/inc/class.uiadmin_location.inc.php:1.11
--- property/inc/class.uiadmin_location.inc.php:1.10 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uiadmin_location.inc.php Fri Feb 3 12:05:49 2006
@@ -1,787 +1,791 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uiadmin_location.inc.php,v 1.10 2006/01/27
14:05:43 sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uiadmin_location
- {
- var $grants;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'config' => True,
- 'edit_config' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'list_attribute' => True,
- 'edit_attrib' => True,
- );
-
- function uiadmin_location()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject($this->currentapp.'.boadmin_location',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->allrows =
$this->bo->allrows;
-
- $this->menu->sub ='adm_loc';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
-
- $this->bo->reset_fm_cache();
- $GLOBALS['phpgw']->xslttpl->add_file(array(
-
'admin_location',
-
'nextmatchs',
-
'menu',
-
'search_field'));
- $links = $this->menu->links('loc_type');
-
- $standard_list = $this->bo->read();
-
- while (is_array($standard_list) && list(,$standard) =
each($standard_list))
- {
- $words = split(' ',$standard['descr']);
- $first = "$words[0] $words[1] $words[2]
$words[3]";
-
- $content[] = array
- (
- 'id'
=> $standard['id'],
- 'name'
=> $standard['name'],
- 'prefix'
=> $standard['prefix'],
- 'first'
=> $first,
- 'link_categories'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.index&type=location&type_id='
. $standard['id']),
- 'link_attribute'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.list_attribute&type_id='
. $standard['id']),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit&id='
. $standard['id']),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.delete&id='
. $standard['id']),
- 'lang_view_standardtext' =>
lang('view the standard'),
- 'lang_category_text' =>
lang('categories for the location type'),
- 'lang_attribute_standardtext' =>
lang('attributes for the location type'),
- 'lang_edit_standardtext' =>
lang('edit the standard'),
- 'lang_delete_standardtext' =>
lang('delete the standard'),
- 'text_categories'
=> lang('Categories'),
- 'text_attribute'
=> lang('Attributes'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
-//_debug_array($content);
-
- $table_header[] = array
- (
-
- 'lang_descr' => lang('Descr'),
- 'lang_prefix' => lang('prefix'),
- 'lang_categories' => lang('Categories'),
- 'lang_attribute' => lang('Attributes'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.index')
-
)),
- 'lang_id' => lang('standard id'),
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.index')
-
)),
- 'lang_name' => lang('Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_standardtext' => lang('add a
standard'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit'),
- 'lang_done' =>
lang('done'),
- 'lang_done_standardtext' => lang('back
to admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
- );
-
-
- $data = array
- (
- 'links'
=> $links,
- 'allow_allrows'
=> False,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($standard_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('location');
- $function_msg =
lang('list location standard');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit()
- {
- $id = get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_location'));
-
- if ($values['save'])
- {
- if (!$values['name'])
- {
- $receipt['error'][] =
array('msg'=>lang('Name not entered!'));
- }
-
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
-
- if (!$receipt['error'])
- {
-
- $receipt =
$this->bo->save($values,$action);
- if(!$id)
- {
- $id=$receipt['id'];
- }
- }
- else
- {
- $receipt['error'][] = array('msg'=>
lang('Table has NOT been saved'));
- }
-
- }
-
- if ($id)
- {
- $values = $this->bo->read_single($id);
- $function_msg = lang('edit standard');
- $action='edit';
- }
- else
- {
- $function_msg = lang('add standard');
- $action='add';
- }
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiadmin_location.edit',
- 'id' => $id
- );
-//_debug_array($link_data);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'lang_prefix'
=> lang('Standard prefix'),
- 'lang_prefix_standardtext' =>
lang('Enter a standard prefix for the id'),
- 'lang_name_standardtext' =>
lang('Enter a name of the standard'),
-
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
- 'lang_id'
=> lang('standard ID'),
- 'lang_name'
=> lang('Name'),
- 'lang_descr'
=> lang('Descr'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
- 'value_name'
=> $values['name'],
- 'value_prefix'
=> $values['prefix'],
- 'lang_id_standardtext' =>
lang('Enter the standard ID'),
- 'lang_descr_standardtext' =>
lang('Enter a description of the standard'),
- 'lang_done_standardtext' =>
lang('Back to the list'),
- 'lang_save_standardtext' =>
lang('Save the standard'),
- 'type_id'
=> $values['type_id'],
- 'value_descr'
=> $values['descr']
- );
-
- $appname
= lang('location');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- $attrib = get_var('attrib',array('POST','GET'));
- $type_id =
get_var('type_id',array('POST','GET'));
- $id =
get_var('id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- if($attrib)
- {
- $function='list_attribute';
- }
- else
- {
- $function='index';
- }
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiadmin_location.'.$function,
- 'type_id' => $type_id
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($type_id,$id,$attrib);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.delete&id='
. $id.'&attrib='.$attrib.'&type_id='.$type_id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_standardtext' => lang('Delete the
entry'),
- 'lang_no_standardtext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('location');
- $function_msg =
lang('delete location standard');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function list_attribute()
- {
- $type_id =
get_var('type_id',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $resort = get_var('resort',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array(
-
'admin_location',
-
'nextmatchs',
-
'search_field'));
-
- if($resort)
- {
-
$this->bo->resort_attrib(array('resort'=>$resort,'type_id' =>
$type_id,'id'=>$id));
- }
-
- $attrib_list = $this->bo->read_attrib($type_id);
-
- while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
- {
- $content[] = array
- (
- 'name'
=> $attrib['name'],
- 'type_name'
=> $attrib['type_name'],
- 'datatype'
=> $attrib['datatype'],
- 'column_name'
=> $attrib['column_name'],
- 'input_text'
=> $attrib['input_text'],
- 'sorting'
=> $attrib['attrib_sort'],
- 'link_up'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.list_attribute&resort=up&id='
. $attrib['id'].'&type_id='.$type_id . '&allrows=' . $this->allrows),
- 'link_down'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.list_attribute&resort=down&id='
. $attrib['id'].'&type_id='.$type_id . '&allrows=' . $this->allrows),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit_attrib&id='
. $attrib['id'].'&type_id='.$type_id),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.delete&id='
. $attrib['id'].'&type_id='.$type_id.'&attrib=true'),
- 'lang_view_attribtext' =>
lang('view the attrib'),
- 'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang('location'),
- 'lang_edit_attribtext' =>
lang('edit the attrib'),
- 'lang_delete_attribtext' =>
lang('delete the attrib'),
- 'text_attribute'
=> lang('Attributes'),
- 'text_up'
=> lang('up'),
- 'text_down'
=> lang('down'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
-//_debug_array($content);
-
- $table_header[] = array
- (
- 'lang_type_name' => lang('Type'),
- 'lang_descr' => lang('Descr'),
- 'lang_datatype' => lang('Datatype'),
- 'lang_sorting' => lang('sorting'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_sorting' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'attrib_sort',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.list_attribute',
-
'type_id'
=>$type_id,
-
'allrows'=>$this->allrows)
-
)),
-
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'column_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.list_attribute',
-
'type_id'
=>$type_id,
-
'allrows'=>$this->allrows)
-
)),
- 'lang_name' => lang('Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_attribtext' => lang('add a attrib'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit_attrib&type_id='.$type_id),
- 'lang_done' =>
lang('done'),
- 'lang_done_attribtext' => lang('back to
admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiadmin_location.list_attribute',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'query'
=>$this->query,
- 'type_id'
=>$type_id
- );
-
- $data = array
- (
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($attrib_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_attribtext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_attrib' =>
$table_header,
- 'values_attrib'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('attribute');
- $function_msg =
lang('list location attribute');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit_attrib()
- {
- $type_id =
get_var('type_id',array('POST','GET'));
- $id =
get_var('id',array('POST','GET'));
- $values = get_var('values',array('POST'));
-
-//_debug_array($values);
-
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_location'));
-
- if ($values['save'])
- {
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- $type_id =
$values['type_id'];
-
- if (!$values['column_name'])
- {
- $receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
- }
-
- if (!$values['input_text'])
- {
- $receipt['error'][] =
array('msg'=>lang('Input text not entered!'));
- }
- if (!$values['statustext'])
- {
- $receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
- }
-
- if (!$values['type_id'])
- {
- $receipt['error'][] =
array('msg'=>lang('Location type not choosen!'));
- }
-
- if (!$values['column_info']['type'])
- {
- $receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
- }
-
-
if(!ctype_digit($values['column_info']['precision']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
-
unset($values['column_info']['precision']);
- }
-
-
if(!ctype_digit($values['column_info']['scale']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
- unset($values['column_info']['scale']);
- }
-
- if (!$values['column_info']['nullable'])
- {
- $receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
- }
-
-
- if (!$receipt['error'])
- {
-
- $receipt =
$this->bo->save_attrib($values,$action);
-
- if(!$id)
- {
- $id=$receipt['id'];
- }
- }
- else
- {
- $receipt['error'][] = array('msg'
=> lang('Attribute has NOT been saved'));
- }
-
- }
-
- if ($id)
- {
- $values =
$this->bo->read_single_attrib($type_id,$id);
- $type_name=$attrib['type_name'];
- $function_msg = lang('edit attribute'). ' ' .
lang($type_name);
- $action='edit';
- }
- else
- {
- $function_msg = lang('add attribute');
- $action='add';
- }
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiadmin_location.edit_attrib',
- 'id' => $id
- );
-//_debug_array($values);
-
- if($values['column_info']['type']=='R' ||
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
- {
- $multiple_choice= True;
- }
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'lang_choice' =>
lang('Choice'),
- 'lang_new_value' =>
lang('New value'),
- 'lang_new_value_statustext' => lang('New
value for mulitple choice'),
- 'multiple_choice' =>
$multiple_choice,
- 'value_choice' =>
$values['choice'],
- 'lang_delete_value' =>
lang('Delete value'),
- 'lang_value' =>
lang('value'),
- 'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
-
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.list_attribute&type_id='.$type_id),
- 'lang_id'
=> lang('Attribute ID'),
- 'lang_location_type' =>
lang('Type'),
- 'lang_no_location_type' => lang('No
entity type'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
-
- 'lang_column_name'
=> lang('Column name'),
- 'value_column_name'
=> $values['column_name'],
- 'lang_column_name_statustext' => lang('enter
the name for the column'),
-
- 'lang_input_text'
=> lang('input text'),
- 'value_input_text'
=> $values['input_text'],
- 'lang_input_name_statustext' => lang('enter
the input text for records'),
-
- 'lang_id_attribtext' => lang('Enter
the attribute ID'),
- 'lang_entity_statustext' => lang('Select
a entity type'),
-
- 'lang_statustext' =>
lang('Statustext'),
- 'lang_statustext_attribtext'=> lang('Enter a
statustext for the inputfield in forms'),
- 'value_statustext' =>
$values['statustext'],
-
- 'lang_done_attribtext' => lang('Back
to the list'),
- 'lang_save_attribtext' => lang('Save
the attribute'),
- 'type_id'
=> $values['type_id'],
- 'entity_list' =>
$this->bo->select_location_type($type_id),
- 'select_location_type' =>
'values[type_id]',
- 'lang_datatype' =>
lang('Datatype'),
- 'lang_datatype_statustext' => lang('Select
a datatype'),
- 'lang_no_datatype' =>
lang('No datatype'),
- 'datatype_list' =>
$this->bocommon->select_datatype($values['column_info']['type']),
-
- 'lang_precision' =>
lang('Precision'),
- 'lang_precision_statustext' => lang('enter
the record length'),
- 'value_precision' =>
$values['column_info']['precision'],
-
- 'lang_scale' =>
lang('scale'),
- 'lang_scale_statustext' => lang('enter
the scale if type is decimal'),
- 'value_scale' =>
$values['column_info']['scale'],
-
- 'lang_default' =>
lang('default'),
- 'lang_default_statustext' => lang('enter
the default value'),
- 'value_default' =>
$values['column_info']['default'],
-
- 'lang_nullable' =>
lang('Nullable'),
- 'lang_nullable_statustext' => lang('Chose
if this column is nullable'),
- 'lang_select_nullable' => lang('Select
nullable'),
- 'nullable_list' =>
$this->bocommon->select_nullable($values['column_info']['nullable']),
- 'value_lookup_form' =>
$values['lookup_form'],
- 'lang_lookup_form'
=> lang('show in lookup forms'),
- 'lang_lookup_form_statustext'
=> lang('check to show this attribue in lookup forms'),
- 'value_list' =>
$values['list'],
- 'lang_list' =>
lang('show in list'),
- 'lang_list_statustext' =>
lang('check to show this attribute in location list')
- );
-//_debug_array($data);
-
- $appname
= lang('location');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function config()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array(
-
'admin_location',
-
'nextmatchs',
-
'menu',
-
'search_field'));
- $links = $this->menu->links('loc_config');
-
- $standard_list = $this->bo->read_config();
-
- while (is_array($standard_list) && list(,$standard) =
each($standard_list))
- {
- $content[] = array
- (
- 'column_name'
=> $standard['column_name'],
- 'name'
=> $standard['location_name'],
- 'prefix'
=> $standard['prefix'],
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit_config&column_name='
. $standard['column_name']),
- 'lang_edit_standardtext' =>
lang('edit the column relation'),
- 'text_edit'
=> lang('edit')
- );
- }
-
-//_debug_array($content);
-
- $table_header[] = array
- (
-
- 'lang_attribute' => lang('Attributes'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_column_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'column_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.config')
-
)),
- 'lang_column_name' => lang('column name'),
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.config')
-
)),
- 'lang_name' => lang('Table Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_standardtext' => lang('add a
standard'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit'),
- 'lang_done' =>
lang('done'),
- 'lang_done_standardtext' => lang('back
to admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
- );
-
-
- $data = array
- (
- 'links'
=> $links,
- 'allow_allrows'
=> False,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($standard_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_list_config' =>
$table_header,
- 'values_list_config' =>
$content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('location');
- $function_msg =
lang('list config');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_config' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit_config()
- {
- $column_name =
get_var('column_name',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_location'));
-
- if ($values['save'])
- {
-
- if (!$receipt['error'])
- {
-
- $receipt =
$this->bo->save_config($values,$column_name);
- }
-
- }
-
- $type_id =
$this->bo->read_config_single($column_name);
-
- $function_msg = lang('edit location config for') . ' '
.$column_name;
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiadmin_location.edit_config',
- 'column_name' => $column_name
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.config'),
-
- 'lang_column_name'
=> lang('Column name'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'column_name'
=> $column_name,
- 'value_name'
=> $values['name'],
-
- 'location_list'
=> $this->bo->select_location_type($type_id),
-
- 'lang_config_statustext' =>
lang('Select the level for this information'),
- 'lang_done_standardtext' =>
lang('Back to the list'),
- 'lang_save_standardtext' =>
lang('Save the standard'),
- 'type_id'
=> $values['type_id'],
- 'value_descr'
=> $values['descr']
- );
-
- $appname
= lang('location');
-
-//_debug_array($data);
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_config' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uiadmin_location.inc.php,v 1.11 2006/02/03
12:05:49 sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uiadmin_location
+ {
+ var $grants;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'config' => True,
+ 'edit_config' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'list_attribute' => True,
+ 'edit_attrib' => True,
+ );
+
+ function uiadmin_location()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bo =
CreateObject($this->currentapp.'.boadmin_location',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->allrows =
$this->bo->allrows;
+
+ $this->menu->sub ='adm_loc';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+
+ $this->bo->reset_fm_cache();
+ $GLOBALS['phpgw']->xslttpl->add_file(array(
+
'admin_location',
+
'nextmatchs',
+
'menu',
+
'search_field'));
+ $links = $this->menu->links('loc_type');
+
+ $standard_list = $this->bo->read();
+
+ while (is_array($standard_list) && list(,$standard) =
each($standard_list))
+ {
+ $words = split(' ',$standard['descr']);
+ $first = "$words[0] $words[1] $words[2]
$words[3]";
+
+ $content[] = array
+ (
+ 'id' =>
$standard['id'],
+ 'name' =>
$standard['name'],
+ 'prefix' =>
$standard['prefix'],
+ 'first' =>
$first,
+ 'link_categories' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.index&type=location&type_id='
. $standard['id']),
+ 'link_attribute' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.list_attribute&type_id='
. $standard['id']),
+ 'link_edit' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit&id='
. $standard['id']),
+ 'link_delete' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.delete&id='
. $standard['id']),
+ 'lang_view_standardtext' =>
lang('view the standard'),
+ 'lang_category_text' =>
lang('categories for the location type'),
+ 'lang_attribute_standardtext' =>
lang('attributes for the location type'),
+ 'lang_edit_standardtext' =>
lang('edit the standard'),
+ 'lang_delete_standardtext' =>
lang('delete the standard'),
+ 'text_categories' =>
lang('Categories'),
+ 'text_attribute' =>
lang('Attributes'),
+ 'text_edit' =>
lang('edit'),
+ 'text_delete' =>
lang('delete')
+ );
+ }
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+
+ 'lang_descr' => lang('Descr'),
+ 'lang_prefix' => lang('prefix'),
+ 'lang_categories' => lang('Categories'),
+ 'lang_attribute' => lang('Attributes'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.index')
+
)),
+ 'lang_id' => lang('standard id'),
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.index')
+
)),
+ 'lang_name' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' => lang('add'),
+ 'lang_add_standardtext' => lang('add a
standard'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit'),
+ 'lang_done' => lang('done'),
+ 'lang_done_standardtext'=> lang('back to
admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
+ );
+
+
+ $data = array
+ (
+ 'links'
=> $links,
+ 'allow_allrows'
=> False,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($standard_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname = lang('location');
+ $function_msg = lang('list location
standard');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_location'));
+
+ if ($values['save'])
+ {
+ if (!$values['name'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Name not entered!'));
+ }
+
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+
+ if (!$receipt['error'])
+ {
+
+ $receipt =
$this->bo->save($values,$action);
+ if(!$id)
+ {
+ $id=$receipt['id'];
+ }
+ }
+ else
+ {
+ $receipt['error'][] = array('msg'=>
lang('Table has NOT been saved'));
+ }
+
+ }
+
+ if ($id)
+ {
+ $values = $this->bo->read_single($id);
+ $function_msg = lang('edit standard');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add standard');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiadmin_location.edit',
+ 'id' => $id
+ );
+//_debug_array($link_data);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_prefix' =>
lang('Standard prefix'),
+ 'lang_prefix_standardtext' =>
lang('Enter a standard prefix for the id'),
+ 'lang_name_standardtext' =>
lang('Enter a name of the standard'),
+
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
+ 'lang_id' =>
lang('standard ID'),
+ 'lang_name' =>
lang('Name'),
+ 'lang_descr' =>
lang('Descr'),
+ 'lang_save' =>
lang('save'),
+ 'lang_done' =>
lang('done'),
+ 'value_id' => $id,
+ 'value_name' =>
$values['name'],
+ 'value_prefix' =>
$values['prefix'],
+ 'lang_id_standardtext' =>
lang('Enter the standard ID'),
+ 'lang_descr_standardtext' =>
lang('Enter a description of the standard'),
+ 'lang_done_standardtext' =>
lang('Back to the list'),
+ 'lang_save_standardtext' =>
lang('Save the standard'),
+ 'type_id' =>
$values['type_id'],
+ 'value_descr' =>
$values['descr']
+ );
+
+ $appname =
lang('location');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ $attrib = get_var('attrib',array('POST','GET'));
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ if($attrib)
+ {
+ $function='list_attribute';
+ }
+ else
+ {
+ $function='index';
+ }
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiadmin_location.'.$function,
+ 'type_id' => $type_id
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($type_id,$id,$attrib);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.delete&id='
. $id.'&attrib='.$attrib.'&type_id='.$type_id),
+ 'lang_confirm_msg' => lang('do you really
want to delete this entry'),
+ 'lang_yes' => lang('yes'),
+ 'lang_yes_standardtext' => lang('Delete the
entry'),
+ 'lang_no_standardtext' => lang('Back to the
list'),
+ 'lang_no' => lang('no')
+ );
+
+ $appname = lang('location');
+ $function_msg = lang('delete location
standard');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function list_attribute()
+ {
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $resort = get_var('resort',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array(
+
'admin_location',
+ 'nextmatchs',
+
'search_field'));
+
+ if($resort)
+ {
+
$this->bo->resort_attrib(array('resort'=>$resort,'type_id' =>
$type_id,'id'=>$id));
+ }
+
+ $attrib_list = $this->bo->read_attrib($type_id);
+
+ while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
+ {
+ $content[] = array
+ (
+ 'name' =>
$attrib['name'],
+ 'type_name' =>
$attrib['type_name'],
+ 'datatype' =>
$attrib['datatype'],
+ 'column_name' =>
$attrib['column_name'],
+ 'input_text' =>
$attrib['input_text'],
+ 'sorting' =>
$attrib['attrib_sort'],
+ 'link_up' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.list_attribute&resort=up&id='
. $attrib['id'].'&type_id='.$type_id . '&allrows=' . $this->allrows),
+ 'link_down' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.list_attribute&resort=down&id='
. $attrib['id'].'&type_id='.$type_id . '&allrows=' . $this->allrows),
+ 'link_edit' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit_attrib&id='
. $attrib['id'].'&type_id='.$type_id),
+ 'link_delete' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.delete&id='
. $attrib['id'].'&type_id='.$type_id.'&attrib=true'),
+ 'lang_view_attribtext' =>
lang('view the attrib'),
+ 'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang('location'),
+ 'lang_edit_attribtext' =>
lang('edit the attrib'),
+ 'lang_delete_attribtext' =>
lang('delete the attrib'),
+ 'text_attribute' =>
lang('Attributes'),
+ 'text_up' =>
lang('up'),
+ 'text_down' =>
lang('down'),
+ 'text_edit' =>
lang('edit'),
+ 'text_delete' =>
lang('delete')
+ );
+ }
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+ 'lang_type_name' => lang('Type'),
+ 'lang_descr' => lang('Descr'),
+ 'lang_datatype' => lang('Datatype'),
+ 'lang_sorting' => lang('sorting'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_sorting' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'attrib_sort',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.list_attribute',
+
'type_id' =>$type_id,
+
'allrows'=>$this->allrows)
+
)),
+
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'column_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.list_attribute',
+
'type_id' =>$type_id,
+
'allrows'=>$this->allrows)
+
)),
+ 'lang_name' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_attribtext' => lang('add a attrib'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit_attrib&type_id='.$type_id),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_attribtext' => lang('back to
admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiadmin_location.list_attribute',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'query'
=>$this->query,
+ 'type_id'
=>$type_id
+ );
+
+ $data = array
+ (
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($attrib_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_attribtext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_attrib' =>
$table_header,
+ 'values_attrib'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname =
lang('attribute');
+ $function_msg =
lang('list location attribute');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit_attrib()
+ {
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+ if(!$values)
+ {
+ $values = array();
+ }
+
+//_debug_array($values);
+
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_location'));
+
+ if ($values['save'])
+ {
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ $type_id =
$values['type_id'];
+
+ if (!$values['column_name'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
+ }
+
+ if (!$values['input_text'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Input text not entered!'));
+ }
+ if (!$values['statustext'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
+ }
+
+ if (!$values['type_id'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Location type not choosen!'));
+ }
+
+ if (!$values['column_info']['type'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
+ }
+
+
if(!ctype_digit($values['column_info']['precision']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
+
unset($values['column_info']['precision']);
+ }
+
+ if($values['column_info']['scale'] &&
!ctype_digit($values['column_info']['scale']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
+ unset($values['column_info']['scale']);
+ }
+
+ if (!$values['column_info']['nullable'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
+ }
+
+
+ if (!$receipt['error'])
+ {
+
+ $receipt =
$this->bo->save_attrib($values,$action);
+
+ if(!$id)
+ {
+ $id=$receipt['id'];
+ }
+ }
+ else
+ {
+ $receipt['error'][] = array('msg'
=> lang('Attribute has NOT been saved'));
+ }
+
+ }
+
+ if ($id)
+ {
+ $values =
$this->bo->read_single_attrib($type_id,$id);
+ $type_name=$attrib['type_name'];
+ $function_msg = lang('edit attribute'). ' ' .
lang($type_name);
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add attribute');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiadmin_location.edit_attrib',
+ 'id' => $id
+ );
+//_debug_array($values);
+
+ if($values['column_info']['type']=='R' ||
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
+ {
+ $multiple_choice= True;
+ }
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'lang_choice' =>
lang('Choice'),
+ 'lang_new_value' =>
lang('New value'),
+ 'lang_new_value_statustext' => lang('New
value for mulitple choice'),
+ 'multiple_choice' =>
$multiple_choice,
+ 'value_choice' =>
$values['choice'],
+ 'lang_delete_value' =>
lang('Delete value'),
+ 'lang_value' =>
lang('value'),
+ 'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
+
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.list_attribute&type_id='.$type_id),
+ 'lang_id' =>
lang('Attribute ID'),
+ 'lang_location_type' =>
lang('Type'),
+ 'lang_no_location_type' => lang('No
entity type'),
+ 'lang_save' =>
lang('save'),
+ 'lang_done' =>
lang('done'),
+ 'value_id' => $id,
+
+ 'lang_column_name' =>
lang('Column name'),
+ 'value_column_name' =>
$values['column_name'],
+ 'lang_column_name_statustext' => lang('enter
the name for the column'),
+
+ 'lang_input_text' =>
lang('input text'),
+ 'value_input_text' =>
$values['input_text'],
+ 'lang_input_name_statustext' => lang('enter
the input text for records'),
+
+ 'lang_id_attribtext' => lang('Enter
the attribute ID'),
+ 'lang_entity_statustext' => lang('Select
a entity type'),
+
+ 'lang_statustext' =>
lang('Statustext'),
+ 'lang_statustext_attribtext'=> lang('Enter a
statustext for the inputfield in forms'),
+ 'value_statustext' =>
$values['statustext'],
+
+ 'lang_done_attribtext' => lang('Back
to the list'),
+ 'lang_save_attribtext' => lang('Save
the attribute'),
+ 'type_id'
=> $values['type_id'],
+ 'entity_list' =>
$this->bo->select_location_type($type_id),
+ 'select_location_type' =>
'values[type_id]',
+ 'lang_datatype' =>
lang('Datatype'),
+ 'lang_datatype_statustext' => lang('Select
a datatype'),
+ 'lang_no_datatype' =>
lang('No datatype'),
+ 'datatype_list' =>
$this->bocommon->select_datatype($values['column_info']['type']),
+
+ 'lang_precision' =>
lang('Precision'),
+ 'lang_precision_statustext' => lang('enter
the record length'),
+ 'value_precision' =>
$values['column_info']['precision'],
+
+ 'lang_scale' =>
lang('scale'),
+ 'lang_scale_statustext' => lang('enter
the scale if type is decimal'),
+ 'value_scale' =>
$values['column_info']['scale'],
+
+ 'lang_default' =>
lang('default'),
+ 'lang_default_statustext' => lang('enter
the default value'),
+ 'value_default' =>
$values['column_info']['default'],
+
+ 'lang_nullable' =>
lang('Nullable'),
+ 'lang_nullable_statustext' => lang('Chose
if this column is nullable'),
+ 'lang_select_nullable' => lang('Select
nullable'),
+ 'nullable_list' =>
$this->bocommon->select_nullable($values['column_info']['nullable']),
+ 'value_lookup_form' =>
$values['lookup_form'],
+ 'lang_lookup_form' =>
lang('show in lookup forms'),
+ 'lang_lookup_form_statustext' =>
lang('check to show this attribue in lookup forms'),
+ 'value_list' =>
$values['list'],
+ 'lang_list' =>
lang('show in list'),
+ 'lang_list_statustext' =>
lang('check to show this attribute in location list')
+ );
+//_debug_array($data);
+
+ $appname
= lang('location');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function config()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array(
+
'admin_location',
+
'nextmatchs',
+
'menu',
+
'search_field'));
+ $links = $this->menu->links('loc_config');
+
+ $standard_list = $this->bo->read_config();
+
+ while (is_array($standard_list) && list(,$standard) =
each($standard_list))
+ {
+ $content[] = array
+ (
+ 'column_name'
=> $standard['column_name'],
+ 'name'
=> $standard['location_name'],
+ 'prefix'
=> $standard['prefix'],
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit_config&column_name='
. $standard['column_name']),
+ 'lang_edit_standardtext' =>
lang('edit the column relation'),
+ 'text_edit'
=> lang('edit')
+ );
+ }
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+
+ 'lang_attribute' => lang('Attributes'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_column_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'column_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.config')
+
)),
+ 'lang_column_name' => lang('column name'),
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiadmin_location.config')
+
)),
+ 'lang_name' => lang('Table Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_standardtext' => lang('add a
standard'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.edit'),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_standardtext' => lang('back
to admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
+ );
+
+
+ $data = array
+ (
+ 'links'
=> $links,
+ 'allow_allrows'
=> False,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($standard_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.index'),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_list_config' =>
$table_header,
+ 'values_list_config' =>
$content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('location');
+ $function_msg =
lang('list config');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_config' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit_config()
+ {
+ $column_name =
get_var('column_name',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_location'));
+
+ if ($values['save'])
+ {
+
+ if (!$receipt['error'])
+ {
+
+ $receipt =
$this->bo->save_config($values,$column_name);
+ }
+
+ }
+
+ $type_id =
$this->bo->read_config_single($column_name);
+
+ $function_msg = lang('edit location config for') . ' '
.$column_name;
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiadmin_location.edit_config',
+ 'column_name' => $column_name
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiadmin_location.config'),
+
+ 'lang_column_name'
=> lang('Column name'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'column_name'
=> $column_name,
+ 'value_name'
=> $values['name'],
+
+ 'location_list'
=> $this->bo->select_location_type($type_id),
+
+ 'lang_config_statustext' =>
lang('Select the level for this information'),
+ 'lang_done_standardtext' =>
lang('Back to the list'),
+ 'lang_save_standardtext' =>
lang('Save the standard'),
+ 'type_id'
=> $values['type_id'],
+ 'value_descr'
=> $values['descr']
+ );
+
+ $appname
= lang('location');
+
+//_debug_array($data);
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_config' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ }
+?>
Index: property/inc/class.uiagreement.inc.php
diff -u property/inc/class.uiagreement.inc.php:1.17
property/inc/class.uiagreement.inc.php:1.18
--- property/inc/class.uiagreement.inc.php:1.17 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uiagreement.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1930 +1,1930 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 agreement
- * @version $Id: class.uiagreement.inc.php,v 1.17 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uiagreement
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'list_attribute'=> True,
- 'edit_attrib' => True,
- 'columns' => True,
- 'edit_item' => True,
- 'view_item' => True,
- 'view_file' => True,
- 'excel' => True,
- 'add_activity' => True
- );
-
- function uiagreement()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.boagreement',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->role = $this->bo->role;
-
- $this->cats =
CreateObject('phpgwapi.categories');
- $this->cats->app_name = 'fm_vendor';
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location= '.pricebook';
-
- $this->acl_read =
$this->acl2->check($this->acl2_location,1);
- $this->acl_add =
$this->acl2->check($this->acl2_location,2);
- $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
- $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
- $this->acl_manage =
$this->acl2->check($this->acl2_location,16);
-
- $this->start = $this->bo->start;
- $this->query = $this->bo->query;
- $this->sort = $this->bo->sort;
- $this->order = $this->bo->order;
- $this->filter = $this->bo->filter;
- $this->cat_id = $this->bo->cat_id;
- $this->vendor_id = $this->bo->vendor_id;
- $this->allrows = $this->bo->allrows;
- $this->member_id = $this->bo->member_id;
- $this->fakebase = $this->bo->fakebase;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'vendor_id' => $this->vendor_id,
- 'allrows' => $this->allrows,
- 'member_id' => $this->member_id
- );
- $this->bo->save_sessiondata($data);
- }
-
- function columns()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
-
- $GLOBALS['phpgw_info']['flags']['noframework'] = True;
-
- $values =
get_var('values',array('POST','GET'));
-
- if ($values['save'])
- {
-
-
$GLOBALS['phpgw']->preferences->account_id=$this->account;
-
$GLOBALS['phpgw']->preferences->read_repository();
-
$GLOBALS['phpgw']->preferences->add($this->currentapp,'agreement_columns',$values['columns'],'user');
-
$GLOBALS['phpgw']->preferences->save_repository();
-
- $receipt['message'][] = array('msg' =>
lang('columns is updated'));
- }
-
- $function_msg = lang('Select Column');
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.columns',
- 'role' => $this->role
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'column_list' =>
$this->bo->column_list($values['columns'],$allrows=True),
- 'function_msg' => $function_msg,
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_columns' => lang('columns'),
- 'lang_none' => lang('None'),
- 'lang_save' => lang('save'),
- 'select_name' => 'period'
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
$function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view_file()
- {
- $GLOBALS['phpgw_info']['flags'][noheader] = True;
- $GLOBALS['phpgw_info']['flags'][nofooter] = True;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $file_name =
urldecode(get_var('file_name',array('POST','GET')));
- $id = get_var('id',array('POST','GET'));
-
- $file = $this->fakebase. SEP . 'agreement' . SEP . $id
. SEP . $file_name;
-
- if($this->bo->vfs->file_exists(array(
- 'string' => $file,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
-
- $size =
$this->bo->vfs->get_size(array(
- 'string' => $file,
- 'relatives' =>
Array(RELATIVE_NONE),
- 'checksubdirs' =>
True));
-
- $document= $this->bo->vfs->read(array(
- 'string' => $file,
- 'relatives' => Array(RELATIVE_NONE)));
-
- $filename =
basename($values['document_name']);
- $filetype = array_pop(explode('.',
basename($file)));
- $browser = CreateObject('phpgwapi.browser');
-
$browser->content_header($filename,$filetype,$size);
-
- echo $document;
-
- }
- }
-
- function index()
- {
- $this->menu->sub = 'agreement';
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('agreement',
-
'menu',
-
'receipt',
-
'search_field',
-
'nextmatchs',
-
'filter_member_of'));
-
- $links = $this->menu->links('agreement','agreement');
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt');
-
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt','');
-
- $list = $this->bo->read();
-
- $uicols = $this->bo->uicols;
-
- $j=0;
-
- if (isset($list) AND is_array($list))
- {
- foreach($list as $entry)
- {
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
- }
- }
-
- if($this->acl_read)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
- $content[$j]['row'][$i]['text']
= lang('view');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.view&id='
. $entry['id'] .'&role=' . $this->role);
- }
- if($this->acl_edit)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('edit the
agreement');
- $content[$j]['row'][$i]['text']
= lang('edit');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $entry['id'] .'&role=' . $this->role);
- }
- if($this->acl_delete)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('delete the
agreement');
- $content[$j]['row'][$i]['text']
= lang('delete');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.delete&agreement_id='
. $entry['id'] .'&role=' . $this->role);
- }
-
- $j++;
- }
- }
-
-//_debug_array($content);
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['datatype'][$i]!='T' &&
$uicols['datatype'][$i]!='CH')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
- (
- 'sort' =>
$this->sort,
- 'var' =>
$uicols['name'][$i],
- 'order' =>
$this->order,
- 'extra'
=> array('menuaction' => $this->currentapp.'.uiagreement.index',
-
'query' =>$this->query,
-
'lookup' =>$lookup,
-
'district_id' => $this->district_id,
-
'start_date' => $start_date,
-
'role' => $this->role,
-
'member_id' => $this->member_id,
-
'allrows' => $this->allrows,
-
'end_date' => $end_date
-
)
- ));
- }
- }
- }
-
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
-
-
- if($this->acl_add)
- {
- $table_add = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
agreement'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&role='
. $this->role)
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'role' =>
$this->role,
- 'member_id' =>
$this->member_id
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $link_columns = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.columns',
- 'role' =>
$this->role
- );
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data =>$link_data));
-
- $data = array
- (
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
- 'lang_columns'
=> lang('columns'),
- 'link_columns'
=> $GLOBALS['phpgw']->link('/index.php',$link_columns),
- 'lang_columns_help'
=> lang('Choose columns'),
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the agreement belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_no_vendor'
=> lang('no vendor'),
- 'lang_vendor_statustext' =>
lang('Select the vendor the agreement belongs to.'),
- 'vendor_list'
=> $this->bo->select_vendor_list('filter',$this->vendor_id),
-
- 'lang_no_member'
=> lang('no member'),
- 'member_of_name'
=> 'member_id',
- 'member_of_list'
=> $member_of_data['cat_list'],
-
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
- $this->save_sessiondata();
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . lang('list ' . $this->role);
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function list_content($list,$uicols,$edit_item='',$view_only='')
- {
- $j=0;
-//_debug_array($list);
- if (isset($list) AND is_array($list))
- {
- foreach($list as $entry)
- {
- $content[$j]['id']
= $entry['id'];
- $content[$j]['activity_id'] =
$entry['activity_id'];
- $content[$j]['index_count']
= $entry['index_count'];
- $content[$j]['m_cost']
= $entry['m_cost'];
- $content[$j]['w_cost']
= $entry['w_cost'];
- $content[$j]['total_cost']
= $entry['total_cost'];
- $content[$j]['index_count'] =
$entry['index_count'];
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
- }
- }
-
- if($this->acl_read && !$edit_item &&
!$view_only)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
- $content[$j]['row'][$i]['text']
= lang('view');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.view_item&agreement_id='
. $entry['agreement_id'] .'&id=' . $entry['id']);
- }
- if($this->acl_edit && !$edit_item &&
!$view_only)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('edit the
agreement');
- $content[$j]['row'][$i]['text']
= lang('edit');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_item&agreement_id='
. $entry['agreement_id'] .'&id=' . $entry['id']);
- }
- if($this->acl_delete && !$edit_item &&
!$view_only)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('delete this
item');
- $content[$j]['row'][$i]['text']
= lang('delete');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&delete_item=1&agreement_id='
. $entry['agreement_id'] .'&activity_id=' . $entry['id']);
- }
-
- $j++;
- }
- }
-
-//html_print_r($content);
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- }
- }
-
- if($this->acl_read && !$edit_item && !$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit && !$edit_item && !$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete && !$edit_item && !$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
- if($this->acl_manage && !$edit_item && !$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('Update');
- $i++;
- }
-
- return
array('content'=>$content,'table_header'=>$table_header);
- }
-
- function add_activity()
- {
- $agreement_id =
get_var('agreement_id',array('POST','GET'));
- $group_id =
get_var('group_id',array('POST','GET'));
- $values = get_var('values',array('POST','GET'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement'));
-
- $agreement =
$this->bo->read_single(array('agreement_id'=>$agreement_id));
-
- if($this->acl_add && (is_array($values)))
- {
- if ($values['save'] || $values['apply'])
- {
- $receipt =
$this->bo->add_activity($values,$agreement_id);
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $agreement_id);
- }
- }
- else
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $agreement_id);
-
- }
- }
-
- $content =
$this->bo->read_group_activity($group_id,$agreement_id);
-
-//_debug_array($content);
- $uicols = $this->bo->uicols;
- $uicols['descr'][] =
lang('select');
-
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- }
- }
-
-
- $data = array
- (
- 'lang_id'
=> lang('ID'),
- 'value_agreement_id' =>
$agreement_id,
- 'lang_name'
=> lang('name'),
- 'value_name'
=> $agreement['name'],
- 'lang_descr'
=> lang('descr'),
- 'value_descr'
=> $agreement['descr'],
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
- 'add_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.add_activity&group_id='
. $group_id . '&agreement_id=' . $agreement_id),
- 'agreement_id'
=> $agreement_id,
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the agreement untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the agreement and return back to the list'),
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . lang('add activity');
-//_debug_array($data);
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add_activity' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function edit()
- {
- $id = get_var('id',array('POST','GET'));
- $values = get_var('values',array('POST'));
- $delete_item = get_var('delete_item',array('GET'));
- $activity_id = get_var('activity_id',array('GET'));
-
- $config =
CreateObject('phpgwapi.config',$this->currentapp);
- $boalarm =
CreateObject($this->currentapp.'.boalarm');
-
- if($delete_item && $id && $activity_id)
- {
- $this->bo->delete_item($id,$activity_id);
- }
-
- $values_attribute =
get_var('values_attribute',array('POST'));
-
- $insert_record_agreement =
$GLOBALS['phpgw']->session->appsession('insert_record_agreement',$this->currentapp);
-
-//_debug_array($insert_record_agreement);
- for ($j=0;$j<count($insert_record_agreement);$j++)
- {
-
$insert_record['extra'][$insert_record_agreement[$j]] =
$insert_record_agreement[$j];
- }
-
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement','nextmatchs','attributes_form'));
-
- if (is_array($values))
- {
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
-//_debug_array($values);
-
- if ($values['save'] || $values['apply']):
- {
- $values['vendor_id'] =
get_var('vendor_id',array('POST'));
- $values['vendor_name'] =
get_var('vendor_name',array('POST'));
- $values['start_date'] =
get_var('start_date',array('POST'));
- $values['end_date']
= get_var('end_date',array('POST'));
- $values['termination_date'] =
get_var('termination_date',array('POST'));
-
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- }
-
- if(!$values['last_name'])
- {
-//
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
- }
-
-
- if($id)
- {
- $values['agreement_id']=$id;
- $action='edit';
- }
- else
- {
-
$values['agreement_id']=$this->bo->request_next_id();
- }
-
-
$values['file_name']=$_FILES['file']['name'];
- $to_file = $this->fakebase. SEP .
'agreement' . SEP . $values['agreement_id'] . SEP . $values['file_name'];
-
- if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
- 'string' => $to_file,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
- }
-
-
- if(!$receipt['error'])
- {
-// $values['agreement_id'] = $id;
- $receipt =
$this->bo->create_home_dir($receipt);
- $receipt =
$this->bo->save($values,$values_attribute,$action);
- $id = $receipt['agreement_id'];
- $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
- if($values['file_name'])
- {
-
$this->bo->create_document_dir($id);
-
$this->bo->vfs->override_acl = 1;
-
- if(!$this->bo->vfs->cp
(array (
- 'from' =>
$_FILES['file']['tmp_name'],
- 'to' =>
$to_file,
- 'relatives'
=> array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
- {
-
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
- }
-
$this->bo->vfs->override_acl = 0;
- }
-
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.index&role='
. $this->role);
- }
- }
- }
- elseif($values['update']):
- {
- $values['date'] =
get_var('date',array('POST'));
-
- if(!$values['date'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
- }
- if(!$values['new_index'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a index !'));
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->update($values);
- }
-
- }
- elseif($values['delete_alarm'] &&
count($values['alarm'])):
- {
-
- if(!$receipt['error'])
- {
- $receipt =
$boalarm->delete_alarm('agreement',$values['alarm']);
- }
-
- }
- elseif(($values['enable_alarm'] ||
$values['disable_alarm']) && count($values['alarm'])):
- {
-
- if(!$receipt['error'])
- {
- $receipt =
$boalarm->enable_alarm('agreement',$values['alarm'],$values['enable_alarm']);
- }
-
- }
- elseif($values['add_alarm']):
- {
- $time =
intval($values['time']['days'])*24*3600 +
-
intval($values['time']['hours'])*3600 +
-
intval($values['time']['mins'])*60;
-
- if ($time > 0)
- {
- $receipt =
$boalarm->add_alarm('agreement',$this->bo->read_event(array('agreement_id'=>$id)),$time,$values['user_id']);
- }
- }
- elseif (!$values['save'] && !$values['apply']
&& !$values['update']):
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.index&role='
. $this->role);
- }
- endif;
- }
-
-
- $agreement =
$this->bo->read_single(array('agreement_id'=>$id));
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- if ($id)
- {
- $this->cat_id =
($agreement['cat_id']?$agreement['cat_id']:$this->cat_id);
- $this->member_id =
($agreement['member_of']?$agreement['member_of']:$this->member_id);
- $list = $this->bo->read_details($id);
-
- $content = $list;
- //_debug_array($list);
- if (isset($list) AND is_array($list))
- {
- $k=count($list);
- for ($j=0;$j<$k;$j++)
- {
- if($this->acl_read &&
!$edit_item && !$view_only)
- {
-
$content[$j]['lang_view_statustext'] = lang('view the entity');
-
$content[$j]['text_view'] = lang('view');
-
$content[$j]['link_view'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.view_item&agreement_id='
. $id .'&id=' . $content[$j]['activity_id']);
- }
- if($this->acl_edit &&
!$edit_item && !$view_only)
- {
-
$content[$j]['lang_edit_statustext'] = lang('edit the agreement');
-
$content[$j]['text_edit'] = lang('edit');
-
$content[$j]['link_edit'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_item&agreement_id='
. $id .'&id=' . $content[$j]['activity_id']);
- }
- if($this->acl_delete &&
!$edit_item && !$view_only)
- {
-
$content[$j]['lang_delete_statustext'] = lang('delete this item');
-
$content[$j]['text_delete'] = lang('delete');
-
$content[$j]['link_delete'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&delete_item=1&id='
. $id .'&activity_id=' . $content[$j]['activity_id']);
- }
-
- $content[$j]['acl_manage']
= $this->acl_manage;
- $content[$j]['acl_read']
= $this->acl_read;
- $content[$j]['acl_edit']
= $this->acl_edit;
- $content[$j]['acl_delete']
= $this->acl_delete;
- }
- }
-
-
- $uicols = $this->bo->uicols;
-
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header']
= $uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- }
- }
-
- if($this->acl_read && !$edit_item &&
!$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- $set_column[]=True;
- }
- if($this->acl_edit && !$edit_item &&
!$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- $set_column[]=True;
- }
- if($this->acl_delete && !$edit_item &&
!$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- $set_column[]=True;
- }
- if($this->acl_manage && !$edit_item &&
!$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('Update');
- $i++;
- $set_column[]=True;
- }
-
-// $table_header=$list['table_header'];
- for ($i=0; $i<9; $i++)
- {
- $set_column[]=True;
- }
-
- if ($content)
- {
- $table_update[] = array
- (
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup'
=> "Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat
. "',button : 'date-trigger'});",
-
- 'lang_new_index'
=> lang('New index'),
- 'lang_new_index_statustext'
=> lang('Enter a new index'),
- 'lang_date_statustext'
=> lang('Select the date for the update'),
- 'lang_update'
=> lang('Update'),
- 'lang_update_statustext'
=> lang('update selected investments')
- );
- }
-
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.edit',
- 'sort' =>$this->sort,
- 'order' =>$this->order,
- 'id' => $id,
- 'role' => $this->role
- );
-
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'vendor_id' =>
$agreement['vendor_id'],
- 'vendor_name' =>
$agreement['vendor_name']));
-
- if($agreement['vendor_id'])
- {
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True, link_data => array()));
- }
-
- $alarm_data=$this->bocommon->initiate_ui_alarm(array(
-
'acl_location'=>$this->acl2_location,
- 'alarm_type'=> 'agreement',
- 'type' => 'form',
- 'text' => 'Email
notification',
- 'times' => $times,
- 'id' => $id,
- 'method' => $method,
- 'data' => $data,
- 'account_id'=> $account_id
- ));
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- switch(substr($dateformat,0,1))
- {
- case 'M':
- $dateformat_validate=
"javascript:vDateType='1'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
- $onBlur =
"DateFormat(this,this.value,event,true,'1')";
- break;
- case 'y':
-
$dateformat_validate="javascript:vDateType='2'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
- $onBlur =
"DateFormat(this,this.value,event,true,'2')";
- break;
- case 'D':
-
$dateformat_validate="javascript:vDateType='3'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
- $onBlur =
"DateFormat(this,this.value,event,true,'3')";
- break;
- }
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add detail'),
- 'lang_add_standardtext' => lang('add an item to
the details'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.add_activity&agreement_id='
. $id . '&group_id=' . $agreement['group_id'])
- );
-
-
- $link_file_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.view_file',
- 'id' =>$id
- );
-
- $config->read_repository();
- $link_to_files = $config->config_data['files_url'];
-
- $j = count($agreement['files']);
- for ($i=0;$i<$j;$i++)
- {
-
$agreement['files'][$i]['file_name']=urlencode($agreement['files'][$i]['name']);
- }
-
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.excel',
- 'id'
=>$id,
- 'allrows'
=>$this->allrows
- );
-
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $data = array
- (
-
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-
- 'alarm_data' =>
$alarm_data,
- 'lang_alarm' =>
lang('Alarm'),
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
-
- 'fileupload'
=> True,
- 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
- 'link_to_files'
=> $link_to_files,
- 'files'
=> $agreement['files'],
- 'lang_files'
=> lang('files'),
- 'lang_filename'
=> lang('Filename'),
- 'lang_delete_file'
=> lang('Delete file'),
- 'lang_view_file_statustext' =>
lang('Klick to view file'),
- 'lang_delete_file_statustext' => lang('Check
to delete file'),
- 'lang_upload_file'
=> lang('Upload file'),
- 'lang_file_statustext' =>
lang('Select file to upload'),
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_id'
=> lang('ID'),
- 'value_agreement_id' => $id,
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'value_cat'
=> $agreement['cat'],
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the agreement untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the agreement and return back to the list'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the agreement belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
-
- 'lang_member_of'
=> lang('member of'),
- 'member_of_name'
=> 'member_id',
- 'member_of_list'
=> $member_of_data['cat_list'],
-
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp'
=> $onKeyUp,
- 'onBlur'
=> $onBlur,
- 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
- 'lang_attributes'
=> lang('Attributes'),
- 'attributes_header'
=> $attributes_header,
- 'attributes_values'
=> $agreement['attributes'],
- 'lookup_functions'
=> $agreement['lookup_functions'],
- 'dateformat'
=> $dateformat,
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
- 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
- 'calendar_setup_termination'
=> "Calendar.setup({inputField : 'termination_date',ifFormat : '" .
$jsDateFormat . "',button : 'termination_date-trigger'});",
-
- 'lang_start_date_statustext' => lang('Select
the estimated end date for the agreement'),
- 'lang_start_date'
=> lang('start date'),
- 'value_start_date'
=> $agreement['start_date'],
-
- 'lang_end_date_statustext' =>
lang('Select the estimated end date for the agreement'),
- 'lang_end_date'
=> lang('end date'),
- 'value_end_date'
=> $agreement['end_date'],
-
- 'lang_termination_date_statustext'
=> lang('Select the estimated termination date'),
- 'lang_termination_date'
=> lang('termination date'),
- 'value_termination_date'
=> $agreement['termination_date'],
-
- 'vendor_data'
=> $vendor_data,
- 'lang_name'
=> lang('name'),
- 'lang_name_statustext' =>
lang('name'),
- 'value_name'
=> $agreement['name'],
- 'lang_descr'
=> lang('descr'),
- 'lang_descr_statustext' =>
lang('descr'),
- 'value_descr'
=> $agreement['descr'],
- 'table_add'
=> $table_add,
- 'values'
=> $content,
- 'table_header'
=> $table_header,
- 'table_update'
=> $table_update,
- 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $id),
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
- 'check_all_script'
=> $check_all_script,
- 'set_column'
=> $set_column,
-
- 'lang_agreement_group' =>
lang('Agreement group'),
- 'lang_no_agreement_group' =>
lang('Select agreement group'),
- 'agreement_group_list' =>
$this->bo->get_agreement_group_list($agreement['group_id']),
-
- 'lang_status'
=> lang('Status'),
- 'status_list'
=> $this->bo->select_status_list('select',$agreement['status']),
- 'status_name'
=> 'values[status]',
- 'lang_no_status'
=> lang('Select status'),
-
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . ($id?lang('edit') . ' ' .
lang($this->role):lang('add') . ' ' . lang($this->role));
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function excel()
- {
- $id = get_var('id',array('POST','GET'));
- $list = $this->bo->read_details($id);
- $uicols = $this->bo->uicols;
-
$this->bocommon->excel($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
- }
-
- function edit_item()
- {
- $agreement_id =
get_var('agreement_id',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $values = get_var('values',array('POST'));
- $delete_last = get_var('delete_last',array('GET'));
- if($delete_last)
- {
- $this->bo->delete_last_index($agreement_id,$id);
- }
-
- $values_attribute =
get_var('values_attribute',array('POST'));
-
-// $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
-// $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
-
- $insert_record_agreement =
$GLOBALS['phpgw']->session->appsession('insert_record_agreement',$this->currentapp);
-
-//_debug_array($insert_record_agreement);
-
- for ($j=0;$j<count($insert_record_entity);$j++)
- {
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
- }
-
- for ($j=0;$j<count($insert_record_agreement1);$j++)
- {
-
$insert_record['extra'][$insert_record_agreement[$j]] =
$insert_record_agreement[$j];
- }
-
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement','attributes_form'));
-
- if (is_array($values))
- {
-
-/* for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
-
-*/
-//_debug_array($values);
- if ($values['save'] || $values['apply']):
- {
-
- if(!$receipt['error'])
- {
- $values['agreement_id'] =
$agreement_id;
- $values['id'] = $id;
- $receipt =
$this->bo->save_item($values,$values_attribute);
- $agreement_id =
$receipt['agreement_id'];
- $id =
$receipt['id'];
- $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $agreement_id);
- }
- }
- }
- elseif($values['update']):
- {
- $values['date'] =
get_var('date',array('POST'));
-
- if(!$values['date'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
- }
- if(!$values['new_index'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a index !'));
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->update($values);
- }
-
- }
- elseif (!$values['save'] && !$values['apply']
&& !$values['update']):
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $agreement_id);
- }
- endif;
- }
-
- $agreement =
$this->bo->read_single(array('agreement_id'=>$agreement_id));
- $values =
$this->bo->read_single_item(array('agreement_id'=>$agreement_id,'id'=>$id));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.edit_item',
- 'agreement_id' => $agreement_id,
- 'id' => $id,
- 'role' => $this->role
- );
-
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- switch(substr($dateformat,0,1))
- {
- case 'M':
- $dateformat_validate=
"javascript:vDateType='1'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
- $onBlur =
"DateFormat(this,this.value,event,true,'1')";
- break;
- case 'y':
-
$dateformat_validate="javascript:vDateType='2'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
- $onBlur =
"DateFormat(this,this.value,event,true,'2')";
- break;
- case 'D':
-
$dateformat_validate="javascript:vDateType='3'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
- $onBlur =
"DateFormat(this,this.value,event,true,'3')";
- break;
- }
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => array()));
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add detail'),
- 'lang_add_standardtext' => lang('add an item to
the details'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_item&agreement_id='
. $agreement_id)
- );
-
-
- if($id)
- {
- $list =
$this->bo->read_prizing(array('agreement_id'=>$agreement_id,'activity_id'=>$id));
- $activity_descr
=$this->bo->get_activity_descr($id);
- }
-
- $uicols = $this->bo->uicols;
- $list =
$this->list_content($list,$uicols,$edit_item=True);
- $content = $list['content'];
- $table_header=$list['table_header'];
-
- for ($i=0; $i<count($list['content'][0]['row']); $i++)
- {
- $set_column[]=True;
- }
-
- $table_update[] = array
- (
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
-
- 'lang_new_index' =>
lang('New index'),
- 'lang_new_index_statustext' => lang('Enter
a new index'),
- 'lang_date_statustext' => lang('Select
the date for the update'),
- 'lang_update' =>
lang('Update'),
- 'lang_update_statustext' => lang('update
selected investments')
- );
-
- $data = array
- (
- 'activity_descr' =>
$activity_descr,
- 'lang_descr' =>
lang('Descr'),
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'edit_url' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_id' =>
lang('ID'),
- 'value_id' =>
$values['id'],
- 'value_num' =>
$values['num'],
- 'value_agreement_id' =>
$agreement_id,
- 'lang_category' =>
lang('category'),
- 'lang_save' =>
lang('save'),
- 'lang_cancel' =>
lang('cancel'),
- 'lang_apply' =>
lang('apply'),
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the agreement untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the agreement and return back to the list'),
-
- 'lang_dateformat' =>
lang(strtolower($dateformat)),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp' =>
$onKeyUp,
- 'onBlur' =>
$onBlur,
- 'dateformat_source' =>
'./'.$this->currentapp.'/inc/dateformat.js',
- 'lang_attributes' =>
lang('Attributes'),
- 'attributes_header' =>
$attributes_header,
- 'attributes_values' =>
$values['attributes'],
- 'lookup_functions' =>
$values['lookup_functions'],
- 'dateformat' =>
$dateformat,
-
- 'jsDateFormat' =>
$jsDateFormat,
- 'date_img' =>
$cal_info['img'],
- 'lang_datetitle' =>
lang('Select date'),
- 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
- 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
-
- 'lang_agreement' =>
lang('Agreement'),
- 'agreement_name' =>
$agreement['name'],
-
- 'table_add'
=> $table_add,
- 'values'
=> $content,
- 'index_count'
=> $content[0]['index_count'],
- 'table_header'
=> $table_header,
- 'acl_manage'
=> $this->acl_manage,
- 'table_update'
=> $table_update,
- 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_item&agreement_id='
. $agreement_id . '&id=' . $id),
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
-
- 'lang_m_cost'
=> lang('Material cost'),
- 'lang_m_cost_statustext' =>
lang('Material cost'),
- 'value_m_cost'
=> $values['m_cost'],
-
- 'lang_w_cost'
=> lang('Labour cost'),
- 'lang_w_cost_statustext' =>
lang('Labour cost'),
- 'value_w_cost'
=> $values['w_cost'],
-
- 'lang_total_cost'
=> lang('Total cost'),
- 'value_total_cost'
=> $values['total_cost'],
-
- 'set_column'
=> $set_column,
- 'lang_delete_last'
=> lang('delete last index'),
- 'lang_delete_last_statustext' => lang('delete
the last index'),
- 'delete_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_item&delete_last=1&agreement_id='
. $agreement_id . '&id=' . $id),
-
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . ($values['id']?lang('edit item') . ' ' .
$agreement['name']:lang('add item') . ' ' . $agreement['name']);
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_item' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view_item()
- {
- $agreement_id =
get_var('agreement_id',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement','attributes_view'));
-
- $agreement =
$this->bo->read_single(array('agreement_id'=>$agreement_id));
- $values =
$this->bo->read_single_item(array('agreement_id'=>$agreement_id,'id'=>$id));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.edit',
- 'id' => $agreement_id
- );
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- if($id)
- {
- $list =
$this->bo->read_prizing(array('agreement_id'=>$agreement_id,'activity_id'=>$id));
- $activity_descr
=$this->bo->get_activity_descr($id);
- }
-
- $uicols = $this->bo->uicols;
- $list =
$this->list_content($list,$uicols,$edit_item=True);
- $content = $list['content'];
- $table_header=$list['table_header'];
-
- $data = array
- (
- 'activity_descr' =>
$activity_descr,
- 'lang_descr' =>
lang('Descr'),
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'edit_url' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_id' =>
lang('ID'),
- 'value_id' =>
$values['id'],
- 'value_num' =>
$values['num'],
- 'value_agreement_id' =>
$agreement_id,
- 'lang_category' =>
lang('category'),
- 'lang_cancel' =>
lang('cancel'),
- 'lang_cancel_statustext' =>
lang('Leave the agreement untouched and return back to the list'),
-
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'attributes_view'
=> $values['attributes'],
-
- 'lang_agreement'
=> lang('Agreement'),
- 'agreement_name'
=> $agreement['name'],
-
- 'table_add'
=> $table_add,
- 'values'
=> $content,
- 'table_header'
=> $table_header,
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
-
- 'lang_m_cost'
=> lang('Material cost'),
- 'value_m_cost'
=> $values['m_cost'],
-
- 'lang_w_cost'
=> lang('Labour cost'),
- 'value_w_cost'
=> $values['w_cost'],
-
- 'lang_total_cost'
=> lang('Total cost'),
- 'value_total_cost'
=> $values['total_cost'],
- 'set_column'
=> $set_column,
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . lang('view item') . ' ' . $agreement['name'];
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view_item' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function delete()
- {
- $attrib = get_var('attrib',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $agreement_id =
get_var('agreement_id',array('POST','GET'));
- $delete = get_var('delete',array('POST'));
- $confirm = get_var('confirm',array('POST'));
-
-
- if($attrib)
- {
- $function='list_attribute';
- }
- else
- {
- $function='index';
- }
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.'.$function,
- 'role' => $this->role
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($agreement_id,$id,$attrib);
-// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
-
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.delete&agreement_id='
. $agreement_id. '&id=' . $id . '&attrib=' . $attrib . '&role=' . $this->role),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('agreement');
- $function_msg =
lang('delete') . ' ' . lang($this->role);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
-
- function view()
- {
- $agreement_id = get_var('id',array('POST','GET'));
- $config =
CreateObject('phpgwapi.config',$this->currentapp);
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement','nextmatchs','attributes_view'));
-
-
- $agreement =
$this->bo->read_single(array('agreement_id'=>$agreement_id));
-
-
- if ($agreement_id)
- {
- $this->cat_id =
($agreement['cat_id']?$agreement['cat_id']:$this->cat_id);
- $this->member_id =
($agreement['member_of']?$agreement['member_of']:$this->member_id);
- $list = $this->bo->read_details($agreement_id);
-
- $uicols = $this->bo->uicols;
- $list =
$this->list_content($list,$uicols,$edit_item=False,$view_only=True);
- $content = $list['content'];
- $table_header=$list['table_header'];
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.index',
- 'agreement_id' => $agreement_id,
- );
-
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'vendor_id' =>
$agreement['vendor_id'],
- 'vendor_name' =>
$agreement['vendor_name'],
- 'type' =>
'view'));
-
- $alarm_data=$this->bocommon->initiate_ui_alarm(array(
-
'acl_location'=>$this->acl2_location,
- 'alarm_type'=> 'agreement',
- 'type' => 'view',
- 'text' => 'Email
notification',
- 'times' => $times,
- 'id' =>
$agreement_id,
- 'method' => $method,
- 'data' => $data,
- 'account_id'=> $account_id
- ));
-
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => array()));
-
- $link_file_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.view_file',
- 'id'
=>$agreement_id
- );
-
-
- $config->read_repository();
- $link_to_files = $config->config_data['files_url'];
-
- $j = count($agreement['files']);
- for ($i=0;$i<$j;$i++)
- {
-
$agreement['files'][$i]['file_name']=urlencode($agreement['files'][$i]['name']);
- }
-
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $link_data2 = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.view',
- 'id' => $agreement_id,
- );
-
- $data = array
- (
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($content),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data2),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-
- 'alarm_data'
=> $alarm_data,
- 'lang_alarm'
=> lang('Alarm'),
- 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
- 'link_to_files'
=> $link_to_files,
- 'files'
=> $agreement['files'],
- 'lang_files'
=> lang('files'),
- 'lang_filename'
=> lang('Filename'),
- 'lang_view_file_statustext' =>
lang('Klick to view file'),
-
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_id'
=> lang('ID'),
- 'value_agreement_id' =>
$agreement_id,
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('done'),
- 'lang_apply'
=> lang('apply'),
- 'value_cat'
=> $agreement['cat'],
- 'lang_cancel_statustext' =>
lang('return back to the list'),
- 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
-
- 'lang_member_of'
=> lang('member of'),
- 'member_of_name'
=> 'member_id',
- 'member_of_list'
=> $member_of_data['cat_list'],
-
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'attributes_view'
=> $agreement['attributes'],
- 'dateformat'
=> $dateformat,
-
- 'lang_start_date'
=> lang('start date'),
- 'value_start_date'
=> $agreement['start_date'],
-
- 'lang_end_date'
=> lang('end date'),
- 'value_end_date'
=> $agreement['end_date'],
-
- 'lang_termination_date' =>
lang('termination date'),
- 'value_termination_date' =>
$agreement['termination_date'],
-
- 'vendor_data'
=> $vendor_data,
- 'lang_name'
=> lang('name'),
- 'value_name'
=> $agreement['name'],
- 'lang_descr'
=> lang('descr'),
- 'value_descr'
=> $agreement['descr'],
- 'table_add'
=> $table_add,
- 'values'
=> $content,
- 'table_header'
=> $table_header,
- 'lang_agreement_group' =>
lang('Agreement group'),
- 'agreement_group_list' =>
$this->bo->get_agreement_group_list($agreement['group_id']),
-
- 'lang_status'
=> lang('Status'),
- 'status_list'
=> $this->bo->select_status_list('select',$agreement['status']),
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . lang('view');
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function list_attribute()
- {
- $id = get_var('id',array('POST','GET'));
- $resort = get_var('resort',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array(
- 'agreement',
- 'nextmatchs',
-
'search_field'));
-
- if($resort)
- {
-
$this->bo->resort_attrib(array('resort'=>$resort,'id'=>$id));
- }
-
- $attrib_list = $this->bo->read_attrib();
-
- while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
- {
- $content[] = array
- (
- 'name'
=> $attrib['name'],
- 'type_name'
=> $attrib['type_name'],
- 'datatype'
=> $attrib['datatype'],
- 'column_name'
=> $attrib['column_name'],
- 'input_text'
=> $attrib['input_text'],
- 'sorting'
=> $attrib['attrib_sort'],
- 'search'
=> $attrib['search'],
- 'link_up'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.list_attribute&resort=up&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
- 'link_down'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.list_attribute&resort=down&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_attrib&id='
. $attrib['id'] . '&role=' . $this->role),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.delete&id='
. $attrib['id'].'&attrib=true&role=' . $this->role),
- 'lang_view_attribtext' =>
lang('view the attrib'),
- 'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang('location'),
- 'lang_edit_attribtext' =>
lang('edit the attrib'),
- 'lang_delete_attribtext' =>
lang('delete the attrib'),
- 'text_attribute'
=> lang('Attributes'),
- 'text_up'
=> lang('up'),
- 'text_down'
=> lang('down'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
- //html_print_r($content);
-
- $table_header[] = array
- (
- 'lang_descr' => lang('Descr'),
- 'lang_datatype' => lang('Datatype'),
- 'lang_sorting' => lang('sorting'),
- 'lang_search' => lang('search'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_sorting' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'attrib_sort',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiagreement.list_attribute',
-
'allrows'=>$this->allrows,
-
'role' => $this->role)
-
)),
-
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'column_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiagreement.list_attribute',
-
'allrows'=>$this->allrows,
-
'role' => $this->role)
-
)),
- 'lang_name' => lang('Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_attribtext' => lang('add a attrib'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_attrib&role='
. $this->role),
- 'lang_done' =>
lang('done'),
- 'lang_done_attribtext' => lang('back to
admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php'),
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.list_attribute',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'query'
=>$this->query,
- 'role' =>
$this->role
-
- );
-
- $data = array
- (
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($attrib_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_attribtext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_attrib' =>
$table_header,
- 'values_attrib'
=> $content,
- 'table_add2'
=> $table_add
- );
-
- $appname
= lang('agreement');
- $function_msg =
lang('list attribute') . ': ' . lang($this->role);
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function edit_attrib()
- {
- $id =
get_var('id',array('POST','GET'));
- $values = get_var('values',array('POST'));
- // $GLOBALS['phpgw']->common->msgbox(lang('Altering
ColumnName OR Datatype - deletes your data in this Column'));
- //html_print_r($values);
-
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement','choice',));
-
- if ($values['save'])
- {
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- $type_id =
$values['type_id'];
-
- if (!$values['column_name'])
- {
- $receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
- }
-
- if (!$values['input_text'])
- {
- $receipt['error'][] =
array('msg'=>lang('Input text not entered!'));
- }
- if (!$values['statustext'])
- {
- $receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
- }
-
- if (!$values['column_info']['type'])
- {
- $receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
- }
-
-
if(!ctype_digit($values['column_info']['precision']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
-
unset($values['column_info']['precision']);
- }
-
-
if(!ctype_digit($values['column_info']['scale']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
- unset($values['column_info']['scale']);
- }
-
- if (!$values['column_info']['nullable'])
- {
- $receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
- }
-
-
- if (!$receipt['error'])
- {
- $receipt =
$this->bo->save_attrib($values,$action);
-
- if(!$id)
- {
- $id=$receipt['id'];
- }
- }
- else
- {
- $receipt['error'][] = array('msg'
=> lang('Attribute has NOT been saved'));
- }
-
- }
-
- if ($id)
- {
- $values = $this->bo->read_single_attrib($id);
- $function_msg = lang('edit attribute') . ': ' .
lang($this->role);
- $action='edit';
- }
- else
- {
- $function_msg = lang('add attribute') . ': ' .
lang($this->role);
- $action='add';
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiagreement.edit_attrib',
- 'id' => $id,
- 'role' => $this->role
-
- );
- //html_print_r($values);
-
- if($values['column_info']['type']=='R' ||
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
- {
- $multiple_choice= True;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'lang_choice' =>
lang('Choice'),
- 'lang_new_value' =>
lang('New value'),
- 'lang_new_value_statustext' => lang('New
value for mulitple choice'),
- 'multiple_choice' =>
$multiple_choice,
- 'value_choice' =>
$values['choice'],
- 'lang_delete_value' =>
lang('Delete value'),
- 'lang_value' =>
lang('value'),
- 'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.list_attribute&type_id='.$type_id
. '&role=' . $this->role),
- 'lang_id'
=> lang('Attribute ID'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
-
- 'lang_column_name'
=> lang('Column name'),
- 'value_column_name'
=> $values['column_name'],
- 'lang_column_name_statustext' => lang('enter
the name for the column'),
-
- 'lang_input_text'
=> lang('input text'),
- 'value_input_text'
=> $values['input_text'],
- 'lang_input_name_statustext' => lang('enter
the input text for records'),
-
- 'lang_id_attribtext' => lang('Enter
the attribute ID'),
- 'lang_entity_statustext' => lang('Select
a agreement type'),
-
- 'lang_statustext' =>
lang('Statustext'),
- 'lang_statustext_attribtext'=> lang('Enter a
statustext for the inputfield in forms'),
- 'value_statustext' =>
$values['statustext'],
-
- 'lang_done_attribtext' => lang('Back
to the list'),
- 'lang_save_attribtext' => lang('Save
the attribute'),
-
- 'lang_datatype' =>
lang('Datatype'),
- 'lang_datatype_statustext' => lang('Select
a datatype'),
- 'lang_no_datatype' =>
lang('No datatype'),
- 'datatype_list' =>
$this->bocommon->select_datatype($values['column_info']['type']),
-
- 'lang_precision' =>
lang('Precision'),
- 'lang_precision_statustext' => lang('enter
the record length'),
- 'value_precision' =>
$values['column_info']['precision'],
-
- 'lang_scale' =>
lang('scale'),
- 'lang_scale_statustext' => lang('enter
the scale if type is decimal'),
- 'value_scale' =>
$values['column_info']['scale'],
-
- 'lang_default' =>
lang('default'),
- 'lang_default_statustext' => lang('enter
the default value'),
- 'value_default' =>
$values['column_info']['default'],
-
- 'lang_nullable' =>
lang('Nullable'),
- 'lang_nullable_statustext' => lang('Chose
if this column is nullable'),
- 'lang_select_nullable' => lang('Select
nullable'),
- 'nullable_list' =>
$this->bocommon->select_nullable($values['column_info']['nullable']),
-
- 'value_list' =>
$values['list'],
- 'lang_list'
=> lang('show in list'),
- 'lang_list_statustext' => lang('check
to show this attribute in location list'),
-
- 'value_search' =>
$values['search'],
- 'lang_include_search' =>
lang('Include in search'),
- 'lang_include_search_statustext'=> lang('check
to show this attribute in location list'),
-
-
- );
- //html_print_r($data);
-
- $appname
= lang('agreement');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 agreement
+ * @version $Id: class.uiagreement.inc.php,v 1.18 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uiagreement
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'list_attribute'=> True,
+ 'edit_attrib' => True,
+ 'columns' => True,
+ 'edit_item' => True,
+ 'view_item' => True,
+ 'view_file' => True,
+ 'excel' => True,
+ 'add_activity' => True
+ );
+
+ function uiagreement()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.boagreement',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->role = $this->bo->role;
+
+ $this->cats =
CreateObject('phpgwapi.categories');
+ $this->cats->app_name = 'fm_vendor';
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location= '.pricebook';
+
+ $this->acl_read =
$this->acl2->check($this->acl2_location,1);
+ $this->acl_add =
$this->acl2->check($this->acl2_location,2);
+ $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
+ $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
+ $this->acl_manage =
$this->acl2->check($this->acl2_location,16);
+
+ $this->start = $this->bo->start;
+ $this->query = $this->bo->query;
+ $this->sort = $this->bo->sort;
+ $this->order = $this->bo->order;
+ $this->filter = $this->bo->filter;
+ $this->cat_id = $this->bo->cat_id;
+ $this->vendor_id = $this->bo->vendor_id;
+ $this->allrows = $this->bo->allrows;
+ $this->member_id = $this->bo->member_id;
+ $this->fakebase = $this->bo->fakebase;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'vendor_id' => $this->vendor_id,
+ 'allrows' => $this->allrows,
+ 'member_id' => $this->member_id
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function columns()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
+
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+
+ $values =
get_var('values',array('POST','GET'));
+
+ if ($values['save'])
+ {
+
+
$GLOBALS['phpgw']->preferences->account_id=$this->account;
+
$GLOBALS['phpgw']->preferences->read_repository();
+
$GLOBALS['phpgw']->preferences->add($this->currentapp,'agreement_columns',$values['columns'],'user');
+
$GLOBALS['phpgw']->preferences->save_repository();
+
+ $receipt['message'][] = array('msg' =>
lang('columns is updated'));
+ }
+
+ $function_msg = lang('Select Column');
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.columns',
+ 'role' => $this->role
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'column_list' =>
$this->bo->column_list($values['columns'],$allrows=True),
+ 'function_msg' => $function_msg,
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_columns' => lang('columns'),
+ 'lang_none' => lang('None'),
+ 'lang_save' => lang('save'),
+ 'select_name' => 'period'
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
$function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view_file()
+ {
+ $GLOBALS['phpgw_info']['flags'][noheader] = True;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = True;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $file_name =
urldecode(get_var('file_name',array('POST','GET')));
+ $id = get_var('id',array('POST','GET'));
+
+ $file = $this->fakebase. SEP . 'agreement' . SEP . $id
. SEP . $file_name;
+
+ if($this->bo->vfs->file_exists(array(
+ 'string' => $file,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+
+ $size =
$this->bo->vfs->get_size(array(
+ 'string' => $file,
+ 'relatives' =>
Array(RELATIVE_NONE),
+ 'checksubdirs' =>
True));
+
+ $document= $this->bo->vfs->read(array(
+ 'string' => $file,
+ 'relatives' => Array(RELATIVE_NONE)));
+
+ $filename =
basename($values['document_name']);
+ $filetype = array_pop(explode('.',
basename($file)));
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($filename,$filetype,$size);
+
+ echo $document;
+
+ }
+ }
+
+ function index()
+ {
+ $this->menu->sub = 'agreement';
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('agreement',
+
'menu',
+
'receipt',
+
'search_field',
+
'nextmatchs',
+
'filter_member_of'));
+
+ $links = $this->menu->links('agreement','agreement');
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt');
+
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt','');
+
+ $list = $this->bo->read();
+
+ $uicols = $this->bo->uicols;
+
+ $j=0;
+
+ if (isset($list) AND is_array($list))
+ {
+ foreach($list as $entry)
+ {
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+ }
+ }
+
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
+ $content[$j]['row'][$i]['text']
= lang('view');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.view&id='
. $entry['id'] .'&role=' . $this->role);
+ }
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('edit the
agreement');
+ $content[$j]['row'][$i]['text']
= lang('edit');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $entry['id'] .'&role=' . $this->role);
+ }
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('delete the
agreement');
+ $content[$j]['row'][$i]['text']
= lang('delete');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.delete&agreement_id='
. $entry['id'] .'&role=' . $this->role);
+ }
+
+ $j++;
+ }
+ }
+
+//_debug_array($content);
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['datatype'][$i]!='T' &&
$uicols['datatype'][$i]!='CH')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+ (
+ 'sort' =>
$this->sort,
+ 'var' =>
$uicols['name'][$i],
+ 'order' =>
$this->order,
+ 'extra'
=> array('menuaction' => $this->currentapp.'.uiagreement.index',
+
'query' =>$this->query,
+
'lookup' =>$lookup,
+
'district_id' => $this->district_id,
+
'start_date' => $start_date,
+
'role' => $this->role,
+
'member_id' => $this->member_id,
+
'allrows' => $this->allrows,
+
'end_date' => $end_date
+
)
+ ));
+ }
+ }
+ }
+
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+
+
+ if($this->acl_add)
+ {
+ $table_add = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
agreement'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&role='
. $this->role)
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'role' =>
$this->role,
+ 'member_id' =>
$this->member_id
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $link_columns = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.columns',
+ 'role' =>
$this->role
+ );
+
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data =>$link_data));
+
+ $data = array
+ (
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+ 'lang_columns'
=> lang('columns'),
+ 'link_columns'
=> $GLOBALS['phpgw']->link('/index.php',$link_columns),
+ 'lang_columns_help'
=> lang('Choose columns'),
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the agreement belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_no_vendor'
=> lang('no vendor'),
+ 'lang_vendor_statustext' =>
lang('Select the vendor the agreement belongs to.'),
+ 'vendor_list'
=> $this->bo->select_vendor_list('filter',$this->vendor_id),
+
+ 'lang_no_member'
=> lang('no member'),
+ 'member_of_name'
=> 'member_id',
+ 'member_of_list'
=> $member_of_data['cat_list'],
+
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+ $this->save_sessiondata();
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . lang('list ' . $this->role);
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function list_content($list,$uicols,$edit_item='',$view_only='')
+ {
+ $j=0;
+//_debug_array($list);
+ if (isset($list) AND is_array($list))
+ {
+ foreach($list as $entry)
+ {
+ $content[$j]['id']
= $entry['id'];
+ $content[$j]['activity_id'] =
$entry['activity_id'];
+ $content[$j]['index_count']
= $entry['index_count'];
+ $content[$j]['m_cost']
= $entry['m_cost'];
+ $content[$j]['w_cost']
= $entry['w_cost'];
+ $content[$j]['total_cost']
= $entry['total_cost'];
+ $content[$j]['index_count'] =
$entry['index_count'];
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+ }
+ }
+
+ if($this->acl_read && !$edit_item &&
!$view_only)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
+ $content[$j]['row'][$i]['text']
= lang('view');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.view_item&agreement_id='
. $entry['agreement_id'] .'&id=' . $entry['id']);
+ }
+ if($this->acl_edit && !$edit_item &&
!$view_only)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('edit the
agreement');
+ $content[$j]['row'][$i]['text']
= lang('edit');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_item&agreement_id='
. $entry['agreement_id'] .'&id=' . $entry['id']);
+ }
+ if($this->acl_delete && !$edit_item &&
!$view_only)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('delete this
item');
+ $content[$j]['row'][$i]['text']
= lang('delete');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&delete_item=1&agreement_id='
. $entry['agreement_id'] .'&activity_id=' . $entry['id']);
+ }
+
+ $j++;
+ }
+ }
+
+//html_print_r($content);
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ }
+ }
+
+ if($this->acl_read && !$edit_item && !$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit && !$edit_item && !$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete && !$edit_item && !$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+ if($this->acl_manage && !$edit_item && !$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('Update');
+ $i++;
+ }
+
+ return
array('content'=>$content,'table_header'=>$table_header);
+ }
+
+ function add_activity()
+ {
+ $agreement_id =
get_var('agreement_id',array('POST','GET'));
+ $group_id =
get_var('group_id',array('POST','GET'));
+ $values = get_var('values',array('POST','GET'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement'));
+
+ $agreement =
$this->bo->read_single(array('agreement_id'=>$agreement_id));
+
+ if($this->acl_add && (is_array($values)))
+ {
+ if ($values['save'] || $values['apply'])
+ {
+ $receipt =
$this->bo->add_activity($values,$agreement_id);
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $agreement_id);
+ }
+ }
+ else
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $agreement_id);
+
+ }
+ }
+
+ $content =
$this->bo->read_group_activity($group_id,$agreement_id);
+
+//_debug_array($content);
+ $uicols = $this->bo->uicols;
+ $uicols['descr'][] =
lang('select');
+
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ }
+ }
+
+
+ $data = array
+ (
+ 'lang_id'
=> lang('ID'),
+ 'value_agreement_id' =>
$agreement_id,
+ 'lang_name'
=> lang('name'),
+ 'value_name'
=> $agreement['name'],
+ 'lang_descr'
=> lang('descr'),
+ 'value_descr'
=> $agreement['descr'],
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+ 'add_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.add_activity&group_id='
. $group_id . '&agreement_id=' . $agreement_id),
+ 'agreement_id'
=> $agreement_id,
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_apply'
=> lang('apply'),
+ 'lang_apply_statustext' =>
lang('Apply the values'),
+ 'lang_cancel_statustext' =>
lang('Leave the agreement untouched and return back to the list'),
+ 'lang_save_statustext' =>
lang('Save the agreement and return back to the list'),
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . lang('add activity');
+//_debug_array($data);
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add_activity' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function edit()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+ $delete_item = get_var('delete_item',array('GET'));
+ $activity_id = get_var('activity_id',array('GET'));
+
+ $config =
CreateObject('phpgwapi.config',$this->currentapp);
+ $boalarm =
CreateObject($this->currentapp.'.boalarm');
+
+ if($delete_item && $id && $activity_id)
+ {
+ $this->bo->delete_item($id,$activity_id);
+ }
+
+ $values_attribute =
get_var('values_attribute',array('POST'));
+
+ $insert_record_agreement =
$GLOBALS['phpgw']->session->appsession('insert_record_agreement',$this->currentapp);
+
+//_debug_array($insert_record_agreement);
+ for ($j=0;$j<count($insert_record_agreement);$j++)
+ {
+
$insert_record['extra'][$insert_record_agreement[$j]] =
$insert_record_agreement[$j];
+ }
+
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement','nextmatchs','attributes_form'));
+
+ if (is_array($values))
+ {
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+//_debug_array($values);
+
+ if ($values['save'] || $values['apply']):
+ {
+ $values['vendor_id'] =
get_var('vendor_id',array('POST'));
+ $values['vendor_name'] =
get_var('vendor_name',array('POST'));
+ $values['start_date'] =
get_var('start_date',array('POST'));
+ $values['end_date']
= get_var('end_date',array('POST'));
+ $values['termination_date'] =
get_var('termination_date',array('POST'));
+
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ }
+
+ if(!$values['last_name'])
+ {
+//
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
+ }
+
+
+ if($id)
+ {
+ $values['agreement_id']=$id;
+ $action='edit';
+ }
+ else
+ {
+
$values['agreement_id']=$this->bo->request_next_id();
+ }
+
+
$values['file_name']=$_FILES['file']['name'];
+ $to_file = $this->fakebase. SEP .
'agreement' . SEP . $values['agreement_id'] . SEP . $values['file_name'];
+
+ if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
+ 'string' => $to_file,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
+ }
+
+
+ if(!$receipt['error'])
+ {
+// $values['agreement_id'] = $id;
+ $receipt =
$this->bo->create_home_dir($receipt);
+ $receipt =
$this->bo->save($values,$values_attribute,$action);
+ $id = $receipt['agreement_id'];
+ $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
+
+ if($values['file_name'])
+ {
+
$this->bo->create_document_dir($id);
+
$this->bo->vfs->override_acl = 1;
+
+ if(!$this->bo->vfs->cp
(array (
+ 'from' =>
$_FILES['file']['tmp_name'],
+ 'to' =>
$to_file,
+ 'relatives'
=> array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+ {
+
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
+ }
+
$this->bo->vfs->override_acl = 0;
+ }
+
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.index&role='
. $this->role);
+ }
+ }
+ }
+ elseif($values['update']):
+ {
+ $values['date'] =
get_var('date',array('POST'));
+
+ if(!$values['date'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
+ }
+ if(!$values['new_index'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a index !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->update($values);
+ }
+
+ }
+ elseif($values['delete_alarm'] &&
count($values['alarm'])):
+ {
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$boalarm->delete_alarm('agreement',$values['alarm']);
+ }
+
+ }
+ elseif(($values['enable_alarm'] ||
$values['disable_alarm']) && count($values['alarm'])):
+ {
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$boalarm->enable_alarm('agreement',$values['alarm'],$values['enable_alarm']);
+ }
+
+ }
+ elseif($values['add_alarm']):
+ {
+ $time =
intval($values['time']['days'])*24*3600 +
+
intval($values['time']['hours'])*3600 +
+
intval($values['time']['mins'])*60;
+
+ if ($time > 0)
+ {
+ $receipt =
$boalarm->add_alarm('agreement',$this->bo->read_event(array('agreement_id'=>$id)),$time,$values['user_id']);
+ }
+ }
+ elseif (!$values['save'] && !$values['apply']
&& !$values['update']):
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.index&role='
. $this->role);
+ }
+ endif;
+ }
+
+
+ $agreement =
$this->bo->read_single(array('agreement_id'=>$id));
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ if ($id)
+ {
+ $this->cat_id =
($agreement['cat_id']?$agreement['cat_id']:$this->cat_id);
+ $this->member_id =
($agreement['member_of']?$agreement['member_of']:$this->member_id);
+ $list = $this->bo->read_details($id);
+
+ $content = $list;
+ //_debug_array($list);
+ if (isset($list) AND is_array($list))
+ {
+ $k=count($list);
+ for ($j=0;$j<$k;$j++)
+ {
+ if($this->acl_read &&
!$edit_item && !$view_only)
+ {
+
$content[$j]['lang_view_statustext'] = lang('view the entity');
+
$content[$j]['text_view'] = lang('view');
+
$content[$j]['link_view'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.view_item&agreement_id='
. $id .'&id=' . $content[$j]['activity_id']);
+ }
+ if($this->acl_edit &&
!$edit_item && !$view_only)
+ {
+
$content[$j]['lang_edit_statustext'] = lang('edit the agreement');
+
$content[$j]['text_edit'] = lang('edit');
+
$content[$j]['link_edit'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_item&agreement_id='
. $id .'&id=' . $content[$j]['activity_id']);
+ }
+ if($this->acl_delete &&
!$edit_item && !$view_only)
+ {
+
$content[$j]['lang_delete_statustext'] = lang('delete this item');
+
$content[$j]['text_delete'] = lang('delete');
+
$content[$j]['link_delete'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&delete_item=1&id='
. $id .'&activity_id=' . $content[$j]['activity_id']);
+ }
+
+ $content[$j]['acl_manage']
= $this->acl_manage;
+ $content[$j]['acl_read']
= $this->acl_read;
+ $content[$j]['acl_edit']
= $this->acl_edit;
+ $content[$j]['acl_delete']
= $this->acl_delete;
+ }
+ }
+
+
+ $uicols = $this->bo->uicols;
+
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header']
= $uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ }
+ }
+
+ if($this->acl_read && !$edit_item &&
!$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ $set_column[]=True;
+ }
+ if($this->acl_edit && !$edit_item &&
!$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ $set_column[]=True;
+ }
+ if($this->acl_delete && !$edit_item &&
!$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ $set_column[]=True;
+ }
+ if($this->acl_manage && !$edit_item &&
!$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('Update');
+ $i++;
+ $set_column[]=True;
+ }
+
+// $table_header=$list['table_header'];
+ for ($i=0; $i<9; $i++)
+ {
+ $set_column[]=True;
+ }
+
+ if ($content)
+ {
+ $table_update[] = array
+ (
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup'
=> "Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat
. "',button : 'date-trigger'});",
+
+ 'lang_new_index'
=> lang('New index'),
+ 'lang_new_index_statustext'
=> lang('Enter a new index'),
+ 'lang_date_statustext'
=> lang('Select the date for the update'),
+ 'lang_update'
=> lang('Update'),
+ 'lang_update_statustext'
=> lang('update selected investments')
+ );
+ }
+
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.edit',
+ 'sort' =>$this->sort,
+ 'order' =>$this->order,
+ 'id' => $id,
+ 'role' => $this->role
+ );
+
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'vendor_id' =>
$agreement['vendor_id'],
+ 'vendor_name' =>
$agreement['vendor_name']));
+
+ if($agreement['vendor_id'])
+ {
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True, link_data => array()));
+ }
+
+ $alarm_data=$this->bocommon->initiate_ui_alarm(array(
+
'acl_location'=>$this->acl2_location,
+ 'alarm_type'=> 'agreement',
+ 'type' => 'form',
+ 'text' => 'Email
notification',
+ 'times' => $times,
+ 'id' => $id,
+ 'method' => $method,
+ 'data' => $data,
+ 'account_id'=> $account_id
+ ));
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+
$dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+
$dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add detail'),
+ 'lang_add_standardtext' => lang('add an item to
the details'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.add_activity&agreement_id='
. $id . '&group_id=' . $agreement['group_id'])
+ );
+
+
+ $link_file_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.view_file',
+ 'id' =>$id
+ );
+
+ $config->read_repository();
+ $link_to_files = $config->config_data['files_url'];
+
+ $j = count($agreement['files']);
+ for ($i=0;$i<$j;$i++)
+ {
+
$agreement['files'][$i]['file_name']=urlencode($agreement['files'][$i]['name']);
+ }
+
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.excel',
+ 'id'
=>$id,
+ 'allrows'
=>$this->allrows
+ );
+
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $data = array
+ (
+
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+
+ 'alarm_data' =>
$alarm_data,
+ 'lang_alarm' =>
lang('Alarm'),
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+
+ 'fileupload'
=> True,
+ 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
+ 'link_to_files'
=> $link_to_files,
+ 'files'
=> $agreement['files'],
+ 'lang_files'
=> lang('files'),
+ 'lang_filename'
=> lang('Filename'),
+ 'lang_delete_file'
=> lang('Delete file'),
+ 'lang_view_file_statustext' =>
lang('Klick to view file'),
+ 'lang_delete_file_statustext' => lang('Check
to delete file'),
+ 'lang_upload_file'
=> lang('Upload file'),
+ 'lang_file_statustext' =>
lang('Select file to upload'),
+
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_id'
=> lang('ID'),
+ 'value_agreement_id' => $id,
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_apply'
=> lang('apply'),
+ 'value_cat'
=> $agreement['cat'],
+ 'lang_apply_statustext' =>
lang('Apply the values'),
+ 'lang_cancel_statustext' =>
lang('Leave the agreement untouched and return back to the list'),
+ 'lang_save_statustext' =>
lang('Save the agreement and return back to the list'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the agreement belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
+
+ 'lang_member_of'
=> lang('member of'),
+ 'member_of_name'
=> 'member_id',
+ 'member_of_list'
=> $member_of_data['cat_list'],
+
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
+ 'lang_attributes'
=> lang('Attributes'),
+ 'attributes_header'
=> $attributes_header,
+ 'attributes_values'
=> $agreement['attributes'],
+ 'lookup_functions'
=> $agreement['lookup_functions'],
+ 'dateformat'
=> $dateformat,
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
+ 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
+ 'calendar_setup_termination'
=> "Calendar.setup({inputField : 'termination_date',ifFormat : '" .
$jsDateFormat . "',button : 'termination_date-trigger'});",
+
+ 'lang_start_date_statustext' => lang('Select
the estimated end date for the agreement'),
+ 'lang_start_date'
=> lang('start date'),
+ 'value_start_date'
=> $agreement['start_date'],
+
+ 'lang_end_date_statustext' =>
lang('Select the estimated end date for the agreement'),
+ 'lang_end_date'
=> lang('end date'),
+ 'value_end_date'
=> $agreement['end_date'],
+
+ 'lang_termination_date_statustext'
=> lang('Select the estimated termination date'),
+ 'lang_termination_date'
=> lang('termination date'),
+ 'value_termination_date'
=> $agreement['termination_date'],
+
+ 'vendor_data'
=> $vendor_data,
+ 'lang_name'
=> lang('name'),
+ 'lang_name_statustext' =>
lang('name'),
+ 'value_name'
=> $agreement['name'],
+ 'lang_descr'
=> lang('descr'),
+ 'lang_descr_statustext' =>
lang('descr'),
+ 'value_descr'
=> $agreement['descr'],
+ 'table_add'
=> $table_add,
+ 'values'
=> $content,
+ 'table_header'
=> $table_header,
+ 'table_update'
=> $table_update,
+ 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $id),
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+ 'check_all_script'
=> $check_all_script,
+ 'set_column'
=> $set_column,
+
+ 'lang_agreement_group' =>
lang('Agreement group'),
+ 'lang_no_agreement_group' =>
lang('Select agreement group'),
+ 'agreement_group_list' =>
$this->bo->get_agreement_group_list($agreement['group_id']),
+
+ 'lang_status'
=> lang('Status'),
+ 'status_list'
=> $this->bo->select_status_list('select',$agreement['status']),
+ 'status_name'
=> 'values[status]',
+ 'lang_no_status'
=> lang('Select status'),
+
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . ($id?lang('edit') . ' ' .
lang($this->role):lang('add') . ' ' . lang($this->role));
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function excel()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $list = $this->bo->read_details($id);
+ $uicols = $this->bo->uicols;
+
$this->bocommon->excel($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
+ }
+
+ function edit_item()
+ {
+ $agreement_id =
get_var('agreement_id',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+ $delete_last = get_var('delete_last',array('GET'));
+ if($delete_last)
+ {
+ $this->bo->delete_last_index($agreement_id,$id);
+ }
+
+ $values_attribute =
get_var('values_attribute',array('POST'));
+
+// $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+// $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
+
+ $insert_record_agreement =
$GLOBALS['phpgw']->session->appsession('insert_record_agreement',$this->currentapp);
+
+//_debug_array($insert_record_agreement);
+
+ for ($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+
+ for ($j=0;$j<count($insert_record_agreement1);$j++)
+ {
+
$insert_record['extra'][$insert_record_agreement[$j]] =
$insert_record_agreement[$j];
+ }
+
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement','attributes_form'));
+
+ if (is_array($values))
+ {
+
+/* for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+
+*/
+//_debug_array($values);
+ if ($values['save'] || $values['apply']):
+ {
+
+ if(!$receipt['error'])
+ {
+ $values['agreement_id'] =
$agreement_id;
+ $values['id'] = $id;
+ $receipt =
$this->bo->save_item($values,$values_attribute);
+ $agreement_id =
$receipt['agreement_id'];
+ $id =
$receipt['id'];
+ $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','agreement_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $agreement_id);
+ }
+ }
+ }
+ elseif($values['update']):
+ {
+ $values['date'] =
get_var('date',array('POST'));
+
+ if(!$values['date'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
+ }
+ if(!$values['new_index'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a index !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->update($values);
+ }
+
+ }
+ elseif (!$values['save'] && !$values['apply']
&& !$values['update']):
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit&id='
. $agreement_id);
+ }
+ endif;
+ }
+
+ $agreement =
$this->bo->read_single(array('agreement_id'=>$agreement_id));
+ $values =
$this->bo->read_single_item(array('agreement_id'=>$agreement_id,'id'=>$id));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.edit_item',
+ 'agreement_id' => $agreement_id,
+ 'id' => $id,
+ 'role' => $this->role
+ );
+
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+
$dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+
$dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => array()));
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add detail'),
+ 'lang_add_standardtext' => lang('add an item to
the details'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_item&agreement_id='
. $agreement_id)
+ );
+
+
+ if($id)
+ {
+ $list =
$this->bo->read_prizing(array('agreement_id'=>$agreement_id,'activity_id'=>$id));
+ $activity_descr
=$this->bo->get_activity_descr($id);
+ }
+
+ $uicols = $this->bo->uicols;
+ $list =
$this->list_content($list,$uicols,$edit_item=True);
+ $content = $list['content'];
+ $table_header=$list['table_header'];
+
+ for ($i=0; $i<count($list['content'][0]['row']); $i++)
+ {
+ $set_column[]=True;
+ }
+
+ $table_update[] = array
+ (
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+
+ 'lang_new_index' =>
lang('New index'),
+ 'lang_new_index_statustext' => lang('Enter
a new index'),
+ 'lang_date_statustext' => lang('Select
the date for the update'),
+ 'lang_update' =>
lang('Update'),
+ 'lang_update_statustext' => lang('update
selected investments')
+ );
+
+ $data = array
+ (
+ 'activity_descr' =>
$activity_descr,
+ 'lang_descr' =>
lang('Descr'),
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'edit_url' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_id' =>
lang('ID'),
+ 'value_id' =>
$values['id'],
+ 'value_num' =>
$values['num'],
+ 'value_agreement_id' =>
$agreement_id,
+ 'lang_category' =>
lang('category'),
+ 'lang_save' =>
lang('save'),
+ 'lang_cancel' =>
lang('cancel'),
+ 'lang_apply' =>
lang('apply'),
+ 'lang_apply_statustext' =>
lang('Apply the values'),
+ 'lang_cancel_statustext' =>
lang('Leave the agreement untouched and return back to the list'),
+ 'lang_save_statustext' =>
lang('Save the agreement and return back to the list'),
+
+ 'lang_dateformat' =>
lang(strtolower($dateformat)),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp' =>
$onKeyUp,
+ 'onBlur' =>
$onBlur,
+ 'dateformat_source' =>
'./'.$this->currentapp.'/inc/dateformat.js',
+ 'lang_attributes' =>
lang('Attributes'),
+ 'attributes_header' =>
$attributes_header,
+ 'attributes_values' =>
$values['attributes'],
+ 'lookup_functions' =>
$values['lookup_functions'],
+ 'dateformat' =>
$dateformat,
+
+ 'jsDateFormat' =>
$jsDateFormat,
+ 'date_img' =>
$cal_info['img'],
+ 'lang_datetitle' =>
lang('Select date'),
+ 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
+ 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
+
+ 'lang_agreement' =>
lang('Agreement'),
+ 'agreement_name' =>
$agreement['name'],
+
+ 'table_add'
=> $table_add,
+ 'values'
=> $content,
+ 'index_count'
=> $content[0]['index_count'],
+ 'table_header'
=> $table_header,
+ 'acl_manage'
=> $this->acl_manage,
+ 'table_update'
=> $table_update,
+ 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_item&agreement_id='
. $agreement_id . '&id=' . $id),
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+
+ 'lang_m_cost'
=> lang('Material cost'),
+ 'lang_m_cost_statustext' =>
lang('Material cost'),
+ 'value_m_cost'
=> $values['m_cost'],
+
+ 'lang_w_cost'
=> lang('Labour cost'),
+ 'lang_w_cost_statustext' =>
lang('Labour cost'),
+ 'value_w_cost'
=> $values['w_cost'],
+
+ 'lang_total_cost'
=> lang('Total cost'),
+ 'value_total_cost'
=> $values['total_cost'],
+
+ 'set_column'
=> $set_column,
+ 'lang_delete_last'
=> lang('delete last index'),
+ 'lang_delete_last_statustext' => lang('delete
the last index'),
+ 'delete_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_item&delete_last=1&agreement_id='
. $agreement_id . '&id=' . $id),
+
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . ($values['id']?lang('edit item') . ' ' .
$agreement['name']:lang('add item') . ' ' . $agreement['name']);
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_item' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view_item()
+ {
+ $agreement_id =
get_var('agreement_id',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement','attributes_view'));
+
+ $agreement =
$this->bo->read_single(array('agreement_id'=>$agreement_id));
+ $values =
$this->bo->read_single_item(array('agreement_id'=>$agreement_id,'id'=>$id));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.edit',
+ 'id' => $agreement_id
+ );
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ if($id)
+ {
+ $list =
$this->bo->read_prizing(array('agreement_id'=>$agreement_id,'activity_id'=>$id));
+ $activity_descr
=$this->bo->get_activity_descr($id);
+ }
+
+ $uicols = $this->bo->uicols;
+ $list =
$this->list_content($list,$uicols,$edit_item=True);
+ $content = $list['content'];
+ $table_header=$list['table_header'];
+
+ $data = array
+ (
+ 'activity_descr' =>
$activity_descr,
+ 'lang_descr' =>
lang('Descr'),
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'edit_url' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_id' =>
lang('ID'),
+ 'value_id' =>
$values['id'],
+ 'value_num' =>
$values['num'],
+ 'value_agreement_id' =>
$agreement_id,
+ 'lang_category' =>
lang('category'),
+ 'lang_cancel' =>
lang('cancel'),
+ 'lang_cancel_statustext' =>
lang('Leave the agreement untouched and return back to the list'),
+
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'attributes_view'
=> $values['attributes'],
+
+ 'lang_agreement'
=> lang('Agreement'),
+ 'agreement_name'
=> $agreement['name'],
+
+ 'table_add'
=> $table_add,
+ 'values'
=> $content,
+ 'table_header'
=> $table_header,
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+
+ 'lang_m_cost'
=> lang('Material cost'),
+ 'value_m_cost'
=> $values['m_cost'],
+
+ 'lang_w_cost'
=> lang('Labour cost'),
+ 'value_w_cost'
=> $values['w_cost'],
+
+ 'lang_total_cost'
=> lang('Total cost'),
+ 'value_total_cost'
=> $values['total_cost'],
+ 'set_column'
=> $set_column,
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . lang('view item') . ' ' . $agreement['name'];
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view_item' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function delete()
+ {
+ $attrib = get_var('attrib',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $agreement_id =
get_var('agreement_id',array('POST','GET'));
+ $delete = get_var('delete',array('POST'));
+ $confirm = get_var('confirm',array('POST'));
+
+
+ if($attrib)
+ {
+ $function='list_attribute';
+ }
+ else
+ {
+ $function='index';
+ }
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.'.$function,
+ 'role' => $this->role
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($agreement_id,$id,$attrib);
+// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.delete&agreement_id='
. $agreement_id. '&id=' . $id . '&attrib=' . $attrib . '&role=' . $this->role),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('agreement');
+ $function_msg =
lang('delete') . ' ' . lang($this->role);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+
+ function view()
+ {
+ $agreement_id = get_var('id',array('POST','GET'));
+ $config =
CreateObject('phpgwapi.config',$this->currentapp);
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement','nextmatchs','attributes_view'));
+
+
+ $agreement =
$this->bo->read_single(array('agreement_id'=>$agreement_id));
+
+
+ if ($agreement_id)
+ {
+ $this->cat_id =
($agreement['cat_id']?$agreement['cat_id']:$this->cat_id);
+ $this->member_id =
($agreement['member_of']?$agreement['member_of']:$this->member_id);
+ $list = $this->bo->read_details($agreement_id);
+
+ $uicols = $this->bo->uicols;
+ $list =
$this->list_content($list,$uicols,$edit_item=False,$view_only=True);
+ $content = $list['content'];
+ $table_header=$list['table_header'];
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.index',
+ 'agreement_id' => $agreement_id,
+ );
+
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'vendor_id' =>
$agreement['vendor_id'],
+ 'vendor_name' =>
$agreement['vendor_name'],
+ 'type' =>
'view'));
+
+ $alarm_data=$this->bocommon->initiate_ui_alarm(array(
+
'acl_location'=>$this->acl2_location,
+ 'alarm_type'=> 'agreement',
+ 'type' => 'view',
+ 'text' => 'Email
notification',
+ 'times' => $times,
+ 'id' =>
$agreement_id,
+ 'method' => $method,
+ 'data' => $data,
+ 'account_id'=> $account_id
+ ));
+
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => array()));
+
+ $link_file_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.view_file',
+ 'id'
=>$agreement_id
+ );
+
+
+ $config->read_repository();
+ $link_to_files = $config->config_data['files_url'];
+
+ $j = count($agreement['files']);
+ for ($i=0;$i<$j;$i++)
+ {
+
$agreement['files'][$i]['file_name']=urlencode($agreement['files'][$i]['name']);
+ }
+
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $link_data2 = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.view',
+ 'id' => $agreement_id,
+ );
+
+ $data = array
+ (
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($content),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data2),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+
+ 'alarm_data'
=> $alarm_data,
+ 'lang_alarm'
=> lang('Alarm'),
+ 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
+ 'link_to_files'
=> $link_to_files,
+ 'files'
=> $agreement['files'],
+ 'lang_files'
=> lang('files'),
+ 'lang_filename'
=> lang('Filename'),
+ 'lang_view_file_statustext' =>
lang('Klick to view file'),
+
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_id'
=> lang('ID'),
+ 'value_agreement_id' =>
$agreement_id,
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('done'),
+ 'lang_apply'
=> lang('apply'),
+ 'value_cat'
=> $agreement['cat'],
+ 'lang_cancel_statustext' =>
lang('return back to the list'),
+ 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
+
+ 'lang_member_of'
=> lang('member of'),
+ 'member_of_name'
=> 'member_id',
+ 'member_of_list'
=> $member_of_data['cat_list'],
+
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'attributes_view'
=> $agreement['attributes'],
+ 'dateformat'
=> $dateformat,
+
+ 'lang_start_date'
=> lang('start date'),
+ 'value_start_date'
=> $agreement['start_date'],
+
+ 'lang_end_date'
=> lang('end date'),
+ 'value_end_date'
=> $agreement['end_date'],
+
+ 'lang_termination_date' =>
lang('termination date'),
+ 'value_termination_date' =>
$agreement['termination_date'],
+
+ 'vendor_data'
=> $vendor_data,
+ 'lang_name'
=> lang('name'),
+ 'value_name'
=> $agreement['name'],
+ 'lang_descr'
=> lang('descr'),
+ 'value_descr'
=> $agreement['descr'],
+ 'table_add'
=> $table_add,
+ 'values'
=> $content,
+ 'table_header'
=> $table_header,
+ 'lang_agreement_group' =>
lang('Agreement group'),
+ 'agreement_group_list' =>
$this->bo->get_agreement_group_list($agreement['group_id']),
+
+ 'lang_status'
=> lang('Status'),
+ 'status_list'
=> $this->bo->select_status_list('select',$agreement['status']),
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('agreement') . ': ' . lang('view');
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function list_attribute()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $resort = get_var('resort',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array(
+ 'agreement',
+ 'nextmatchs',
+
'search_field'));
+
+ if($resort)
+ {
+
$this->bo->resort_attrib(array('resort'=>$resort,'id'=>$id));
+ }
+
+ $attrib_list = $this->bo->read_attrib();
+
+ while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
+ {
+ $content[] = array
+ (
+ 'name'
=> $attrib['name'],
+ 'type_name'
=> $attrib['type_name'],
+ 'datatype'
=> $attrib['datatype'],
+ 'column_name'
=> $attrib['column_name'],
+ 'input_text'
=> $attrib['input_text'],
+ 'sorting'
=> $attrib['attrib_sort'],
+ 'search'
=> $attrib['search'],
+ 'link_up'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.list_attribute&resort=up&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
+ 'link_down'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.list_attribute&resort=down&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_attrib&id='
. $attrib['id'] . '&role=' . $this->role),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.delete&id='
. $attrib['id'].'&attrib=true&role=' . $this->role),
+ 'lang_view_attribtext' =>
lang('view the attrib'),
+ 'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang('location'),
+ 'lang_edit_attribtext' =>
lang('edit the attrib'),
+ 'lang_delete_attribtext' =>
lang('delete the attrib'),
+ 'text_attribute'
=> lang('Attributes'),
+ 'text_up'
=> lang('up'),
+ 'text_down'
=> lang('down'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+ //html_print_r($content);
+
+ $table_header[] = array
+ (
+ 'lang_descr' => lang('Descr'),
+ 'lang_datatype' => lang('Datatype'),
+ 'lang_sorting' => lang('sorting'),
+ 'lang_search' => lang('search'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_sorting' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'attrib_sort',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiagreement.list_attribute',
+
'allrows'=>$this->allrows,
+
'role' => $this->role)
+
)),
+
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'column_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiagreement.list_attribute',
+
'allrows'=>$this->allrows,
+
'role' => $this->role)
+
)),
+ 'lang_name' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_attribtext' => lang('add a attrib'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.edit_attrib&role='
. $this->role),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_attribtext' => lang('back to
admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php'),
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.list_attribute',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'query'
=>$this->query,
+ 'role' =>
$this->role
+
+ );
+
+ $data = array
+ (
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($attrib_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_attribtext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_attrib' =>
$table_header,
+ 'values_attrib'
=> $content,
+ 'table_add2'
=> $table_add
+ );
+
+ $appname
= lang('agreement');
+ $function_msg =
lang('list attribute') . ': ' . lang($this->role);
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function edit_attrib()
+ {
+ $id =
get_var('id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+ // $GLOBALS['phpgw']->common->msgbox(lang('Altering
ColumnName OR Datatype - deletes your data in this Column'));
+ //html_print_r($values);
+
$GLOBALS['phpgw']->xslttpl->add_file(array('agreement','choice',));
+
+ if ($values['save'])
+ {
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ $type_id =
$values['type_id'];
+
+ if (!$values['column_name'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
+ }
+
+ if (!$values['input_text'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Input text not entered!'));
+ }
+ if (!$values['statustext'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
+ }
+
+ if (!$values['column_info']['type'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
+ }
+
+
if(!ctype_digit($values['column_info']['precision']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
+
unset($values['column_info']['precision']);
+ }
+
+
if(!ctype_digit($values['column_info']['scale']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
+ unset($values['column_info']['scale']);
+ }
+
+ if (!$values['column_info']['nullable'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
+ }
+
+
+ if (!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_attrib($values,$action);
+
+ if(!$id)
+ {
+ $id=$receipt['id'];
+ }
+ }
+ else
+ {
+ $receipt['error'][] = array('msg'
=> lang('Attribute has NOT been saved'));
+ }
+
+ }
+
+ if ($id)
+ {
+ $values = $this->bo->read_single_attrib($id);
+ $function_msg = lang('edit attribute') . ': ' .
lang($this->role);
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add attribute') . ': ' .
lang($this->role);
+ $action='add';
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiagreement.edit_attrib',
+ 'id' => $id,
+ 'role' => $this->role
+
+ );
+ //html_print_r($values);
+
+ if($values['column_info']['type']=='R' ||
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
+ {
+ $multiple_choice= True;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'lang_choice' =>
lang('Choice'),
+ 'lang_new_value' =>
lang('New value'),
+ 'lang_new_value_statustext' => lang('New
value for mulitple choice'),
+ 'multiple_choice' =>
$multiple_choice,
+ 'value_choice' =>
$values['choice'],
+ 'lang_delete_value' =>
lang('Delete value'),
+ 'lang_value' =>
lang('value'),
+ 'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiagreement.list_attribute&type_id='.$type_id
. '&role=' . $this->role),
+ 'lang_id'
=> lang('Attribute ID'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id'
=> $id,
+
+ 'lang_column_name'
=> lang('Column name'),
+ 'value_column_name'
=> $values['column_name'],
+ 'lang_column_name_statustext' => lang('enter
the name for the column'),
+
+ 'lang_input_text'
=> lang('input text'),
+ 'value_input_text'
=> $values['input_text'],
+ 'lang_input_name_statustext' => lang('enter
the input text for records'),
+
+ 'lang_id_attribtext' => lang('Enter
the attribute ID'),
+ 'lang_entity_statustext' => lang('Select
a agreement type'),
+
+ 'lang_statustext' =>
lang('Statustext'),
+ 'lang_statustext_attribtext'=> lang('Enter a
statustext for the inputfield in forms'),
+ 'value_statustext' =>
$values['statustext'],
+
+ 'lang_done_attribtext' => lang('Back
to the list'),
+ 'lang_save_attribtext' => lang('Save
the attribute'),
+
+ 'lang_datatype' =>
lang('Datatype'),
+ 'lang_datatype_statustext' => lang('Select
a datatype'),
+ 'lang_no_datatype' =>
lang('No datatype'),
+ 'datatype_list' =>
$this->bocommon->select_datatype($values['column_info']['type']),
+
+ 'lang_precision' =>
lang('Precision'),
+ 'lang_precision_statustext' => lang('enter
the record length'),
+ 'value_precision' =>
$values['column_info']['precision'],
+
+ 'lang_scale' =>
lang('scale'),
+ 'lang_scale_statustext' => lang('enter
the scale if type is decimal'),
+ 'value_scale' =>
$values['column_info']['scale'],
+
+ 'lang_default' =>
lang('default'),
+ 'lang_default_statustext' => lang('enter
the default value'),
+ 'value_default' =>
$values['column_info']['default'],
+
+ 'lang_nullable' =>
lang('Nullable'),
+ 'lang_nullable_statustext' => lang('Chose
if this column is nullable'),
+ 'lang_select_nullable' => lang('Select
nullable'),
+ 'nullable_list' =>
$this->bocommon->select_nullable($values['column_info']['nullable']),
+
+ 'value_list' =>
$values['list'],
+ 'lang_list'
=> lang('show in list'),
+ 'lang_list_statustext' => lang('check
to show this attribute in location list'),
+
+ 'value_search' =>
$values['search'],
+ 'lang_include_search' =>
lang('Include in search'),
+ 'lang_include_search_statustext'=> lang('check
to show this attribute in location list'),
+
+
+ );
+ //html_print_r($data);
+
+ $appname
= lang('agreement');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
?>
\ No newline at end of file
Index: property/inc/class.uialarm.inc.php
diff -u property/inc/class.uialarm.inc.php:1.10
property/inc/class.uialarm.inc.php:1.11
--- property/inc/class.uialarm.inc.php:1.10 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uialarm.inc.php Fri Feb 3 12:05:49 2006
@@ -1,474 +1,474 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uialarm.inc.php,v 1.10 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uialarm
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uialarm()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.boalarm',True);
- $this->boasync =
CreateObject($this->currentapp.'.boasync');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->start = $this->bo->start;
- $this->query = $this->bo->query;
- $this->sort = $this->bo->sort;
- $this->order = $this->bo->order;
- $this->filter = $this->bo->filter;
- $this->method_id = $this->bo->method_id;
- $this->allrows = $this->bo->allrows;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'method_id' => $this->method_id,
- 'this->allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- $GLOBALS['phpgw']->xslttpl->add_file(array('alarm',
-
'menu',
-
'receipt',
-
'search_field',
-
'nextmatchs'));
-
- $links = $this->menu->links();
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt');
-
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt','');
- $values = get_var('values',array('POST'));
- if($values['delete_alarm'] && count($values['alarm'])):
- {
- $receipt =
$this->bo->delete_alarm('fm_async',$values['alarm']);
- }
- elseif(($values['enable_alarm'] ||
$values['disable_alarm']) && count($values['alarm'])):
- {
- $receipt =
$this->bo->enable_alarm('fm_async',$values['alarm'],$values['enable_alarm']);
- }
- elseif($values['test_cron']):
- {
- $this->bo->test_cron();
- }
- endif;
-
- $list = $this->bo->read();
-//_debug_array($list);
-
- while (is_array($list) && list(,$alarm) = each($list))
- {
- if(is_array($alarm['times']))
- {
- while (is_array($alarm['times']) &&
list($key,$value) = each($alarm['times']))
- {
- $times .=$key . ' => ' .$value.
' ';
- }
-
- }
- else
- {
- $times =
$GLOBALS['phpgw']->common->show_date($alarm['times']);
- }
- if(is_array($alarm['data']))
- {
- while (is_array($alarm['data']) &&
list($key,$value) = each($alarm['data']))
- {
- $data .=$key . ' => ' .$value .
' ';
- }
-
- }
-
- if (substr($alarm['id'],0,8)=='fm_async')
- {
- $link_edit
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uialarm.edit&async_id='
. urlencode($alarm['id']));
- $lang_edit_statustext =
lang('edit the alarm');
- $text_edit
= lang('edit');
- }
-
- $content[] = array
- (
- 'id'
=> $alarm['id'],
- 'next_run'
=> $GLOBALS['phpgw']->common->show_date($alarm['next']),
- 'method'
=> $alarm['method'],
- 'times'
=> $times,
- 'data'
=> $data,
- 'enabled'
=> $alarm['enabled'],
- 'user'
=> $alarm['user'],
- 'link_edit'
=> $link_edit,
- 'lang_edit_statustext' =>
$lang_edit_statustext,
- 'text_edit'
=> $text_edit
- );
- unset($alarm);
- unset($data);
- unset($times);
- unset($link_edit);
- unset($lang_edit_statustext);
- unset($text_edit);
- }
-
- $table_header = array
- (
- 'lang_next_run' => lang('Next run'),
- 'lang_times' => lang('Times'),
- 'lang_method' => lang('Method'),
- 'lang_user' => lang('User'),
- 'lang_data' => lang('Data'),
- 'lang_select' => lang('select'),
- 'lang_edit' => lang('edit'),
- 'lang_alarm_id' => lang('alarm id'),
- 'lang_enabled' => lang('enabled'),
- 'sort_user' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'account_lid',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uialarm.index',
-
'cat_id' =>
$this->cat_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_method' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'method',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uialarm.index',
-
'cat_id' =>
$this->cat_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_next_run' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'next',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uialarm.index',
-
'cat_id' =>
$this->cat_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_alarm_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uialarm.index',
-
'cat_id' =>
$this->cat_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
))
- );
-
- $alter_alarm = array
- (
- 'lang_enable' => lang('Enable'),
- 'lang_disable' => lang('Disable'),
- 'lang_delete' => lang('Delete'),
- 'lang_test_cron' => lang('test cron')
- );
-
- $table_add = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add a alarm'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uialarm.edit')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uialarm.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
- 'allow_allrows'
=> true,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the alarm belongs to. To do not use a category select
NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> '',//$this->bo->select_category_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add,
- 'alter_alarm'
=> $alter_alarm,
- );
- $this->save_sessiondata();
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('alarm') . ': ' . lang('list alarm');
-//_debug_array($data);
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function edit()
- {
- $method_id = get_var('method_id',array('POST'));
- $async_id =
urldecode(get_var('async_id',array('POST','GET')));
- $values = get_var('values',array('POST'));
-
- if($async_id)
- {
- $async_id_elements = explode(':',$async_id);
- $method_id = $async_id_elements[1];
- }
-
- $this->method_id =
($method_id?$method_id:$this->method_id);
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('alarm'));
-
-
- if ($values['save'] || $values['apply'])
- {
-
- $units = array(
- 'year',
- 'month',
- 'day',
- 'dow',
- 'hour',
- 'min');
-
- $times = array();
- foreach($units as $u)
- {
- if ($values[$u] !== '')
- {
- $times[$u] = $values[$u];
- }
- }
-
- if(!$receipt['error'])
- {
- $this->method_id =
($values['method_id']?$values['method_id']:$this->method_id);
-
- $values['alarm_id'] = $alarm_id;
-
-
$async=$this->boasync->read_single($this->method_id);
-//_debug_array($async);
- $data_set = unserialize($async['data']);
- $data_set['enabled'] = True;
- $data_set['times'] =
$times;
- $data_set['owner'] =
$this->account;
- $data_set['event_id'] =
$this->method_id;
- $data_set['id'] =
$async_id;
-
- $async_id =
$this->bo->save_alarm($alarm_type='fm_async',$entity_id=$this->method_id,$alarm=$data_set,$async['name']);
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uialarm.index');
- }
- }
- }
-
- if ($values['cancel'])
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uialarm.index');
- }
-
- if ($async_id)
- {
- $alarm =
$this->bo->read_alarm($alarm_type='fm_async',$async_id);
- $this->method_id =
($alarm['event_id']?$alarm['event_id']:$this->method_id);
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uialarm.edit',
- 'async_id' => $async_id
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-//_debug_array($alarm);
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'abook_data'
=> $abook_data,
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_async_id'
=> lang('ID'),
- 'value_async_id'
=> $async_id,
- 'lang_method'
=> lang('method'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the owner untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the owner and return back to the list'),
- 'lang_no_method'
=> lang('no method'),
- 'lang_method_statustext' =>
lang('Select the method for this times service'),
- 'method_list'
=> $this->bo->select_method_list($this->method_id),
- 'lang_timing'
=> lang('timing'),
- 'lang_year'
=> lang('year'),
- 'value_year'
=> $alarm['times']['year'],
- 'lang_month'
=> lang('month'),
- 'value_month'
=> $alarm['times']['month'],
- 'lang_day'
=> lang('day'),
- 'value_day'
=> $alarm['times']['day'],
- 'lang_dow'
=> lang('Day of week (0-6, 0=Sun)'),
- 'value_dow'
=> $alarm['times']['dow'],
- 'lang_hour'
=> lang('hour'),
- 'value_hour'
=> $alarm['times']['hour'],
- 'lang_minute'
=> lang('minute'),
- 'value_minute'
=> $alarm['times']['min'],
- 'lang_data'
=> lang('data'),
- 'lang_data_statustext' =>
lang('inputdata for the method')
- );
-//_debug_array($data);
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('async') . ': ' . ($async_id?lang('edit timer'):lang('add timer'));
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- /**
- * @todo remove or alter this function
- */
-
- function delete()
- {
- $owner_id =
get_var('owner_id',array('POST','GET'));
- $delete = get_var('delete',array('POST'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiowner.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($owner_id);
-// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
-
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiowner.delete&owner_id='
. $owner_id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('owner');
- $function_msg =
lang('delete owner');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
-
- function view()
- {
- $owner_id = get_var('owner_id',array('GET'));
- $action = get_var('action',array('GET'));
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('owner') . ': ' . lang('view owner');
-
- $GLOBALS['phpgw']->xslttpl->add_file('owner');
-
- $owner = $this->bo->read_single($owner_id);
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiowner.index'),
- 'lang_name' => lang('name'),
- 'lang_category' => lang('category'),
- 'lang_time_created' => lang('time created'),
- 'lang_done' => lang('done'),
- 'value_name' => $owner['name'],
- 'value_cat' =>
$this->bo->read_category_name($owner['cat_id']),
- 'value_date' =>
$GLOBALS['phpgw']->common->show_date($owner['entry_date'])
- );
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uialarm.inc.php,v 1.11 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uialarm
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uialarm()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.boalarm',True);
+ $this->boasync =
CreateObject($this->currentapp.'.boasync');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->start = $this->bo->start;
+ $this->query = $this->bo->query;
+ $this->sort = $this->bo->sort;
+ $this->order = $this->bo->order;
+ $this->filter = $this->bo->filter;
+ $this->method_id = $this->bo->method_id;
+ $this->allrows = $this->bo->allrows;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'method_id' => $this->method_id,
+ 'this->allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ $GLOBALS['phpgw']->xslttpl->add_file(array('alarm',
+
'menu',
+
'receipt',
+
'search_field',
+
'nextmatchs'));
+
+ $links = $this->menu->links();
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt');
+
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt','');
+ $values = get_var('values',array('POST'));
+ if($values['delete_alarm'] && count($values['alarm'])):
+ {
+ $receipt =
$this->bo->delete_alarm('fm_async',$values['alarm']);
+ }
+ elseif(($values['enable_alarm'] ||
$values['disable_alarm']) && count($values['alarm'])):
+ {
+ $receipt =
$this->bo->enable_alarm('fm_async',$values['alarm'],$values['enable_alarm']);
+ }
+ elseif($values['test_cron']):
+ {
+ $this->bo->test_cron();
+ }
+ endif;
+
+ $list = $this->bo->read();
+//_debug_array($list);
+
+ while (is_array($list) && list(,$alarm) = each($list))
+ {
+ if(is_array($alarm['times']))
+ {
+ while (is_array($alarm['times']) &&
list($key,$value) = each($alarm['times']))
+ {
+ $times .=$key . ' => ' .$value.
' ';
+ }
+
+ }
+ else
+ {
+ $times =
$GLOBALS['phpgw']->common->show_date($alarm['times']);
+ }
+ if(is_array($alarm['data']))
+ {
+ while (is_array($alarm['data']) &&
list($key,$value) = each($alarm['data']))
+ {
+ $data .=$key . ' => ' .$value .
' ';
+ }
+
+ }
+
+ if (substr($alarm['id'],0,8)=='fm_async')
+ {
+ $link_edit
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uialarm.edit&async_id='
. urlencode($alarm['id']));
+ $lang_edit_statustext =
lang('edit the alarm');
+ $text_edit
= lang('edit');
+ }
+
+ $content[] = array
+ (
+ 'id'
=> $alarm['id'],
+ 'next_run'
=> $GLOBALS['phpgw']->common->show_date($alarm['next']),
+ 'method'
=> $alarm['method'],
+ 'times'
=> $times,
+ 'data'
=> $data,
+ 'enabled'
=> $alarm['enabled'],
+ 'user'
=> $alarm['user'],
+ 'link_edit'
=> $link_edit,
+ 'lang_edit_statustext' =>
$lang_edit_statustext,
+ 'text_edit'
=> $text_edit
+ );
+ unset($alarm);
+ unset($data);
+ unset($times);
+ unset($link_edit);
+ unset($lang_edit_statustext);
+ unset($text_edit);
+ }
+
+ $table_header = array
+ (
+ 'lang_next_run' => lang('Next run'),
+ 'lang_times' => lang('Times'),
+ 'lang_method' => lang('Method'),
+ 'lang_user' => lang('User'),
+ 'lang_data' => lang('Data'),
+ 'lang_select' => lang('select'),
+ 'lang_edit' => lang('edit'),
+ 'lang_alarm_id' => lang('alarm id'),
+ 'lang_enabled' => lang('enabled'),
+ 'sort_user' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'account_lid',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uialarm.index',
+
'cat_id' =>
$this->cat_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
)),
+ 'sort_method' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'method',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uialarm.index',
+
'cat_id' =>
$this->cat_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
)),
+ 'sort_next_run' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'next',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uialarm.index',
+
'cat_id' =>
$this->cat_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
)),
+ 'sort_alarm_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uialarm.index',
+
'cat_id' =>
$this->cat_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
))
+ );
+
+ $alter_alarm = array
+ (
+ 'lang_enable' => lang('Enable'),
+ 'lang_disable' => lang('Disable'),
+ 'lang_delete' => lang('Delete'),
+ 'lang_test_cron' => lang('test cron')
+ );
+
+ $table_add = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add a alarm'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uialarm.edit')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uialarm.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'allow_allrows'
=> true,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the alarm belongs to. To do not use a category select
NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> '',//$this->bo->select_category_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add,
+ 'alter_alarm'
=> $alter_alarm,
+ );
+ $this->save_sessiondata();
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('alarm') . ': ' . lang('list alarm');
+//_debug_array($data);
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function edit()
+ {
+ $method_id = get_var('method_id',array('POST'));
+ $async_id =
urldecode(get_var('async_id',array('POST','GET')));
+ $values = get_var('values',array('POST'));
+
+ if($async_id)
+ {
+ $async_id_elements = explode(':',$async_id);
+ $method_id = $async_id_elements[1];
+ }
+
+ $this->method_id =
($method_id?$method_id:$this->method_id);
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('alarm'));
+
+
+ if ($values['save'] || $values['apply'])
+ {
+
+ $units = array(
+ 'year',
+ 'month',
+ 'day',
+ 'dow',
+ 'hour',
+ 'min');
+
+ $times = array();
+ foreach($units as $u)
+ {
+ if ($values[$u] !== '')
+ {
+ $times[$u] = $values[$u];
+ }
+ }
+
+ if(!$receipt['error'])
+ {
+ $this->method_id =
($values['method_id']?$values['method_id']:$this->method_id);
+
+ $values['alarm_id'] = $alarm_id;
+
+
$async=$this->boasync->read_single($this->method_id);
+//_debug_array($async);
+ $data_set = unserialize($async['data']);
+ $data_set['enabled'] = True;
+ $data_set['times'] =
$times;
+ $data_set['owner'] =
$this->account;
+ $data_set['event_id'] =
$this->method_id;
+ $data_set['id'] =
$async_id;
+
+ $async_id =
$this->bo->save_alarm($alarm_type='fm_async',$entity_id=$this->method_id,$alarm=$data_set,$async['name']);
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','alarm_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uialarm.index');
+ }
+ }
+ }
+
+ if ($values['cancel'])
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uialarm.index');
+ }
+
+ if ($async_id)
+ {
+ $alarm =
$this->bo->read_alarm($alarm_type='fm_async',$async_id);
+ $this->method_id =
($alarm['event_id']?$alarm['event_id']:$this->method_id);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uialarm.edit',
+ 'async_id' => $async_id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+//_debug_array($alarm);
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'abook_data'
=> $abook_data,
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_async_id'
=> lang('ID'),
+ 'value_async_id'
=> $async_id,
+ 'lang_method'
=> lang('method'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_apply'
=> lang('apply'),
+ 'lang_apply_statustext' =>
lang('Apply the values'),
+ 'lang_cancel_statustext' =>
lang('Leave the owner untouched and return back to the list'),
+ 'lang_save_statustext' =>
lang('Save the owner and return back to the list'),
+ 'lang_no_method'
=> lang('no method'),
+ 'lang_method_statustext' =>
lang('Select the method for this times service'),
+ 'method_list'
=> $this->bo->select_method_list($this->method_id),
+ 'lang_timing'
=> lang('timing'),
+ 'lang_year'
=> lang('year'),
+ 'value_year'
=> $alarm['times']['year'],
+ 'lang_month'
=> lang('month'),
+ 'value_month'
=> $alarm['times']['month'],
+ 'lang_day'
=> lang('day'),
+ 'value_day'
=> $alarm['times']['day'],
+ 'lang_dow'
=> lang('Day of week (0-6, 0=Sun)'),
+ 'value_dow'
=> $alarm['times']['dow'],
+ 'lang_hour'
=> lang('hour'),
+ 'value_hour'
=> $alarm['times']['hour'],
+ 'lang_minute'
=> lang('minute'),
+ 'value_minute'
=> $alarm['times']['min'],
+ 'lang_data'
=> lang('data'),
+ 'lang_data_statustext' =>
lang('inputdata for the method')
+ );
+//_debug_array($data);
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('async') . ': ' . ($async_id?lang('edit timer'):lang('add timer'));
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ /**
+ * @todo remove or alter this function
+ */
+
+ function delete()
+ {
+ $owner_id =
get_var('owner_id',array('POST','GET'));
+ $delete = get_var('delete',array('POST'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiowner.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($owner_id);
+// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiowner.delete&owner_id='
. $owner_id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('owner');
+ $function_msg =
lang('delete owner');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+
+ function view()
+ {
+ $owner_id = get_var('owner_id',array('GET'));
+ $action = get_var('action',array('GET'));
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('owner') . ': ' . lang('view owner');
+
+ $GLOBALS['phpgw']->xslttpl->add_file('owner');
+
+ $owner = $this->bo->read_single($owner_id);
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiowner.index'),
+ 'lang_name' => lang('name'),
+ 'lang_category' => lang('category'),
+ 'lang_time_created' => lang('time created'),
+ 'lang_done' => lang('done'),
+ 'value_name' => $owner['name'],
+ 'value_cat' =>
$this->bo->read_category_name($owner['cat_id']),
+ 'value_date' =>
$GLOBALS['phpgw']->common->show_date($owner['entry_date'])
+ );
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uiasync.inc.php
diff -u property/inc/class.uiasync.inc.php:1.10
property/inc/class.uiasync.inc.php:1.11
--- property/inc/class.uiasync.inc.php:1.10 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uiasync.inc.php Fri Feb 3 12:05:49 2006
@@ -1,314 +1,314 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uiasync.inc.php,v 1.10 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uiasync
- {
- var $grants;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uiasync()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject($this->currentapp.'.boasync',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->allrows =
$this->bo->allrows;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'allrows' => $this->allrows,
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('async','nextmatchs',
-
'search_field'));
-
- $method_list = $this->bo->read();
-
- while (is_array($method_list) && list(,$method) =
each($method_list))
- {
- $data_set = unserialize($method['data']);
-
- $method_data=array();
- while (is_array($data_set) && list($key,$value)
= each($data_set))
- {
-
- $method_data[] = $key . '=' . $value;
- }
-
-
- $content[] = array
- (
- 'id'
=> $method['id'],
- 'name'
=> $method['name'],
- 'first'
=> $method['descr'],
- 'data'
=> @implode (',',$method_data),
- 'link_run'
=> $GLOBALS['phpgw']->link('/index.php','menuaction='.$method['name'] .
'&' . @implode ('&',$method_data)),
- 'link_schedule'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uialarm.edit&method_id='
. $method['id']),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.edit&id='
. $method['id']),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.delete&id='
. $method['id']),
- 'lang_schedule_statustext'=>
lang('schedule the method'),
- 'lang_run_statustext' => lang('Run
the method now'),
- 'lang_view_statustext' => lang('view
the method'),
- 'lang_edit_statustext' => lang('edit
the method'),
- 'lang_delete_statustext' =>
lang('delete the method'),
- 'text_schedule'
=> lang('Schedule'),
- 'text_run'
=> lang('Run Now'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
-//_debug_array($content);
-
- $table_header[] = array
- (
-
- 'lang_descr' => lang('Descr'),
- 'lang_data' => lang('Data'),
- 'lang_schedule' => lang('Schedule'),
- 'lang_run' => lang('Run
Now'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiasync.index')
-
)),
- 'lang_id' => lang('method id'),
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiasync.index')
-
)),
- 'lang_name' => lang('Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add a method'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.edit'),
- 'lang_done' =>
lang('done'),
- 'lang_done_statustext' => lang('back to
admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
- );
-
-
- $data = array
- (
- 'allow_allrows'
=> False,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($method_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.index'),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('method');
- $function_msg =
lang('list async method');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit()
- {
- $id = get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('async'));
-
- if ($values['save'])
- {
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- else
- {
- $id = $values['id'];
- }
-
- $data = str_replace(' '
,'',stripslashes($values['data']));
- $data = stripslashes($values['data']);
-
- $data= explode(",", $data);
-
- if(is_array($data))
- {
- foreach($data as $set)
- {
- $set= explode("=", $set);
- $data_set[$set[0]]=$set[1];
- }
- }
-
- if($values['data'])
- {
- $values['data']=serialize($data_set);
- }
-
- $receipt = $this->bo->save($values,$action);
- $id = $receipt['id'];
- }
-
- if ($id)
- {
- $method = $this->bo->read_single($id);
- $data_set = unserialize($method['data']);
- while (is_array($data_set) && list($key,$value)
= each($data_set))
- {
- $method_data[] = $key . '=' . $value;
- }
-
- $method_data= @implode (',',$method_data);
- $function_msg = lang('edit method');
- $action='edit';
- }
- else
- {
- $function_msg = lang('add method');
- $action='add';
- }
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiasync.edit',
- 'id' => $id
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.index'),
- 'lang_id'
=> lang('method ID'),
- 'lang_name'
=> lang('Name'),
- 'lang_descr'
=> lang('Descr'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
- 'value_name'
=> $method['name'],
- 'lang_id_statustext' =>
lang('Enter the method ID'),
- 'lang_descr_statustext' => lang('Enter
a description the method'),
- 'lang_done_statustext' => lang('Back
to the list'),
- 'lang_save_statustext' => lang('Save
the method'),
- 'type_id'
=> $method['type_id'],
- 'location_code'
=> $method['location_code'],
- 'value_descr'
=> $method['descr'],
- 'value_data'
=> $method_data,
- 'lang_data'
=> lang('Data'),
- 'lang_data_statustext' =>
lang('Input data for the nethod'),
- );
-
- $appname
= lang('async method');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- $id = get_var('id',array('POST','GET'));
- $confirm =
get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiasync.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.delete&id='
. $id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('async method');
- $function_msg =
lang('delete async method');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uiasync.inc.php,v 1.11 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uiasync
+ {
+ var $grants;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uiasync()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bo =
CreateObject($this->currentapp.'.boasync',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->allrows =
$this->bo->allrows;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'allrows' => $this->allrows,
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('async','nextmatchs',
+
'search_field'));
+
+ $method_list = $this->bo->read();
+
+ while (is_array($method_list) && list(,$method) =
each($method_list))
+ {
+ $data_set = unserialize($method['data']);
+
+ $method_data=array();
+ while (is_array($data_set) && list($key,$value)
= each($data_set))
+ {
+
+ $method_data[] = $key . '=' . $value;
+ }
+
+
+ $content[] = array
+ (
+ 'id'
=> $method['id'],
+ 'name'
=> $method['name'],
+ 'first'
=> $method['descr'],
+ 'data'
=> @implode (',',$method_data),
+ 'link_run'
=> $GLOBALS['phpgw']->link('/index.php','menuaction='.$method['name'] .
'&' . @implode ('&',$method_data)),
+ 'link_schedule'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uialarm.edit&method_id='
. $method['id']),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.edit&id='
. $method['id']),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.delete&id='
. $method['id']),
+ 'lang_schedule_statustext'=>
lang('schedule the method'),
+ 'lang_run_statustext' => lang('Run
the method now'),
+ 'lang_view_statustext' => lang('view
the method'),
+ 'lang_edit_statustext' => lang('edit
the method'),
+ 'lang_delete_statustext' =>
lang('delete the method'),
+ 'text_schedule'
=> lang('Schedule'),
+ 'text_run'
=> lang('Run Now'),
+ 'text_view'
=> lang('view'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+
+ 'lang_descr' => lang('Descr'),
+ 'lang_data' => lang('Data'),
+ 'lang_schedule' => lang('Schedule'),
+ 'lang_run' => lang('Run
Now'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiasync.index')
+
)),
+ 'lang_id' => lang('method id'),
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiasync.index')
+
)),
+ 'lang_name' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add a method'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.edit'),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_statustext' => lang('back to
admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
+ );
+
+
+ $data = array
+ (
+ 'allow_allrows'
=> False,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($method_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.index'),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('method');
+ $function_msg =
lang('list async method');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('async'));
+
+ if ($values['save'])
+ {
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ else
+ {
+ $id = $values['id'];
+ }
+
+ $data = str_replace(' '
,'',stripslashes($values['data']));
+ $data = stripslashes($values['data']);
+
+ $data= explode(",", $data);
+
+ if(is_array($data))
+ {
+ foreach($data as $set)
+ {
+ $set= explode("=", $set);
+ $data_set[$set[0]]=$set[1];
+ }
+ }
+
+ if($values['data'])
+ {
+ $values['data']=serialize($data_set);
+ }
+
+ $receipt = $this->bo->save($values,$action);
+ $id = $receipt['id'];
+ }
+
+ if ($id)
+ {
+ $method = $this->bo->read_single($id);
+ $data_set = unserialize($method['data']);
+ while (is_array($data_set) && list($key,$value)
= each($data_set))
+ {
+ $method_data[] = $key . '=' . $value;
+ }
+
+ $method_data= @implode (',',$method_data);
+ $function_msg = lang('edit method');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add method');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiasync.edit',
+ 'id' => $id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.index'),
+ 'lang_id'
=> lang('method ID'),
+ 'lang_name'
=> lang('Name'),
+ 'lang_descr'
=> lang('Descr'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id'
=> $id,
+ 'value_name'
=> $method['name'],
+ 'lang_id_statustext' =>
lang('Enter the method ID'),
+ 'lang_descr_statustext' => lang('Enter
a description the method'),
+ 'lang_done_statustext' => lang('Back
to the list'),
+ 'lang_save_statustext' => lang('Save
the method'),
+ 'type_id'
=> $method['type_id'],
+ 'location_code'
=> $method['location_code'],
+ 'value_descr'
=> $method['descr'],
+ 'value_data'
=> $method_data,
+ 'lang_data'
=> lang('Data'),
+ 'lang_data_statustext' =>
lang('Input data for the nethod'),
+ );
+
+ $appname
= lang('async method');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $confirm =
get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiasync.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiasync.delete&id='
. $id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('async method');
+ $function_msg =
lang('delete async method');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uib_account.inc.php
diff -u property/inc/class.uib_account.inc.php:1.10
property/inc/class.uib_account.inc.php:1.11
--- property/inc/class.uib_account.inc.php:1.10 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uib_account.inc.php Fri Feb 3 12:05:49 2006
@@ -1,321 +1,321 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uib_account.inc.php,v 1.10 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uib_account
- {
- var $grants;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uib_account()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.bob_account',true);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- $this->menu =
CreateObject($this->currentapp.'.menu');
- $this->menu->sub ='invoice';
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.b_account';
- $this->acl_read =
$this->acl2->check('.b_account',1);
- $this->acl_add =
$this->acl2->check('.b_account',2);
- $this->acl_edit =
$this->acl2->check('.b_account',4);
- $this->acl_delete =
$this->acl2->check('.b_account',8);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->allrows =
$this->bo->allrows;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('b_account','nextmatchs','menu',
-
'search_field'));
-
- $links = $this->menu->links('b_account');
-
- $b_account_list = $this->bo->read($type);
-
- while (is_array($b_account_list) && list(,$b_account) =
each($b_account_list))
- {
- $words = split(' ',$b_account['descr']);
- $first = "$words[0] $words[1] $words[2]
$words[3]";
-
- if($this->acl_edit)
- {
- $link_edit
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.edit&id='
. $b_account['id']);
- }
-
- if($this->acl_delete)
- {
- $link_delete
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.delete&id='
. $b_account['id']);
- }
-
- $content[] = array
- (
- 'id'
=> $b_account['id'],
- 'first'
=> $first,
- 'link_edit'
=> $link_edit,
- 'link_delete'
=> $link_delete,
- 'lang_view_b_accounttext' =>
lang('view the budget account'),
- 'lang_edit_b_accounttext' =>
lang('edit the budget account'),
- 'lang_delete_b_accounttext' =>
lang('delete the budget account'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
-
- }
-
-//_debug_array($content);
-
- $table_header[] = array
- (
-
- 'lang_descr' => lang('Descr'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uib_account.index')
-
)),
- 'lang_id' => lang('budget account'),
- );
-
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_b_accounttext' => lang('add a
budget account'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.edit'),
- 'lang_done'
=> lang('done'),
- 'lang_done_b_accounttext' => lang('back
to admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
-
- $data = array
- (
- 'links'
=> $links,
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($b_account_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.index&type='.$type),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_b_accounttext' =>
lang('Enter the search string. To show all entries, empty this field and press
the SUBMIT button again'),
- 'lang_searchbutton_b_accounttext' =>
lang('Submit the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('budget account');
- $function_msg =
lang('list budget account');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $id = get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('b_account'));
-
- if ($values['save'])
- {
- if(!$id && !ctype_digit($values['id']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter an integer !'));
- unset($values['id']);
- }
-
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- else
- {
- $id = $values['id'];
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save($values,$action);
- }
- }
-
- if ($id)
- {
- $b_account = $this->bo->read_single($id);
- $function_msg = lang('edit budget account');
- $action='edit';
- }
- else
- {
- $function_msg = lang('add budget account');
- $action='add';
- }
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uib_account.edit',
- 'id' => $id
- );
-//_debug_array($link_data);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.index&type='.$type),
- 'lang_id'
=> lang('budget account'),
- 'lang_descr'
=> lang('Descr'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
- 'lang_group'
=> lang('group'),
- 'value_group'
=> $b_account['group'],
- 'lang_id_b_accounttext' =>
lang('Enter the budget account'),
- 'lang_descr_b_accounttext' =>
lang('Enter a description the budget account'),
- 'lang_done_b_accounttext' =>
lang('Back to the list'),
- 'lang_save_b_accounttext' =>
lang('Save the budget account'),
- 'value_descr'
=> $b_account['descr'],
- 'lang_responsible'
=> lang('Responsible'),
- 'lang_user_statustext' =>
lang('Select the budget responsible'),
- 'select_user_name'
=> 'values[responsible]',
- 'lang_no_user'
=> lang('Select responsible'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2('select',128,$b_account['responsible'],'.invoice'),
-
- );
-
- $appname
= lang('budget account');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
-
- $id = get_var('id',array('POST','GET'));
- $confirm =
get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uib_account.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.delete&id='
. $id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_b_accounttext' => lang('Delete
the entry'),
- 'lang_no_b_accounttext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('budget account');
- $function_msg =
lang('delete budget account');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uib_account.inc.php,v 1.11 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uib_account
+ {
+ var $grants;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uib_account()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.bob_account',true);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+ $this->menu->sub ='invoice';
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.b_account';
+ $this->acl_read =
$this->acl2->check('.b_account',1);
+ $this->acl_add =
$this->acl2->check('.b_account',2);
+ $this->acl_edit =
$this->acl2->check('.b_account',4);
+ $this->acl_delete =
$this->acl2->check('.b_account',8);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->allrows =
$this->bo->allrows;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('b_account','nextmatchs','menu',
+
'search_field'));
+
+ $links = $this->menu->links('b_account');
+
+ $b_account_list = $this->bo->read($type);
+
+ while (is_array($b_account_list) && list(,$b_account) =
each($b_account_list))
+ {
+ $words = split(' ',$b_account['descr']);
+ $first = "$words[0] $words[1] $words[2]
$words[3]";
+
+ if($this->acl_edit)
+ {
+ $link_edit
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.edit&id='
. $b_account['id']);
+ }
+
+ if($this->acl_delete)
+ {
+ $link_delete
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.delete&id='
. $b_account['id']);
+ }
+
+ $content[] = array
+ (
+ 'id'
=> $b_account['id'],
+ 'first'
=> $first,
+ 'link_edit'
=> $link_edit,
+ 'link_delete'
=> $link_delete,
+ 'lang_view_b_accounttext' =>
lang('view the budget account'),
+ 'lang_edit_b_accounttext' =>
lang('edit the budget account'),
+ 'lang_delete_b_accounttext' =>
lang('delete the budget account'),
+ 'text_view'
=> lang('view'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+
+ }
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+
+ 'lang_descr' => lang('Descr'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uib_account.index')
+
)),
+ 'lang_id' => lang('budget account'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_b_accounttext' => lang('add a
budget account'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.edit'),
+ 'lang_done'
=> lang('done'),
+ 'lang_done_b_accounttext' => lang('back
to admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+
+ $data = array
+ (
+ 'links'
=> $links,
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($b_account_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.index&type='.$type),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_b_accounttext' =>
lang('Enter the search string. To show all entries, empty this field and press
the SUBMIT button again'),
+ 'lang_searchbutton_b_accounttext' =>
lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('budget account');
+ $function_msg =
lang('list budget account');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $id = get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('b_account'));
+
+ if ($values['save'])
+ {
+ if(!$id && !ctype_digit($values['id']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter an integer !'));
+ unset($values['id']);
+ }
+
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ else
+ {
+ $id = $values['id'];
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save($values,$action);
+ }
+ }
+
+ if ($id)
+ {
+ $b_account = $this->bo->read_single($id);
+ $function_msg = lang('edit budget account');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add budget account');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uib_account.edit',
+ 'id' => $id
+ );
+//_debug_array($link_data);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.index&type='.$type),
+ 'lang_id'
=> lang('budget account'),
+ 'lang_descr'
=> lang('Descr'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id'
=> $id,
+ 'lang_group'
=> lang('group'),
+ 'value_group'
=> $b_account['group'],
+ 'lang_id_b_accounttext' =>
lang('Enter the budget account'),
+ 'lang_descr_b_accounttext' =>
lang('Enter a description the budget account'),
+ 'lang_done_b_accounttext' =>
lang('Back to the list'),
+ 'lang_save_b_accounttext' =>
lang('Save the budget account'),
+ 'value_descr'
=> $b_account['descr'],
+ 'lang_responsible'
=> lang('Responsible'),
+ 'lang_user_statustext' =>
lang('Select the budget responsible'),
+ 'select_user_name'
=> 'values[responsible]',
+ 'lang_no_user'
=> lang('Select responsible'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2('select',128,$b_account['responsible'],'.invoice'),
+
+ );
+
+ $appname
= lang('budget account');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ if(!$this->acl_delete)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+
+ $id = get_var('id',array('POST','GET'));
+ $confirm =
get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uib_account.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uib_account.delete&id='
. $id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_b_accounttext' => lang('Delete
the entry'),
+ 'lang_no_b_accounttext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('budget account');
+ $function_msg =
lang('delete budget account');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uicategory.inc.php
diff -u property/inc/class.uicategory.inc.php:1.9
property/inc/class.uicategory.inc.php:1.10
--- property/inc/class.uicategory.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uicategory.inc.php Fri Feb 3 12:05:49 2006
@@ -1,290 +1,290 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uicategory.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uicategory
- {
- var $grants;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uicategory()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject($this->currentapp.'.bocategory',true);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->allrows =
$this->bo->allrows;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- $type = get_var('type',array('POST','GET'));
- $type_id =
get_var('type_id',array('POST','GET'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('category','nextmatchs',
-
'search_field'));
-
- $category_list = $this->bo->read($type,$type_id);
-
- while (is_array($category_list) && list(,$category) =
each($category_list))
- {
- $words = split(' ',$category['descr']);
- $first = "$words[0] $words[1] $words[2]
$words[3]";
-
- $content[] = array
- (
- 'id'
=> $category['id'],
- 'first'
=> $first,
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.edit&id='
. $category['id'].'&type='.$type . '&type_id=' . $type_id),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.delete&id='
. $category['id'].'&type='.$type . '&type_id=' . $type_id),
- 'lang_view_categorytext' =>
lang('view the category'),
- 'lang_edit_categorytext' =>
lang('edit the category'),
- 'lang_delete_categorytext' =>
lang('delete the category'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
-//_debug_array($content);
-
- $table_header[] = array
- (
-
- 'lang_descr' => lang('Descr'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uicategory.index',
-
'type' =>$type,
-
'type_id' => $type_id)
-
)),
- 'lang_id' => lang('category id'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_categorytext' => lang('add a
category'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.edit&type='.$type
. '&type_id=' . $type_id),
- 'lang_done' =>
lang('done'),
- 'lang_done_categorytext' => lang('back
to admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
-
- $data = array
- (
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($category_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.index&type='.$type
. '&type_id=' . $type_id),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_categorytext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_categorytext' =>
lang('Submit the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang($type). ' ' . $type_id;
-;
- $function_msg =
lang('list %1 category',$type);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit()
- {
- $type = get_var('type',array('POST','GET'));
- $type_id =
get_var('type_id',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('category'));
-
- if ($values['save'])
- {
- if(!$id && !ctype_digit($values['id']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter an integer !'));
- unset($values['id']);
- }
-
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- else
- {
- $id = $values['id'];
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save($values,$action,$type,$type_id);
- }
- }
-
- if ($id)
- {
- $category =
$this->bo->read_single($id,$type,$type_id);
- $function_msg = lang('edit category');
- $action='edit';
- }
- else
- {
- $function_msg = lang('add category');
- $action='add';
- }
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uicategory.edit',
- 'id' => $id,
- 'type' => $type,
- 'type_id' => $type_id
- );
-//_debug_array($link_data);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.index&type='.$type
. '&type_id=' . $type_id),
- 'lang_id' =>
lang('category ID'),
- 'lang_descr'
=> lang('Descr'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id' => $id,
- 'lang_id_categorytext' => lang('Enter the
category ID'),
- 'lang_descr_categorytext'
=> lang('Enter a description the category'),
- 'lang_done_categorytext'
=> lang('Back to the list'),
- 'lang_save_categorytext'
=> lang('Save the category'),
- 'type_id' =>
$category['type_id'],
- 'value_descr'
=> $category['descr']
- );
-
- $appname
= lang($type). ' ' . $type_id;
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- $type = get_var('type',array('POST','GET'));
- $type_id =
get_var('type_id',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $confirm =
get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uicategory.index',
- 'type' => $type,
- 'type_id' => $type_id
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id,$type,$type_id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.delete&id='
. $id.'&type='.$type . '&type_id=' . $type_id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_categorytext' => lang('Delete the
entry'),
- 'lang_no_categorytext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang($type). ' ' . $type_id;
- $function_msg =
lang('delete '.$type.' category');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uicategory.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uicategory
+ {
+ var $grants;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uicategory()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bo =
CreateObject($this->currentapp.'.bocategory',true);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->allrows =
$this->bo->allrows;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ $type = get_var('type',array('POST','GET'));
+ $type_id =
get_var('type_id',array('POST','GET'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('category','nextmatchs',
+
'search_field'));
+
+ $category_list = $this->bo->read($type,$type_id);
+
+ while (is_array($category_list) && list(,$category) =
each($category_list))
+ {
+ $words = split(' ',$category['descr']);
+ $first = "$words[0] $words[1] $words[2]
$words[3]";
+
+ $content[] = array
+ (
+ 'id'
=> $category['id'],
+ 'first'
=> $first,
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.edit&id='
. $category['id'].'&type='.$type . '&type_id=' . $type_id),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.delete&id='
. $category['id'].'&type='.$type . '&type_id=' . $type_id),
+ 'lang_view_categorytext' =>
lang('view the category'),
+ 'lang_edit_categorytext' =>
lang('edit the category'),
+ 'lang_delete_categorytext' =>
lang('delete the category'),
+ 'text_view'
=> lang('view'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+
+ 'lang_descr' => lang('Descr'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uicategory.index',
+
'type' =>$type,
+
'type_id' => $type_id)
+
)),
+ 'lang_id' => lang('category id'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_categorytext' => lang('add a
category'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.edit&type='.$type
. '&type_id=' . $type_id),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_categorytext' => lang('back
to admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+
+ $data = array
+ (
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($category_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.index&type='.$type
. '&type_id=' . $type_id),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_categorytext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_categorytext' =>
lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang($type). ' ' . $type_id;
+;
+ $function_msg =
lang('list %1 category',$type);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit()
+ {
+ $type = get_var('type',array('POST','GET'));
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('category'));
+
+ if ($values['save'])
+ {
+ if(!$id && !ctype_digit($values['id']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter an integer !'));
+ unset($values['id']);
+ }
+
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ else
+ {
+ $id = $values['id'];
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save($values,$action,$type,$type_id);
+ }
+ }
+
+ if ($id)
+ {
+ $category =
$this->bo->read_single($id,$type,$type_id);
+ $function_msg = lang('edit category');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add category');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uicategory.edit',
+ 'id' => $id,
+ 'type' => $type,
+ 'type_id' => $type_id
+ );
+//_debug_array($link_data);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.index&type='.$type
. '&type_id=' . $type_id),
+ 'lang_id' =>
lang('category ID'),
+ 'lang_descr'
=> lang('Descr'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id' => $id,
+ 'lang_id_categorytext' => lang('Enter the
category ID'),
+ 'lang_descr_categorytext'
=> lang('Enter a description the category'),
+ 'lang_done_categorytext'
=> lang('Back to the list'),
+ 'lang_save_categorytext'
=> lang('Save the category'),
+ 'type_id' =>
$category['type_id'],
+ 'value_descr'
=> $category['descr']
+ );
+
+ $appname
= lang($type). ' ' . $type_id;
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ $type = get_var('type',array('POST','GET'));
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $confirm =
get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uicategory.index',
+ 'type' => $type,
+ 'type_id' => $type_id
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id,$type,$type_id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicategory.delete&id='
. $id.'&type='.$type . '&type_id=' . $type_id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_categorytext' => lang('Delete the
entry'),
+ 'lang_no_categorytext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang($type). ' ' . $type_id;
+ $function_msg =
lang('delete '.$type.' category');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uicustom.inc.php
diff -u property/inc/class.uicustom.inc.php:1.12
property/inc/class.uicustom.inc.php:1.13
--- property/inc/class.uicustom.inc.php:1.12 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uicustom.inc.php Fri Feb 3 12:05:49 2006
@@ -1,567 +1,567 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 custom
- * @version $Id: class.uicustom.inc.php,v 1.12 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uicustom
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'excel' => True,
- 'delete' => True
- );
-
- function uicustom()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.bocustom',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->start = $this->bo->start;
- $this->query = $this->bo->query;
- $this->sort = $this->bo->sort;
- $this->order = $this->bo->order;
- $this->filter = $this->bo->filter;
- $this->cat_id = $this->bo->cat_id;
- $this->allrows = $this->bo->allrows;
- $this->menu->sub ='custom';
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.custom';
- $this->acl_read =
$this->acl2->check('.custom',1);
- $this->acl_add =
$this->acl2->check('.custom',2);
- $this->acl_edit =
$this->acl2->check('.custom',4);
- $this->acl_delete =
$this->acl2->check('.custom',8);
-
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'this->allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- $GLOBALS['phpgw']->xslttpl->add_file(array('custom',
-
'menu',
-
'receipt',
-
'search_field',
-
'nextmatchs'));
-
- $links = $this->menu->links();
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','custom_receipt');
-
$GLOBALS['phpgw']->session->appsession('session_data','custom_receipt','');
-
- $list = $this->bo->read();
-
- $uicols['name'][] = 'custom_id';
- $uicols['descr'][] = lang('ID');
- $uicols['name'][] = 'name';
- $uicols['descr'][] = lang('Name');
- $uicols['name'][] = 'entry_date';
- $uicols['descr'][] = lang('date');
- $uicols['name'][] = 'user';
- $uicols['descr'][] = lang('User');
-
- $j=0;
- if (isset($list) AND is_array($list))
- {
- foreach($list as $entry)
- {
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
- }
- }
-
- if($this->acl_read)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
- $content[$j]['row'][$i]['text']
= lang('view');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.view&custom_id='
. $entry['custom_id']);
- }
- if($this->acl_edit)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('edit the
actor');
- $content[$j]['row'][$i]['text']
= lang('edit');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.edit&custom_id='
. $entry['custom_id']);
- }
- if($this->acl_delete)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('delete the
actor');
- $content[$j]['row'][$i]['text']
= lang('delete');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.delete&custom_id='
. $entry['custom_id']);
- }
-
- $j++;
- }
- }
-
-//_debug_array($list);
- $i=0;
- $table_header[$i]['header'] = lang('ID');
- $table_header[$i]['width'] = '5%';
- $table_header[$i]['align'] = 'center';
- $table_header[$i]['sort_link'] =true;
- $table_header[$i]['sort'] =
$this->nextmatchs->show_sort_order(array
- (
- 'sort' => $this->sort,
- 'var' => 'id',
- 'order' => $this->order,
- 'extra' => array('menuaction'
=> $this->currentapp.'.uicustom.index',
-
'query' =>$this->query,
-
'start_date' => $start_date,
-
'end_date'=>$end_date)
- ));
- $i++;
- $table_header[$i]['header'] = lang('name');
- $table_header[$i]['width'] = '5%';
- $table_header[$i]['align'] = 'center';
- $table_header[$i]['sort_link'] =true;
- $table_header[$i]['sort'] =
$this->nextmatchs->show_sort_order(array
- (
- 'sort' => $this->sort,
- 'var' => 'name',
- 'order' => $this->order,
- 'extra' => array('menuaction'
=> $this->currentapp.'.uicustom.index',
-
'query' =>$this->query,
-
'start_date' => $start_date,
-
'end_date'=>$end_date)
- ));
- $i++;
-
- $table_header[$i]['header'] = lang('date');
- $table_header[$i]['width'] = '5%';
- $table_header[$i]['align'] = 'center';
- $table_header[$i]['sort_link'] =true;
- $table_header[$i]['sort'] =
$this->nextmatchs->show_sort_order(array
- (
- 'sort' => $this->sort,
- 'var' => 'name',
- 'order' => $this->order,
- 'extra' => array('menuaction'
=> $this->currentapp.'.uicustom.index',
-
'query' =>$this->query,
-
'start_date' => $start_date,
-
'end_date'=>$end_date)
- ));
- $i++;
- $table_header[$i]['header'] = lang('User');
- $table_header[$i]['width'] = '5%';
- $table_header[$i]['align'] = 'center';
- $table_header[$i]['sort_link'] =true;
- $table_header[$i]['sort'] =
$this->nextmatchs->show_sort_order(array
- (
- 'sort' => $this->sort,
- 'var' => 'user_id',
- 'order' => $this->order,
- 'extra' => array('menuaction'
=> $this->currentapp.'.uicustom.index',
-
'query' =>$this->query,
-
'start_date' => $start_date,
-
'end_date'=>$end_date)
- ));
- $i++;
-
-
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
-
-
- if($this->acl_add)
- {
- $table_add = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
custom query'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.edit')
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uicustom.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
- 'allow_allrows'
=> true,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
- $this->save_sessiondata();
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('custom') . ': ' . lang('list custom');
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $custom_id =
get_var('custom_id',array('POST','GET'));
- $cols_id =
get_var('cols_id',array('POST','GET'));
- $resort = get_var('resort',array('POST','GET'));
- $values = get_var('values',array('POST'));
-
- if($cols_id)
- {
-
$this->bo->resort(array('custom_id'=>$custom_id,'id'=>$cols_id,'resort'=>$resort));
- }
-
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('custom'));
-
- if ($values['save'] || $values['apply'])
- {
- if(!$values['name'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
- }
-
- if(!$values['sql_text'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a sql query !'));
- }
-
- if(!$receipt['error'])
- {
- $values['custom_id'] = $custom_id;
- $receipt = $this->bo->save($values);
- $custom_id = $receipt['custom_id'];
- $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','custom_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uicustom.index');
- }
- }
- }
-
- if ($values['cancel'])
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uicustom.index');
- }
-
-
- if ($custom_id)
- {
- $custom = $this->bo->read_single($custom_id);
- $this->cat_id =
($custom['cat_id']?$custom['cat_id']:$this->cat_id);
- }
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uicustom.edit',
- 'custom_id' => $custom_id
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- while (is_array($custom['cols']) && list(,$entry) =
each($custom['cols']))
- {
- $cols[] = array(
- 'id' => $entry['id'],
- 'name' => $entry['name'],
- 'descr' => $entry['descr'],
- 'sorting' => $entry['sorting'],
- 'text_up' => lang('Up'),
- 'text_down' => lang('Down'),
- 'link_up' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.edit&resort=up&cols_id='
. $entry['id'] . '&custom_id=' . $custom_id),
- 'link_down' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.edit&resort=down&cols_id='
. $entry['id'] . '&custom_id=' . $custom_id)
- );
- }
-
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_custom_id'
=> lang('ID'),
- 'value_custom_id'
=> $custom_id,
- 'lang_sql_text'
=> lang('sql'),
- 'lang_name'
=> lang('name'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'value_sql_text'
=> $custom['sql_text'],
- 'value_name'
=> $custom['name'],
- 'lang_name_statustext' =>
lang('Enter a name for the query'),
- 'lang_sql_statustext' =>
lang('Enter a sql query'),
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the custom untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the custom and return back to the list'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the custom belongs to. To do not use a category
select NO CATEGORY'),
- 'lang_descr'
=> lang('descr'),
- 'lang_new_name_statustext' =>
lang('name'),
- 'lang_new_descr_statustext' =>
lang('descr'),
- 'cols'
=> $cols,
- 'lang_col_name'
=> lang('Column name'),
- 'lang_col_descr'
=> lang('Column description'),
- 'lang_delete_column' =>
lang('Delete column'),
- 'lang_delete_cols_statustext' => lang('Delete
this column from the output'),
- 'lang_up_text'
=> lang('Up'),
- 'lang_down_text'
=> lang('Down'),
- 'lang_sorting'
=> lang('Sorting'),
-
- );
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('custom') . ': ' . ($custom_id?lang('edit custom'):lang('add custom'));
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function delete()
- {
- $custom_id =
get_var('custom_id',array('POST','GET'));
- $delete = get_var('delete',array('POST'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uicustom.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($custom_id);
-
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.delete&custom_id='
. $custom_id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('custom');
- $function_msg =
lang('delete custom');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function view()
- {
- $custom_id = get_var('custom_id',array('GET'));
- $action = get_var('action',array('GET'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('custom','nextmatchs'));
-
- $list= $this->bo->read_custom($custom_id);
- $uicols = $this->bo->uicols;
-
-//_debug_array($uicols);
-
- $j=0;
- if (isSet($list) AND is_array($list))
- {
- foreach($list as $entry)
- {
- for ($i=0;$i<count($uicols);$i++)
- {
-
$content[$j]['row'][$i]['value'] =
$entry[$uicols[$i]['name']];
- }
-
- $j++;
- }
- }
-
- for ($i=0;$i<count($uicols);$i++)
- {
- $table_header[$i]['header'] =
$uicols[$i]['descr'];
- $table_header[$i]['width'] = '15%';
- $table_header[$i]['align'] =
'left';
- }
-
-//_debug_array($content);
-
-
- $custom_name = $this->bo->read_custom_name($custom_id);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('custom') . ': ' . $custom_name;
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uicustom.view',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'custom_id'
=>$custom_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uicustom.excel',
- 'sort' =>$this->sort,
- 'order' =>$this->order,
- 'filter' =>$this->filter,
- 'query' =>$this->query,
- 'custom_id' =>$custom_id,
- 'allrows' =>
$this->allrows
- );
-
- $data = array
- (
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
-
- 'allow_allrows'
=> true,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
-
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.index'),
- 'lang_done' => lang('done'),
- );
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function excel()
- {
- $custom_id =
get_var('custom_id',array('POST','GET'));
- $list= $this->bo->read_custom($custom_id,$allrows=True);
- $uicols = $this->bo->uicols;
- foreach($uicols as $col)
- {
- $names[] = $col['name'];
- $descr[] = $col['descr'];
- }
- $this->bocommon->excel($list,$names,$descr);
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 custom
+ * @version $Id: class.uicustom.inc.php,v 1.13 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uicustom
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'excel' => True,
+ 'delete' => True
+ );
+
+ function uicustom()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.bocustom',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->start = $this->bo->start;
+ $this->query = $this->bo->query;
+ $this->sort = $this->bo->sort;
+ $this->order = $this->bo->order;
+ $this->filter = $this->bo->filter;
+ $this->cat_id = $this->bo->cat_id;
+ $this->allrows = $this->bo->allrows;
+ $this->menu->sub ='custom';
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.custom';
+ $this->acl_read =
$this->acl2->check('.custom',1);
+ $this->acl_add =
$this->acl2->check('.custom',2);
+ $this->acl_edit =
$this->acl2->check('.custom',4);
+ $this->acl_delete =
$this->acl2->check('.custom',8);
+
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'this->allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ $GLOBALS['phpgw']->xslttpl->add_file(array('custom',
+
'menu',
+
'receipt',
+
'search_field',
+
'nextmatchs'));
+
+ $links = $this->menu->links();
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','custom_receipt');
+
$GLOBALS['phpgw']->session->appsession('session_data','custom_receipt','');
+
+ $list = $this->bo->read();
+
+ $uicols['name'][] = 'custom_id';
+ $uicols['descr'][] = lang('ID');
+ $uicols['name'][] = 'name';
+ $uicols['descr'][] = lang('Name');
+ $uicols['name'][] = 'entry_date';
+ $uicols['descr'][] = lang('date');
+ $uicols['name'][] = 'user';
+ $uicols['descr'][] = lang('User');
+
+ $j=0;
+ if (isset($list) AND is_array($list))
+ {
+ foreach($list as $entry)
+ {
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+ }
+ }
+
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
+ $content[$j]['row'][$i]['text']
= lang('view');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.view&custom_id='
. $entry['custom_id']);
+ }
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('edit the
actor');
+ $content[$j]['row'][$i]['text']
= lang('edit');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.edit&custom_id='
. $entry['custom_id']);
+ }
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('delete the
actor');
+ $content[$j]['row'][$i]['text']
= lang('delete');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.delete&custom_id='
. $entry['custom_id']);
+ }
+
+ $j++;
+ }
+ }
+
+//_debug_array($list);
+ $i=0;
+ $table_header[$i]['header'] = lang('ID');
+ $table_header[$i]['width'] = '5%';
+ $table_header[$i]['align'] = 'center';
+ $table_header[$i]['sort_link'] =true;
+ $table_header[$i]['sort'] =
$this->nextmatchs->show_sort_order(array
+ (
+ 'sort' => $this->sort,
+ 'var' => 'id',
+ 'order' => $this->order,
+ 'extra' => array('menuaction'
=> $this->currentapp.'.uicustom.index',
+
'query' =>$this->query,
+
'start_date' => $start_date,
+
'end_date'=>$end_date)
+ ));
+ $i++;
+ $table_header[$i]['header'] = lang('name');
+ $table_header[$i]['width'] = '5%';
+ $table_header[$i]['align'] = 'center';
+ $table_header[$i]['sort_link'] =true;
+ $table_header[$i]['sort'] =
$this->nextmatchs->show_sort_order(array
+ (
+ 'sort' => $this->sort,
+ 'var' => 'name',
+ 'order' => $this->order,
+ 'extra' => array('menuaction'
=> $this->currentapp.'.uicustom.index',
+
'query' =>$this->query,
+
'start_date' => $start_date,
+
'end_date'=>$end_date)
+ ));
+ $i++;
+
+ $table_header[$i]['header'] = lang('date');
+ $table_header[$i]['width'] = '5%';
+ $table_header[$i]['align'] = 'center';
+ $table_header[$i]['sort_link'] =true;
+ $table_header[$i]['sort'] =
$this->nextmatchs->show_sort_order(array
+ (
+ 'sort' => $this->sort,
+ 'var' => 'name',
+ 'order' => $this->order,
+ 'extra' => array('menuaction'
=> $this->currentapp.'.uicustom.index',
+
'query' =>$this->query,
+
'start_date' => $start_date,
+
'end_date'=>$end_date)
+ ));
+ $i++;
+ $table_header[$i]['header'] = lang('User');
+ $table_header[$i]['width'] = '5%';
+ $table_header[$i]['align'] = 'center';
+ $table_header[$i]['sort_link'] =true;
+ $table_header[$i]['sort'] =
$this->nextmatchs->show_sort_order(array
+ (
+ 'sort' => $this->sort,
+ 'var' => 'user_id',
+ 'order' => $this->order,
+ 'extra' => array('menuaction'
=> $this->currentapp.'.uicustom.index',
+
'query' =>$this->query,
+
'start_date' => $start_date,
+
'end_date'=>$end_date)
+ ));
+ $i++;
+
+
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+
+
+ if($this->acl_add)
+ {
+ $table_add = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
custom query'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.edit')
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uicustom.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'allow_allrows'
=> true,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+ $this->save_sessiondata();
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('custom') . ': ' . lang('list custom');
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $custom_id =
get_var('custom_id',array('POST','GET'));
+ $cols_id =
get_var('cols_id',array('POST','GET'));
+ $resort = get_var('resort',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+
+ if($cols_id)
+ {
+
$this->bo->resort(array('custom_id'=>$custom_id,'id'=>$cols_id,'resort'=>$resort));
+ }
+
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('custom'));
+
+ if ($values['save'] || $values['apply'])
+ {
+ if(!$values['name'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
+ }
+
+ if(!$values['sql_text'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a sql query !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $values['custom_id'] = $custom_id;
+ $receipt = $this->bo->save($values);
+ $custom_id = $receipt['custom_id'];
+ $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','custom_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uicustom.index');
+ }
+ }
+ }
+
+ if ($values['cancel'])
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uicustom.index');
+ }
+
+
+ if ($custom_id)
+ {
+ $custom = $this->bo->read_single($custom_id);
+ $this->cat_id =
($custom['cat_id']?$custom['cat_id']:$this->cat_id);
+ }
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uicustom.edit',
+ 'custom_id' => $custom_id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ while (is_array($custom['cols']) && list(,$entry) =
each($custom['cols']))
+ {
+ $cols[] = array(
+ 'id' => $entry['id'],
+ 'name' => $entry['name'],
+ 'descr' => $entry['descr'],
+ 'sorting' => $entry['sorting'],
+ 'text_up' => lang('Up'),
+ 'text_down' => lang('Down'),
+ 'link_up' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.edit&resort=up&cols_id='
. $entry['id'] . '&custom_id=' . $custom_id),
+ 'link_down' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.edit&resort=down&cols_id='
. $entry['id'] . '&custom_id=' . $custom_id)
+ );
+ }
+
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_custom_id'
=> lang('ID'),
+ 'value_custom_id'
=> $custom_id,
+ 'lang_sql_text'
=> lang('sql'),
+ 'lang_name'
=> lang('name'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_apply'
=> lang('apply'),
+ 'value_sql_text'
=> $custom['sql_text'],
+ 'value_name'
=> $custom['name'],
+ 'lang_name_statustext' =>
lang('Enter a name for the query'),
+ 'lang_sql_statustext' =>
lang('Enter a sql query'),
+ 'lang_apply_statustext' =>
lang('Apply the values'),
+ 'lang_cancel_statustext' =>
lang('Leave the custom untouched and return back to the list'),
+ 'lang_save_statustext' =>
lang('Save the custom and return back to the list'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the custom belongs to. To do not use a category
select NO CATEGORY'),
+ 'lang_descr'
=> lang('descr'),
+ 'lang_new_name_statustext' =>
lang('name'),
+ 'lang_new_descr_statustext' =>
lang('descr'),
+ 'cols'
=> $cols,
+ 'lang_col_name'
=> lang('Column name'),
+ 'lang_col_descr'
=> lang('Column description'),
+ 'lang_delete_column' =>
lang('Delete column'),
+ 'lang_delete_cols_statustext' => lang('Delete
this column from the output'),
+ 'lang_up_text'
=> lang('Up'),
+ 'lang_down_text'
=> lang('Down'),
+ 'lang_sorting'
=> lang('Sorting'),
+
+ );
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('custom') . ': ' . ($custom_id?lang('edit custom'):lang('add custom'));
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function delete()
+ {
+ $custom_id =
get_var('custom_id',array('POST','GET'));
+ $delete = get_var('delete',array('POST'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uicustom.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($custom_id);
+
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.delete&custom_id='
. $custom_id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('custom');
+ $function_msg =
lang('delete custom');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function view()
+ {
+ $custom_id = get_var('custom_id',array('GET'));
+ $action = get_var('action',array('GET'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('custom','nextmatchs'));
+
+ $list= $this->bo->read_custom($custom_id);
+ $uicols = $this->bo->uicols;
+
+//_debug_array($uicols);
+
+ $j=0;
+ if (isSet($list) AND is_array($list))
+ {
+ foreach($list as $entry)
+ {
+ for ($i=0;$i<count($uicols);$i++)
+ {
+
$content[$j]['row'][$i]['value'] =
$entry[$uicols[$i]['name']];
+ }
+
+ $j++;
+ }
+ }
+
+ for ($i=0;$i<count($uicols);$i++)
+ {
+ $table_header[$i]['header'] =
$uicols[$i]['descr'];
+ $table_header[$i]['width'] = '15%';
+ $table_header[$i]['align'] =
'left';
+ }
+
+//_debug_array($content);
+
+
+ $custom_name = $this->bo->read_custom_name($custom_id);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('custom') . ': ' . $custom_name;
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uicustom.view',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'custom_id'
=>$custom_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uicustom.excel',
+ 'sort' =>$this->sort,
+ 'order' =>$this->order,
+ 'filter' =>$this->filter,
+ 'query' =>$this->query,
+ 'custom_id' =>$custom_id,
+ 'allrows' =>
$this->allrows
+ );
+
+ $data = array
+ (
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+
+ 'allow_allrows'
=> true,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uicustom.index'),
+ 'lang_done' => lang('done'),
+ );
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function excel()
+ {
+ $custom_id =
get_var('custom_id',array('POST','GET'));
+ $list= $this->bo->read_custom($custom_id,$allrows=True);
+ $uicols = $this->bo->uicols;
+ foreach($uicols as $col)
+ {
+ $names[] = $col['name'];
+ $descr[] = $col['descr'];
+ }
+ $this->bocommon->excel($list,$names,$descr);
+ }
+ }
+?>
Index: property/inc/class.uidocument.inc.php
diff -u property/inc/class.uidocument.inc.php:1.11
property/inc/class.uidocument.inc.php:1.12
--- property/inc/class.uidocument.inc.php:1.11 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uidocument.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1195 +1,1195 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 document
- * @version $Id: class.uidocument.inc.php,v 1.11 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uidocument
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'list_doc' => True,
- 'view' => True,
- 'view_file' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uidocument()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject($this->currentapp.'.bodocument',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
- $this->bolocation =
CreateObject($this->currentapp.'.bolocation');
- $this->config =
CreateObject('phpgwapi.config',$this->currentapp);
- $this->boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.document';
- $this->acl_read =
$this->acl2->check('.document',1);
- $this->acl_add =
$this->acl2->check('.document',2);
- $this->acl_edit =
$this->acl2->check('.document',4);
- $this->acl_delete =
$this->acl2->check('.document',8);
-
- $this->rootdir =
$this->bo->rootdir;
- $this->fakebase =
$this->bo->fakebase;
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->status_id =
$this->bo->status_id;
- $this->entity_id =
$this->bo->entity_id;
- $this->doc_type =
$this->bo->doc_type;
- $this->query_location =
$this->bo->query_location;
-
- $this->menu->sub ='document';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'status_id' => $this->status_id,
- 'entity_id' => $this->entity_id,
- 'doc_type' => $this->doc_type,
- 'query_location' => $this->query_location
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('document','values','table_header',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $entity_id = get_var('entity_id',array('POST','GET'));
- $links = $this->menu->links('document_'.$entity_id);
-
- $preserve =
get_var('preserve',array('POST','GET'));
-
- if($preserve)
- {
- $this->bo->read_sessiondata();
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort
= $this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->status_id =
$this->bo->status_id;
- $this->entity_id =
$this->bo->entity_id;
- }
-
- $document_list = $this->bo->read();
-
-//_debug_array($document_list);
-
-
- $uicols = $this->bo->uicols;
-
- $j=0;
- while (is_array($document_list) &&
list(,$document_entry) = each($document_list))
- {
- for ($k=0;$k<count($uicols['name']);$k++)
- {
- if($uicols['input_type'][$k]!='hidden')
- {
-
-
if($document_entry['query_location'][$uicols['name'][$k]])
- {
-
- $content[$j]['row'][]=
array(
- 'statustext'
=> lang('search'),
- 'text'
=> $document_entry[$uicols['name'][$k]],
- 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.index&query='
. $document_entry['query_location'][$uicols['name'][$k]] . '&entity_id=' .
$document_entry['p_entity_id'] . '&cat_id=' . $document_entry['p_cat_id'])
- );
- }
- else
- {
- $content[$j]['row'][]=
array(
- 'value'
=> $document_entry[$uicols['name'][$k]],
- 'name'
=> $uicols['name'][$k],
- );
- }
-
- }
- }
-
- if($this->acl_read)
- {
- $content[$j]['row'][]= array(
- 'statustext'
=> lang('view documents for this location/entity'),
- 'text'
=> lang('documents'),
- 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.list_doc&location_code='
. $document_entry['location_code'] . '&p_num=' . $document_entry['p_num'] .
'&entity_id=' . $document_entry['p_entity_id'] . '&cat_id=' .
$document_entry['p_cat_id'] . '&doc_type=' . $this->doc_type)
- );
- }
-
- $j++;
- }
-
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['name'][$i]=='loc1')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'location_code',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uidocument.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id,
-
'doc_type'
=>$this->doc_type,
-
'entity_id'
=>$this->entity_id)
-
));
- }
- if($uicols['name'][$i]=='document_id')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'document_id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uidocument.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id,
-
'doc_type'
=>$this->doc_type,
-
'entity_id'
=>$this->entity_id)
-
));
- }
- if($uicols['name'][$i]=='address')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'address',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uidocument.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id,
-
'doc_type'
=>$this->doc_type,
-
'entity_id'
=>$this->entity_id)
-
));
- }
- }
- }
-
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
-
- if($this->acl_add)
- {
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
document'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.edit&entity_id='
. $this->entity_id . '&cat_id=' . $this->cat_id)
-
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uidocument.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'district_id'
=>$this->district_id,
- 'filter'
=>$this->filter,
- 'status_id'
=>$this->status_id,
- 'query'
=>$this->query,
- 'doc_type'
=>$this->doc_type,
- 'entity_id'
=>$this->entity_id
- );
-
- if($this->entity_id)
- {
- $boentity =
CreateObject($this->currentapp.'.boentity');
- $boentity->entity_id=$this->entity_id;
- $cat_list =
$this->bo->select_category_list('filter',$this->cat_id);
- $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
- $appname_sub = $entity['name'];
- }
- else
- {
- $appname_sub = lang('location');
- }
-
- $data = array
- (
- 'link_history'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.index&cat_id='
. $this->cat_id),
- 'lang_history_statustext' =>
lang('search for history at this location'),
- 'lang_select'
=> lang('select'),
- 'links'
=> $links,
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($document_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'type'
=> $this->cat_id,
- 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
- 'select_district_name' =>
'district_id',
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category. To do not use a category select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $cat_list,
-
- 'lang_no_doc_type'
=> lang('no document type'),
- 'lang_doc_type_statustext' =>
lang('Select the document type the document belongs to.'),
- 'doc_type'
=> $this->bo->select_doc_type_list('filter',$this->doc_type),
-
-
- 'lang_status_statustext' =>
lang('Select the status the document belongs to. To do not use a category
select NO STATUS'),
- 'status_name'
=> 'status_id',
- 'lang_no_status'
=> lang('No status'),
- 'status_list'
=> $this->bo->select_status_list('filter',$this->status_id),
-
- 'lang_user_statustext' =>
lang('Select the user the document belongs to. To do not use a category select
NO USER'),
- 'select_user_name'
=> 'filter',
- 'lang_no_user'
=> lang('No user'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl2_location,array('all'),$default=$this->account),
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname = lang('document');
- $function_msg = lang('list document');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg . ' - ' .
$appname_sub;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function list_doc()
- {
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $preserve =
get_var('preserve',array('POST','GET'));
-
- if($preserve)
- {
- $this->bo->read_sessiondata();
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort
= $this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->entity_id =
$this->bo->entity_id;
- $this->cat_id =
$this->bo->cat_id;
- $this->status_id =
$this->bo->status_id;
- }
-//_debug_array($this->cat_id);
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('document',
-
'menu',
-
'receipt',
-
'nextmatchs',
-
'search_field'));
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','document_receipt');
-
$GLOBALS['phpgw']->session->appsession('session_data','document_receipt','');
-
- $location_code =
get_var('location_code',array('POST','GET'));
- if($this->query_location)
- {
- $location_code = $this->query_location;
- }
-
- $p_num = get_var('p_num',array('POST','GET'));
-
- $location=$this->bo->read_location_data($location_code);
-
- if($this->cat_id)
- {
- $entity_data[$this->entity_id]['p_num']=$p_num;
-
$entity_data[$this->entity_id]['p_entity_id']=$this->entity_id;
-
$entity_data[$this->entity_id]['p_cat_id']=$this->cat_id;
- $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
- $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
- $lookup_entity =
$this->bocommon->get_lookup_entity('document');
- $appname_sub = $entity['name'];
- }
- else
- {
- $appname_sub = lang('location');
- }
-
- if($category['name'])
- {
-
$entity_data[$this->entity_id]['p_cat_name']=$category['name'];
- }
-
- $this->config->read_repository();
- $files_url = $this->config->config_data['files_url'];
-
- $links = $this->menu->links();
-
- $document_list =
$this->bo->read_at_location($location_code);
-
-//_debug_array($document_list);
-
- if($this->cat_id)
- {
- $directory = $this->fakebase. SEP .
'document' . SEP . $location['loc1'] . SEP . $entity['name'] . SEP .
$category['name'] . SEP . $p_num;
- }
- else
- {
- $directory = $this->fakebase. SEP .
'document' . SEP . $location['loc1'];
- }
-
- while (is_array($document_list) && list(,$document) =
each($document_list))
- {
- if($document['link'])
- {
- $link_view_file=$document['link'];
- $document['document_name']='link';
- unset($link_to_files);
- }
- else
- {
- if(!$link_to_files)
- {
- $link_view_file =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.view_file&document_id='
. $document['document_id'] . '&entity_id=' . $this->entity_id . '&cat_id=' .
$this->cat_id . '&p_num=' . $p_num);
- $link_to_files = $files_url;
- }
- }
-
- $content[] = array
- (
- 'directory'
=> $directory,
- 'document_id'
=> $document['document_id'],
- 'document_name'
=> $document['document_name'],
- 'title'
=> $document['title'],
- 'user'
=> $document['user'],
- 'doc_type'
=> $document['doc_type'],
- 'link_view_file'
=> $link_view_file,
- 'link_to_files'
=> $link_to_files,
- 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.view&document_id='
. $document['document_id'] . '&from=list_doc'),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.edit&document_id='
. $document['document_id'] . '&from=list_doc'),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.delete&document_id='
. $document['document_id'] . '&location_code=' . $location_code . '&p_num=' .
$p_num),
- 'lang_view_file_statustext' =>
lang('view the document'),
- 'lang_view_statustext' =>
lang('view information about the document'),
- 'lang_edit_statustext' =>
lang('edit information about the document'),
- 'lang_delete_statustext' =>
lang('delete this document'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
-
- $table_header[] = array
- (
- 'sort_document_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'document_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uidocument.list_doc',
-
'entity_id'
=>$this->entity_id,
-
'cat_id'
=>$this->cat_id,
-
'doc_type'
=>$this->doc_type,
-
'p_num'
=>$p_num,
-
'location_code'
=>$location_code,
-
'filter'
=>$this->filter,
-
'query'
=>$this->query,
-
'query_location'
=>$this->query_location
-
)
-
)),
- 'lang_document_name' => lang('Document
name'),
- 'lang_doc_type' => lang('Doc
type'),
- 'lang_user' =>
lang('user'),
- 'lang_title' =>
lang('Title'),
- 'lang_view' => lang('view'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- );
-
-
- $link_data_add = array
- (
- 'menuaction' =>
$this->currentapp.'.uidocument.edit',
- 'location_code'
=>$location_code,
- 'p_entity_id'
=>$this->entity_id,
- 'entity_id'
=>$this->entity_id,
- 'p_cat_id'
=>$this->cat_id,
- 'cat_id'
=>$this->cat_id,
- 'p_num'
=>$p_num,
- 'from'
=>'list_doc',
- 'bypass'
=>True
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add a
document'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_add)
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uidocument.list_doc',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'entity_id'
=>$this->entity_id,
- 'cat_id'
=>$this->cat_id,
- 'p_num'
=>$p_num,
- 'doc_type'
=>$this->doc_type,
- 'location_code'
=>$location_code,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'query_location'
=>$this->query_location
- );
-
-
-
$location_data=$this->bolocation->initiate_ui_location(array(
- 'values' =>
$location,
- 'type_id' =>
count(explode('-',$location_code)),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
False,
- 'lookup_type' => 'view',
- 'lookup_entity' =>
$lookup_entity,
- 'entity_data' => $entity_data,
- 'link_data' =>
$link_data,
- 'query_link' => True
- ));
-
-//_debug_array($location_data);
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'location_data'
=> $location_data,
- 'link_history'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.list_doc&cat_id='
. $this->cat_id),
- 'lang_history_statustext' =>
lang('search for history at this location'),
- 'lang_select'
=> lang('select'),
- 'lookup_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
- 'lookup'
=> $lookup,
- 'links'
=> $links,
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($document_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'type'
=> $this->doc_type,
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the document belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'doc_type',
- 'cat_list'
=> $this->bo->select_doc_type_list('filter',$this->doc_type),
-
-// 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
-// 'lang_no_district'
=> lang('no district'),
-// 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
-// 'select_district_name' =>
'district_id',
-
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_status_statustext' =>
lang('Select the status the document belongs to. To do not use a category
select NO STATUS'),
- 'status_name'
=> 'status_id',
- 'lang_no_status'
=> lang('No status'),
- 'status_list'
=> $this->bo->select_status_list('filter',$this->status_id),
-
- 'lang_user_statustext' =>
lang('Select the user the document belongs to. To do not use a category select
NO USER'),
- 'select_user_name'
=> 'filter',
- 'lang_no_user'
=> lang('No user'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl2_location,array('all'),$default=$this->account),
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_document' =>
$table_header,
- 'values_document'
=> $content,
- 'table_add'
=> $table_add,
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.index&preserve=1'),
- 'lang_done'
=> lang('done'),
- 'lang_done_statustext' =>
lang('Back to the list')
- );
-
- $appname = lang('document');
- $function_msg = lang('list document');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg . ' - ' .
$appname_sub;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_document' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function view_file()
- {
- $GLOBALS['phpgw_info']['flags'][noheader] = True;
- $GLOBALS['phpgw_info']['flags'][nofooter] = True;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $document_id =
get_var('document_id',array('POST','GET'));
- $p_num = get_var('p_num',array('POST','GET'));
-
-
- $values = $this->bo->read_single($document_id);
-
- if($this->cat_id)
- {
- $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
- $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
- $file = $this->fakebase. SEP . 'document' .
SEP . $values['location_data']['loc1'] . SEP . $entity['name'] . SEP .
$category['name'] . SEP . $p_num . SEP . $values['document_name'];
- }
- else
- {
- $file = $this->fakebase. SEP . 'document' .
SEP .$values['location_data']['loc1'] . SEP . $values['document_name'];
- }
-
- if($this->bo->vfs->file_exists(array(
- 'string' => $file,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
-
- $size =
$this->bo->vfs->get_size(array(
- 'string' => $file,
- 'relatives' =>
Array(RELATIVE_NONE),
- 'checksubdirs' =>
True));
-
- $document= $this->bo->vfs->read(array(
- 'string' => $file,
- 'relatives' => Array(RELATIVE_NONE)));
-
- $filename =
basename($values['document_name']);
- $filetype = array_pop(explode('.',
basename($file)));
- $browser = CreateObject('phpgwapi.browser');
-
$browser->content_header($filename,$filetype,$size);
-
- echo $document;
- }
- }
-
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $from =
get_var('from',array('POST','GET'));
- $document_id =
get_var('document_id',array('POST','GET'));
-// $location_code =
get_var('location_code',array('POST','GET'));
- $values =
get_var('values',array('POST'));
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
- $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
-
- for ($j=0;$j<count($insert_record_entity);$j++)
- {
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
- }
-
- if(!$from)
- {
- $from='index';
- }
- $GLOBALS['phpgw']->xslttpl->add_file(array('document'));
-
- $bypass =
get_var('bypass',array('POST','GET'));
-
- $receipt = $this->bo->create_home_dir();
-
- if($_POST && !$bypass)
- {
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
-
- }
- else
- {
- $location_code =
get_var('location_code',array('POST','GET'));
- $p_entity_id =
get_var('p_entity_id',array('POST','GET'));
- $p_cat_id =
get_var('p_cat_id',array('POST','GET'));
- $values['p'][$p_entity_id]['p_entity_id']
= $p_entity_id;
- $values['p'][$p_entity_id]['p_cat_id']
= $p_cat_id;
- $values['p'][$p_entity_id]['p_num']
= get_var('p_num',array('POST','GET'));
- $values['p_entity_id']=$p_entity_id;
- $values['p_cat_id']=$p_cat_id;
-
- if($p_entity_id && $p_cat_id)
- {
- $entity_category =
$this->boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
-
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
- }
-
- if($location_code)
- {
- $values['location_data'] =
$this->bolocation->read_single($location_code,array());
- }
-
- }
-
-
-//_debug_array($values);
- if($values[extra]['p_entity_id'])
- {
- $this->entity_id=$values[extra]['p_entity_id'];
- $this->cat_id=$values[extra]['p_cat_id'];
- $p_num=$values['extra']['p_num'];
- }
-
- if($this->cat_id)
- {
- $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
- $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
- $values['entity_name']=$entity['name'];
- $values['category_name']=$category['name'];
- }
-
- if ($values['save'])
- {
- $values['document_date'] =
get_var('document_date',array('POST'));
- $values['vendor_id'] =
get_var('vendor_id',array('POST'));
-
- if(!$values['link'])
- {
-
$values['document_name']=$_FILES['document_file']['name'];
- }
-
- if((!$values['document_name'] &&
!$values['document_name_orig']) && !$values['link'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a file to upload !'));
- }
-
- if(!$values['doc_type'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- $error_id=true;
- }
-
- if(!$values['status'])
- {
-//
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
- }
- if(!$values['location'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
- }
-
- if($values['extra']['p_num'])
- {
- $to_file = $this->fakebase. SEP .
'document' . SEP . $values['location']['loc1'] . SEP . $entity['name'] . SEP .
$category['name'] . SEP . $values['extra']['p_num'] . SEP .
$values['document_name'];
- }
- else
- {
- $to_file = $this->fakebase. SEP .
'document' . SEP . $values['location']['loc1'] . SEP . $values['document_name'];
- }
-
- if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
- 'string' => $to_file,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
- }
-
-
$receipt=$this->bo->create_document_dir(array('loc1'=>$values['location']['loc1'],'entity_name'=>$entity['name'],'category_name'=>$category['name'],
'p_num'=>$values['extra']['p_num']),$receipt);
-
- $values['document_id'] = $document_id;
-
-
- if(!$receipt['error'])
- {
- if($values['document_name'] &&
!$values['link'])
- {
- if(!$this->bo->vfs->cp (array (
- 'from' =>
$_FILES['document_file']['tmp_name'],
- 'to' => $to_file,
- 'relatives' =>
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
- {
-
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
- }
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save($values);
- //
$document_id=$receipt['document_id'];
-
$GLOBALS['phpgw']->session->appsession('session_data','document_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uidocument.list_doc&location_code='
.implode("-", $values['location']) . '&entity_id=' . $this->entity_id .
'&cat_id=' . $this->cat_id . '&p_num=' . $values['extra']['p_num'] );
- }
- }
- else
- {
- $values['document_name']='';
- if($values['location'])
- {
- $location_code=implode("-",
$values['location']);
- $values['location_data'] =
$this->bolocation->read_single($location_code,$values['extra']);
- }
- if($values['extra']['p_num'])
- {
-
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
- }
- }
- }
-
- if ($document_id ||(!$receipt['error'] &&
$values['document_id']))
- {
- $values = $this->bo->read_single($document_id);
- $record_history =
$this->bo->read_record_history($document_id);
- $function_msg = lang('Edit document');
- }
- else
- {
- $function_msg = lang('Add document');
- }
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- if ($values['doc_type'])
- {
- $this->doc_type = $values['doc_type'];
- }
- if ($values['location_code'])
- {
- $location_code = $values['location_code'];
- }
-/* if ($values['p_num'])
- {
- $p_num = $values['p_num'];
- }
-*/
-
$location_data=$this->bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' => -1,
// calculated from location_types
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
False,
- 'lookup_type' => 'form',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('document'),
- 'entity_data' => $values['p']
- ));
-
-
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'vendor_id' =>
$values['vendor_id'],
- 'vendor_name' =>
$values['vendor_name']));
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uidocument.edit',
- 'document_id' => $document_id,
- 'from' => $from,
- 'location_code' =>
$values['location_code'],
- 'entity_id'
=>$this->entity_id,
- 'cat_id' =>$this->cat_id,
- );
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'vendor_data'
=> $vendor_data,
- 'record_history'
=> $record_history,
- 'table_header_history' =>
$table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup'
=> "Calendar.setup({inputField : 'document_date',ifFormat : '" .
$jsDateFormat . "',button : 'document_date-trigger'});",
-
- 'lang_document_date_statustext' => lang('Select
date the document was created'),
- 'lang_document_date' =>
lang('document date'),
- 'value_document_date' =>
$values['document_date'],
-
- 'vendor_data'
=> $vendor_data,
- 'location_data'
=> $location_data,
- 'location_type'
=> 'form',
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_year'
=> lang('Year'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_save_statustext' =>
lang('Save the document'),
-
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.'
.$from . '&location_code=' . $location_code . '&entity_id=' . $this->entity_id
. '&cat_id=' . $this->cat_id . '&p_num=' . $p_num . '&preserve=1'),
- 'lang_done'
=> lang('done'),
- 'lang_done_statustext' =>
lang('Back to the list'),
-
- 'lang_update_file'
=> lang('Update file'),
-
- 'lang_document_id'
=> lang('document ID'),
- 'value_document_id'
=> $document_id,
-
- 'lang_document_name'
=> lang('document name'),
- 'value_document_name' =>
$values['document_name'],
- 'lang_document_name_statustext'
=> lang('Enter document Name'),
-
- 'lang_floor_id'
=> lang('Floor ID'),
- 'value_floor_id'
=> $values['floor_id'],
- 'lang_floor_statustext' =>
lang('Enter the floor ID'),
-
- 'lang_title'
=> lang('title'),
- 'value_title'
=> $values['title'],
- 'lang_title_statustext' =>
lang('Enter document title'),
-
- 'lang_version'
=> lang('Version'),
- 'value_version'
=> $values['version'],
- 'lang_version_statustext' =>
lang('Enter document version'),
-
- 'lang_link'
=> lang('Link'),
- 'value_link'
=> $values['link'],
- 'lang_link_statustext' =>
lang('Alternative - link instead of uploading a file'),
-
- 'lang_descr_statustext' =>
lang('Enter a description of the document'),
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_no_cat'
=> lang('Select category'),
- 'lang_cat_statustext' =>
lang('Select the category the document belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[doc_type]',
- 'value_cat_id'
=> $values['doc_type'],
- 'cat_list'
=> $this->bo->select_doc_type_list('select',$values['doc_type']),
-
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_user_statustext' =>
lang('Select the coordinator the document belongs to. To do not use a category
select NO USER'),
- 'select_user_name'
=> 'values[coordinator]',
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl2_location),
-
- 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
- 'status_name' =>
'values[status]',
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
- 'lang_status_statustext' =>
lang('What is the current status of this document ?'),
-
- 'value_location_code' =>
$values['location_code'],
-
- 'branch_list'
=> $this->bo->select_branch_list($values['branch_id']),
- 'lang_no_branch'
=> lang('No branch'),
- 'lang_branch'
=> lang('branch'),
- 'lang_branch_statustext' =>
lang('Select the branch for this document')
- );
-
- $appname = lang('document');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
-
- $location_code =
get_var('location_code',array('POST','GET'));
- $p_num = get_var('p_num',array('POST','GET'));
- $document_id =
get_var('document_id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uidocument.list_doc',
- 'location_code' => $location_code,
- 'p_num' => $p_num
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($document_id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.delete&document_id='
. $document_id . '&location_code=' . $location_code . '&p_num=' . $p_num),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('document');
- $function_msg =
lang('delete document');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view()
- {
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $from =
get_var('from',array('POST','GET'));
- $document_id =
get_var('document_id',array('POST','GET'));
-
- if(!$from)
- {
- $from='index';
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('document'));
-
- $values = $this->bo->read_single($document_id);
- $function_msg = lang('view document');
- $record_history =
$this->bo->read_record_history($document_id);
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- if ($values['doc_type'])
- {
- $this->cat_id = $values['doc_type'];
- }
-
-
$location_data=$this->bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
False,
- 'lookup_type' => 'view',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('document'),
- 'entity_data' => $values['p']
- ));
-
-
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'type' =>
'view',
- 'vendor_id' =>
$values['vendor_id'],
- 'vendor_name' =>
$values['vendor_name']));
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uidocument.edit',
- 'document_id' => $document_id
- );
-
- $data = array
- (
- 'vendor_data'
=> $vendor_data,
- 'record_history'
=> $record_history,
- 'table_header_history' =>
$table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
- 'lang_document_date'
=> lang('document date'),
- 'value_document_date' =>
$values['document_date'],
-
- 'vendor_data'
=> $vendor_data,
- 'location_data'
=> $location_data,
- 'location_type'
=> 'form',
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.'
.$from . '&location_code=' . $values['location_code'] . '&entity_id=' .
$values['p_entity_id'] . '&cat_id=' . $values['p_cat_id'] . '&preserve=1'),
- 'lang_year'
=> lang('Year'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
-
- 'lang_update_file'
=> lang('Update file'),
-
- 'lang_document_id'
=> lang('document ID'),
- 'value_document_id'
=> $document_id,
-
- 'lang_document_name'
=> lang('document name'),
- 'value_document_name' =>
$values['document_name'],
- 'lang_document_name_statustext'
=> lang('Enter document Name'),
-
- 'lang_floor_id'
=> lang('Floor ID'),
- 'value_floor_id'
=> $values['floor_id'],
- 'lang_floor_statustext' =>
lang('Enter the floor ID'),
-
- 'lang_title'
=> lang('title'),
- 'value_title'
=> $values['title'],
- 'lang_title_statustext' =>
lang('Enter document title'),
-
- 'lang_version'
=> lang('Version'),
- 'value_version'
=> $values['version'],
- 'lang_version_statustext' =>
lang('Enter document version'),
-
- 'lang_descr_statustext' =>
lang('Enter a description of the document'),
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the document'),
- 'lang_no_cat'
=> lang('Select category'),
- 'lang_cat_statustext' =>
lang('Select the category the document belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[doc_type]',
- 'value_cat_id'
=> $values['doc_type'],
- 'cat_list'
=> $this->bo->select_doc_type_list('select',$values['doc_type']),
-
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_user_statustext' =>
lang('Select the coordinator the document belongs to. To do not use a category
select NO USER'),
- 'select_user_name'
=> 'values[coordinator]',
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=>
$this->bocommon->get_user_list('select',$values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
-
- 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
- 'status_name'
=> 'values[status]',
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
- 'lang_status_statustext' =>
lang('What is the current status of this document ?'),
-
-
- 'branch_list'
=> $this->bo->select_branch_list($values['branch_id']),
- 'lang_no_branch'
=> lang('No branch'),
- 'lang_branch'
=> lang('branch'),
- 'lang_branch_statustext' =>
lang('Select the branch for this document'),
-
- 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.edit&document_id='
. $document_id . '&from=' . $from),
- 'lang_edit_statustext'
=> lang('Edit this entry'),
- 'lang_edit'
=> lang('Edit')
- );
-
- $appname = lang('document');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 document
+ * @version $Id: class.uidocument.inc.php,v 1.12 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uidocument
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'list_doc' => True,
+ 'view' => True,
+ 'view_file' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uidocument()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bo =
CreateObject($this->currentapp.'.bodocument',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+ $this->bolocation =
CreateObject($this->currentapp.'.bolocation');
+ $this->config =
CreateObject('phpgwapi.config',$this->currentapp);
+ $this->boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.document';
+ $this->acl_read =
$this->acl2->check('.document',1);
+ $this->acl_add =
$this->acl2->check('.document',2);
+ $this->acl_edit =
$this->acl2->check('.document',4);
+ $this->acl_delete =
$this->acl2->check('.document',8);
+
+ $this->rootdir =
$this->bo->rootdir;
+ $this->fakebase =
$this->bo->fakebase;
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->status_id =
$this->bo->status_id;
+ $this->entity_id =
$this->bo->entity_id;
+ $this->doc_type =
$this->bo->doc_type;
+ $this->query_location =
$this->bo->query_location;
+
+ $this->menu->sub ='document';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'status_id' => $this->status_id,
+ 'entity_id' => $this->entity_id,
+ 'doc_type' => $this->doc_type,
+ 'query_location' => $this->query_location
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('document','values','table_header',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $entity_id = get_var('entity_id',array('POST','GET'));
+ $links = $this->menu->links('document_'.$entity_id);
+
+ $preserve =
get_var('preserve',array('POST','GET'));
+
+ if($preserve)
+ {
+ $this->bo->read_sessiondata();
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort
= $this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->status_id =
$this->bo->status_id;
+ $this->entity_id =
$this->bo->entity_id;
+ }
+
+ $document_list = $this->bo->read();
+
+//_debug_array($document_list);
+
+
+ $uicols = $this->bo->uicols;
+
+ $j=0;
+ while (is_array($document_list) &&
list(,$document_entry) = each($document_list))
+ {
+ for ($k=0;$k<count($uicols['name']);$k++)
+ {
+ if($uicols['input_type'][$k]!='hidden')
+ {
+
+
if($document_entry['query_location'][$uicols['name'][$k]])
+ {
+
+ $content[$j]['row'][]=
array(
+ 'statustext'
=> lang('search'),
+ 'text'
=> $document_entry[$uicols['name'][$k]],
+ 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.index&query='
. $document_entry['query_location'][$uicols['name'][$k]] . '&entity_id=' .
$document_entry['p_entity_id'] . '&cat_id=' . $document_entry['p_cat_id'])
+ );
+ }
+ else
+ {
+ $content[$j]['row'][]=
array(
+ 'value'
=> $document_entry[$uicols['name'][$k]],
+ 'name'
=> $uicols['name'][$k],
+ );
+ }
+
+ }
+ }
+
+ if($this->acl_read)
+ {
+ $content[$j]['row'][]= array(
+ 'statustext'
=> lang('view documents for this location/entity'),
+ 'text'
=> lang('documents'),
+ 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.list_doc&location_code='
. $document_entry['location_code'] . '&p_num=' . $document_entry['p_num'] .
'&entity_id=' . $document_entry['p_entity_id'] . '&cat_id=' .
$document_entry['p_cat_id'] . '&doc_type=' . $this->doc_type)
+ );
+ }
+
+ $j++;
+ }
+
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['name'][$i]=='loc1')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'location_code',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uidocument.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id,
+
'doc_type'
=>$this->doc_type,
+
'entity_id'
=>$this->entity_id)
+
));
+ }
+ if($uicols['name'][$i]=='document_id')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'document_id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uidocument.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id,
+
'doc_type'
=>$this->doc_type,
+
'entity_id'
=>$this->entity_id)
+
));
+ }
+ if($uicols['name'][$i]=='address')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'address',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uidocument.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id,
+
'doc_type'
=>$this->doc_type,
+
'entity_id'
=>$this->entity_id)
+
));
+ }
+ }
+ }
+
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
document'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.edit&entity_id='
. $this->entity_id . '&cat_id=' . $this->cat_id)
+
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uidocument.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'filter'
=>$this->filter,
+ 'status_id'
=>$this->status_id,
+ 'query'
=>$this->query,
+ 'doc_type'
=>$this->doc_type,
+ 'entity_id'
=>$this->entity_id
+ );
+
+ if($this->entity_id)
+ {
+ $boentity =
CreateObject($this->currentapp.'.boentity');
+ $boentity->entity_id=$this->entity_id;
+ $cat_list =
$this->bo->select_category_list('filter',$this->cat_id);
+ $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
+ $appname_sub = $entity['name'];
+ }
+ else
+ {
+ $appname_sub = lang('location');
+ }
+
+ $data = array
+ (
+ 'link_history'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.index&cat_id='
. $this->cat_id),
+ 'lang_history_statustext' =>
lang('search for history at this location'),
+ 'lang_select'
=> lang('select'),
+ 'links'
=> $links,
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($document_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'type'
=> $this->cat_id,
+ 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+ 'select_district_name' =>
'district_id',
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category. To do not use a category select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $cat_list,
+
+ 'lang_no_doc_type'
=> lang('no document type'),
+ 'lang_doc_type_statustext' =>
lang('Select the document type the document belongs to.'),
+ 'doc_type'
=> $this->bo->select_doc_type_list('filter',$this->doc_type),
+
+
+ 'lang_status_statustext' =>
lang('Select the status the document belongs to. To do not use a category
select NO STATUS'),
+ 'status_name'
=> 'status_id',
+ 'lang_no_status'
=> lang('No status'),
+ 'status_list'
=> $this->bo->select_status_list('filter',$this->status_id),
+
+ 'lang_user_statustext' =>
lang('Select the user the document belongs to. To do not use a category select
NO USER'),
+ 'select_user_name'
=> 'filter',
+ 'lang_no_user'
=> lang('No user'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl2_location,array('all'),$default=$this->account),
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname = lang('document');
+ $function_msg = lang('list document');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg . ' - ' .
$appname_sub;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function list_doc()
+ {
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $preserve =
get_var('preserve',array('POST','GET'));
+
+ if($preserve)
+ {
+ $this->bo->read_sessiondata();
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort
= $this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->entity_id =
$this->bo->entity_id;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->status_id =
$this->bo->status_id;
+ }
+//_debug_array($this->cat_id);
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('document',
+
'menu',
+
'receipt',
+
'nextmatchs',
+
'search_field'));
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','document_receipt');
+
$GLOBALS['phpgw']->session->appsession('session_data','document_receipt','');
+
+ $location_code =
get_var('location_code',array('POST','GET'));
+ if($this->query_location)
+ {
+ $location_code = $this->query_location;
+ }
+
+ $p_num = get_var('p_num',array('POST','GET'));
+
+ $location=$this->bo->read_location_data($location_code);
+
+ if($this->cat_id)
+ {
+ $entity_data[$this->entity_id]['p_num']=$p_num;
+
$entity_data[$this->entity_id]['p_entity_id']=$this->entity_id;
+
$entity_data[$this->entity_id]['p_cat_id']=$this->cat_id;
+ $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
+ $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+ $lookup_entity =
$this->bocommon->get_lookup_entity('document');
+ $appname_sub = $entity['name'];
+ }
+ else
+ {
+ $appname_sub = lang('location');
+ }
+
+ if($category['name'])
+ {
+
$entity_data[$this->entity_id]['p_cat_name']=$category['name'];
+ }
+
+ $this->config->read_repository();
+ $files_url = $this->config->config_data['files_url'];
+
+ $links = $this->menu->links();
+
+ $document_list =
$this->bo->read_at_location($location_code);
+
+//_debug_array($document_list);
+
+ if($this->cat_id)
+ {
+ $directory = $this->fakebase. SEP .
'document' . SEP . $location['loc1'] . SEP . $entity['name'] . SEP .
$category['name'] . SEP . $p_num;
+ }
+ else
+ {
+ $directory = $this->fakebase. SEP .
'document' . SEP . $location['loc1'];
+ }
+
+ while (is_array($document_list) && list(,$document) =
each($document_list))
+ {
+ if($document['link'])
+ {
+ $link_view_file=$document['link'];
+ $document['document_name']='link';
+ unset($link_to_files);
+ }
+ else
+ {
+ if(!$link_to_files)
+ {
+ $link_view_file =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.view_file&document_id='
. $document['document_id'] . '&entity_id=' . $this->entity_id . '&cat_id=' .
$this->cat_id . '&p_num=' . $p_num);
+ $link_to_files = $files_url;
+ }
+ }
+
+ $content[] = array
+ (
+ 'directory'
=> $directory,
+ 'document_id'
=> $document['document_id'],
+ 'document_name'
=> $document['document_name'],
+ 'title'
=> $document['title'],
+ 'user'
=> $document['user'],
+ 'doc_type'
=> $document['doc_type'],
+ 'link_view_file'
=> $link_view_file,
+ 'link_to_files'
=> $link_to_files,
+ 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.view&document_id='
. $document['document_id'] . '&from=list_doc'),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.edit&document_id='
. $document['document_id'] . '&from=list_doc'),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.delete&document_id='
. $document['document_id'] . '&location_code=' . $location_code . '&p_num=' .
$p_num),
+ 'lang_view_file_statustext' =>
lang('view the document'),
+ 'lang_view_statustext' =>
lang('view information about the document'),
+ 'lang_edit_statustext' =>
lang('edit information about the document'),
+ 'lang_delete_statustext' =>
lang('delete this document'),
+ 'text_view'
=> lang('view'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+
+ $table_header[] = array
+ (
+ 'sort_document_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'document_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uidocument.list_doc',
+
'entity_id'
=>$this->entity_id,
+
'cat_id'
=>$this->cat_id,
+
'doc_type'
=>$this->doc_type,
+
'p_num'
=>$p_num,
+
'location_code'
=>$location_code,
+
'filter'
=>$this->filter,
+
'query'
=>$this->query,
+
'query_location'
=>$this->query_location
+
)
+
)),
+ 'lang_document_name' => lang('Document
name'),
+ 'lang_doc_type' => lang('Doc
type'),
+ 'lang_user' =>
lang('user'),
+ 'lang_title' =>
lang('Title'),
+ 'lang_view' => lang('view'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ );
+
+
+ $link_data_add = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uidocument.edit',
+ 'location_code'
=>$location_code,
+ 'p_entity_id'
=>$this->entity_id,
+ 'entity_id'
=>$this->entity_id,
+ 'p_cat_id'
=>$this->cat_id,
+ 'cat_id'
=>$this->cat_id,
+ 'p_num'
=>$p_num,
+ 'from'
=>'list_doc',
+ 'bypass'
=>True
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add a
document'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_add)
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uidocument.list_doc',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'entity_id'
=>$this->entity_id,
+ 'cat_id'
=>$this->cat_id,
+ 'p_num'
=>$p_num,
+ 'doc_type'
=>$this->doc_type,
+ 'location_code'
=>$location_code,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'query_location'
=>$this->query_location
+ );
+
+
+
$location_data=$this->bolocation->initiate_ui_location(array(
+ 'values' =>
$location,
+ 'type_id' =>
count(explode('-',$location_code)),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
False,
+ 'lookup_type' => 'view',
+ 'lookup_entity' =>
$lookup_entity,
+ 'entity_data' => $entity_data,
+ 'link_data' =>
$link_data,
+ 'query_link' => True
+ ));
+
+//_debug_array($location_data);
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'location_data'
=> $location_data,
+ 'link_history'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.list_doc&cat_id='
. $this->cat_id),
+ 'lang_history_statustext' =>
lang('search for history at this location'),
+ 'lang_select'
=> lang('select'),
+ 'lookup_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
+ 'lookup'
=> $lookup,
+ 'links'
=> $links,
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($document_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'type'
=> $this->doc_type,
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the document belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'doc_type',
+ 'cat_list'
=> $this->bo->select_doc_type_list('filter',$this->doc_type),
+
+// 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
+// 'lang_no_district'
=> lang('no district'),
+// 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+// 'select_district_name' =>
'district_id',
+
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_status_statustext' =>
lang('Select the status the document belongs to. To do not use a category
select NO STATUS'),
+ 'status_name'
=> 'status_id',
+ 'lang_no_status'
=> lang('No status'),
+ 'status_list'
=> $this->bo->select_status_list('filter',$this->status_id),
+
+ 'lang_user_statustext' =>
lang('Select the user the document belongs to. To do not use a category select
NO USER'),
+ 'select_user_name'
=> 'filter',
+ 'lang_no_user'
=> lang('No user'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl2_location,array('all'),$default=$this->account),
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_document' =>
$table_header,
+ 'values_document'
=> $content,
+ 'table_add'
=> $table_add,
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.index&preserve=1'),
+ 'lang_done'
=> lang('done'),
+ 'lang_done_statustext' =>
lang('Back to the list')
+ );
+
+ $appname = lang('document');
+ $function_msg = lang('list document');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg . ' - ' .
$appname_sub;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_document' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function view_file()
+ {
+ $GLOBALS['phpgw_info']['flags'][noheader] = True;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = True;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $document_id =
get_var('document_id',array('POST','GET'));
+ $p_num = get_var('p_num',array('POST','GET'));
+
+
+ $values = $this->bo->read_single($document_id);
+
+ if($this->cat_id)
+ {
+ $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
+ $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+ $file = $this->fakebase. SEP . 'document' .
SEP . $values['location_data']['loc1'] . SEP . $entity['name'] . SEP .
$category['name'] . SEP . $p_num . SEP . $values['document_name'];
+ }
+ else
+ {
+ $file = $this->fakebase. SEP . 'document' .
SEP .$values['location_data']['loc1'] . SEP . $values['document_name'];
+ }
+
+ if($this->bo->vfs->file_exists(array(
+ 'string' => $file,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+
+ $size =
$this->bo->vfs->get_size(array(
+ 'string' => $file,
+ 'relatives' =>
Array(RELATIVE_NONE),
+ 'checksubdirs' =>
True));
+
+ $document= $this->bo->vfs->read(array(
+ 'string' => $file,
+ 'relatives' => Array(RELATIVE_NONE)));
+
+ $filename =
basename($values['document_name']);
+ $filetype = array_pop(explode('.',
basename($file)));
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($filename,$filetype,$size);
+
+ echo $document;
+ }
+ }
+
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $from =
get_var('from',array('POST','GET'));
+ $document_id =
get_var('document_id',array('POST','GET'));
+// $location_code =
get_var('location_code',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+ $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
+
+ for ($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+
+ if(!$from)
+ {
+ $from='index';
+ }
+ $GLOBALS['phpgw']->xslttpl->add_file(array('document'));
+
+ $bypass =
get_var('bypass',array('POST','GET'));
+
+ $receipt = $this->bo->create_home_dir();
+
+ if($_POST && !$bypass)
+ {
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+
+ }
+ else
+ {
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $p_entity_id =
get_var('p_entity_id',array('POST','GET'));
+ $p_cat_id =
get_var('p_cat_id',array('POST','GET'));
+ $values['p'][$p_entity_id]['p_entity_id']
= $p_entity_id;
+ $values['p'][$p_entity_id]['p_cat_id']
= $p_cat_id;
+ $values['p'][$p_entity_id]['p_num']
= get_var('p_num',array('POST','GET'));
+ $values['p_entity_id']=$p_entity_id;
+ $values['p_cat_id']=$p_cat_id;
+
+ if($p_entity_id && $p_cat_id)
+ {
+ $entity_category =
$this->boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
+
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
+ }
+
+ if($location_code)
+ {
+ $values['location_data'] =
$this->bolocation->read_single($location_code,array());
+ }
+
+ }
+
+
+//_debug_array($values);
+ if($values[extra]['p_entity_id'])
+ {
+ $this->entity_id=$values[extra]['p_entity_id'];
+ $this->cat_id=$values[extra]['p_cat_id'];
+ $p_num=$values['extra']['p_num'];
+ }
+
+ if($this->cat_id)
+ {
+ $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
+ $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+ $values['entity_name']=$entity['name'];
+ $values['category_name']=$category['name'];
+ }
+
+ if ($values['save'])
+ {
+ $values['document_date'] =
get_var('document_date',array('POST'));
+ $values['vendor_id'] =
get_var('vendor_id',array('POST'));
+
+ if(!$values['link'])
+ {
+
$values['document_name']=$_FILES['document_file']['name'];
+ }
+
+ if((!$values['document_name'] &&
!$values['document_name_orig']) && !$values['link'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a file to upload !'));
+ }
+
+ if(!$values['doc_type'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ $error_id=true;
+ }
+
+ if(!$values['status'])
+ {
+//
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
+ }
+ if(!$values['location'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
+ }
+
+ if($values['extra']['p_num'])
+ {
+ $to_file = $this->fakebase. SEP .
'document' . SEP . $values['location']['loc1'] . SEP . $entity['name'] . SEP .
$category['name'] . SEP . $values['extra']['p_num'] . SEP .
$values['document_name'];
+ }
+ else
+ {
+ $to_file = $this->fakebase. SEP .
'document' . SEP . $values['location']['loc1'] . SEP . $values['document_name'];
+ }
+
+ if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
+ 'string' => $to_file,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
+ }
+
+
$receipt=$this->bo->create_document_dir(array('loc1'=>$values['location']['loc1'],'entity_name'=>$entity['name'],'category_name'=>$category['name'],
'p_num'=>$values['extra']['p_num']),$receipt);
+
+ $values['document_id'] = $document_id;
+
+
+ if(!$receipt['error'])
+ {
+ if($values['document_name'] &&
!$values['link'])
+ {
+ if(!$this->bo->vfs->cp (array (
+ 'from' =>
$_FILES['document_file']['tmp_name'],
+ 'to' => $to_file,
+ 'relatives' =>
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+ {
+
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
+ }
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save($values);
+ //
$document_id=$receipt['document_id'];
+
$GLOBALS['phpgw']->session->appsession('session_data','document_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uidocument.list_doc&location_code='
.implode("-", $values['location']) . '&entity_id=' . $this->entity_id .
'&cat_id=' . $this->cat_id . '&p_num=' . $values['extra']['p_num'] );
+ }
+ }
+ else
+ {
+ $values['document_name']='';
+ if($values['location'])
+ {
+ $location_code=implode("-",
$values['location']);
+ $values['location_data'] =
$this->bolocation->read_single($location_code,$values['extra']);
+ }
+ if($values['extra']['p_num'])
+ {
+
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
+ }
+ }
+ }
+
+ if ($document_id ||(!$receipt['error'] &&
$values['document_id']))
+ {
+ $values = $this->bo->read_single($document_id);
+ $record_history =
$this->bo->read_record_history($document_id);
+ $function_msg = lang('Edit document');
+ }
+ else
+ {
+ $function_msg = lang('Add document');
+ }
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ if ($values['doc_type'])
+ {
+ $this->doc_type = $values['doc_type'];
+ }
+ if ($values['location_code'])
+ {
+ $location_code = $values['location_code'];
+ }
+/* if ($values['p_num'])
+ {
+ $p_num = $values['p_num'];
+ }
+*/
+
$location_data=$this->bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' => -1,
// calculated from location_types
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
False,
+ 'lookup_type' => 'form',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('document'),
+ 'entity_data' => $values['p']
+ ));
+
+
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'vendor_id' =>
$values['vendor_id'],
+ 'vendor_name' =>
$values['vendor_name']));
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uidocument.edit',
+ 'document_id' => $document_id,
+ 'from' => $from,
+ 'location_code' =>
$values['location_code'],
+ 'entity_id'
=>$this->entity_id,
+ 'cat_id' =>$this->cat_id,
+ );
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'vendor_data'
=> $vendor_data,
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history'),
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup'
=> "Calendar.setup({inputField : 'document_date',ifFormat : '" .
$jsDateFormat . "',button : 'document_date-trigger'});",
+
+ 'lang_document_date_statustext' => lang('Select
date the document was created'),
+ 'lang_document_date' =>
lang('document date'),
+ 'value_document_date' =>
$values['document_date'],
+
+ 'vendor_data'
=> $vendor_data,
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'form',
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_year'
=> lang('Year'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_save_statustext' =>
lang('Save the document'),
+
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.'
.$from . '&location_code=' . $location_code . '&entity_id=' . $this->entity_id
. '&cat_id=' . $this->cat_id . '&p_num=' . $p_num . '&preserve=1'),
+ 'lang_done'
=> lang('done'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+
+ 'lang_update_file'
=> lang('Update file'),
+
+ 'lang_document_id'
=> lang('document ID'),
+ 'value_document_id'
=> $document_id,
+
+ 'lang_document_name'
=> lang('document name'),
+ 'value_document_name' =>
$values['document_name'],
+ 'lang_document_name_statustext'
=> lang('Enter document Name'),
+
+ 'lang_floor_id'
=> lang('Floor ID'),
+ 'value_floor_id'
=> $values['floor_id'],
+ 'lang_floor_statustext' =>
lang('Enter the floor ID'),
+
+ 'lang_title'
=> lang('title'),
+ 'value_title'
=> $values['title'],
+ 'lang_title_statustext' =>
lang('Enter document title'),
+
+ 'lang_version'
=> lang('Version'),
+ 'value_version'
=> $values['version'],
+ 'lang_version_statustext' =>
lang('Enter document version'),
+
+ 'lang_link'
=> lang('Link'),
+ 'value_link'
=> $values['link'],
+ 'lang_link_statustext' =>
lang('Alternative - link instead of uploading a file'),
+
+ 'lang_descr_statustext' =>
lang('Enter a description of the document'),
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_no_cat'
=> lang('Select category'),
+ 'lang_cat_statustext' =>
lang('Select the category the document belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[doc_type]',
+ 'value_cat_id'
=> $values['doc_type'],
+ 'cat_list'
=> $this->bo->select_doc_type_list('select',$values['doc_type']),
+
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_user_statustext' =>
lang('Select the coordinator the document belongs to. To do not use a category
select NO USER'),
+ 'select_user_name'
=> 'values[coordinator]',
+ 'lang_no_user'
=> lang('Select coordinator'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl2_location),
+
+ 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
+ 'status_name' =>
'values[status]',
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+ 'lang_status_statustext' =>
lang('What is the current status of this document ?'),
+
+ 'value_location_code' =>
$values['location_code'],
+
+ 'branch_list'
=> $this->bo->select_branch_list($values['branch_id']),
+ 'lang_no_branch'
=> lang('No branch'),
+ 'lang_branch'
=> lang('branch'),
+ 'lang_branch_statustext' =>
lang('Select the branch for this document')
+ );
+
+ $appname = lang('document');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ if(!$this->acl_delete)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $p_num = get_var('p_num',array('POST','GET'));
+ $document_id =
get_var('document_id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uidocument.list_doc',
+ 'location_code' => $location_code,
+ 'p_num' => $p_num
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($document_id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.delete&document_id='
. $document_id . '&location_code=' . $location_code . '&p_num=' . $p_num),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('document');
+ $function_msg =
lang('delete document');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view()
+ {
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $from =
get_var('from',array('POST','GET'));
+ $document_id =
get_var('document_id',array('POST','GET'));
+
+ if(!$from)
+ {
+ $from='index';
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('document'));
+
+ $values = $this->bo->read_single($document_id);
+ $function_msg = lang('view document');
+ $record_history =
$this->bo->read_record_history($document_id);
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ if ($values['doc_type'])
+ {
+ $this->cat_id = $values['doc_type'];
+ }
+
+
$location_data=$this->bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
False,
+ 'lookup_type' => 'view',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('document'),
+ 'entity_data' => $values['p']
+ ));
+
+
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'type' =>
'view',
+ 'vendor_id' =>
$values['vendor_id'],
+ 'vendor_name' =>
$values['vendor_name']));
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uidocument.edit',
+ 'document_id' => $document_id
+ );
+
+ $data = array
+ (
+ 'vendor_data'
=> $vendor_data,
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history'),
+
+ 'lang_document_date'
=> lang('document date'),
+ 'value_document_date' =>
$values['document_date'],
+
+ 'vendor_data'
=> $vendor_data,
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'form',
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.'
.$from . '&location_code=' . $values['location_code'] . '&entity_id=' .
$values['p_entity_id'] . '&cat_id=' . $values['p_cat_id'] . '&preserve=1'),
+ 'lang_year'
=> lang('Year'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+
+ 'lang_update_file'
=> lang('Update file'),
+
+ 'lang_document_id'
=> lang('document ID'),
+ 'value_document_id'
=> $document_id,
+
+ 'lang_document_name'
=> lang('document name'),
+ 'value_document_name' =>
$values['document_name'],
+ 'lang_document_name_statustext'
=> lang('Enter document Name'),
+
+ 'lang_floor_id'
=> lang('Floor ID'),
+ 'value_floor_id'
=> $values['floor_id'],
+ 'lang_floor_statustext' =>
lang('Enter the floor ID'),
+
+ 'lang_title'
=> lang('title'),
+ 'value_title'
=> $values['title'],
+ 'lang_title_statustext' =>
lang('Enter document title'),
+
+ 'lang_version'
=> lang('Version'),
+ 'value_version'
=> $values['version'],
+ 'lang_version_statustext' =>
lang('Enter document version'),
+
+ 'lang_descr_statustext' =>
lang('Enter a description of the document'),
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the document'),
+ 'lang_no_cat'
=> lang('Select category'),
+ 'lang_cat_statustext' =>
lang('Select the category the document belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[doc_type]',
+ 'value_cat_id'
=> $values['doc_type'],
+ 'cat_list'
=> $this->bo->select_doc_type_list('select',$values['doc_type']),
+
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_user_statustext' =>
lang('Select the coordinator the document belongs to. To do not use a category
select NO USER'),
+ 'select_user_name'
=> 'values[coordinator]',
+ 'lang_no_user'
=> lang('Select coordinator'),
+ 'user_list'
=>
$this->bocommon->get_user_list('select',$values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+
+ 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
+ 'status_name'
=> 'values[status]',
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+ 'lang_status_statustext' =>
lang('What is the current status of this document ?'),
+
+
+ 'branch_list'
=> $this->bo->select_branch_list($values['branch_id']),
+ 'lang_no_branch'
=> lang('No branch'),
+ 'lang_branch'
=> lang('branch'),
+ 'lang_branch_statustext' =>
lang('Select the branch for this document'),
+
+ 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uidocument.edit&document_id='
. $document_id . '&from=' . $from),
+ 'lang_edit_statustext'
=> lang('Edit this entry'),
+ 'lang_edit'
=> lang('Edit')
+ );
+
+ $appname = lang('document');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+
+ }
+?>
Index: property/inc/class.uientity.inc.php
diff -u property/inc/class.uientity.inc.php:1.16
property/inc/class.uientity.inc.php:1.17
--- property/inc/class.uientity.inc.php:1.16 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uientity.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1184 +1,1184 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 entity
- * @version $Id: class.uientity.inc.php,v 1.16 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uientity
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'columns' => True,
- 'excel' => True,
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'view_file' =>True
- );
-
- function uientity()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.boentity',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity',True);
-
- $this->entity_id =
$this->bo->entity_id;
- $this->cat_id =
$this->bo->cat_id;
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- if(!$this->cat_id)
- {
- $this->acl2_location = '.entity.' .
$this->entity_id;
- }
- else
- {
- $this->acl2_location = '.entity.' .
$this->entity_id . '.' . $this->cat_id;
- }
- $this->acl_read =
$this->acl2->check($this->acl2_location,1);
- $this->acl_add =
$this->acl2->check($this->acl2_location,2);
- $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
- $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->part_of_town_id =
$this->bo->part_of_town_id;
- $this->district_id =
$this->bo->district_id;
- $this->status =
$this->bo->status;
- $this->fakebase =
$this->bo->fakebase;
- $this->category_name =
$this->bo->category_name;
- $this->menu->sub
='entity_'.$this->entity_id;
-
$GLOBALS['phpgw']->session->appsession('entity_id',$this->currentapp,$this->entity_id);
- $this->start_date =
$this->bo->start_date;
- $this->end_date =
$this->bo->end_date;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'part_of_town_id' =>
$this->part_of_town_id,
- 'district_id' => $this->district_id,
- 'entity_id' => $this->entity_id,
- 'status' => $this->status,
- 'start_date' => $this->start_date,
- 'end_date' => $this->end_date
- );
- $this->bo->save_sessiondata($data);
- }
-
- function excel()
- {
- $GLOBALS['phpgw_info']['flags'][noheader] = True;
- $GLOBALS['phpgw_info']['flags'][nofooter] = True;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
-
- $start_date = urldecode($this->start_date);
- $end_date = urldecode($this->end_date);
-
- $list =
$this->bo->read(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'allrows'=>true,'start_date'=>$start_date,'end_date'=>$end_date));
- $uicols = $this->bo->uicols;
-
- $filename=
$GLOBALS['phpgw_info']['user']['account_lid'].'.xls';
- $count_uicols_name=count($uicols['name']);
-
- $workbook =
CreateObject($this->currentapp.'.excel',"-");
- $browser = CreateObject('phpgwapi.browser');
-
$browser->content_header($filename,'application/vnd.ms-excel');
-
- $worksheet1 =& $workbook->add_worksheet('First One');
-
- $j=0;
- if (isset($list) AND is_array($list))
- {
- foreach($list as $entry)
- {
- $m=0;
- for ($k=0;$k<$count_uicols_name;$k++)
- {
-
if($uicols['input_type'][$k]!='hidden')
- {
- $content[$j][$m]
= $entry[$uicols['name'][$k]];
-
$worksheet1->write_string(0, $m, $uicols['descr'][$k]);
- $m++;
- }
- }
- $j++;
- }
-
- foreach($content as $row)
- {
- $line++;
- for ($i=0; $i<count($row); $i++)
- {
-
$worksheet1->write($line,$i,$row[$i]);
- }
- }
- }
- $workbook->close();
- }
-
-
- function columns()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
-
- $GLOBALS['phpgw_info']['flags']['noframework'] = True;
-
- $values =
get_var('values',array('POST','GET'));
-
- if ($values['save'] && $this->cat_id)
- {
-
$GLOBALS['phpgw']->preferences->account_id=$this->account;
-
$GLOBALS['phpgw']->preferences->read_repository();
-
$GLOBALS['phpgw']->preferences->add($this->currentapp,"entity_columns_" .
$this->entity_id . '_' . $this->cat_id,$values['columns'],'user');
-
$GLOBALS['phpgw']->preferences->save_repository();
-
- $receipt['message'][] = array('msg' =>
lang('columns is updated'));
- }
-
- if(!$this->cat_id)
- {
- $receipt['error'][] = array('msg' =>
lang('Choose a category'));
- }
- $function_msg = lang('Select Column');
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uientity.columns',
- 'entity_id' =>
$this->entity_id,
- 'cat_id' => $this->cat_id
- );
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'column_list' =>
$this->bo->column_list($values['columns'],$entity_id=$this->entity_id,$cat_id=$this->cat_id,$allrows=True),
- 'function_msg' => $function_msg,
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_columns' => lang('columns'),
- 'lang_none' => lang('None'),
- 'lang_save' => lang('save'),
- 'select_name' => 'period'
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
$function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view_file()
- {
- $GLOBALS['phpgw_info']['flags'][noheader] = True;
- $GLOBALS['phpgw_info']['flags'][nofooter] = True;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $file_name =
urldecode(get_var('file_name',array('POST','GET')));
- $loc1 = get_var('loc1',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
-
- $file = $this->fakebase. SEP . $this->category_name .
SEP . $loc1 . SEP . $id . SEP . $file_name;
-
-//echo 'file: ' . $file . '<br>';
- if($this->bo->vfs->file_exists(array(
- 'string' => $file,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $size =
$this->bo->vfs->get_size(array(
- 'string' => $file,
- 'relatives' =>
Array(RELATIVE_NONE),
- 'checksubdirs' =>
True));
-
- $document= $this->bo->vfs->read(array(
- 'string' => $file,
- 'relatives' => Array(RELATIVE_NONE)));
-
- $filename =
basename($values['document_name']);
- $filetype = array_pop(explode('.',
basename($file)));
- $browser = CreateObject('phpgwapi.browser');
-
$browser->content_header($filename,$filetype,$size);
-
- echo $document;
-
- }
- }
-
- function index()
- {
- if(!$this->acl_read && $this->cat_id)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('entity',
- 'menu',
-
'nextmatchs'));
-
- $links = $this->menu->links();
-
- $start_date = urldecode($this->start_date);
- $end_date = urldecode($this->end_date);
-
- $entity_list =
$this->bo->read(array('start_date'=>$start_date,'end_date'=>$end_date));
-
- $uicols = $this->bo->uicols;
-
- $j=0;
-
- if (isset($entity_list) AND is_array($entity_list))
- {
- foreach($entity_list as $entity_entry)
- {
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
if($entity_entry['query_location'][$uicols['name'][$i]])
- {
-
$content[$j]['row'][$i]['statustext'] = lang('search');
-
$content[$j]['row'][$i]['text'] =
$entity_entry[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.index&entity_id='
. $this->entity_id . '&cat_id=' . $this->cat_id .'&query=' .
$entity_entry['query_location'][$uicols['name'][$i]]);
- }
- else
- {
-
$content[$j]['row'][$i]['value'] =
$entity_entry[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
- }
- }
- }
-
- if($this->acl_read)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
- $content[$j]['row'][$i]['text']
= lang('view');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.view&entity_id='
. $this->entity_id . '&cat_id=' . $this->cat_id .'&id=' . $entity_entry['id']);
- }
- if($this->acl_edit)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('edit the
entity');
- $content[$j]['row'][$i]['text']
= lang('edit');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.edit&entity_id='
. $this->entity_id . '&cat_id=' . $this->cat_id .'&id=' . $entity_entry['id']);
- }
- if($this->acl_delete)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('delete the
entity');
- $content[$j]['row'][$i]['text']
= lang('delete');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.delete&entity_id='
. $this->entity_id . '&cat_id=' . $this->cat_id .'&id=' . $entity_entry['id']);
- }
-
- $j++;
- }
- }
-
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['datatype'][$i]!='T' &&
$uicols['datatype'][$i]!='CH')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
- (
- 'sort' =>
$this->sort,
- 'var' =>
$uicols['name'][$i],
- 'order' =>
$this->order,
- 'extra'
=> array('menuaction' => $this->currentapp.'.uientity.index',
-
'type_id' =>$type_id,
-
'query' =>$this->query,
-
'lookup' =>$lookup,
-
'district_id' => $this->district_id,
-
'entity_id' =>$this->entity_id,
-
'cat_id' =>$this->cat_id,
-
'start_date'=>$start_date,
-
'end_date'=>$end_date)
- ));
- }
- }
- }
-
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
-
-
- if($this->acl_add)
- {
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
entity'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.edit&entity_id='.
$this->entity_id .'&cat_id='. $this->cat_id)
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uientity.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'entity_id'
=>$this->entity_id,
- 'district_id'
=>$this->district_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'start_date' =>$start_date,
- 'end_date'
=>$end_date
- );
-
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uientity.excel',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'entity_id'
=>$this->entity_id,
- 'cat_id'
=>$this->cat_id,
- 'district_id'
=>$this->district_id,
- 'status_id'
=>$this->status,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'start_date' =>$start_date,
- 'end_date'
=>$end_date,
- 'start' =>$this->start
- );
-
- $link_columns = array
- (
- 'menuaction' =>
$this->currentapp.'.uientity.columns',
- 'entity_id'
=>$this->entity_id,
- 'cat_id'
=>$this->cat_id
- );
-
- $link_date_search
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
-
-
if($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'])
- {
- $group_filters = 'select';
-
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field_grouped'));
- }
- else
- {
- $group_filters = 'filter';
-
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
- }
-
- $data = array
- (
- 'group_filters' =>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'],
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
-
- 'lang_columns' =>
lang('columns'),
- 'link_columns' =>
$GLOBALS['phpgw']->link('/index.php',$link_columns),
- 'lang_columns_help' =>
lang('Choose columns'),
-
- 'start_date' =>
$start_date,
- 'end_date'
=> $end_date,
- 'lang_none'
=> lang('None'),
- 'lang_date_search' =>
lang('Date search'),
- 'lang_date_search_help' => lang('Narrow
the search by dates'),
- 'link_date_search' =>
$link_date_search,
- 'lang_date_search' =>
lang('Date search'),
- 'overlib_source' =>
'./'.$this->currentapp.'/inc/overlib.js',
-
-
- 'links'
=> $links,
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($entity_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-
- 'district_list'
=> $this->bocommon->select_district_list($group_filters,$this->district_id),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
- 'select_district_name' =>
'district_id',
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category. To do not use a category select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list($group_filters,$this->cat_id),
-
- 'lang_status_statustext' =>
lang('Select the status. To do not use a status select NO STATUS'),
- 'status_name'
=> 'status',
- 'lang_no_status'
=> lang('No status'),
- 'status_list'
=> $this->bo->select_status_list($group_filters,$this->status),
-
- 'lang_user_statustext' =>
lang('Select the user. To do not use a category select NO USER'),
- 'select_user_name'
=> 'filter',
- 'lang_no_user'
=> lang('No user'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl2_location,array('all'),$default='all'),
-
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- if($this->entity_id)
- {
- $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
- $appname = $entity['name'];
- }
- if($this->cat_id)
- {
- $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
- $function_msg
= 'list ' . $category['name'];
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- }
-
- if(!$this->entity_id || !$this->cat_id)
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
- $receipt['error'][]=array('msg'=>lang('Please
select type'));
- $msgbox_data =
$this->bocommon->msgbox_data($receipt);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('empty' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- else
- {
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
- }
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $config =
CreateObject('phpgwapi.config',$this->currentapp);
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $id =
get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST','GET'));
- $values_attribute =
get_var('values_attribute',array('POST','GET'));
- $bypass =
get_var('bypass',array('POST','GET'));
- $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
- $tenant_id =
get_var('tenant_id',array('POST','GET'));
-
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
- $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
-
- for ($j=0;$j<count($insert_record_entity);$j++)
- {
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('entity','attributes_form'));
-
- $values['vendor_id'] =
get_var('vendor_id',array('POST'));
- $values['vendor_name'] =
get_var('vendor_name',array('POST'));
- $values['date'] =
get_var('date',array('POST'));
- $ticket_id =
get_var('ticket_id',array('POST','GET'));
- $request_id =
get_var('request_id',array('POST','GET'));
-
- if($_POST && !$bypass)
- {
-
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
-
- }
- else
- {
- $location_code =
get_var('location_code',array('POST','GET'));
- $values['descr'] =
get_var('descr',array('POST','GET'));
- $p_entity_id =
get_var('p_entity_id',array('POST','GET'));
- $p_cat_id =
get_var('p_cat_id',array('POST','GET'));
- $values['p'][$p_entity_id]['p_entity_id']
= $p_entity_id;
- $values['p'][$p_entity_id]['p_cat_id']
= $p_cat_id;
- $values['p'][$p_entity_id]['p_num']
= get_var('p_num',array('POST','GET'));
-
-
- $origin =
get_var('origin',array('POST','GET'));
- $origin_id =
get_var('origin_id',array('POST','GET'));
-
-
- if($p_entity_id && $p_cat_id)
- {
- $entity_category =
$this->boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
-
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
- }
-
-
- if($location_code)
- {
- $values['location_data'] =
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
- }
-
- }
-
- if($values['origin'])
- {
- $origin = $values['origin'];
- $origin_id = $values['origin_id'];
- }
-
- if($origin)
- {
- unset($values['origin']);
- unset($values['origin_id']);
- $values['origin'][0]['type']= $origin;
-
$values['origin'][0]['link']=$this->bocommon->get_origin_link($origin);
- $values['origin'][0]['data'][]= array(
- 'id'=> $origin_id,
- 'type'=> $origin
- );
- }
-
- if($tenant_id)
- {
- $lookup_tenant=True;
- }
-
- if ($values['save'])
- {
- if(!$values['location'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
- $error_id=true;
- }
-
- if(!$this->cat_id)
- {
-
$receipt['error'][]=array('msg'=>lang('Please select entity type !'));
- $error_id=true;
- }
-
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- else
- {
-
$values['id']=$this->bo->generate_id(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id));
- }
-
- $values['file_name']=$_FILES['file']['name'];
- $to_file = $this->fakebase. SEP .
$this->category_name . SEP . $values['location']['loc1'] . SEP . $values['id']
. SEP . $values['file_name'];
-
- if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
- 'string' => $to_file,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->create_home_dir($receipt);
- $receipt =
$this->bo->save($values,$values_attribute,$action,$this->entity_id,$this->cat_id);
- $id = $values['id'];
- $function_msg = lang('edit entity');
-
- if($values['file_name'])
- {
-
$this->bo->create_document_dir($values['location']['loc1'], $values['id']);
- $this->bo->vfs->override_acl =
1;
-
- if(!$this->bo->vfs->cp (array (
- 'from' =>
$_FILES['file']['tmp_name'],
- 'to' => $to_file,
- 'relatives' =>
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
- {
-
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
- }
- $this->bo->vfs->override_acl =
0;
- }
- }
- else
- {
- if($values['location'])
- {
- $location_code=implode("-",
$values['location']);
- $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
- }
- if($values['extra']['p_num'])
- {
-
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
- }
- }
- }
-
- if ($id)
- {
- $values =
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'id'=>$id));
- }
- else
- {
- if($this->cat_id)
- {
- $values =
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id));
- }
- }
-
- if($this->cat_id)
- {
- $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
- }
- else
- {
- $cat_list =
$this->bo->select_category_list('select',$this->cat_id);
- }
-
- $lookup_type='form';
-
- $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
-
- if ($id)
- {
- $function_msg = lang('edit') . ' ' .
$category['name'];
- }
- else
- {
- $function_msg = lang('add') . ' ' .
$category['name'];
- }
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
- if (isset($entity['lookup_entity']) &&
is_array($entity['lookup_entity']))
- { for
($i=0;$i<count($entity['lookup_entity']);$i++)
- {
- $lookup_entity[$i]['id'] =
$entity['lookup_entity'][$i];
- $entity_lookup =
$this->boadmin_entity->read_single($entity['lookup_entity'][$i],false);
- $lookup_entity[$i]['name'] =
$entity_lookup['name'];
- }
- }
-
- if($category['lookup_tenant'])
- {
- $lookup_tenant=True;
- }
-
- if(!$category['location_level'])
- {
- $category['location_level']= -1;
- }
-
-
-
- if($entity['location_form'])
- {
-
$location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' =>
$category['location_level'],
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'lookup_type' => $lookup_type,
- 'tenant' =>
$lookup_tenant,
- 'lookup_entity' =>
$lookup_entity,
- 'entity_data' => $values['p']
- ));
- }
-
-/* if($category['lookup_vendor'])
- {
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'vendor_id' =>
$values['vendor_id'],
- 'vendor_name' =>
$values['vendor_name']));
- }
-*/
-
- $attributes_header[] = array(
- 'lang_name' => lang('Name'),
- 'lang_descr' => lang('Description'),
- 'lang_datatype' => lang('Datatype'),
- 'lang_value' => lang('Value')
- );
-
- if($error_id)
- {
- unset($values['id']);
- unset($id);
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uientity.edit',
- 'id' => $id,
- 'entity_id' => $this->entity_id,
- 'cat_id' => $this->cat_id
- );
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- switch(substr($dateformat,0,1))
- {
- case 'M':
- $dateformat_validate=
"javascript:vDateType='1'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
- $onBlur =
"DateFormat(this,this.value,event,true,'1')";
- break;
- case 'y':
-
$dateformat_validate="javascript:vDateType='2'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
- $onBlur =
"DateFormat(this,this.value,event,true,'2')";
- break;
- case 'D':
-
$dateformat_validate="javascript:vDateType='3'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
- $onBlur =
"DateFormat(this,this.value,event,true,'3')";
- break;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $link_file_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uientity.view_file',
- 'loc1'
=>$values['location_data']['loc1'],
- 'id' =>$id,
- 'cat_id'
=>$this->cat_id,
- 'entity_id'
=>$this->entity_id
- );
-
-
- $config->read_repository();
- $link_to_files = $config->config_data['files_url'];
-
- $j = count($values['files']);
- for ($i=0;$i<$j;$i++)
- {
-
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
- }
-
- $project_link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiproject.edit',
- 'bypass' => true,
- 'location_code' =>
$values['location_code'],
- 'p_num' =>
$values['p_num'],
- 'p_entity_id' =>
$values['p_entity_id'],
- 'p_cat_id' =>
$values['p_cat_id'],
- 'tenant_id' =>
$values['tenant_id'],
- 'origin' => 'entity_' .
$this->entity_id . '_' . $this->cat_id,
- 'origin_id' => $id
- );
-
-//_debug_array($values['origin']);
- for ($i=0;$i<count($values['origin']);$i++)
- {
-
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
-
if(substr($values['origin'][$i]['type'],0,6)=='entity')
- {
- $type =
explode("_",$values['origin'][$i]['type']);
- $entity_id = $type[1];
- $cat_id = $type[2];
-
- if(!is_object($boadmin_entity))
- {
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- }
- $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
- $values['origin'][$i]['descr'] =
$entity_category['name'];
- }
- else
- {
- $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
- }
- }
-
- $data = array
- (
- 'start_project'
=> $category['start_project'],
- 'lang_start_project' =>
lang('start project'),
- 'project_link'
=> $GLOBALS['phpgw']->link('/index.php',$project_link_data),
- 'fileupload'
=> $category['fileupload'],
- 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
- 'link_to_files'
=> $link_to_files,
- 'files'
=> $values['files'],
- 'lang_files'
=> lang('files'),
- 'lang_filename'
=> lang('Filename'),
- 'lang_delete_file'
=> lang('Delete file'),
- 'lang_view_file_statustext' =>
lang('Klick to view file'),
- 'lang_delete_file_statustext' => lang('Check
to delete file'),
- 'lang_upload_file'
=> lang('Upload file'),
- 'lang_file_statustext' =>
lang('Select file to upload'),
-
- 'value_origin'
=> $values['origin'],
- 'value_origin_type'
=> $origin,
- 'value_origin_id'
=> $origin_id,
-
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category. To do not use a category select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $cat_list,
- 'location_code'
=> $location_code,
- 'lookup_tenant'
=> $lookup_tenant,
-
- 'lang_entity'
=> lang('entity'),
- 'entity_name'
=> $entity['name'],
- 'lang_category'
=> lang('category'),
- 'category_name'
=> $category['name'],
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp'
=> $onKeyUp,
- 'onBlur'
=> $onBlur,
- 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
- 'lang_attributes'
=> lang('Attributes'),
- 'attributes_header'
=> $attributes_header,
- 'attributes_values'
=> $values['attributes'],
- 'lookup_functions'
=> $values['lookup_functions'],
- 'dateformat'
=> $dateformat,
- 'lang_none'
=> lang('None'),
- 'vendor_data'
=> $vendor_data,
- 'location_data'
=> $location_data,
- 'lookup_type'
=> $lookup_type,
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.index&entity_id='
. $this->entity_id . '&cat_id='. $this->cat_id),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_id'
=> lang('ID'),
- 'value_id'
=> $values['id'],
- 'value_num'
=> $values['num'],
- 'error_flag'
=> $error_id,
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the entity')
- );
-
- $appname = $entity['name'];
-//_debug_array($attributes_values);
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
-
- $id = get_var('id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uientity.index',
- 'entity_id' => $this->entity_id,
- 'cat_id' => $this->cat_id
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.delete&entity_id='
. $this->entity_id .'&cat_id=' . $this->cat_id . '&id=' . $id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('entity');
- $function_msg =
lang('delete entity');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $config =
CreateObject('phpgwapi.config',$this->currentapp);
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $id = get_var('id',array('POST','GET'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('entity','attributes_view'));
-
-
- if ($id)
- {
- $values =
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'id'=>$id));
- }
-
- $lookup_type='view';
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
- $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
- $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
-
- if (isset($entity['lookup_entity']) &&
is_array($entity['lookup_entity']))
- { for
($i=0;$i<count($entity['lookup_entity']);$i++)
- {
-
if($values['p'][$entity['lookup_entity'][$i]])
- {
- $lookup_entity[$i]['id'] =
$entity['lookup_entity'][$i];
- $entity_lookup =
$this->boadmin_entity->read_single($entity['lookup_entity'][$i],false);
- $lookup_entity[$i]['name'] =
$entity_lookup['name'];
- }
- }
- }
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'lookup_type' => $lookup_type,
- 'tenant' =>
$category['lookup_tenant'],
- 'lookup_entity' =>
$lookup_entity,
- 'entity_data' => $values['p']
- ));
-
- $appname = $entity['name'];
- $function_msg = lang('view') . ' ' .
$category['name'];
-
-/* if($category['lookup_vendor'])
- {
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'vendor_id' =>
$values['vendor_id'],
- 'vendor_name' =>
$values['vendor_name']));
- }
-*/
- $attributes_values=$values['attributes'];
-
- $attributes_header[] = array(
- 'lang_name' => lang('Name'),
- 'lang_descr' => lang('Description'),
- 'lang_datatype' => lang('Datatype'),
- 'lang_value' => lang('Value')
- );
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uientity.edit',
- 'id' => $id,
- 'entity_id' => $this->entity_id,
- 'cat_id' => $this->cat_id
- );
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $link_file_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uientity.view_file',
- 'loc1'
=>$values['location_data']['loc1'],
- 'id' =>$id,
- 'cat_id'
=>$this->cat_id,
- 'entity_id'
=>$this->entity_id
- );
-
- $config->read_repository();
- $link_to_files = $config->config_data['files_url'];
-
- $j = count($values['files']);
- for ($i=0;$i<$j;$i++)
- {
-
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
- }
-
- if(is_array($values['origin']))
- {
- for ($i=0;$i<count($values['origin']);$i++)
- {
-
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
-
if(substr($values['origin'][$i]['type'],0,6)=='entity')
- {
- $type =
explode("_",$values['origin'][$i]['type']);
- $entity_id = $type[1];
- $cat_id = $type[2];
-
- if(!is_object($boadmin_entity))
- {
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- }
- $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
- $values['origin'][$i]['descr']
= $entity_category['name'];
- }
- else
- {
- $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
- }
- }
- }
-
- $data = array
- (
- 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
- 'link_to_files'
=> $link_to_files,
- 'files'
=> $values['files'],
- 'lang_files'
=> lang('files'),
- 'lang_filename'
=> lang('Filename'),
- 'lang_view_file_statustext' =>
lang('Klick to view file'),
-
- 'value_origin'
=> $values['origin'],
- 'value_origin_type'
=> $origin,
- 'value_origin_id'
=> $origin_id,
-
- 'lang_entity'
=> lang('entity'),
- 'entity_name'
=> $entity['name'],
- 'lang_category'
=> lang('category'),
- 'category_name'
=> $category['name'],
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'lang_attributes'
=> lang('Attributes'),
- 'attributes_view'
=> $attributes_values,
- 'dateformat'
=> $dateformat,
-
- 'vendor_data'
=> $vendor_data,
- 'location_data'
=> $location_data,
- 'lookup_type'
=> $lookup_type,
- 'edit_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.index&entity_id='
. $this->entity_id . '&cat_id='. $this->cat_id),
- 'lang_category'
=> lang('category'),
- 'lang_edit'
=> lang('Edit'),
- 'lang_done'
=> lang('done'),
- 'lang_id'
=> lang('ID'),
- 'value_id' =>
$values['id'],
- 'value_num' =>
$values['num'],
- 'error_flag'
=> $error_id,
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Edit the entity'),
- 'status_list'
=> $this->bo->select_status_list('select',$values['status'])
- );
-
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 entity
+ * @version $Id: class.uientity.inc.php,v 1.17 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uientity
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'columns' => True,
+ 'excel' => True,
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'view_file' =>True
+ );
+
+ function uientity()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.boentity',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity',True);
+
+ $this->entity_id =
$this->bo->entity_id;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ if(!$this->cat_id)
+ {
+ $this->acl2_location = '.entity.' .
$this->entity_id;
+ }
+ else
+ {
+ $this->acl2_location = '.entity.' .
$this->entity_id . '.' . $this->cat_id;
+ }
+ $this->acl_read =
$this->acl2->check($this->acl2_location,1);
+ $this->acl_add =
$this->acl2->check($this->acl2_location,2);
+ $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
+ $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->part_of_town_id =
$this->bo->part_of_town_id;
+ $this->district_id =
$this->bo->district_id;
+ $this->status =
$this->bo->status;
+ $this->fakebase =
$this->bo->fakebase;
+ $this->category_name =
$this->bo->category_name;
+ $this->menu->sub
='entity_'.$this->entity_id;
+
$GLOBALS['phpgw']->session->appsession('entity_id',$this->currentapp,$this->entity_id);
+ $this->start_date =
$this->bo->start_date;
+ $this->end_date =
$this->bo->end_date;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'part_of_town_id' =>
$this->part_of_town_id,
+ 'district_id' => $this->district_id,
+ 'entity_id' => $this->entity_id,
+ 'status' => $this->status,
+ 'start_date' => $this->start_date,
+ 'end_date' => $this->end_date
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function excel()
+ {
+ $GLOBALS['phpgw_info']['flags'][noheader] = True;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = True;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
+
+ $start_date = urldecode($this->start_date);
+ $end_date = urldecode($this->end_date);
+
+ $list =
$this->bo->read(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'allrows'=>true,'start_date'=>$start_date,'end_date'=>$end_date));
+ $uicols = $this->bo->uicols;
+
+ $filename=
$GLOBALS['phpgw_info']['user']['account_lid'].'.xls';
+ $count_uicols_name=count($uicols['name']);
+
+ $workbook =
CreateObject($this->currentapp.'.excel',"-");
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($filename,'application/vnd.ms-excel');
+
+ $worksheet1 =& $workbook->add_worksheet('First One');
+
+ $j=0;
+ if (isset($list) AND is_array($list))
+ {
+ foreach($list as $entry)
+ {
+ $m=0;
+ for ($k=0;$k<$count_uicols_name;$k++)
+ {
+
if($uicols['input_type'][$k]!='hidden')
+ {
+ $content[$j][$m]
= $entry[$uicols['name'][$k]];
+
$worksheet1->write_string(0, $m, $uicols['descr'][$k]);
+ $m++;
+ }
+ }
+ $j++;
+ }
+
+ foreach($content as $row)
+ {
+ $line++;
+ for ($i=0; $i<count($row); $i++)
+ {
+
$worksheet1->write($line,$i,$row[$i]);
+ }
+ }
+ }
+ $workbook->close();
+ }
+
+
+ function columns()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
+
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+
+ $values =
get_var('values',array('POST','GET'));
+
+ if ($values['save'] && $this->cat_id)
+ {
+
$GLOBALS['phpgw']->preferences->account_id=$this->account;
+
$GLOBALS['phpgw']->preferences->read_repository();
+
$GLOBALS['phpgw']->preferences->add($this->currentapp,"entity_columns_" .
$this->entity_id . '_' . $this->cat_id,$values['columns'],'user');
+
$GLOBALS['phpgw']->preferences->save_repository();
+
+ $receipt['message'][] = array('msg' =>
lang('columns is updated'));
+ }
+
+ if(!$this->cat_id)
+ {
+ $receipt['error'][] = array('msg' =>
lang('Choose a category'));
+ }
+ $function_msg = lang('Select Column');
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uientity.columns',
+ 'entity_id' =>
$this->entity_id,
+ 'cat_id' => $this->cat_id
+ );
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'column_list' =>
$this->bo->column_list($values['columns'],$entity_id=$this->entity_id,$cat_id=$this->cat_id,$allrows=True),
+ 'function_msg' => $function_msg,
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_columns' => lang('columns'),
+ 'lang_none' => lang('None'),
+ 'lang_save' => lang('save'),
+ 'select_name' => 'period'
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
$function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view_file()
+ {
+ $GLOBALS['phpgw_info']['flags'][noheader] = True;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = True;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $file_name =
urldecode(get_var('file_name',array('POST','GET')));
+ $loc1 = get_var('loc1',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+
+ $file = $this->fakebase. SEP . $this->category_name .
SEP . $loc1 . SEP . $id . SEP . $file_name;
+
+//echo 'file: ' . $file . '<br>';
+ if($this->bo->vfs->file_exists(array(
+ 'string' => $file,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $size =
$this->bo->vfs->get_size(array(
+ 'string' => $file,
+ 'relatives' =>
Array(RELATIVE_NONE),
+ 'checksubdirs' =>
True));
+
+ $document= $this->bo->vfs->read(array(
+ 'string' => $file,
+ 'relatives' => Array(RELATIVE_NONE)));
+
+ $filename =
basename($values['document_name']);
+ $filetype = array_pop(explode('.',
basename($file)));
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($filename,$filetype,$size);
+
+ echo $document;
+
+ }
+ }
+
+ function index()
+ {
+ if(!$this->acl_read && $this->cat_id)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('entity',
+ 'menu',
+
'nextmatchs'));
+
+ $links = $this->menu->links();
+
+ $start_date = urldecode($this->start_date);
+ $end_date = urldecode($this->end_date);
+
+ $entity_list =
$this->bo->read(array('start_date'=>$start_date,'end_date'=>$end_date));
+
+ $uicols = $this->bo->uicols;
+
+ $j=0;
+
+ if (isset($entity_list) AND is_array($entity_list))
+ {
+ foreach($entity_list as $entity_entry)
+ {
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
if($entity_entry['query_location'][$uicols['name'][$i]])
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('search');
+
$content[$j]['row'][$i]['text'] =
$entity_entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.index&entity_id='
. $this->entity_id . '&cat_id=' . $this->cat_id .'&query=' .
$entity_entry['query_location'][$uicols['name'][$i]]);
+ }
+ else
+ {
+
$content[$j]['row'][$i]['value'] =
$entity_entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+ }
+ }
+ }
+
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
+ $content[$j]['row'][$i]['text']
= lang('view');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.view&entity_id='
. $this->entity_id . '&cat_id=' . $this->cat_id .'&id=' . $entity_entry['id']);
+ }
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('edit the
entity');
+ $content[$j]['row'][$i]['text']
= lang('edit');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.edit&entity_id='
. $this->entity_id . '&cat_id=' . $this->cat_id .'&id=' . $entity_entry['id']);
+ }
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('delete the
entity');
+ $content[$j]['row'][$i]['text']
= lang('delete');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.delete&entity_id='
. $this->entity_id . '&cat_id=' . $this->cat_id .'&id=' . $entity_entry['id']);
+ }
+
+ $j++;
+ }
+ }
+
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['datatype'][$i]!='T' &&
$uicols['datatype'][$i]!='CH')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+ (
+ 'sort' =>
$this->sort,
+ 'var' =>
$uicols['name'][$i],
+ 'order' =>
$this->order,
+ 'extra'
=> array('menuaction' => $this->currentapp.'.uientity.index',
+
'type_id' =>$type_id,
+
'query' =>$this->query,
+
'lookup' =>$lookup,
+
'district_id' => $this->district_id,
+
'entity_id' =>$this->entity_id,
+
'cat_id' =>$this->cat_id,
+
'start_date'=>$start_date,
+
'end_date'=>$end_date)
+ ));
+ }
+ }
+ }
+
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+
+
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
entity'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.edit&entity_id='.
$this->entity_id .'&cat_id='. $this->cat_id)
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uientity.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'entity_id'
=>$this->entity_id,
+ 'district_id'
=>$this->district_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'start_date' =>$start_date,
+ 'end_date'
=>$end_date
+ );
+
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uientity.excel',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'entity_id'
=>$this->entity_id,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'status_id'
=>$this->status,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'start_date' =>$start_date,
+ 'end_date'
=>$end_date,
+ 'start' =>$this->start
+ );
+
+ $link_columns = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uientity.columns',
+ 'entity_id'
=>$this->entity_id,
+ 'cat_id'
=>$this->cat_id
+ );
+
+ $link_date_search
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
+
+
if($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'])
+ {
+ $group_filters = 'select';
+
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field_grouped'));
+ }
+ else
+ {
+ $group_filters = 'filter';
+
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
+ }
+
+ $data = array
+ (
+ 'group_filters' =>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'],
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+
+ 'lang_columns' =>
lang('columns'),
+ 'link_columns' =>
$GLOBALS['phpgw']->link('/index.php',$link_columns),
+ 'lang_columns_help' =>
lang('Choose columns'),
+
+ 'start_date' =>
$start_date,
+ 'end_date'
=> $end_date,
+ 'lang_none'
=> lang('None'),
+ 'lang_date_search' =>
lang('Date search'),
+ 'lang_date_search_help' => lang('Narrow
the search by dates'),
+ 'link_date_search' =>
$link_date_search,
+ 'lang_date_search' =>
lang('Date search'),
+ 'overlib_source' =>
'./'.$this->currentapp.'/inc/overlib.js',
+
+
+ 'links'
=> $links,
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($entity_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+
+ 'district_list'
=> $this->bocommon->select_district_list($group_filters,$this->district_id),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+ 'select_district_name' =>
'district_id',
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category. To do not use a category select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list($group_filters,$this->cat_id),
+
+ 'lang_status_statustext' =>
lang('Select the status. To do not use a status select NO STATUS'),
+ 'status_name'
=> 'status',
+ 'lang_no_status'
=> lang('No status'),
+ 'status_list'
=> $this->bo->select_status_list($group_filters,$this->status),
+
+ 'lang_user_statustext' =>
lang('Select the user. To do not use a category select NO USER'),
+ 'select_user_name'
=> 'filter',
+ 'lang_no_user'
=> lang('No user'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl2_location,array('all'),$default='all'),
+
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ if($this->entity_id)
+ {
+ $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
+ $appname = $entity['name'];
+ }
+ if($this->cat_id)
+ {
+ $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+ $function_msg
= 'list ' . $category['name'];
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ }
+
+ if(!$this->entity_id || !$this->cat_id)
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+ $receipt['error'][]=array('msg'=>lang('Please
select type'));
+ $msgbox_data =
$this->bocommon->msgbox_data($receipt);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('empty' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ else
+ {
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+ }
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $config =
CreateObject('phpgwapi.config',$this->currentapp);
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $id =
get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST','GET'));
+ $values_attribute =
get_var('values_attribute',array('POST','GET'));
+ $bypass =
get_var('bypass',array('POST','GET'));
+ $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
+ $tenant_id =
get_var('tenant_id',array('POST','GET'));
+
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+ $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
+
+ for ($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('entity','attributes_form'));
+
+ $values['vendor_id'] =
get_var('vendor_id',array('POST'));
+ $values['vendor_name'] =
get_var('vendor_name',array('POST'));
+ $values['date'] =
get_var('date',array('POST'));
+ $ticket_id =
get_var('ticket_id',array('POST','GET'));
+ $request_id =
get_var('request_id',array('POST','GET'));
+
+ if($_POST && !$bypass)
+ {
+
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+
+ }
+ else
+ {
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $values['descr'] =
get_var('descr',array('POST','GET'));
+ $p_entity_id =
get_var('p_entity_id',array('POST','GET'));
+ $p_cat_id =
get_var('p_cat_id',array('POST','GET'));
+ $values['p'][$p_entity_id]['p_entity_id']
= $p_entity_id;
+ $values['p'][$p_entity_id]['p_cat_id']
= $p_cat_id;
+ $values['p'][$p_entity_id]['p_num']
= get_var('p_num',array('POST','GET'));
+
+
+ $origin =
get_var('origin',array('POST','GET'));
+ $origin_id =
get_var('origin_id',array('POST','GET'));
+
+
+ if($p_entity_id && $p_cat_id)
+ {
+ $entity_category =
$this->boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
+
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
+ }
+
+
+ if($location_code)
+ {
+ $values['location_data'] =
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
+ }
+
+ }
+
+ if($values['origin'])
+ {
+ $origin = $values['origin'];
+ $origin_id = $values['origin_id'];
+ }
+
+ if($origin)
+ {
+ unset($values['origin']);
+ unset($values['origin_id']);
+ $values['origin'][0]['type']= $origin;
+
$values['origin'][0]['link']=$this->bocommon->get_origin_link($origin);
+ $values['origin'][0]['data'][]= array(
+ 'id'=> $origin_id,
+ 'type'=> $origin
+ );
+ }
+
+ if($tenant_id)
+ {
+ $lookup_tenant=True;
+ }
+
+ if ($values['save'])
+ {
+ if(!$values['location'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
+ $error_id=true;
+ }
+
+ if(!$this->cat_id)
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select entity type !'));
+ $error_id=true;
+ }
+
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ else
+ {
+
$values['id']=$this->bo->generate_id(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id));
+ }
+
+ $values['file_name']=$_FILES['file']['name'];
+ $to_file = $this->fakebase. SEP .
$this->category_name . SEP . $values['location']['loc1'] . SEP . $values['id']
. SEP . $values['file_name'];
+
+ if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
+ 'string' => $to_file,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->create_home_dir($receipt);
+ $receipt =
$this->bo->save($values,$values_attribute,$action,$this->entity_id,$this->cat_id);
+ $id = $values['id'];
+ $function_msg = lang('edit entity');
+
+ if($values['file_name'])
+ {
+
$this->bo->create_document_dir($values['location']['loc1'], $values['id']);
+ $this->bo->vfs->override_acl =
1;
+
+ if(!$this->bo->vfs->cp (array (
+ 'from' =>
$_FILES['file']['tmp_name'],
+ 'to' => $to_file,
+ 'relatives' =>
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+ {
+
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
+ }
+ $this->bo->vfs->override_acl =
0;
+ }
+ }
+ else
+ {
+ if($values['location'])
+ {
+ $location_code=implode("-",
$values['location']);
+ $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
+ }
+ if($values['extra']['p_num'])
+ {
+
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
+ }
+ }
+ }
+
+ if ($id)
+ {
+ $values =
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'id'=>$id));
+ }
+ else
+ {
+ if($this->cat_id)
+ {
+ $values =
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id));
+ }
+ }
+
+ if($this->cat_id)
+ {
+ $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+ }
+ else
+ {
+ $cat_list =
$this->bo->select_category_list('select',$this->cat_id);
+ }
+
+ $lookup_type='form';
+
+ $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
+
+ if ($id)
+ {
+ $function_msg = lang('edit') . ' ' .
$category['name'];
+ }
+ else
+ {
+ $function_msg = lang('add') . ' ' .
$category['name'];
+ }
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ if (isset($entity['lookup_entity']) &&
is_array($entity['lookup_entity']))
+ { for
($i=0;$i<count($entity['lookup_entity']);$i++)
+ {
+ $lookup_entity[$i]['id'] =
$entity['lookup_entity'][$i];
+ $entity_lookup =
$this->boadmin_entity->read_single($entity['lookup_entity'][$i],false);
+ $lookup_entity[$i]['name'] =
$entity_lookup['name'];
+ }
+ }
+
+ if($category['lookup_tenant'])
+ {
+ $lookup_tenant=True;
+ }
+
+ if(!$category['location_level'])
+ {
+ $category['location_level']= -1;
+ }
+
+
+
+ if($entity['location_form'])
+ {
+
$location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' =>
$category['location_level'],
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'lookup_type' => $lookup_type,
+ 'tenant' =>
$lookup_tenant,
+ 'lookup_entity' =>
$lookup_entity,
+ 'entity_data' => $values['p']
+ ));
+ }
+
+/* if($category['lookup_vendor'])
+ {
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'vendor_id' =>
$values['vendor_id'],
+ 'vendor_name' =>
$values['vendor_name']));
+ }
+*/
+
+ $attributes_header[] = array(
+ 'lang_name' => lang('Name'),
+ 'lang_descr' => lang('Description'),
+ 'lang_datatype' => lang('Datatype'),
+ 'lang_value' => lang('Value')
+ );
+
+ if($error_id)
+ {
+ unset($values['id']);
+ unset($id);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uientity.edit',
+ 'id' => $id,
+ 'entity_id' => $this->entity_id,
+ 'cat_id' => $this->cat_id
+ );
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+
$dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+
$dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $link_file_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uientity.view_file',
+ 'loc1'
=>$values['location_data']['loc1'],
+ 'id' =>$id,
+ 'cat_id'
=>$this->cat_id,
+ 'entity_id'
=>$this->entity_id
+ );
+
+
+ $config->read_repository();
+ $link_to_files = $config->config_data['files_url'];
+
+ $j = count($values['files']);
+ for ($i=0;$i<$j;$i++)
+ {
+
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
+ }
+
+ $project_link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiproject.edit',
+ 'bypass' => true,
+ 'location_code' =>
$values['location_code'],
+ 'p_num' =>
$values['p_num'],
+ 'p_entity_id' =>
$values['p_entity_id'],
+ 'p_cat_id' =>
$values['p_cat_id'],
+ 'tenant_id' =>
$values['tenant_id'],
+ 'origin' => 'entity_' .
$this->entity_id . '_' . $this->cat_id,
+ 'origin_id' => $id
+ );
+
+//_debug_array($values['origin']);
+ for ($i=0;$i<count($values['origin']);$i++)
+ {
+
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
+
if(substr($values['origin'][$i]['type'],0,6)=='entity')
+ {
+ $type =
explode("_",$values['origin'][$i]['type']);
+ $entity_id = $type[1];
+ $cat_id = $type[2];
+
+ if(!is_object($boadmin_entity))
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ }
+ $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
+ $values['origin'][$i]['descr'] =
$entity_category['name'];
+ }
+ else
+ {
+ $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
+ }
+ }
+
+ $data = array
+ (
+ 'start_project'
=> $category['start_project'],
+ 'lang_start_project' =>
lang('start project'),
+ 'project_link'
=> $GLOBALS['phpgw']->link('/index.php',$project_link_data),
+ 'fileupload'
=> $category['fileupload'],
+ 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
+ 'link_to_files'
=> $link_to_files,
+ 'files'
=> $values['files'],
+ 'lang_files'
=> lang('files'),
+ 'lang_filename'
=> lang('Filename'),
+ 'lang_delete_file'
=> lang('Delete file'),
+ 'lang_view_file_statustext' =>
lang('Klick to view file'),
+ 'lang_delete_file_statustext' => lang('Check
to delete file'),
+ 'lang_upload_file'
=> lang('Upload file'),
+ 'lang_file_statustext' =>
lang('Select file to upload'),
+
+ 'value_origin'
=> $values['origin'],
+ 'value_origin_type'
=> $origin,
+ 'value_origin_id'
=> $origin_id,
+
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category. To do not use a category select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $cat_list,
+ 'location_code'
=> $location_code,
+ 'lookup_tenant'
=> $lookup_tenant,
+
+ 'lang_entity'
=> lang('entity'),
+ 'entity_name'
=> $entity['name'],
+ 'lang_category'
=> lang('category'),
+ 'category_name'
=> $category['name'],
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
+ 'lang_attributes'
=> lang('Attributes'),
+ 'attributes_header'
=> $attributes_header,
+ 'attributes_values'
=> $values['attributes'],
+ 'lookup_functions'
=> $values['lookup_functions'],
+ 'dateformat'
=> $dateformat,
+ 'lang_none'
=> lang('None'),
+ 'vendor_data'
=> $vendor_data,
+ 'location_data'
=> $location_data,
+ 'lookup_type'
=> $lookup_type,
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.index&entity_id='
. $this->entity_id . '&cat_id='. $this->cat_id),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_id'
=> lang('ID'),
+ 'value_id'
=> $values['id'],
+ 'value_num'
=> $values['num'],
+ 'error_flag'
=> $error_id,
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the entity')
+ );
+
+ $appname = $entity['name'];
+//_debug_array($attributes_values);
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ if(!$this->acl_delete)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+
+ $id = get_var('id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uientity.index',
+ 'entity_id' => $this->entity_id,
+ 'cat_id' => $this->cat_id
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.delete&entity_id='
. $this->entity_id .'&cat_id=' . $this->cat_id . '&id=' . $id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('entity');
+ $function_msg =
lang('delete entity');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $config =
CreateObject('phpgwapi.config',$this->currentapp);
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $id = get_var('id',array('POST','GET'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('entity','attributes_view'));
+
+
+ if ($id)
+ {
+ $values =
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'id'=>$id));
+ }
+
+ $lookup_type='view';
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ $entity =
$this->boadmin_entity->read_single($this->entity_id,false);
+ $category =
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+
+ if (isset($entity['lookup_entity']) &&
is_array($entity['lookup_entity']))
+ { for
($i=0;$i<count($entity['lookup_entity']);$i++)
+ {
+
if($values['p'][$entity['lookup_entity'][$i]])
+ {
+ $lookup_entity[$i]['id'] =
$entity['lookup_entity'][$i];
+ $entity_lookup =
$this->boadmin_entity->read_single($entity['lookup_entity'][$i],false);
+ $lookup_entity[$i]['name'] =
$entity_lookup['name'];
+ }
+ }
+ }
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'lookup_type' => $lookup_type,
+ 'tenant' =>
$category['lookup_tenant'],
+ 'lookup_entity' =>
$lookup_entity,
+ 'entity_data' => $values['p']
+ ));
+
+ $appname = $entity['name'];
+ $function_msg = lang('view') . ' ' .
$category['name'];
+
+/* if($category['lookup_vendor'])
+ {
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'vendor_id' =>
$values['vendor_id'],
+ 'vendor_name' =>
$values['vendor_name']));
+ }
+*/
+ $attributes_values=$values['attributes'];
+
+ $attributes_header[] = array(
+ 'lang_name' => lang('Name'),
+ 'lang_descr' => lang('Description'),
+ 'lang_datatype' => lang('Datatype'),
+ 'lang_value' => lang('Value')
+ );
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uientity.edit',
+ 'id' => $id,
+ 'entity_id' => $this->entity_id,
+ 'cat_id' => $this->cat_id
+ );
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $link_file_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uientity.view_file',
+ 'loc1'
=>$values['location_data']['loc1'],
+ 'id' =>$id,
+ 'cat_id'
=>$this->cat_id,
+ 'entity_id'
=>$this->entity_id
+ );
+
+ $config->read_repository();
+ $link_to_files = $config->config_data['files_url'];
+
+ $j = count($values['files']);
+ for ($i=0;$i<$j;$i++)
+ {
+
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
+ }
+
+ if(is_array($values['origin']))
+ {
+ for ($i=0;$i<count($values['origin']);$i++)
+ {
+
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
+
if(substr($values['origin'][$i]['type'],0,6)=='entity')
+ {
+ $type =
explode("_",$values['origin'][$i]['type']);
+ $entity_id = $type[1];
+ $cat_id = $type[2];
+
+ if(!is_object($boadmin_entity))
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ }
+ $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
+ $values['origin'][$i]['descr']
= $entity_category['name'];
+ }
+ else
+ {
+ $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
+ }
+ }
+ }
+
+ $data = array
+ (
+ 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
+ 'link_to_files'
=> $link_to_files,
+ 'files'
=> $values['files'],
+ 'lang_files'
=> lang('files'),
+ 'lang_filename'
=> lang('Filename'),
+ 'lang_view_file_statustext' =>
lang('Klick to view file'),
+
+ 'value_origin'
=> $values['origin'],
+ 'value_origin_type'
=> $origin,
+ 'value_origin_id'
=> $origin_id,
+
+ 'lang_entity'
=> lang('entity'),
+ 'entity_name'
=> $entity['name'],
+ 'lang_category'
=> lang('category'),
+ 'category_name'
=> $category['name'],
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'lang_attributes'
=> lang('Attributes'),
+ 'attributes_view'
=> $attributes_values,
+ 'dateformat'
=> $dateformat,
+
+ 'vendor_data'
=> $vendor_data,
+ 'location_data'
=> $location_data,
+ 'lookup_type'
=> $lookup_type,
+ 'edit_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.index&entity_id='
. $this->entity_id . '&cat_id='. $this->cat_id),
+ 'lang_category'
=> lang('category'),
+ 'lang_edit'
=> lang('Edit'),
+ 'lang_done'
=> lang('done'),
+ 'lang_id'
=> lang('ID'),
+ 'value_id' =>
$values['id'],
+ 'value_num' =>
$values['num'],
+ 'error_flag'
=> $error_id,
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Edit the entity'),
+ 'status_list'
=> $this->bo->select_status_list('select',$values['status'])
+ );
+
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uigab.inc.php
diff -u property/inc/class.uigab.inc.php:1.12
property/inc/class.uigab.inc.php:1.13
--- property/inc/class.uigab.inc.php:1.12 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uigab.inc.php Fri Feb 3 12:05:49 2006
@@ -1,846 +1,846 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 location
- * @version $Id: class.uigab.inc.php,v 1.12 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uigab
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'list_detail' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uigab()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject($this->currentapp.'.bogab',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
- $this->bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $this->config =
CreateObject('phpgwapi.config');
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.location';
- $this->acl_read =
$this->acl2->check('.location',1);
- $this->acl_add =
$this->acl2->check('.location',2);
- $this->acl_edit =
$this->acl2->check('.location',4);
- $this->acl_delete =
$this->acl2->check('.location',8);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->status_id =
$this->bo->status_id;
- $this->allrows =
$this->bo->allrows;
- $this->gab_insert_level =
$this->bo->gab_insert_level;
-
- $this->menu->sub ='location';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('gab',
-
'menu',
-
'nextmatchs'));
-
- $address =
get_var('address',array('POST','GET'));
- $location_code =
get_var('location_code',array('POST','GET'));
- $gaards_nr =
get_var('gaards_nr',array('POST','GET'));
- $bruksnr =
get_var('bruksnr',array('POST','GET'));
- $feste_nr =
get_var('feste_nr',array('POST','GET'));
- $seksjons_nr =
get_var('seksjons_nr',array('POST','GET'));
- $reset_query =
get_var('reset_query',array('POST','GET'));
-
- if($reset_query)
- {
- unset($address);
- unset($location_code);
- unset($gaards_nr);
- unset($bruksnr);
- unset($feste_nr);
- unset($seksjons_nr);
- }
-
- $links = $this->menu->links('gab');
-
- $gab_list =
$this->bo->read($location_code,$gaards_nr,$bruksnr,$feste_nr,$seksjons_nr,$address);
-
- if($this->acl_read)
- {
- $text_view = lang('view');
- $lang_view_statustext = lang('view gab
detail');
- }
-
- $config =
CreateObject('phpgwapi.config',$this->currentapp);
-
- $config->read_repository();
- $link_to_map = $config->config_data['map_url'];
- if($link_to_map)
- {
- $text_map=lang('Map');
- $lang_map_statustext = lang('View map');
- }
- $link_to_gab = $config->config_data['gab_url'];
- if($link_to_gab)
- {
- $text_gab=lang('GAB');
- $lang_gab_statustext = lang('View gab-info');
- }
-
- while (is_array($gab_list) && list(,$gab) =
each($gab_list))
- {
-
- $value_gaards_nr =
substr($gab['gab_id'],4,5);
- $value_bruks_nr =
substr($gab['gab_id'],9,4);
- $value_feste_nr =
substr($gab['gab_id'],13,4);
- $value_seksjons_nr =
substr($gab['gab_id'],17,3);
-
- $content[] = array
- (
- 'owner' =>
lang($gab['owner']),
- 'hits' =>
$gab['hits'],
- 'address' =>
$gab['address'],
- 'gaards_nr' =>
$value_gaards_nr,
- 'bruks_nr' =>
$value_bruks_nr,
- 'feste_nr' =>
$value_feste_nr,
- 'seksjons_nr' =>
$value_seksjons_nr,
- 'location_code' =>
$gab['location_code'],
- 'link_view' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.list_detail&gab_id='
. $gab['gab_id']),
- 'lang_view_statustext' =>
$lang_view_statustext,
- 'text_view' =>
$text_view,
- 'link_map' =>
$link_to_map . '?maptype=Eiendomskart&gnr=' . (int)$value_gaards_nr . '&bnr=' .
(int)$value_bruks_nr . '&fnr=' . (int)$value_feste_nr,
- 'lang_map_statustext' =>
$lang_map_statustext,
- 'text_map' =>
$text_map,
- 'link_gab' =>
$link_to_gab . '?type=eiendom&Gnr=' . (int)$value_gaards_nr . '&Bnr=' .
(int)$value_bruks_nr . '&Fnr=' . (int)$value_feste_nr . '&Snr=' .
(int)$value_seksjons_nr,
- 'lang_gab_statustext' =>
$lang_gab_statustext,
- 'text_gab' =>
$text_gab
- );
- }
-
-
- $table_header[] = array
- (
- 'sort_gab_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'gab_id',
-
'order' => $this->order,
-
'extra' => array('menuaction'=> $this->currentapp.'.uigab.index',
-
'cat_id' =>$this->cat_id,
-
'district_id' => $this->district_id,
-
'filter' =>$this->filter,
-
'allrows' => $this->allrows,
-
'query' =>$this->query,
-
'location_code' =>$location_code,
-
'gaards_nr' =>$gaards_nr,
-
'bruksnr' =>$bruksnr,
-
'feste_nr' =>$feste_nr,
-
'seksjons_nr' =>$seksjons_nr,
-
'address' =>$address)
-
)),
- 'lang_gab' => lang('gab'),
- 'sort_hits' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'hits',
-
'order' => $this->order,
-
'extra' => array('menuaction'=> $this->currentapp.'.uigab.index',
-
'cat_id' =>$this->cat_id,
-
'district_id' => $this->district_id,
-
'filter' =>$this->filter,
-
'allrows' => $this->allrows,
-
'query' =>$this->query,
-
'location_code' =>$location_code,
-
'gaards_nr' =>$gaards_nr,
-
'bruksnr' =>$bruksnr,
-
'feste_nr' =>$feste_nr,
-
'seksjons_nr' =>$seksjons_nr,
-
'address' =>$address)
-
)),
- 'sort_location_code' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'location_code',
-
'order' => $this->order,
-
'extra' => array('menuaction'=> $this->currentapp.'.uigab.index',
-
'cat_id' =>$this->cat_id,
-
'district_id' => $this->district_id,
-
'filter' =>$this->filter,
-
'allrows' => $this->allrows,
-
'query' =>$this->query,
-
'location_code' =>$location_code,
-
'gaards_nr' =>$gaards_nr,
-
'bruksnr' =>$bruksnr,
-
'feste_nr' =>$feste_nr,
-
'seksjons_nr' =>$seksjons_nr,
-
'address' =>$address)
-
)),
- 'lang_owner' => lang('owner'),
- 'lang_hits' =>
lang('number'),
- 'lang_address' => lang('Address'),
- 'lang_gaards_nr' => lang('gaards nr'),
- 'lang_bruksnr' => lang('bruks nr'),
- 'lang_feste_nr' => lang('Feste nr'),
- 'lang_seksjons_nr' => lang('Seksjons nr'),
- 'lang_location_code'=> lang('Location'),
- 'lang_view' => lang('view'),
- 'lang_map' => $text_map
- );
-
- $search_field_header[] = array
- (
- 'lang_property' => lang('Property ID'),
- 'lang_gaards_nr' => lang('gaards nr'),
- 'lang_bruksnr' => lang('bruks nr'),
- 'lang_feste_nr' => lang('Feste nr'),
- 'lang_seksjons_nr' => lang('Seksjons nr')
- );
-
- if($this->acl_add)
- {
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
gab'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&from=index')
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uigab.index',
- 'sort' =>$this->sort,
- 'order' =>$this->order,
- 'cat_id' =>$this->cat_id,
- 'filter' =>$this->filter,
- 'location_code' =>$location_code,
- 'gaards_nr' =>$gaards_nr,
- 'bruksnr' =>$bruksnr,
- 'feste_nr' =>$feste_nr,
- 'seksjons_nr' =>$seksjons_nr,
- 'address' =>$address
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $data = array
- (
- 'search_field_header' =>
$search_field_header,
- 'links' =>
$links,
- 'allrows' =>
$this->allrows,
- 'allow_allrows' => true,
- 'start_record' =>
$this->start,
- 'record_limit' =>
$record_limit,
- 'num_records' =>
count($gab_list),
- 'all_records' =>
$this->bo->total_records,
- 'link_url' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path' =>
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'select_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'address' =>
$address,
- 'location_code' =>
$location_code,
- 'gaards_nr' =>
$gaards_nr,
- 'bruksnr' =>
$bruksnr,
- 'feste_nr' =>
$feste_nr,
- 'seksjons_nr' =>
$seksjons_nr,
- 'lang_search_location_statustext' =>
lang('search by location_code. To show all entries, empty all fields and press
the SUBMIT button again'),
- 'lang_search_gaard_statustext' =>
lang('search by gaards nr. To show all entries, empty all fields and press the
SUBMIT button again'),
- 'lang_search_bruk_statustext' =>
lang('search by bruk. To show all entries, empty all fields and press the
SUBMIT button again'),
- 'lang_search_feste_statustext' =>
lang('search by feste. To show all entries, empty all fields and press the
SUBMIT button again'),
- 'lang_search_seksjon_statustext' =>
lang('search by seksjon. To show all entries, empty all fields and press the
SUBMIT button again'),
- 'lang_searchbutton_statustext' =>
lang('Submit the search string'),
- 'lang_reset_query_statustext' =>
lang('check to reset the query'),
- 'lang_search' =>
lang('search'),
- 'table_header_gab' =>
$table_header,
- 'values_gab' =>
$content,
- 'table_add' =>
$table_add
- );
-
- $appname = lang('gab');
- $function_msg = lang('list gab');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_gab' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function list_detail()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('gab','values','table_header',
-
'menu',
-
'nextmatchs'));
-
- $gab_id =
get_var('gab_id',array('POST','GET'));
-
- $links = $this->menu->links('gab');
-
- $gab_list = $this->bo->read_detail($gab_id);
-
- $uicols = $this->bo->uicols;
-
- $j=0;
- while (is_array($gab_list) && list(,$gab_entry) =
each($gab_list))
- {
- for ($k=0;$k<count($uicols['name']);$k++)
- {
- if($uicols['input_type'][$k]!='hidden')
- {
-
$content[$j]['row'][$k]['value'] =
$gab_entry[$uicols['name'][$k]];
- $content[$j]['row'][$k]['name']
= $uicols['name'][$k];
- }
- }
-
- if(!$lookup)
- {
- if($this->acl_read)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('view the gab');
- $content[$j]['row'][$k]['text']
= lang('view');
- $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.view&gab_id='
. $gab_entry['gab_id'] . '&location_code=' . $gab_entry['location_code']);
- $k++;
- }
-
- if($this->acl_edit)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('edit the gab');
- $content[$j]['row'][$k]['text']
= lang('edit');
- $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&gab_id='
. $gab_entry['gab_id'] . '&location_code=' . $gab_entry['location_code'] .
'&from=list_detail');
- $k++;
- }
-
- if($this->acl_delete)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('delete the
gab');
- $content[$j]['row'][$k]['text']
= lang('delete');
- $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.delete&gab_id='
. $gab_entry['gab_id'] . '&location_code=' . $gab_entry['location_code']);
- $k++;
- }
- }
-
- $j++;
- }
-
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['name'][$i]=='loc1')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'location_code',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uigab.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='gab_id')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'gab_id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uigab.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='address')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'address',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uigab.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- }
- }
-
- if(!$lookup)
- {
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
- }
- else
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header'] =
lang('select');
- }
-
-//_debug_array($content);
- if($this->acl_add)
- {
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
gab'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&from=list_detail&gab_id='
. $gab_id . '&new=true')
-
- );
- }
-
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('done'),
- 'lang_done_statustext' => lang('back to list'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.index')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uigab.list_detail',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'gab_id'
=>$gab_id
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $data = array
- (
- 'gaards_nr'
=> substr($gab_id,4,5),
- 'bruks_nr'
=> substr($gab_id,9,4),
- 'feste_nr'
=> substr($gab_id,13,4),
- 'seksjons_nr'
=> substr($gab_id,17,3),
-
- 'value_owner'
=> lang($gab_list[0]['owner']),
- 'lang_owner'
=> lang('owner'),
- 'lang_gaards_nr'
=> lang('gaards nr'),
- 'lang_bruksnr'
=> lang('bruks nr'),
- 'lang_feste_nr'
=> lang('Feste nr'),
- 'lang_seksjons_nr'
=> lang('Seksjons nr'),
-
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($gab_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add,
- 'table_done'
=> $table_done
- );
-
- $appname = lang('gab');
- $function_msg = lang('list gab detail');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_gab_detail' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $from =
get_var('from',array('POST','GET'));
- $new =
get_var('new',array('POST','GET'));
- $gab_id =
get_var('gab_id',array('POST','GET'));
- $location_code =
get_var('location_code',array('POST','GET'));
- $values =
get_var('values',array('POST'));
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('gab'));
-
- if(!$values && $location_code)
- {
- $values['location_data'] =
$this->bolocation->read_single($location_code,$values['extra']);
- }
-
-//_debug_array($values);
-
- if ($values['save'])
- {
-
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$key] =
$_POST[$key];
- }
- }
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
-
- $values['gab_id'] = $gab_id;
-
- $values['location_code'] = $location_code;
-
- if(!$values['location_code'] &&
!$values['location'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
- }
-
- if((count($values['location']) <
$this->gab_insert_level) && !$values['propagate'] && !$values['location_code'])
- {
- $receipt['error'][] =
array('msg'=>lang('Either select propagate - or choose location level %1
!',$this->gab_insert_level));
- }
-
-//_debug_array($values);
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save($values);
- $location_code =
$receipt['location_code'];
- $gab_id =
$receipt['gab_id'];
-//_debug_array($receipt);
- }
- }
-
- if ($gab_id && !$new)
- {
- $values =
$this->bo->read_single($gab_id,$location_code);
- }
- if ($values['location_code'])
- {
- $function_msg = lang('Edit gab');
- $action='edit';
- $lookup_type ='view';
-
- }
- else
- {
- $function_msg = lang('Add gab');
- $action='add';
- $lookup_type ='form';
- }
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
-
- if($values['location_data'])
- {
- $type_id =
count(explode('-',$values['location_code']));
- }
- else
- {
- $type_id = $this->gab_insert_level;
- }
-
$location_data=$this->bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' =>
$type_id,
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
False,
- 'lookup_type' => $lookup_type
- ));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uigab.edit',
- 'gab_id' => $gab_id,
- 'location_code' => $location_code,
- 'from' => $from
- );
-
-
- if($from=='list_detail')
- {
- $gab_done='&gab_id=' . $gab_id;
- }
-
- $kommune_nr = substr($gab_id,0,4);
- if(!$kommune_nr > 0)
- {
- $this->config->read_repository();
- $kommune_nr=
$this->config->config_data['default_municipal'];
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'value_owner'
=> $values['owner'],
- 'lang_owner'
=> lang('owner'),
- 'kommune_nr'
=> $kommune_nr,
- 'gaards_nr'
=> substr($gab_id,4,5),
- 'bruks_nr'
=> substr($gab_id,9,4),
- 'feste_nr'
=> substr($gab_id,13,4),
- 'seksjons_nr'
=> substr($gab_id,17,3),
-
- 'lang_kommune_nr'
=> lang('kommune nr'),
- 'lang_gaards_nr'
=> lang('gaards nr'),
- 'lang_bruksnr'
=> lang('bruks nr'),
- 'lang_feste_nr'
=> lang('Feste nr'),
- 'lang_seksjons_nr'
=> lang('Seksjons nr'),
-
- 'action'
=> $action,
- 'lookup_type'
=> $lookup_type,
- 'location_data'
=> $location_data,
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.'.$from.$gab_done),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
-
- 'lang_propagate'
=> lang('propagate'),
- 'lang_propagate_statustext' =>
lang('check to inherit from this location'),
-
- 'lang_remark_statustext' =>
lang('Enter a remark for this entity'),
- 'lang_remark'
=> lang('remark'),
- 'value_remark'
=> $values['remark'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the gab')
- );
-
- $appname = lang('gab');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
-
- $gab_id = get_var('gab_id',array('POST','GET'));
- $location_code =
get_var('location_code',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uigab.list_detail',
- 'gab_id' => $gab_id
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($gab_id,$location_code);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.delete&gab_id='
. $gab_id . '&location_code=' . $location_code),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('gab');
- $function_msg =
lang('delete gab at:') . ' ' . $location_code;
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $gab_id =
get_var('gab_id',array('POST','GET'));
- $location_code =
get_var('location_code',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('gab'));
-
-//_debug_array($values);
-
-
- if ($gab_id && !$new)
- {
- $values =
$this->bo->read_single($gab_id,$location_code);
- }
-
- $function_msg = lang('View gab');
- $location_type ='view';
-
-
-
$location_data=$this->bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' =>
count(explode('-',$values['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
False,
- 'lookup_type' => 'view'
- ));
-
-
- $data = array
- (
- 'kommune_nr'
=> substr($gab_id,0,4),
- 'gaards_nr'
=> substr($gab_id,4,5),
- 'bruks_nr'
=> substr($gab_id,9,4),
- 'feste_nr'
=> substr($gab_id,13,4),
- 'seksjons_nr'
=> substr($gab_id,17,3),
-
- 'value_owner'
=> lang($values['owner']),
- 'lang_owner'
=> lang('owner'),
-
- 'lang_kommune_nr'
=> lang('kommune nr'),
- 'lang_gaards_nr'
=> lang('gaards nr'),
- 'lang_bruksnr'
=> lang('bruks nr'),
- 'lang_feste_nr'
=> lang('Feste nr'),
- 'lang_seksjons_nr'
=> lang('Seksjons nr'),
-
- 'location_type'
=> $location_type,
- 'location_data'
=> $location_data,
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.list_detail&gab_id='
. $gab_id),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
-
- 'lang_remark'
=> lang('remark'),
- 'value_remark'
=> $values['remark'],
- 'lang_done_statustext' =>
lang('Back to the list'),
-
- 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&from=list_detail&gab_id='
. $gab_id . '&location_code=' . $location_code),
- 'lang_edit_statustext'
=> lang('Edit this entry'),
- 'lang_edit'
=> lang('Edit')
- );
-
- $appname = lang('gab');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 location
+ * @version $Id: class.uigab.inc.php,v 1.13 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uigab
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'list_detail' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uigab()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bo =
CreateObject($this->currentapp.'.bogab',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+ $this->bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $this->config =
CreateObject('phpgwapi.config');
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.location';
+ $this->acl_read =
$this->acl2->check('.location',1);
+ $this->acl_add =
$this->acl2->check('.location',2);
+ $this->acl_edit =
$this->acl2->check('.location',4);
+ $this->acl_delete =
$this->acl2->check('.location',8);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->status_id =
$this->bo->status_id;
+ $this->allrows =
$this->bo->allrows;
+ $this->gab_insert_level =
$this->bo->gab_insert_level;
+
+ $this->menu->sub ='location';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('gab',
+
'menu',
+
'nextmatchs'));
+
+ $address =
get_var('address',array('POST','GET'));
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $gaards_nr =
get_var('gaards_nr',array('POST','GET'));
+ $bruksnr =
get_var('bruksnr',array('POST','GET'));
+ $feste_nr =
get_var('feste_nr',array('POST','GET'));
+ $seksjons_nr =
get_var('seksjons_nr',array('POST','GET'));
+ $reset_query =
get_var('reset_query',array('POST','GET'));
+
+ if($reset_query)
+ {
+ unset($address);
+ unset($location_code);
+ unset($gaards_nr);
+ unset($bruksnr);
+ unset($feste_nr);
+ unset($seksjons_nr);
+ }
+
+ $links = $this->menu->links('gab');
+
+ $gab_list =
$this->bo->read($location_code,$gaards_nr,$bruksnr,$feste_nr,$seksjons_nr,$address);
+
+ if($this->acl_read)
+ {
+ $text_view = lang('view');
+ $lang_view_statustext = lang('view gab
detail');
+ }
+
+ $config =
CreateObject('phpgwapi.config',$this->currentapp);
+
+ $config->read_repository();
+ $link_to_map = $config->config_data['map_url'];
+ if($link_to_map)
+ {
+ $text_map=lang('Map');
+ $lang_map_statustext = lang('View map');
+ }
+ $link_to_gab = $config->config_data['gab_url'];
+ if($link_to_gab)
+ {
+ $text_gab=lang('GAB');
+ $lang_gab_statustext = lang('View gab-info');
+ }
+
+ while (is_array($gab_list) && list(,$gab) =
each($gab_list))
+ {
+
+ $value_gaards_nr =
substr($gab['gab_id'],4,5);
+ $value_bruks_nr =
substr($gab['gab_id'],9,4);
+ $value_feste_nr =
substr($gab['gab_id'],13,4);
+ $value_seksjons_nr =
substr($gab['gab_id'],17,3);
+
+ $content[] = array
+ (
+ 'owner' =>
lang($gab['owner']),
+ 'hits' =>
$gab['hits'],
+ 'address' =>
$gab['address'],
+ 'gaards_nr' =>
$value_gaards_nr,
+ 'bruks_nr' =>
$value_bruks_nr,
+ 'feste_nr' =>
$value_feste_nr,
+ 'seksjons_nr' =>
$value_seksjons_nr,
+ 'location_code' =>
$gab['location_code'],
+ 'link_view' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.list_detail&gab_id='
. $gab['gab_id']),
+ 'lang_view_statustext' =>
$lang_view_statustext,
+ 'text_view' =>
$text_view,
+ 'link_map' =>
$link_to_map . '?maptype=Eiendomskart&gnr=' . (int)$value_gaards_nr . '&bnr=' .
(int)$value_bruks_nr . '&fnr=' . (int)$value_feste_nr,
+ 'lang_map_statustext' =>
$lang_map_statustext,
+ 'text_map' =>
$text_map,
+ 'link_gab' =>
$link_to_gab . '?type=eiendom&Gnr=' . (int)$value_gaards_nr . '&Bnr=' .
(int)$value_bruks_nr . '&Fnr=' . (int)$value_feste_nr . '&Snr=' .
(int)$value_seksjons_nr,
+ 'lang_gab_statustext' =>
$lang_gab_statustext,
+ 'text_gab' =>
$text_gab
+ );
+ }
+
+
+ $table_header[] = array
+ (
+ 'sort_gab_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'gab_id',
+
'order' => $this->order,
+
'extra' => array('menuaction'=> $this->currentapp.'.uigab.index',
+
'cat_id' =>$this->cat_id,
+
'district_id' => $this->district_id,
+
'filter' =>$this->filter,
+
'allrows' => $this->allrows,
+
'query' =>$this->query,
+
'location_code' =>$location_code,
+
'gaards_nr' =>$gaards_nr,
+
'bruksnr' =>$bruksnr,
+
'feste_nr' =>$feste_nr,
+
'seksjons_nr' =>$seksjons_nr,
+
'address' =>$address)
+
)),
+ 'lang_gab' => lang('gab'),
+ 'sort_hits' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'hits',
+
'order' => $this->order,
+
'extra' => array('menuaction'=> $this->currentapp.'.uigab.index',
+
'cat_id' =>$this->cat_id,
+
'district_id' => $this->district_id,
+
'filter' =>$this->filter,
+
'allrows' => $this->allrows,
+
'query' =>$this->query,
+
'location_code' =>$location_code,
+
'gaards_nr' =>$gaards_nr,
+
'bruksnr' =>$bruksnr,
+
'feste_nr' =>$feste_nr,
+
'seksjons_nr' =>$seksjons_nr,
+
'address' =>$address)
+
)),
+ 'sort_location_code' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'location_code',
+
'order' => $this->order,
+
'extra' => array('menuaction'=> $this->currentapp.'.uigab.index',
+
'cat_id' =>$this->cat_id,
+
'district_id' => $this->district_id,
+
'filter' =>$this->filter,
+
'allrows' => $this->allrows,
+
'query' =>$this->query,
+
'location_code' =>$location_code,
+
'gaards_nr' =>$gaards_nr,
+
'bruksnr' =>$bruksnr,
+
'feste_nr' =>$feste_nr,
+
'seksjons_nr' =>$seksjons_nr,
+
'address' =>$address)
+
)),
+ 'lang_owner' => lang('owner'),
+ 'lang_hits' =>
lang('number'),
+ 'lang_address' => lang('Address'),
+ 'lang_gaards_nr' => lang('gaards nr'),
+ 'lang_bruksnr' => lang('bruks nr'),
+ 'lang_feste_nr' => lang('Feste nr'),
+ 'lang_seksjons_nr' => lang('Seksjons nr'),
+ 'lang_location_code'=> lang('Location'),
+ 'lang_view' => lang('view'),
+ 'lang_map' => $text_map
+ );
+
+ $search_field_header[] = array
+ (
+ 'lang_property' => lang('Property ID'),
+ 'lang_gaards_nr' => lang('gaards nr'),
+ 'lang_bruksnr' => lang('bruks nr'),
+ 'lang_feste_nr' => lang('Feste nr'),
+ 'lang_seksjons_nr' => lang('Seksjons nr')
+ );
+
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
gab'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&from=index')
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uigab.index',
+ 'sort' =>$this->sort,
+ 'order' =>$this->order,
+ 'cat_id' =>$this->cat_id,
+ 'filter' =>$this->filter,
+ 'location_code' =>$location_code,
+ 'gaards_nr' =>$gaards_nr,
+ 'bruksnr' =>$bruksnr,
+ 'feste_nr' =>$feste_nr,
+ 'seksjons_nr' =>$seksjons_nr,
+ 'address' =>$address
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $data = array
+ (
+ 'search_field_header' =>
$search_field_header,
+ 'links' =>
$links,
+ 'allrows' =>
$this->allrows,
+ 'allow_allrows' => true,
+ 'start_record' =>
$this->start,
+ 'record_limit' =>
$record_limit,
+ 'num_records' =>
count($gab_list),
+ 'all_records' =>
$this->bo->total_records,
+ 'link_url' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path' =>
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'select_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'address' =>
$address,
+ 'location_code' =>
$location_code,
+ 'gaards_nr' =>
$gaards_nr,
+ 'bruksnr' =>
$bruksnr,
+ 'feste_nr' =>
$feste_nr,
+ 'seksjons_nr' =>
$seksjons_nr,
+ 'lang_search_location_statustext' =>
lang('search by location_code. To show all entries, empty all fields and press
the SUBMIT button again'),
+ 'lang_search_gaard_statustext' =>
lang('search by gaards nr. To show all entries, empty all fields and press the
SUBMIT button again'),
+ 'lang_search_bruk_statustext' =>
lang('search by bruk. To show all entries, empty all fields and press the
SUBMIT button again'),
+ 'lang_search_feste_statustext' =>
lang('search by feste. To show all entries, empty all fields and press the
SUBMIT button again'),
+ 'lang_search_seksjon_statustext' =>
lang('search by seksjon. To show all entries, empty all fields and press the
SUBMIT button again'),
+ 'lang_searchbutton_statustext' =>
lang('Submit the search string'),
+ 'lang_reset_query_statustext' =>
lang('check to reset the query'),
+ 'lang_search' =>
lang('search'),
+ 'table_header_gab' =>
$table_header,
+ 'values_gab' =>
$content,
+ 'table_add' =>
$table_add
+ );
+
+ $appname = lang('gab');
+ $function_msg = lang('list gab');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_gab' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function list_detail()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('gab','values','table_header',
+
'menu',
+
'nextmatchs'));
+
+ $gab_id =
get_var('gab_id',array('POST','GET'));
+
+ $links = $this->menu->links('gab');
+
+ $gab_list = $this->bo->read_detail($gab_id);
+
+ $uicols = $this->bo->uicols;
+
+ $j=0;
+ while (is_array($gab_list) && list(,$gab_entry) =
each($gab_list))
+ {
+ for ($k=0;$k<count($uicols['name']);$k++)
+ {
+ if($uicols['input_type'][$k]!='hidden')
+ {
+
$content[$j]['row'][$k]['value'] =
$gab_entry[$uicols['name'][$k]];
+ $content[$j]['row'][$k]['name']
= $uicols['name'][$k];
+ }
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('view the gab');
+ $content[$j]['row'][$k]['text']
= lang('view');
+ $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.view&gab_id='
. $gab_entry['gab_id'] . '&location_code=' . $gab_entry['location_code']);
+ $k++;
+ }
+
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('edit the gab');
+ $content[$j]['row'][$k]['text']
= lang('edit');
+ $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&gab_id='
. $gab_entry['gab_id'] . '&location_code=' . $gab_entry['location_code'] .
'&from=list_detail');
+ $k++;
+ }
+
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('delete the
gab');
+ $content[$j]['row'][$k]['text']
= lang('delete');
+ $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.delete&gab_id='
. $gab_entry['gab_id'] . '&location_code=' . $gab_entry['location_code']);
+ $k++;
+ }
+ }
+
+ $j++;
+ }
+
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['name'][$i]=='loc1')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'location_code',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uigab.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='gab_id')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'gab_id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uigab.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='address')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'address',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uigab.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ }
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+ }
+ else
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header'] =
lang('select');
+ }
+
+//_debug_array($content);
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
gab'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&from=list_detail&gab_id='
. $gab_id . '&new=true')
+
+ );
+ }
+
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('done'),
+ 'lang_done_statustext' => lang('back to list'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.index')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uigab.list_detail',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'gab_id'
=>$gab_id
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $data = array
+ (
+ 'gaards_nr'
=> substr($gab_id,4,5),
+ 'bruks_nr'
=> substr($gab_id,9,4),
+ 'feste_nr'
=> substr($gab_id,13,4),
+ 'seksjons_nr'
=> substr($gab_id,17,3),
+
+ 'value_owner'
=> lang($gab_list[0]['owner']),
+ 'lang_owner'
=> lang('owner'),
+ 'lang_gaards_nr'
=> lang('gaards nr'),
+ 'lang_bruksnr'
=> lang('bruks nr'),
+ 'lang_feste_nr'
=> lang('Feste nr'),
+ 'lang_seksjons_nr'
=> lang('Seksjons nr'),
+
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($gab_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add,
+ 'table_done'
=> $table_done
+ );
+
+ $appname = lang('gab');
+ $function_msg = lang('list gab detail');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_gab_detail' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $from =
get_var('from',array('POST','GET'));
+ $new =
get_var('new',array('POST','GET'));
+ $gab_id =
get_var('gab_id',array('POST','GET'));
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('gab'));
+
+ if(!$values && $location_code)
+ {
+ $values['location_data'] =
$this->bolocation->read_single($location_code,$values['extra']);
+ }
+
+//_debug_array($values);
+
+ if ($values['save'])
+ {
+
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$key] =
$_POST[$key];
+ }
+ }
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+
+ $values['gab_id'] = $gab_id;
+
+ $values['location_code'] = $location_code;
+
+ if(!$values['location_code'] &&
!$values['location'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
+ }
+
+ if((count($values['location']) <
$this->gab_insert_level) && !$values['propagate'] && !$values['location_code'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Either select propagate - or choose location level %1
!',$this->gab_insert_level));
+ }
+
+//_debug_array($values);
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save($values);
+ $location_code =
$receipt['location_code'];
+ $gab_id =
$receipt['gab_id'];
+//_debug_array($receipt);
+ }
+ }
+
+ if ($gab_id && !$new)
+ {
+ $values =
$this->bo->read_single($gab_id,$location_code);
+ }
+ if ($values['location_code'])
+ {
+ $function_msg = lang('Edit gab');
+ $action='edit';
+ $lookup_type ='view';
+
+ }
+ else
+ {
+ $function_msg = lang('Add gab');
+ $action='add';
+ $lookup_type ='form';
+ }
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+
+ if($values['location_data'])
+ {
+ $type_id =
count(explode('-',$values['location_code']));
+ }
+ else
+ {
+ $type_id = $this->gab_insert_level;
+ }
+
$location_data=$this->bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' =>
$type_id,
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
False,
+ 'lookup_type' => $lookup_type
+ ));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uigab.edit',
+ 'gab_id' => $gab_id,
+ 'location_code' => $location_code,
+ 'from' => $from
+ );
+
+
+ if($from=='list_detail')
+ {
+ $gab_done='&gab_id=' . $gab_id;
+ }
+
+ $kommune_nr = substr($gab_id,0,4);
+ if(!$kommune_nr > 0)
+ {
+ $this->config->read_repository();
+ $kommune_nr=
$this->config->config_data['default_municipal'];
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'value_owner'
=> $values['owner'],
+ 'lang_owner'
=> lang('owner'),
+ 'kommune_nr'
=> $kommune_nr,
+ 'gaards_nr'
=> substr($gab_id,4,5),
+ 'bruks_nr'
=> substr($gab_id,9,4),
+ 'feste_nr'
=> substr($gab_id,13,4),
+ 'seksjons_nr'
=> substr($gab_id,17,3),
+
+ 'lang_kommune_nr'
=> lang('kommune nr'),
+ 'lang_gaards_nr'
=> lang('gaards nr'),
+ 'lang_bruksnr'
=> lang('bruks nr'),
+ 'lang_feste_nr'
=> lang('Feste nr'),
+ 'lang_seksjons_nr'
=> lang('Seksjons nr'),
+
+ 'action'
=> $action,
+ 'lookup_type'
=> $lookup_type,
+ 'location_data'
=> $location_data,
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.'.$from.$gab_done),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+
+ 'lang_propagate'
=> lang('propagate'),
+ 'lang_propagate_statustext' =>
lang('check to inherit from this location'),
+
+ 'lang_remark_statustext' =>
lang('Enter a remark for this entity'),
+ 'lang_remark'
=> lang('remark'),
+ 'value_remark'
=> $values['remark'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the gab')
+ );
+
+ $appname = lang('gab');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ if(!$this->acl_delete)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+
+ $gab_id = get_var('gab_id',array('POST','GET'));
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uigab.list_detail',
+ 'gab_id' => $gab_id
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($gab_id,$location_code);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.delete&gab_id='
. $gab_id . '&location_code=' . $location_code),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('gab');
+ $function_msg =
lang('delete gab at:') . ' ' . $location_code;
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $gab_id =
get_var('gab_id',array('POST','GET'));
+ $location_code =
get_var('location_code',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('gab'));
+
+//_debug_array($values);
+
+
+ if ($gab_id && !$new)
+ {
+ $values =
$this->bo->read_single($gab_id,$location_code);
+ }
+
+ $function_msg = lang('View gab');
+ $location_type ='view';
+
+
+
$location_data=$this->bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' =>
count(explode('-',$values['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
False,
+ 'lookup_type' => 'view'
+ ));
+
+
+ $data = array
+ (
+ 'kommune_nr'
=> substr($gab_id,0,4),
+ 'gaards_nr'
=> substr($gab_id,4,5),
+ 'bruks_nr'
=> substr($gab_id,9,4),
+ 'feste_nr'
=> substr($gab_id,13,4),
+ 'seksjons_nr'
=> substr($gab_id,17,3),
+
+ 'value_owner'
=> lang($values['owner']),
+ 'lang_owner'
=> lang('owner'),
+
+ 'lang_kommune_nr'
=> lang('kommune nr'),
+ 'lang_gaards_nr'
=> lang('gaards nr'),
+ 'lang_bruksnr'
=> lang('bruks nr'),
+ 'lang_feste_nr'
=> lang('Feste nr'),
+ 'lang_seksjons_nr'
=> lang('Seksjons nr'),
+
+ 'location_type'
=> $location_type,
+ 'location_data'
=> $location_data,
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.list_detail&gab_id='
. $gab_id),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+
+ 'lang_remark'
=> lang('remark'),
+ 'value_remark'
=> $values['remark'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+
+ 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uigab.edit&from=list_detail&gab_id='
. $gab_id . '&location_code=' . $location_code),
+ 'lang_edit_statustext'
=> lang('Edit this entry'),
+ 'lang_edit'
=> lang('Edit')
+ );
+
+ $appname = lang('gab');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uiinvestment.inc.php
diff -u property/inc/class.uiinvestment.inc.php:1.9
property/inc/class.uiinvestment.inc.php:1.10
--- property/inc/class.uiinvestment.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uiinvestment.inc.php Fri Feb 3 12:05:49 2006
@@ -1,690 +1,690 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 eco
- * @version $Id: class.uiinvestment.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uiinvestment
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'history' => True,
- 'add' => True,
- 'delete' => True
- );
-
- function uiinvestment()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.boinvestment',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
- $this->bolocation =
CreateObject($this->currentapp.'.bolocation');
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.invoice';
- $this->acl_read =
$this->acl2->check('.invoice',1);
- $this->acl_add =
$this->acl2->check('.invoice',2);
- $this->acl_edit =
$this->acl2->check('.invoice',4);
- $this->acl_delete =
$this->acl2->check('.invoice',8);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->part_of_town_id =
$this->bo->part_of_town_id;
- $this->allrows =
$this->bo->allrows;
- $this->admin_invoice =
$this->acl2->check('.invoice',16);
- $this->menu->sub ='invoice';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' =>
$this->filter,
- 'cat_id' =>
$this->cat_id,
- 'part_of_town_id' =>
$this->part_of_town_id,
- 'this->allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('investment',
-
'menu',
-
'nextmatchs'));
-
- $links = $this->menu->links('investment');
- $preserve =
get_var('preserve',array('POST','GET'));
- $values = get_var('values',array('POST'));
- $date = get_var('date',array('POST'));
-
- if($preserve)
- {
- $this->bo->read_sessiondata();
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort
= $this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->part_of_town_id =
$this->bo->part_of_town_id;
- $this->allrows =
$this->bo->allrows;
- }
-
- if($date)
- {
- $values['date'] = $date;
- }
-
- if($values)
- {
- $receipt=$this->update_investment($values);
- }
-
- $investment_list = $this->bo->read();
-
-//_debug_array($values);
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'Y';
- $dlarr[strpos($dateformat,'m')] = 'm';
- $dlarr[strpos($dateformat,'d')] = 'd';
- ksort($dlarr);
- $dateformat
= (implode($sep,$dlarr));
-
- while (is_array($investment_list) && list(,$investment)
= each($investment_list))
- {
-
- $content[] = array
- (
- 'entity_id'
=> $investment['entity_id'],
- 'investment_id'
=> $investment['investment_id'],
- 'district_id'
=> $investment['district_id'],
- 'date'
=> date($dateformat,strtotime($investment['date'])),
- 'counter'
=> $investment['counter'],
- 'part_of_town'
=> $investment['part_of_town'],
- 'descr'
=> $investment['descr'],
- 'initial_value_ex'
=> $investment['initial_value'],
- 'initial_value'
=> number_format($investment['initial_value'], 0, ',', ''),
- 'value_ex'
=> $investment['value'],
- 'value'
=> number_format($investment['value'], 0, ',', ''),
- 'this_index'
=> $investment['this_index'],
- 'index_count'
=> $investment['index_count'],
- 'entity_name'
=> $investment['entity_name'],
- 'this_write_off'
=> number_format($investment['this_write_off'], 0, ',', ''),
- 'link_history'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.history&entity_id='
. $investment['entity_id'].'&investment_id=' .
$investment['investment_id'].'&entity_type=' . $this->cat_id),
- 'lang_history'
=> lang('History'),
- 'lang_history_statustext' =>
lang('View/Edit the history'),
- 'is_admin'
=> $this->admin_invoice
- );
-
- $sum_initial_value
= $sum_initial_value + $investment['initial_value'];
- $sum_value
= $sum_value + $investment['value'];
-
- }
-
- $table_header[] = array
- (
- 'lang_district' =>
lang('District'),
- 'lang_part_of_town' => lang('Part
of town'),
- 'lang_entity_id' => lang('entity
id'),
- 'lang_investment_id' => lang('investment
id'),
- 'lang_descr' =>
lang('Descr'),
- 'lang_entity_name' => lang('Entity
name'),
- 'lang_initial_value' => lang('Initial
value'),
- 'lang_value' =>
lang('Value'),
- 'lang_last_index' => lang('Last
index'),
- 'lang_write_off' => lang('Write
off'),
- 'lang_date' =>
lang('Date'),
- 'lang_index_count' => lang('Index
count'),
- 'lang_history' =>
lang('History'),
- 'lang_select' =>
lang('Select')
- );
-
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $table_update[] = array
- (
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
-
- 'lang_new_index' =>
lang('New index'),
- 'lang_new_index_statustext' => lang('Enter
a new index'),
- 'lang_date_statustext' => lang('Select
the date for the update'),
- 'lang_update' =>
lang('Update'),
- 'lang_update_statustext' => lang('update
selected investments')
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('Add'),
- 'lang_add_statustext' => lang('add a
investment'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.add')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiinvestment.index',
- 'order' => $this->order,
- 'sort' => $this->sort,
- 'cat_id' =>
$this->cat_id,
- 'part_of_town_id' =>
$this->part_of_town_id,
- 'query' => $this->query,
- 'start' => $this->start,
- 'filter' => $this->filter
- );
-
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
- 'lang_search'
=> lang('Search'),
- 'lang_search_statustext' =>
lang('Search for investment entries'),
-// 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'form_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index'),
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
- 'allow_allrows'
=> true,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($investment_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the investment belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category('select',$this->cat_id),
- 'lang_town_statustext' =>
lang('Select the part of town the investment belongs to. To do not use a part
of town - select NO PART OF TOWN'),
- 'lang_part_of_town'
=> lang('Part of town'),
- 'lang_no_part_of_town' =>
lang('Show all'),
- 'part_of_town_list'
=> $this->bocommon->select_part_of_town('select',$this->part_of_town_id),
- 'select_name_part_of_town' =>
'part_of_town_id',
- 'filter_list'
=> $this->bo->filter('select',$this->filter),
- 'filter_name'
=> 'filter',
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_show_all'
=> lang('Show all'),
-
- 'lang_submit'
=> lang('submit'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'sum_initial_value'
=> number_format($sum_initial_value, 0, ',', ''),
- 'sum_value'
=> number_format($sum_value, 0, ',', ''),
-
- 'table_update'
=> $table_update,
- 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index'),
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('investment');
- $function_msg =
lang('list investment');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function update_investment($values='')
- {
-//_debug_array($values);
-
- $errorcount = 0;
-
- if(!$values['date'])
- {
-
$receipt['error'][$errorcount++]=array('msg'=>lang('Please select a date !'));
- }
- if(!$values['new_index'])
- {
-
$receipt['error'][$errorcount++]=array('msg'=>lang('Please set a new index !'));
- }
- if(!$values['update'])
- {
-
$receipt['error'][$errorcount++]=array('msg'=>lang('Nothing to do!'));
- }
-
- if(!$receipt['error'])
- {
- $receipt=$this->bo->update_investment($values);
- }
- return $receipt;
- }
-
- function history()
- {
- $GLOBALS['phpgw']->xslttpl->add_file(array('investment',
-
'menu',
-
'nextmatchs'));
-
- $links = $this->menu->links();
- $values =
get_var('values',array('POST'));
- $date =
get_var('date',array('POST','GET'));
- $entity_type =
get_var('entity_type',array('POST','GET'));
- $entity_id =
get_var('entity_id',array('POST','GET'));
- $investment_id =
get_var('investment_id',array('POST','GET'));
-
- if($date)
- {
- $values['date'] = $date;
- }
-//_debug_array($values);
-
- if($values)
- {
- $receipt= $this->update_investment($values);
- }
-
- $investment_list =
$this->bo->read_single($entity_id,$investment_id);
-//_debug_array($investment_list);
-
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'Y';
- $dlarr[strpos($dateformat,'m')] = 'm';
- $dlarr[strpos($dateformat,'d')] = 'd';
- ksort($dlarr);
- $dateformat
= (implode($sep,$dlarr));
-
- while (is_array($investment_list) && list(,$investment)
= each($investment_list))
- {
-
- $content[] = array
- (
- 'date'
=> @date($dateformat,strtotime($investment['date'])),
- 'initial_value_ex'
=> $investment['initial_value'],
- 'initial_value'
=> number_format($investment['initial_value'], 0, ',', ''),
- 'value_ex'
=> $investment['value'],
- 'value'
=> number_format($investment['value'], 0, ',', ''),
- 'this_index'
=> $investment['this_index'],
- 'current_index'
=> $investment['current_index'],
- 'index_count'
=> $investment['index_count'],
- 'this_write_off'
=> number_format($investment['this_write_off'], 0, ',', ''),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.delete&entity_id='
. $entity_id.'&investment_id=' . $investment_id.'&index_count=' .
$investment['index_count'].'&entity_type='.$entity_type),
- 'lang_delete'
=> lang('Delete'),
- 'lang_delete_statustext' =>
lang('Delete last entry'),
- 'is_admin'
=> $this->admin_invoice
- );
-
- }
-
-//_debug_array($content);
- $table_header[] = array
- (
- 'lang_initial_value' => lang('Initial
value'),
- 'lang_value' =>
lang('Value'),
- 'lang_last_index' => lang('Last
index'),
- 'lang_write_off' => lang('Write
off'),
- 'lang_date' =>
lang('Date'),
- 'lang_index_count' => lang('Index
count'),
- 'lang_delete' =>
lang('Delete')
- );
-
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $table_update[] = array
- (
- 'lang_new_index' =>
lang('New index'),
- 'lang_new_index_statustext' => lang('Enter
a new index'),
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
-
- 'lang_date_statustext' => lang('Select
the date for the update'),
- 'lang_update' =>
lang('Update'),
- 'lang_update_statustext' => lang('update
selected investments')
- );
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('done'),
- 'lang_done_statustext' => lang('Back to
investment list '),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index&preserve=1')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiinvestment.index',
- 'order' => $this->order,
- 'sort' => $this->sort,
- 'cat_id' =>
$this->cat_id,
- 'part_of_town_id' =>
$this->part_of_town_id,
- 'sub' => $this->sub,
- 'query' => $this->query,
- 'start' => $this->start,
- 'filter' =>
$this->filter,
- 'entity_type' => $entity_type
- );
-
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'entity_id'
=> $entity_id,
- 'lang_entity_id'
=> lang('Entity Id'),
- 'investment_id'
=> $investment_id,
- 'lang_investment_id' =>
lang('Investment Id'),
- 'entity_type'
=> lang($entity_type),
- 'lang_entity_type'
=> lang('Entity Type'),
- 'links'
=> $links,
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'allow_allrows'
=> true,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($investment_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.history&entity_id='
. $entity_id.'&investment_id=' . $investment_id . '&entity_type=' .
$entity_type),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'entity_id'
=> $entity_id,
- 'investment_id'
=> $investment_id,
- 'table_header_history' =>
$table_header,
- 'values_history'
=> $content,
- 'table_update'
=> $table_update,
- 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.history&entity_id='
. $entity_id.'&investment_id=' . $investment_id . '&entity_type=' .
$entity_type),
- 'table_done'
=> $table_done
- );
-
- $appname
= lang('investment');
- $function_msg =
lang('investment history');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('history' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
-// $this->save_sessiondata();
- }
-
-
- function add()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
- $values =
get_var('values',array('POST'));
- $values['date'] =
get_var('date',array('POST'));
-
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
- $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
-
- for ($j=0;$j<count($insert_record_entity);$j++)
- {
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('investment'));
-
- if ($values['save'])
- {
-
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
-
- if(!$values['type'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a type !'));
- }
-
- if(!$values['period'] && !$values['new_period'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a period for write off
!'));
- }
-
- if(!$values['date'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
- }
-
- if(!$values['initial_value'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please set a initial value !'));
- }
-
- if(!$values['location']['loc1'] &&
!$values['extra']['p_num'])
- {
-
$receipt['error'][]=array('msg'=>lang('Pleace select a location - or an entity
!'));
- }
-
-//_debug_array($values['extra']);
- if(!$receipt['error'])
- {
-
$receipt=$this->bo->save_investment($values);
- unset($values);
- }
- else
- {
- if($values['location'])
- {
- $location_code=implode("-",
$values['location']);
- $values['location_data'] =
$this->bolocation->read_single($location_code,$values['extra']);
- }
-
- if($values['extra']['p_num'])
- {
-
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
- }
- }
- }
-
-
$location_data=$this->bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' => -1,
// calculated from location_types
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'lookup_type' => 'form',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('investment'),
- 'entity_data' => $values['p']
- ));
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiinvestment.add'
- );
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'location_data'
=> $location_data,
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
-
- 'lang_date_statustext' =>
lang('insert the date for the initial value'),
-
- 'lang_date'
=> lang('Date'),
- 'lang_location'
=> lang('Location'),
- 'lang_select_location_statustext'=>
lang('select either a location or an entity'),
-
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index&preserve=1'),
-
- 'lang_write_off_period' =>
lang('Write off period'),
- 'lang_new'
=> lang('New'),
- 'lang_select'
=> lang('Select'),
- 'cat_list'
=> $this->bo->write_off_period_list($values['period']),
- 'lang_descr'
=> lang('Description'),
- 'lang_type'
=> lang('Type'),
- 'lang_amount'
=> lang('Amount'),
- 'lang_value_statustext' =>
lang('insert the value at the start-date as a positive amount'),
- 'lang_new_period_statustext' => lang('Enter
a new writeoff period if it is NOT in the list'),
- 'filter_list'
=> $this->bo->filter('select',$values['type']),
- 'filter_name'
=> 'values[type]',
- 'lang_filter_statustext' =>
lang('Select the type of value'),
- 'lang_show_all'
=> lang('Select'),
-
- 'lang_name'
=> lang('name'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_new_period'
=> $values['new_period'],
- 'value_inital_value' =>
$values['initial_value'],
- 'value_date'
=> $values['date'],
- 'value_descr'
=> $values['descr'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the investment'),
- 'lang_no_cat'
=> lang('Select'),
- 'lang_cat_statustext' =>
lang('Select the category the investment belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[period]',
- 'investment_type_id' =>
$investment['investment_type_id']
- );
-
- $appname
= lang('investment');
- $function_msg =
lang('add investment');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add'
=> $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- $entity_id = get_var('entity_id',array('POST','GET'));
- $investment_id =
get_var('investment_id',array('POST','GET'));
- $index_count =
get_var('index_count',array('POST','GET'));
- $entity_type =
get_var('entity_type',array('POST','GET'));
-
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiinvestment.history',
- 'entity_id' => $entity_id,
- 'investment_id' => $investment_id,
- 'index_count' => $index_count,
- 'entity_type' => $entity_type
- );
-
- if (get_var('confirm',array('POST')))
- {
-
-
$this->bo->delete($entity_id,$investment_id,$index_count);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.delete&entity_id='
. $entity_id.'&investment_id=' . $investment_id.'&index_count=' .
$index_count.'&entity_type='.$entity_type),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('investment');
- $function_msg =
lang('delete investment history element');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 eco
+ * @version $Id: class.uiinvestment.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uiinvestment
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'history' => True,
+ 'add' => True,
+ 'delete' => True
+ );
+
+ function uiinvestment()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.boinvestment',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+ $this->bolocation =
CreateObject($this->currentapp.'.bolocation');
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.invoice';
+ $this->acl_read =
$this->acl2->check('.invoice',1);
+ $this->acl_add =
$this->acl2->check('.invoice',2);
+ $this->acl_edit =
$this->acl2->check('.invoice',4);
+ $this->acl_delete =
$this->acl2->check('.invoice',8);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->part_of_town_id =
$this->bo->part_of_town_id;
+ $this->allrows =
$this->bo->allrows;
+ $this->admin_invoice =
$this->acl2->check('.invoice',16);
+ $this->menu->sub ='invoice';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' =>
$this->filter,
+ 'cat_id' =>
$this->cat_id,
+ 'part_of_town_id' =>
$this->part_of_town_id,
+ 'this->allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('investment',
+
'menu',
+
'nextmatchs'));
+
+ $links = $this->menu->links('investment');
+ $preserve =
get_var('preserve',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+ $date = get_var('date',array('POST'));
+
+ if($preserve)
+ {
+ $this->bo->read_sessiondata();
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort
= $this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->part_of_town_id =
$this->bo->part_of_town_id;
+ $this->allrows =
$this->bo->allrows;
+ }
+
+ if($date)
+ {
+ $values['date'] = $date;
+ }
+
+ if($values)
+ {
+ $receipt=$this->update_investment($values);
+ }
+
+ $investment_list = $this->bo->read();
+
+//_debug_array($values);
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'Y';
+ $dlarr[strpos($dateformat,'m')] = 'm';
+ $dlarr[strpos($dateformat,'d')] = 'd';
+ ksort($dlarr);
+ $dateformat
= (implode($sep,$dlarr));
+
+ while (is_array($investment_list) && list(,$investment)
= each($investment_list))
+ {
+
+ $content[] = array
+ (
+ 'entity_id'
=> $investment['entity_id'],
+ 'investment_id'
=> $investment['investment_id'],
+ 'district_id'
=> $investment['district_id'],
+ 'date'
=> date($dateformat,strtotime($investment['date'])),
+ 'counter'
=> $investment['counter'],
+ 'part_of_town'
=> $investment['part_of_town'],
+ 'descr'
=> $investment['descr'],
+ 'initial_value_ex'
=> $investment['initial_value'],
+ 'initial_value'
=> number_format($investment['initial_value'], 0, ',', ''),
+ 'value_ex'
=> $investment['value'],
+ 'value'
=> number_format($investment['value'], 0, ',', ''),
+ 'this_index'
=> $investment['this_index'],
+ 'index_count'
=> $investment['index_count'],
+ 'entity_name'
=> $investment['entity_name'],
+ 'this_write_off'
=> number_format($investment['this_write_off'], 0, ',', ''),
+ 'link_history'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.history&entity_id='
. $investment['entity_id'].'&investment_id=' .
$investment['investment_id'].'&entity_type=' . $this->cat_id),
+ 'lang_history'
=> lang('History'),
+ 'lang_history_statustext' =>
lang('View/Edit the history'),
+ 'is_admin'
=> $this->admin_invoice
+ );
+
+ $sum_initial_value
= $sum_initial_value + $investment['initial_value'];
+ $sum_value
= $sum_value + $investment['value'];
+
+ }
+
+ $table_header[] = array
+ (
+ 'lang_district' =>
lang('District'),
+ 'lang_part_of_town' => lang('Part
of town'),
+ 'lang_entity_id' => lang('entity
id'),
+ 'lang_investment_id' => lang('investment
id'),
+ 'lang_descr' =>
lang('Descr'),
+ 'lang_entity_name' => lang('Entity
name'),
+ 'lang_initial_value' => lang('Initial
value'),
+ 'lang_value' =>
lang('Value'),
+ 'lang_last_index' => lang('Last
index'),
+ 'lang_write_off' => lang('Write
off'),
+ 'lang_date' =>
lang('Date'),
+ 'lang_index_count' => lang('Index
count'),
+ 'lang_history' =>
lang('History'),
+ 'lang_select' =>
lang('Select')
+ );
+
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $table_update[] = array
+ (
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+
+ 'lang_new_index' =>
lang('New index'),
+ 'lang_new_index_statustext' => lang('Enter
a new index'),
+ 'lang_date_statustext' => lang('Select
the date for the update'),
+ 'lang_update' =>
lang('Update'),
+ 'lang_update_statustext' => lang('update
selected investments')
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('Add'),
+ 'lang_add_statustext' => lang('add a
investment'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.add')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiinvestment.index',
+ 'order' => $this->order,
+ 'sort' => $this->sort,
+ 'cat_id' =>
$this->cat_id,
+ 'part_of_town_id' =>
$this->part_of_town_id,
+ 'query' => $this->query,
+ 'start' => $this->start,
+ 'filter' => $this->filter
+ );
+
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'lang_search'
=> lang('Search'),
+ 'lang_search_statustext' =>
lang('Search for investment entries'),
+// 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'form_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index'),
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+ 'allow_allrows'
=> true,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($investment_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the investment belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category('select',$this->cat_id),
+ 'lang_town_statustext' =>
lang('Select the part of town the investment belongs to. To do not use a part
of town - select NO PART OF TOWN'),
+ 'lang_part_of_town'
=> lang('Part of town'),
+ 'lang_no_part_of_town' =>
lang('Show all'),
+ 'part_of_town_list'
=> $this->bocommon->select_part_of_town('select',$this->part_of_town_id),
+ 'select_name_part_of_town' =>
'part_of_town_id',
+ 'filter_list'
=> $this->bo->filter('select',$this->filter),
+ 'filter_name'
=> 'filter',
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_show_all'
=> lang('Show all'),
+
+ 'lang_submit'
=> lang('submit'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'sum_initial_value'
=> number_format($sum_initial_value, 0, ',', ''),
+ 'sum_value'
=> number_format($sum_value, 0, ',', ''),
+
+ 'table_update'
=> $table_update,
+ 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index'),
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('investment');
+ $function_msg =
lang('list investment');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function update_investment($values='')
+ {
+//_debug_array($values);
+
+ $errorcount = 0;
+
+ if(!$values['date'])
+ {
+
$receipt['error'][$errorcount++]=array('msg'=>lang('Please select a date !'));
+ }
+ if(!$values['new_index'])
+ {
+
$receipt['error'][$errorcount++]=array('msg'=>lang('Please set a new index !'));
+ }
+ if(!$values['update'])
+ {
+
$receipt['error'][$errorcount++]=array('msg'=>lang('Nothing to do!'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt=$this->bo->update_investment($values);
+ }
+ return $receipt;
+ }
+
+ function history()
+ {
+ $GLOBALS['phpgw']->xslttpl->add_file(array('investment',
+
'menu',
+
'nextmatchs'));
+
+ $links = $this->menu->links();
+ $values =
get_var('values',array('POST'));
+ $date =
get_var('date',array('POST','GET'));
+ $entity_type =
get_var('entity_type',array('POST','GET'));
+ $entity_id =
get_var('entity_id',array('POST','GET'));
+ $investment_id =
get_var('investment_id',array('POST','GET'));
+
+ if($date)
+ {
+ $values['date'] = $date;
+ }
+//_debug_array($values);
+
+ if($values)
+ {
+ $receipt= $this->update_investment($values);
+ }
+
+ $investment_list =
$this->bo->read_single($entity_id,$investment_id);
+//_debug_array($investment_list);
+
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'Y';
+ $dlarr[strpos($dateformat,'m')] = 'm';
+ $dlarr[strpos($dateformat,'d')] = 'd';
+ ksort($dlarr);
+ $dateformat
= (implode($sep,$dlarr));
+
+ while (is_array($investment_list) && list(,$investment)
= each($investment_list))
+ {
+
+ $content[] = array
+ (
+ 'date'
=> @date($dateformat,strtotime($investment['date'])),
+ 'initial_value_ex'
=> $investment['initial_value'],
+ 'initial_value'
=> number_format($investment['initial_value'], 0, ',', ''),
+ 'value_ex'
=> $investment['value'],
+ 'value'
=> number_format($investment['value'], 0, ',', ''),
+ 'this_index'
=> $investment['this_index'],
+ 'current_index'
=> $investment['current_index'],
+ 'index_count'
=> $investment['index_count'],
+ 'this_write_off'
=> number_format($investment['this_write_off'], 0, ',', ''),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.delete&entity_id='
. $entity_id.'&investment_id=' . $investment_id.'&index_count=' .
$investment['index_count'].'&entity_type='.$entity_type),
+ 'lang_delete'
=> lang('Delete'),
+ 'lang_delete_statustext' =>
lang('Delete last entry'),
+ 'is_admin'
=> $this->admin_invoice
+ );
+
+ }
+
+//_debug_array($content);
+ $table_header[] = array
+ (
+ 'lang_initial_value' => lang('Initial
value'),
+ 'lang_value' =>
lang('Value'),
+ 'lang_last_index' => lang('Last
index'),
+ 'lang_write_off' => lang('Write
off'),
+ 'lang_date' =>
lang('Date'),
+ 'lang_index_count' => lang('Index
count'),
+ 'lang_delete' =>
lang('Delete')
+ );
+
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $table_update[] = array
+ (
+ 'lang_new_index' =>
lang('New index'),
+ 'lang_new_index_statustext' => lang('Enter
a new index'),
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+
+ 'lang_date_statustext' => lang('Select
the date for the update'),
+ 'lang_update' =>
lang('Update'),
+ 'lang_update_statustext' => lang('update
selected investments')
+ );
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('done'),
+ 'lang_done_statustext' => lang('Back to
investment list '),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index&preserve=1')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiinvestment.index',
+ 'order' => $this->order,
+ 'sort' => $this->sort,
+ 'cat_id' =>
$this->cat_id,
+ 'part_of_town_id' =>
$this->part_of_town_id,
+ 'sub' => $this->sub,
+ 'query' => $this->query,
+ 'start' => $this->start,
+ 'filter' =>
$this->filter,
+ 'entity_type' => $entity_type
+ );
+
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'entity_id'
=> $entity_id,
+ 'lang_entity_id'
=> lang('Entity Id'),
+ 'investment_id'
=> $investment_id,
+ 'lang_investment_id' =>
lang('Investment Id'),
+ 'entity_type'
=> lang($entity_type),
+ 'lang_entity_type'
=> lang('Entity Type'),
+ 'links'
=> $links,
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'allow_allrows'
=> true,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($investment_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.history&entity_id='
. $entity_id.'&investment_id=' . $investment_id . '&entity_type=' .
$entity_type),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'entity_id'
=> $entity_id,
+ 'investment_id'
=> $investment_id,
+ 'table_header_history' =>
$table_header,
+ 'values_history'
=> $content,
+ 'table_update'
=> $table_update,
+ 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.history&entity_id='
. $entity_id.'&investment_id=' . $investment_id . '&entity_type=' .
$entity_type),
+ 'table_done'
=> $table_done
+ );
+
+ $appname
= lang('investment');
+ $function_msg =
lang('investment history');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('history' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+// $this->save_sessiondata();
+ }
+
+
+ function add()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+ $values =
get_var('values',array('POST'));
+ $values['date'] =
get_var('date',array('POST'));
+
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+ $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
+
+ for ($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('investment'));
+
+ if ($values['save'])
+ {
+
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+
+ if(!$values['type'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a type !'));
+ }
+
+ if(!$values['period'] && !$values['new_period'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a period for write off
!'));
+ }
+
+ if(!$values['date'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
+ }
+
+ if(!$values['initial_value'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please set a initial value !'));
+ }
+
+ if(!$values['location']['loc1'] &&
!$values['extra']['p_num'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Pleace select a location - or an entity
!'));
+ }
+
+//_debug_array($values['extra']);
+ if(!$receipt['error'])
+ {
+
$receipt=$this->bo->save_investment($values);
+ unset($values);
+ }
+ else
+ {
+ if($values['location'])
+ {
+ $location_code=implode("-",
$values['location']);
+ $values['location_data'] =
$this->bolocation->read_single($location_code,$values['extra']);
+ }
+
+ if($values['extra']['p_num'])
+ {
+
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
+ }
+ }
+ }
+
+
$location_data=$this->bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' => -1,
// calculated from location_types
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'lookup_type' => 'form',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('investment'),
+ 'entity_data' => $values['p']
+ ));
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiinvestment.add'
+ );
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'location_data'
=> $location_data,
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+
+ 'lang_date_statustext' =>
lang('insert the date for the initial value'),
+
+ 'lang_date'
=> lang('Date'),
+ 'lang_location'
=> lang('Location'),
+ 'lang_select_location_statustext'=>
lang('select either a location or an entity'),
+
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.index&preserve=1'),
+
+ 'lang_write_off_period' =>
lang('Write off period'),
+ 'lang_new'
=> lang('New'),
+ 'lang_select'
=> lang('Select'),
+ 'cat_list'
=> $this->bo->write_off_period_list($values['period']),
+ 'lang_descr'
=> lang('Description'),
+ 'lang_type'
=> lang('Type'),
+ 'lang_amount'
=> lang('Amount'),
+ 'lang_value_statustext' =>
lang('insert the value at the start-date as a positive amount'),
+ 'lang_new_period_statustext' => lang('Enter
a new writeoff period if it is NOT in the list'),
+ 'filter_list'
=> $this->bo->filter('select',$values['type']),
+ 'filter_name'
=> 'values[type]',
+ 'lang_filter_statustext' =>
lang('Select the type of value'),
+ 'lang_show_all'
=> lang('Select'),
+
+ 'lang_name'
=> lang('name'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_new_period'
=> $values['new_period'],
+ 'value_inital_value' =>
$values['initial_value'],
+ 'value_date'
=> $values['date'],
+ 'value_descr'
=> $values['descr'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the investment'),
+ 'lang_no_cat'
=> lang('Select'),
+ 'lang_cat_statustext' =>
lang('Select the category the investment belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[period]',
+ 'investment_type_id' =>
$investment['investment_type_id']
+ );
+
+ $appname
= lang('investment');
+ $function_msg =
lang('add investment');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add'
=> $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ $entity_id = get_var('entity_id',array('POST','GET'));
+ $investment_id =
get_var('investment_id',array('POST','GET'));
+ $index_count =
get_var('index_count',array('POST','GET'));
+ $entity_type =
get_var('entity_type',array('POST','GET'));
+
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiinvestment.history',
+ 'entity_id' => $entity_id,
+ 'investment_id' => $investment_id,
+ 'index_count' => $index_count,
+ 'entity_type' => $entity_type
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+
+
$this->bo->delete($entity_id,$investment_id,$index_count);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvestment.delete&entity_id='
. $entity_id.'&investment_id=' . $investment_id.'&index_count=' .
$index_count.'&entity_type='.$entity_type),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('investment');
+ $function_msg =
lang('delete investment history element');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uilocation.inc.php
diff -u property/inc/class.uilocation.inc.php:1.17
property/inc/class.uilocation.inc.php:1.18
--- property/inc/class.uilocation.inc.php:1.17 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uilocation.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1513 +1,1513 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 location
- * @version $Id: class.uilocation.inc.php,v 1.17 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uilocation
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $currentapp;
-
- var $public_functions = array
- (
- 'excel' => True,
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'update_cat'=> True,
- 'stop' => True,
- 'summary' => True
- );
-
- function uilocation()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject($this->currentapp.'.bolocation',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
- $this->soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.location';
- $this->acl_read =
$this->acl2->check('.location',1);
- $this->acl_add =
$this->acl2->check('.location',2);
- $this->acl_edit =
$this->acl2->check('.location',4);
- $this->acl_delete =
$this->acl2->check('.location',8);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->part_of_town_id =
$this->bo->part_of_town_id;
- $this->district_id =
$this->bo->district_id;
- $this->status =
$this->bo->status;
- $this->type_id =
$this->bo->type_id;
- $this->allrows =
$this->bo->allrows;
-
- $this->menu->sub ='location';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' =>
$this->filter,
- 'cat_id' =>
$this->cat_id,
- 'part_of_town_id' =>
$this->part_of_town_id,
- 'district_id' => $this->district_id,
- 'status' =>
$this->status,
- 'type_id' =>
$this->type_id,
- 'allrows' =>
$this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function excel()
- {
- $summary =
get_var('summary',array('GET'));
- $type_id =
get_var('type_id',array('GET'));
- $lookup =
get_var('lookup',array('POST','GET'));
- $lookup_name =
get_var('lookup_name',array('POST','GET'));
- $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
-
- if(!$summary)
- {
- $list =
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>True));
- }
- else
- {
- $list= $this->bo->read_summary();
- }
-
- $uicols = $this->bo->uicols;
-
$this->bocommon->excel($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
- }
-
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('location',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $type_id =
get_var('type_id',array('GET'));
- $lookup =
get_var('lookup',array('POST','GET'));
- $lookup_name =
get_var('lookup_name',array('POST','GET'));
- $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
-
- if(!$type_id)
- {
- $type_id=1;
- }
- if($lookup)
- {
- $GLOBALS['phpgw_info']['flags']['noframework']
= True;
- }
- $links = $this->menu->links('location'.$type_id . '_' .
!!$lookup_tenant);
-
-
- $location_list =
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows));
-
- $uicols = $this->bo->uicols;
-//_debug_array($location_list);
-//_debug_array($uicols);
-
- $j=0;
- if (isSet($location_list) AND is_array($location_list))
- {
- foreach($location_list as $location)
- {
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
-
if($uicols['input_type'][$i]!='hidden')
- {
-
-
if($location['query_location'][$uicols['name'][$i]])
- {
-
$content[$j]['row'][$i]['statustext'] = lang('search');
-
$content[$j]['row'][$i]['text'] =
$location[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index&query='
. $location['query_location'][$uicols['name'][$i]] . '&lookup=' . $lookup .
'&type_id=' . $type_id . '&lookup_tenant=' . $lookup_tenant . '&lookup_name=' .
$lookup_name);
- }
- else
- {
-
$content[$j]['row'][$i]['value'] =
$location[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
-
$content[$j]['row'][$i]['lookup'] = $lookup;
- }
- }
-
-
$content[$j]['hidden'][$i]['value'] =
$location[$uicols['name'][$i]];
-
$content[$j]['hidden'][$i]['name'] =
$uicols['name'][$i];
- }
-
- if(!$lookup)
- {
- if($this->acl_read)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('view the
location');
-
$content[$j]['row'][$i]['text'] = lang('view');
-
$content[$j]['row'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.view&location_code='
. $location['location_code'] . '&lookup_tenant=' . $lookup_tenant);
- $i++;
- }
-
- if($this->acl_edit)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('edit the
location');
-
$content[$j]['row'][$i]['text'] = lang('edit');
-
$content[$j]['row'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.edit&location_code='
. $location['location_code'] . '&lookup_tenant=' . $lookup_tenant);
- $i++;
- }
-
- if($this->acl_delete)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('delete the
location');
-
$content[$j]['row'][$i]['text'] =
lang('delete');
-
$content[$j]['row'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.delete&location_code='
. $location['location_code'] . '&type_id=' . $type_id . '&lookup_tenant=' .
$lookup_tenant);
- }
- }
- $j++;
- }
- }
-//_debug_array($content);
-
- $uicols_count = count($uicols['descr']);
- for ($i=0;$i<$uicols_count;$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['name'][$i]=='loc1')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'fm_location1.loc1',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilocation.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'district_id'
=>$this->district_id,
-
'part_of_town_id'
=>$this->part_of_town_id,
-
'lookup'
=>$lookup,
-
'lookup_tenant'
=>$lookup_tenant,
-
'lookup_name'
=>$lookup_name,
-
'cat_id'
=>$this->cat_id,
-
'status'
=> $this->status)
-
));
- }
- if($uicols['name'][$i]=='street_name')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'street_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilocation.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'district_id'
=>$this->district_id,
-
'part_of_town_id'
=>$this->part_of_town_id,
-
'lookup'
=>$lookup,
-
'lookup_tenant'
=>$lookup_tenant,
-
'lookup_name'
=>$lookup_name,
-
'cat_id'
=>$this->cat_id,
-
'status'
=> $this->status)
-
));
- }
- }
- }
-
- if(!$lookup)
- {
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
- }
- else
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('select');
- }
-
- if($this->acl_add)
- {
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
location'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.edit&type_id='
. $type_id)
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uilocation.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'district_id'
=>$this->district_id,
- 'part_of_town_id'
=>$this->part_of_town_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'lookup'
=>$lookup,
- 'lookup_tenant'
=>$lookup_tenant,
- 'lookup_name'
=>$lookup_name,
- 'type_id'
=>$type_id,
- 'status'
=> $this->status
- );
-
- $input_name =
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp);
-
- for ($k=0;$k<count($input_name);$k++)
- {
- $function_exchange_values .=
"opener.document.form." . $input_name[$k] . ".value = '';" ."\r\n";
- }
-
- for ($i=0;$i<count($uicols['name']);$i++)
- {
- if($uicols['exchange'][$i])
- {
- $function_exchange_values .=
'opener.document.form.' . $uicols['name'][$i] .'.value = thisform.elements[' .
$i . '].value;' ."\r\n";
- }
- }
-
- $function_exchange_values .='window.close()';
-
-//_debug_array($input_name);
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uilocation.excel',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'district_id'
=>$this->district_id,
- 'part_of_town_id'
=>$this->part_of_town_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'lookup'
=>$lookup,
- 'lookup_tenant'
=>$lookup_tenant,
- 'lookup_name'
=>$lookup_name,
- 'type_id'
=>$type_id,
- 'status'
=> $this->status,
- 'start' =>$this->start
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
-
- $data = array
- (
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
-
- 'exchange_values'
=> 'Exchange_values(this.form);',
- 'function_exchange_values' =>
$function_exchange_values,
- 'lang_select'
=> lang('select'),
- 'lookup'
=> $lookup,
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
- 'lang_property_name' =>
lang('Property name'),
- 'links'
=> $links,
- 'allow_allrows'
=> True,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($location_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-
- 'lang_status_statustext' =>
lang('Select the status. To do not use a status select NO STATUS'),
- 'status_name'
=> 'status',
- 'lang_no_status'
=> lang('No status'),
- 'status_list'
=> $this->bo->select_status_list('filter',$this->status),
-
- 'part_of_town_list'
=> $this->bocommon->select_part_of_town('filter',$this->part_of_town_id),
- 'lang_no_part_of_town'
=> lang('no part of town'),
- 'lang_town_statustext'
=> lang('Select the part of town the selection belongs to. To do not use a part
of town select NO PART OF TOWN'),
- 'select_name_part_of_town'
=> 'part_of_town_id',
-
- 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
- 'select_district_name' =>
'district_id',
-
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the location belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id,$type_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'owner_name'
=> 'filter',
- 'owner_list'
=> $this->bo->get_owner_type_list('filter', $this->filter),
- 'lang_show_all'
=> lang('Show all'),
- 'lang_owner_statustext' =>
lang('Select the owner type. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('location');
-
- if($lookup)
- {
- $lookup_list =
$GLOBALS['phpgw']->session->appsession('lookup_name',$this->currentapp);
- $function_msg
= $lookup_list[$lookup_name];
- }
- else
- {
- if($lookup_tenant)
- {
- $function_msg
= lang('Tenant');
- }
- else
- {
- $function_msg
= $uicols['descr'][($type_id-1)];
- }
- }
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
-
- }
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $get_history =
get_var('get_history',array('POST'));
- $change_type =
get_var('change_type',array('POST'));
- $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
- $location_code =
get_var('location_code',array('POST','GET'));
- $values_attribute =
get_var('values_attribute',array('POST','GET'));
- $location = split('-',$location_code);
-
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
-
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp,'');
-
- if($_POST['save'])
- {
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
$values[$insert_record['location'][$i]]= $_POST[$insert_record['location'][$i]];
- }
-
- for ($i=0; $i<count($insert_record['extra']);
$i++)
- {
- $values[$insert_record['extra'][$i]]=
$_POST[$insert_record['extra'][$i]];
- }
- }
-
- $type_id =
get_var('type_id',array('GET'));
-
- if($location_code)
- {
- $type_id = count($location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('location','attributes_form'));
-
- if (is_array($values) )
- {
- for ($i=1; $i<($type_id+1); $i++)
- {
- if((!$values['loc' . $i] &&
!$location[($i-1)]) || !$values['loc' . $i])
- {
-
-
$receipt['error'][]=array('msg'=>lang('Please select a location %1 ID !',$i));
- $error_id=true;
- }
-
- $values['location_code'][]=
$values['loc' . $i];
-
- if($i<$type_id)
- {
- $location_parent[]=
$values['loc' . ($i)];
- }
- }
-
- $values['location_code']=implode("-",
$values['location_code']);
-
- if($values['location_code'] && !$location_code)
- {
-
if($this->bo->check_location($values['location_code'],$type_id))
- {
-
$receipt['error'][]=array('msg'=>lang('This location is already registered!') .
'[ '.$values['location_code'].' ]');
- $error_location_id=true;
- $error_id=true;
- }
- }
-
- if($location_code)
- {
- $action='edit';
- $values['change_type'] = $change_type;
-
-
- if(!$values['change_type'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select change type'));
- }
- }
- elseif(!$location_code && !$error_id )
- {
- $location_code=$values['location_code'];
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save($values,$values_attribute,$action,$type_id,$location_parent);
- }
- else
- {
- if($location_parent)
- {
-
$location_code_parent=implode("-", $location_parent);
- $values =
$this->bo->read_single($location_code_parent);
- }
- }
- }
-
- if(!$error_id && $location_code)
- {
- $values =
$this->bo->read_single($location_code,array('tenant_id'=>'lookup'));
- $check_history =
$this->bo->check_history($location_code);
- if($get_history)
- {
- $history =
$this->bo->get_history($location_code);
- $uicols = $this->bo->uicols;
-
- $j=0;
- if (isSet($history) AND
is_array($history))
- {
- foreach($history as $entry)
- {
- $k=0;
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
$content[$j]['row'][$k]['value'] =
$entry[$uicols['name'][$i]];
-
$content[$j]['row'][$k]['name'] = $uicols['name'][$i];
-
$content[$j]['row'][$k]['lookup'] = $lookup;
- }
-
-
$content[$j]['hidden'][$k]['value'] =
$entry[$uicols['name'][$i]];
-
$content[$j]['hidden'][$k]['name'] =
$uicols['name'][$i];
- $k++;
- }
- $j++;
- }
- }
-
- $uicols_count =
count($uicols['descr']);
- for ($i=0;$i<$uicols_count;$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
$table_header[$i]['header'] = $uicols['descr'][$i];
-
$table_header[$i]['width'] = '5%';
-
$table_header[$i]['align'] = 'center';
- }
- }
- }
- }
- else
- {
- unset($values['location_code']);
- }
-
- if ($values['cat_id'] > 0)
- {
- $this->cat_id = $values['cat_id'];
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uilocation.edit',
- 'location_code' => $location_code,
- 'type_id' => $type_id,
- 'lookup_tenant' => $lookup_tenant
- );
-
- if($values['location_code'])
- {
- $lookup_type='form';
- }
- else
- {
- $lookup_type='form';
- }
-
- $location_data=$this->bo->initiate_ui_location(array(
- 'values' =>
$values,
- 'type_id' =>
($type_id-1),
- 'no_link' =>
($type_id), // disable lookup links for location type less than type_id
- 'tenant' =>
False,
- 'lookup_type' => $lookup_type
- ));
-
- $location_types = $this->bo->location_types;
- $config = $this->bo->config;
-
- if ($location_code)
- {
- $function_msg = lang('edit');
- }
- else
- {
- $function_msg = lang('add');
- }
-
- $function_msg .= ' '
.$location_types[($type_id-1)]['name'];
-
- $custom_fields =
$this->soadmin_location->read_attrib(array('type_id'=>$type_id,'allrows'=>True));
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
-
- if(!is_array($insert_record))
- {
- $insert_record = array();
- }
-
- $j=0;
- $additional_fields[$j]['input_text'] =
$location_types[($type_id-1)]['name'];
- $additional_fields[$j]['statustext'] =
$location_types[($type_id-1)]['descr'];
- $additional_fields[$j]['datatype'] =
'varchar';
- $additional_fields[$j]['input_name'] = 'loc' .
$type_id;
- $additional_fields[$j]['name'] = 'loc' . $type_id;
- $additional_fields[$j]['value'] =
$values[$additional_fields[$j]['input_name']];
- $additional_fields[$j]['class'] =
'th_text';
- $insert_record['extra'][]
= $additional_fields[$j]['input_name'];
-
- $j++;
- $additional_fields[$j]['input_text'] = lang('name');
- $additional_fields[$j]['statustext'] = lang('enter
the name for this location');
- $additional_fields[$j]['datatype'] =
'varchar';
- $additional_fields[$j]['input_name'] = 'loc' .
$type_id . '_name';
- $additional_fields[$j]['name'] = 'loc' . $type_id .
'_name';
- $additional_fields[$j]['value'] =
$values[$additional_fields[$j]['input_name']];
- $insert_record['extra'][]
= $additional_fields[$j]['input_name'];
- $j++;
-
-
- $contacts =
CreateObject('phpgwapi.contacts');
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $sep = '/';
- $dlarr[strpos($dateformat,'Y')] = 'Y';
- $dlarr[strpos($dateformat,'m')] = 'm';
- $dlarr[strpos($dateformat,'d')] = 'd';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- $input_type_array = array(
- 'R' => 'radio',
- 'CH' => 'checkbox',
- 'LB' => 'listbox'
- );
-
- $vendor = CreateObject($this->currentapp.'.soactor');
- $vendor->role = 'vendor';
-
- $r=0;
- $m=0;
- while (is_array($custom_fields) && list(,$custom) =
each($custom_fields))
- {
- $location_datatype[]= array('input_name'
=> $custom['column_name'],
- 'datatype' =>
$custom['datatype']
- );
-
- $attributes_values[$r]['id'] = $custom['id'];
- $attributes_values[$r]['input_text'] =
$custom['input_text'];
- $attributes_values[$r]['statustext'] =
$custom['statustext'];
- $attributes_values[$r]['datatype']
= $custom['datatype'];
- $attributes_values[$r]['name'] =
$custom['column_name'];
- $attributes_values[$r]['input_name'] =
$custom['column_name'];
- $attributes_values[$r]['value']
= $values[$custom['column_name']];
- if($attributes_values[$r]['datatype']=='D' &&
$attributes_values[$r]['value'])
- {
- $timestamp_date=
mktime(0,0,0,date(m,strtotime($attributes_values[$r]['value'])),date(d,strtotime($attributes_values[$r]['value'])),date(y,strtotime($attributes_values[$r]['value'])));
- $attributes_values[$r]['value'] =
$GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
- }
- if($attributes_values[$r]['datatype']=='AB')
- {
- if($attributes_values[$r]['value'])
- {
- $contact_data =
$contacts->read_single_entry($attributes_values[$r]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-
$attributes_values[$r]['contact_name'] = $contact_data[0]['n_family'] . ', ' .
$contact_data[0]['n_given'];
- }
-
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $attributes_values[$r]['name']);
-
- $functions[$m]['name'] = 'lookup_'.
$attributes_values[$r]['name'] .'()';
- $functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
-
- if($attributes_values[$r]['datatype']=='VENDOR')
- {
- if($attributes_values[$r]['value'])
- {
- $vendor_data =
$vendor->read_single(array('actor_id'=>$attributes_values[$r]['value']));
-
- for
($n=0;$n<count($vendor_data['attributes']);$n++)
- {
-
if($vendor_data['attributes'][$n]['name'] == 'org_name')
- {
-
$attributes_values[$r]['vendor_name']= $vendor_data['attributes'][$n]['value'];
- $n
=count($vendor_data['attributes']);
- }
- }
- }
-
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $attributes_values[$r]['name']);
-
- $lookup_functions[$m]['name'] =
'lookup_'. $attributes_values[$r]['name'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
-
-
- if($attributes_values[$r]['datatype']=='R' ||
$attributes_values[$r]['datatype']=='CH' ||
$attributes_values[$r]['datatype']=='LB')
- {
- $attributes_values[$r]['choice']
=
$this->soadmin_location->read_attrib_choice($type_id,$attributes_values[$r]['id']);
-
$input_type=$input_type_array[$attributes_values[$r]['datatype']];
-
-
if($attributes_values[$r]['datatype']=='CH')
- {
-
$attributes_values[$r]['value']=unserialize($attributes_values[$r]['value']);
-
$attributes_values[$r]['choice'] =
$this->bocommon->select_multi_list_2($attributes_values[$r]['value'],$attributes_values[$r]['choice'],$input_type);
-
- }
- else
- {
- for
($j=0;$j<count($attributes_values[$r]['choice']);$j++)
- {
-
$attributes_values[$r]['choice'][$j]['input_type']=$input_type;
-
if($attributes_values[$r]['choice'][$j]['id']==$attributes_values[$r]['value'])
- {
-
$attributes_values[$r]['choice'][$j]['checked']='checked';
- }
- }
- }
- }
-
- $attributes_values[$r]['datatype_text'] =
$this->bocommon->translate_datatype($attributes_values[$r]['datatype']);
- $attributes_values[$r]['counter'] = $r;
- $attributes_values[$r]['type_id'] =
$type_id;
- $r++;
-
- for ($j=0;$j<count($functions);$j++)
- {
- $lookup_functions .= 'function ' .
$functions[$j]['name'] ."\r\n";
- $lookup_functions .= '{'."\r\n";
- $lookup_functions .=
$functions[$j]['action'] ."\r\n";
- $lookup_functions .= '}'."\r\n";
- }
- }
-
-
$GLOBALS['phpgw']->session->appsession('location_datatype',$this->currentapp,$location_datatype);
-
- $insert_record['extra'][]
= 'cat_id';
-
- $config_count=count($config);
- for ($j=0;$j<$config_count;$j++)
- {
- if($config[$j]['location_type'] == $type_id)
- {
-
-
if($config[$j]['column_name']=='street_id')
- {
- $edit_street=True;
- $insert_record['extra'][]
= 'street_id';
- $insert_record['extra'][]
= 'street_number';
- }
-
-
if($config[$j]['column_name']=='tenant_id')
- {
- $edit_tenant=True;
- $insert_record['extra'][]
= 'tenant_id';
- }
-
-
if($config[$j]['column_name']=='part_of_town_id')
- {
- $edit_part_of_town=True;
- $select_name_part_of_town
= 'part_of_town_id';
- $part_of_town_list
=
$this->bocommon->select_part_of_town('select',$values['part_of_town_id']);
- $lang_town_statustext
= lang('Select the part of town the property belongs to. To do not use
a part of town - select NO PART OF TOWN');
- $insert_record['extra'][]
= 'part_of_town_id';
- }
-
if($config[$j]['column_name']=='owner_id')
- {
- $edit_owner=True;
- $lang_owner
= lang('Owner');
- $owner_list
= $this->bo->get_owner_list('',$values['owner_id']);
- $lang_select_owner
= lang('Select owner');
- $lang_owner_statustext
= lang('Select the owner');
- $insert_record['extra'][]
= 'owner_id';
- }
- }
- }
-
-
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp,$insert_record);
-
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- switch(substr($dateformat,0,1))
- {
- case 'M':
- $dateformat_validate=
"javascript:vDateType='1'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
- $onBlur =
"DateFormat(this,this.value,event,true,'1')";
- break;
- case 'y':
-
$dateformat_validate="javascript:vDateType='2'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
- $onBlur =
"DateFormat(this,this.value,event,true,'2')";
- break;
- case 'D':
-
$dateformat_validate="javascript:vDateType='3'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
- $onBlur =
"DateFormat(this,this.value,event,true,'3')";
- break;
- }
-
- if($receipt)
- {
- $msgbox_data =
$this->bocommon->msgbox_data($receipt);
- }
-
-
- $entities= $this->bo->read_entity_to_link();
-
- if (isset($entities) AND is_array($entities))
- {
- foreach($entities as $entity_entry)
-
- {
- $entities_link[] = array
- (
- 'entity_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.index&entity_id='
. $entity_entry['entity_id'] . '&cat_id=' . $entity_entry['cat_id'] .
'&query=' . $location_code),
- 'lang_entity_statustext'
=> $entity_entry['descr'],
- 'text_entity'
=> $entity_entry['name'],
- );
- }
- }
-
-
- if($location_code)
- {
- $change_type_list =
$this->bo->select_change_type($values['change_type']);
- }
-
- $data = array
- (
- 'lang_change_type'
=> lang('Change type'),
- 'lang_no_change_type' =>
lang('No Change type'),
- 'lang_change_type_statustext' => lang('Type
of changes'),
- 'change_type_list'
=> $change_type_list,
- 'check_history'
=> $check_history,
- 'lang_history'
=> lang('History'),
- 'lang_history_statustext' =>
lang('Fetch the history for this item'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
-
- 'lang_related_info'
=> lang('related info'),
- 'entities_link'
=> $entities_link,
- 'edit_street'
=> $edit_street,
- 'edit_tenant'
=> $edit_tenant,
- 'edit_part_of_town'
=> $edit_part_of_town,
- 'edit_owner'
=> $edit_owner,
- 'select_name_part_of_town' =>
$select_name_part_of_town,
- 'part_of_town_list'
=> $part_of_town_list,
- 'lang_town_statustext' =>
$lang_town_statustext,
- 'lang_part_of_town'
=> lang('Part of town'),
- 'lang_no_part_of_town' =>
lang('No part of town'),
- 'lang_owner'
=> $lang_owner,
- 'owner_list'
=> $owner_list,
- 'lang_select_owner'
=> $lang_select_owner,
- 'lang_owner_statustext' =>
$lang_owner_statustext,
- 'additional_fields'
=> $additional_fields,
- 'attributes_values'
=> $attributes_values,
- 'lookup_functions'
=> $lookup_functions,
- 'lang_none'
=> lang('None'),
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp'
=> $onKeyUp,
- 'onBlur'
=> $onBlur,
- 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
- 'street_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.street'),
- 'lang_street'
=> lang('Street'),
- 'lang_select_street_help' =>
lang('Select the street name'),
- 'lang_street_num_statustext' => lang('Enter
the street number'),
- 'value_street_id'
=> $values['street_id'],
- 'value_street_name'
=> $values['street_name'],
- 'value_street_number' =>
$values['street_number'],
-
- 'tenant_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.tenant'),
- 'lang_tenant'
=> lang('tenant'),
- 'value_tenant_id'
=> $values['tenant_id'],
- 'value_last_name'
=> $values['last_name'],
- 'value_first_name'
=> $values['first_name'],
- 'lang_tenant_statustext' =>
lang('Select a tenant'),
- 'size_last_name'
=> strlen($values['last_name']),
- 'size_first_name'
=> strlen($values['first_name']),
- 'lookup_type'
=> $lookup_type,
- 'location_data'
=> $location_data,
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index&type_id='
. $type_id . '&lookup_tenant=' . $lookup_tenant),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the location'),
- 'lang_category'
=> lang('category'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the location belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list('select',$values['cat_id'],$type_id)
- );
-
- $appname
= lang('location');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function delete()
- {
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
-
- $location_code =
get_var('location_code',array('GET'));
- $type_id =
get_var('type_id',array('GET',POST));
-
-
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uilocation.index',
- 'type_id' =>$type_id
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($location_code);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.delete&location_code='
. $location_code . '&type_id=' . $type_id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('location');
- $function_msg =
lang('delete location');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view()
- {
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $get_history =
get_var('get_history',array('POST'));
- $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
- $location_code =
get_var('location_code',array('POST','GET'));
- $location = split('-',$location_code);
-
- $type_id =
get_var('type_id',array('GET'));
-
- if($location_code)
- {
- $type_id = count($location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('location','attributes_view'));
-
- $values =
$this->bo->read_single($location_code,array('tenant_id'=>'lookup'));
-
- $check_history =
$this->bo->check_history($location_code);
- if($get_history)
- {
- $history =
$this->bo->get_history($location_code);
- $uicols = $this->bo->uicols;
-
- $j=0;
- if (isSet($history) AND is_array($history))
- {
- foreach($history as $entry)
- {
- $k=0;
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
$content[$j]['row'][$k]['value'] =
$entry[$uicols['name'][$i]];
-
$content[$j]['row'][$k]['name'] = $uicols['name'][$i];
-
$content[$j]['row'][$k]['lookup'] = $lookup;
- }
-
-
$content[$j]['hidden'][$k]['value'] =
$entry[$uicols['name'][$i]];
-
$content[$j]['hidden'][$k]['name'] =
$uicols['name'][$i];
- $k++;
- }
- $j++;
- }
- }
-
- $uicols_count = count($uicols['descr']);
- for ($i=0;$i<$uicols_count;$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header']
= $uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- }
- }
- }
-
- $lookup_type='view';
-
- $location_data=$this->bo->initiate_ui_location(array(
- 'values' =>
$values,
- 'type_id' =>
($type_id-1),
- 'lookup_type' => $lookup_type
- ));
-
- $location_types = $this->bo->location_types;
- $config = $this->bo->config;
-
- $function_msg = lang('view');
-
- $function_msg .= ' '
.$location_types[($type_id-1)]['name'];
-
- $custom_fields =
$this->soadmin_location->read_attrib(array('type_id'=>$type_id,'allrows'=>True));
-
- $j=0;
- $additional_fields[$j]['input_text'] =
$location_types[($type_id-1)]['name'];
- $additional_fields[$j]['input_name'] = 'loc' .
$type_id;
- $additional_fields[$j]['datatype'] =
'varchar';
- $additional_fields[$j]['value'] =
$values[$additional_fields[$j]['input_name']];
- $additional_fields[$j]['class'] =
'th_text';
-
- $j++;
- $additional_fields[$j]['input_text'] = lang('name');
- $additional_fields[$j]['input_name'] = 'loc' .
$type_id . '_name';
- $additional_fields[$j]['datatype'] =
'varchar';
- $additional_fields[$j]['value'] =
$values[$additional_fields[$j]['input_name']];
- $j++;
-
-
- $contacts =
CreateObject('phpgwapi.contacts');
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $sep = '/';
- $dlarr[strpos($dateformat,'Y')] = 'Y';
- $dlarr[strpos($dateformat,'m')] = 'm';
- $dlarr[strpos($dateformat,'d')] = 'd';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- $input_type_array = array(
- 'R' => 'radio',
- 'CH' => 'checkbox',
- 'LB' => 'listbox'
- );
-
- $vendor = CreateObject($this->currentapp.'.soactor');
- $vendor->role = 'vendor';
-
- $r=0;
- $m=0;
-
- while (is_array($custom_fields) && list(,$custom) =
each($custom_fields))
- {
- $location_datatype[]= array('input_name'
=> $custom['column_name'],
- 'datatype' =>
$custom['datatype']
- );
-
- $attributes_values[$r]['id'] = $custom['id'];
- $attributes_values[$r]['input_text'] =
$custom['input_text'];
- $attributes_values[$r]['statustext'] =
$custom['statustext'];
- $attributes_values[$r]['datatype']
= $custom['datatype'];
- $attributes_values[$r]['name'] =
$custom['column_name'];
- $attributes_values[$r]['input_name'] =
$custom['column_name'];
- $attributes_values[$r]['value']
= $values[$custom['column_name']];
- if($attributes_values[$r]['datatype']=='D' &&
$attributes_values[$r]['value'])
- {
- $timestamp_date=
mktime(0,0,0,date(m,strtotime($attributes_values[$r]['value'])),date(d,strtotime($attributes_values[$r]['value'])),date(y,strtotime($attributes_values[$r]['value'])));
- $attributes_values[$r]['value'] =
$GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
- }
- if($attributes_values[$r]['datatype']=='AB')
- {
- if($attributes_values[$r]['value'])
- {
- $contact_data =
$contacts->read_single_entry($attributes_values[$r]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
-
$attributes_values[$r]['contact_name'] = $contact_data[0]['n_family'] . ', ' .
$contact_data[0]['n_given'];
- }
-
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $attributes_values[$r]['name']);
-
- $functions[$m]['name'] = 'lookup_'.
$attributes_values[$r]['name'] .'()';
- $functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
-
- if($attributes_values[$r]['datatype']=='VENDOR')
- {
- if($attributes_values[$r]['value'])
- {
- $vendor_data =
$vendor->read_single(array('actor_id'=>$attributes_values[$r]['value']));
-
- for
($n=0;$n<count($vendor_data['attributes']);$n++)
- {
-
if($vendor_data['attributes'][$n]['name'] == 'org_name')
- {
-
$attributes_values[$r]['vendor_name']= $vendor_data['attributes'][$n]['value'];
- $n
=count($vendor_data['attributes']);
- }
- }
- }
-
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $attributes_values[$r]['name']);
-
- $lookup_functions[$m]['name'] =
'lookup_'. $attributes_values[$r]['name'] .'()';
- $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
- $m++;
- }
-
- if($attributes_values[$r]['datatype']=='R' ||
$attributes_values[$r]['datatype']=='CH' ||
$attributes_values[$r]['datatype']=='LB')
- {
- $attributes_values[$r]['choice']
=
$this->soadmin_location->read_attrib_choice($type_id,$attributes_values[$r]['id']);
-
$input_type=$input_type_array[$attributes_values[$r]['datatype']];
-
-
if($attributes_values[$r]['datatype']=='CH')
- {
-
$attributes_values[$r]['value']=unserialize($attributes_values[$r]['value']);
-
$attributes_values[$r]['choice'] =
$this->bocommon->select_multi_list_2($attributes_values[$r]['value'],$attributes_values[$r]['choice'],$input_type);
-
- }
- else
- {
- for
($j=0;$j<count($attributes_values[$r]['choice']);$j++)
- {
-
$attributes_values[$r]['choice'][$j]['input_type']=$input_type;
-
if($attributes_values[$r]['choice'][$j]['id']==$attributes_values[$r]['value'])
- {
-
$attributes_values[$r]['choice'][$j]['checked']='checked';
- }
- }
- }
- }
-
- $attributes_values[$r]['datatype_text'] =
$this->bocommon->translate_datatype($attributes_values[$r]['datatype']);
- $r++;
- }
-
-
-// _debug_array($custom_fields);
-
- for ($j=0;$j<count($config);$j++)
- {
- if($config[$j]['location_type'] == $type_id)
- {
-
-
if($config[$j]['column_name']=='street_id')
- {
- $edit_street=True;
- $insert_record[] =
'street_id';
- }
-
-
if($config[$j]['column_name']=='tenant_id')
- {
- $edit_tenant=True;
- $insert_record[] =
'tenant_id';
- }
-
-
if($config[$j]['column_name']=='part_of_town_id')
- {
- $edit_part_of_town=True;
- $select_name_part_of_town
= 'part_of_town_id';
- $part_of_town_list
=
$this->bocommon->select_part_of_town('select',$values['part_of_town_id']);
- $lang_town_statustext
= lang('Select the part of town the property belongs to. To do not use
a part of town - select NO PART OF TOWN');
- $insert_record[] =
'part_of_town_id';
- }
-
if($config[$j]['column_name']=='owner_id')
- {
- $edit_owner=True;
- $lang_owner
= lang('Owner');
- $owner_list
= $this->bo->get_owner_list('',$values['owner_id']);
- $lang_select_owner
= lang('Select owner');
- $lang_owner_statustext
= lang('Select the owner');
- $insert_record[] =
'owner_id';
- }
- }
- }
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
-
- $entities= $this->bo->read_entity_to_link();
-
- if (isset($entities) AND is_array($entities))
- {
- foreach($entities as $entity_entry)
-
- {
- $entities_link[] = array
- (
- 'entity_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.index&entity_id='
. $entity_entry['entity_id'] . '&cat_id=' . $entity_entry['cat_id'] .
'&query=' . $location_code),
- 'lang_entity_statustext'
=> $entity_entry['descr'],
- 'text_entity'
=> $entity_entry['name'],
- );
- }
- }
-
- $change_type_list =
$this->bo->select_change_type($values['change_type']);
-
- $data = array
- (
- 'lang_change_type'
=> lang('Change type'),
- 'check_history'
=> $check_history,
- 'lang_history'
=> lang('History'),
- 'lang_history_statustext' =>
lang('Fetch the history for this item'),
- 'table_header'
=> $table_header,
- 'change_type_list'
=> $change_type_list,
- 'values'
=> $content,
-
- 'lang_related_info'
=> lang('related info'),
- 'entities_link'
=> $entities_link,
- 'edit_street'
=> $edit_street,
- 'edit_tenant'
=> $edit_tenant,
- 'edit_part_of_town'
=> $edit_part_of_town,
- 'edit_owner'
=> $edit_owner,
- 'select_name_part_of_town' =>
$select_name_part_of_town,
- 'part_of_town_list'
=> $part_of_town_list,
- 'lang_town_statustext' =>
$lang_town_statustext,
- 'lang_part_of_town'
=> lang('Part of town'),
- 'lang_no_part_of_town' =>
lang('No part of town'),
- 'lang_owner'
=> $lang_owner,
- 'owner_list'
=> $owner_list,
- 'lang_select_owner'
=> $lang_select_owner,
- 'lang_owner_statustext' =>
$lang_owner_statustext,
- 'additional_fields'
=> $additional_fields,
- 'lang_street'
=> lang('Street'),
- 'lang_select_street_help' =>
lang('Select the street name'),
- 'lang_street_num_statustext' => lang('Enter
the street number'),
- 'value_street_id'
=> $values['street_id'],
- 'value_street_name'
=> $values['street_name'],
- 'value_street_number' =>
$values['street_number'],
-
- 'attributes_view'
=> $attributes_values,
- 'dateformat'
=> $dateformat,
- 'lang_dateformat'
=> strtolower($dateformat),
- 'lang_none'
=> lang('None'),
-
- 'lang_tenant'
=> lang('tenant'),
- 'value_tenant_id'
=> $values['tenant_id'],
- 'value_last_name'
=> $values['last_name'],
- 'value_first_name'
=> $values['first_name'],
- 'lang_tenant_statustext' =>
lang('Select a tenant'),
- 'size_last_name'
=> strlen($values['last_name']),
- 'size_first_name'
=> strlen($values['first_name']),
- 'lookup_type'
=> $lookup_type,
- 'location_data'
=> $location_data,
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index&type_id='
. $type_id . '&lookup_tenant=' . $lookup_tenant),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the location'),
- 'lang_edit'
=> lang('Edit'),
- 'edit_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.edit&location_code='
. $location_code . '&lookup_tenant=' . $lookup_tenant),
- 'lang_edit_statustext' => lang('Edit
this entry'),
- 'lang_category'
=> lang('category'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the location belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list('select',$values['cat_id'],$type_id)
- );
-
- $appname
= lang('location');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function update_cat()
- {
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uilocation.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $receipt= $this->bo->update_cat();
- $lang_confirm_msg = lang('Do you really want to
update the categories again');
- $lang_yes = lang('again');
- }
- else
- {
- $lang_confirm_msg = lang('Do you really
want to update the categories');
- $lang_yes = lang('yes');
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('location'));
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php'),
- 'update_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.update_cat'),
- 'message' =>
$receipt['message'],
- 'lang_confirm_msg' =>
$lang_confirm_msg,
- 'lang_yes' =>
$lang_yes,
- 'lang_yes_statustext' => lang('Update the
category to not active based on if there is only nonactive apartments'),
- 'lang_no_statustext' => lang('Back to
Admin'),
- 'lang_no' =>
lang('no')
- );
-
- $appname = lang('location');
- $function_msg = lang('Update the not active category
for locations');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('update_cat' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function stop()
- {
- $perm =
get_var('perm',array('POST','GET'));
- $location =
get_var('acl_location',array('POST','GET'));
-
- $right =
array(1=>'read',2=>'add',4=>'edit',8=>'delete',16=>'manage');
-
- $links = $this->menu->links();
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('location','menu'));
-
- $receipt['error'][]=array('msg'=>lang('You need the
right "%1" for this application at "%2" to access this
function',lang($right[$perm]),$location));
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links' => $links
- );
-
- $appname = lang('Access error');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' : ' . $appname;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('stop' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function summary()
- {
- $links = $this->menu->links('summary');
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('location','menu'));
-
- $summary_list= $this->bo->read_summary();
- $uicols = $this->bo->uicols;
-
- $j=0;
- if (isSet($summary_list) AND is_array($summary_list))
- {
- foreach($summary_list as $summary)
- {
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
$content[$j]['row'][$i]['value'] =
$summary[$uicols['name'][$i]];
- $content[$j]['row'][$i]['name']
= $summary['name'][$i];
- }
-
- $j++;
- }
- }
-
- $uicols_count = count($uicols['descr']);
- for ($i=0;$i<$uicols_count;$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '15%';
- $table_header[$i]['align']
= 'left';
-
- }
- }
-
-
-
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uilocation.excel',
- 'district_id'
=>$this->district_id,
- 'part_of_town_id'
=>$this->part_of_town_id,
- 'filter'
=>$this->filter,
- 'type_id'
=>$type_id,
- 'summary'
=>True
- );
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uilocation.summary',
- 'district_id'
=>$this->district_id,
- 'part_of_town_id'
=>$this->part_of_town_id,
- 'filter'
=>$this->filter,
- 'type_id'
=>$type_id
- );
-
-
- $data = array
- (
- 'links'
=> $links,
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'owner_name'
=> 'filter',
- 'owner_list'
=> $this->bo->get_owner_type_list('filter', $this->filter),
- 'lang_show_all'
=> lang('Show all'),
- 'lang_owner_statustext' =>
lang('Select the owner type. To show all entries select SHOW ALL'),
- 'select_name_part_of_town' =>
'part_of_town_id',
- 'part_of_town_list'
=> $this->bocommon->select_part_of_town('filter',$this->part_of_town_id),
- 'lang_town_statustext' =>
lang('Select the part of town the property belongs to. To do not use a part of
town - select NO PART OF TOWN'),
- 'lang_no_part_of_town' =>
lang('No Part of town'),
-
- 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
- 'select_district_name' =>
'district_id',
- 'lang_excel'
=> 'excel',
- 'link_excel'
=> $GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help'
=> lang('Download table to MS Excel'),
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
- 'table_header_summary' =>
$table_header,
- 'values'
=> $content
- );
-
-//_debug_array($data);
-
- $appname = lang('Summary');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' : ' . $appname;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('summary' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 location
+ * @version $Id: class.uilocation.inc.php,v 1.18 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uilocation
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'excel' => True,
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'update_cat'=> True,
+ 'stop' => True,
+ 'summary' => True
+ );
+
+ function uilocation()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bo =
CreateObject($this->currentapp.'.bolocation',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+ $this->soadmin_location =
CreateObject($this->currentapp.'.soadmin_location');
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.location';
+ $this->acl_read =
$this->acl2->check('.location',1);
+ $this->acl_add =
$this->acl2->check('.location',2);
+ $this->acl_edit =
$this->acl2->check('.location',4);
+ $this->acl_delete =
$this->acl2->check('.location',8);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->part_of_town_id =
$this->bo->part_of_town_id;
+ $this->district_id =
$this->bo->district_id;
+ $this->status =
$this->bo->status;
+ $this->type_id =
$this->bo->type_id;
+ $this->allrows =
$this->bo->allrows;
+
+ $this->menu->sub ='location';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' =>
$this->filter,
+ 'cat_id' =>
$this->cat_id,
+ 'part_of_town_id' =>
$this->part_of_town_id,
+ 'district_id' => $this->district_id,
+ 'status' =>
$this->status,
+ 'type_id' =>
$this->type_id,
+ 'allrows' =>
$this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function excel()
+ {
+ $summary =
get_var('summary',array('GET'));
+ $type_id =
get_var('type_id',array('GET'));
+ $lookup =
get_var('lookup',array('POST','GET'));
+ $lookup_name =
get_var('lookup_name',array('POST','GET'));
+ $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
+
+ if(!$summary)
+ {
+ $list =
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>True));
+ }
+ else
+ {
+ $list= $this->bo->read_summary();
+ }
+
+ $uicols = $this->bo->uicols;
+
$this->bocommon->excel($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
+ }
+
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('location',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $type_id =
get_var('type_id',array('GET'));
+ $lookup =
get_var('lookup',array('POST','GET'));
+ $lookup_name =
get_var('lookup_name',array('POST','GET'));
+ $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
+
+ if(!$type_id)
+ {
+ $type_id=1;
+ }
+ if($lookup)
+ {
+ $GLOBALS['phpgw_info']['flags']['noframework']
= True;
+ }
+ $links = $this->menu->links('location'.$type_id . '_' .
!!$lookup_tenant);
+
+
+ $location_list =
$this->bo->read(array('type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,'lookup'=>$lookup,'allrows'=>$this->allrows));
+
+ $uicols = $this->bo->uicols;
+//_debug_array($location_list);
+//_debug_array($uicols);
+
+ $j=0;
+ if (isSet($location_list) AND is_array($location_list))
+ {
+ foreach($location_list as $location)
+ {
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
+
if($location['query_location'][$uicols['name'][$i]])
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('search');
+
$content[$j]['row'][$i]['text'] =
$location[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index&query='
. $location['query_location'][$uicols['name'][$i]] . '&lookup=' . $lookup .
'&type_id=' . $type_id . '&lookup_tenant=' . $lookup_tenant . '&lookup_name=' .
$lookup_name);
+ }
+ else
+ {
+
$content[$j]['row'][$i]['value'] =
$location[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+
$content[$j]['row'][$i]['lookup'] = $lookup;
+ }
+ }
+
+
$content[$j]['hidden'][$i]['value'] =
$location[$uicols['name'][$i]];
+
$content[$j]['hidden'][$i]['name'] =
$uicols['name'][$i];
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('view the
location');
+
$content[$j]['row'][$i]['text'] = lang('view');
+
$content[$j]['row'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.view&location_code='
. $location['location_code'] . '&lookup_tenant=' . $lookup_tenant);
+ $i++;
+ }
+
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('edit the
location');
+
$content[$j]['row'][$i]['text'] = lang('edit');
+
$content[$j]['row'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.edit&location_code='
. $location['location_code'] . '&lookup_tenant=' . $lookup_tenant);
+ $i++;
+ }
+
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('delete the
location');
+
$content[$j]['row'][$i]['text'] =
lang('delete');
+
$content[$j]['row'][$i]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.delete&location_code='
. $location['location_code'] . '&type_id=' . $type_id . '&lookup_tenant=' .
$lookup_tenant);
+ }
+ }
+ $j++;
+ }
+ }
+//_debug_array($content);
+
+ $uicols_count = count($uicols['descr']);
+ for ($i=0;$i<$uicols_count;$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['name'][$i]=='loc1')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'fm_location1.loc1',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilocation.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'district_id'
=>$this->district_id,
+
'part_of_town_id'
=>$this->part_of_town_id,
+
'lookup'
=>$lookup,
+
'lookup_tenant'
=>$lookup_tenant,
+
'lookup_name'
=>$lookup_name,
+
'cat_id'
=>$this->cat_id,
+
'status'
=> $this->status)
+
));
+ }
+ if($uicols['name'][$i]=='street_name')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'street_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilocation.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'district_id'
=>$this->district_id,
+
'part_of_town_id'
=>$this->part_of_town_id,
+
'lookup'
=>$lookup,
+
'lookup_tenant'
=>$lookup_tenant,
+
'lookup_name'
=>$lookup_name,
+
'cat_id'
=>$this->cat_id,
+
'status'
=> $this->status)
+
));
+ }
+ }
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+ }
+ else
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('select');
+ }
+
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
location'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.edit&type_id='
. $type_id)
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilocation.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'part_of_town_id'
=>$this->part_of_town_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'lookup'
=>$lookup,
+ 'lookup_tenant'
=>$lookup_tenant,
+ 'lookup_name'
=>$lookup_name,
+ 'type_id'
=>$type_id,
+ 'status'
=> $this->status
+ );
+
+ $input_name =
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp);
+
+ for ($k=0;$k<count($input_name);$k++)
+ {
+ $function_exchange_values .=
"opener.document.form." . $input_name[$k] . ".value = '';" ."\r\n";
+ }
+
+ for ($i=0;$i<count($uicols['name']);$i++)
+ {
+ if($uicols['exchange'][$i])
+ {
+ $function_exchange_values .=
'opener.document.form.' . $uicols['name'][$i] .'.value = thisform.elements[' .
$i . '].value;' ."\r\n";
+ }
+ }
+
+ $function_exchange_values .='window.close()';
+
+//_debug_array($input_name);
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilocation.excel',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'part_of_town_id'
=>$this->part_of_town_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'lookup'
=>$lookup,
+ 'lookup_tenant'
=>$lookup_tenant,
+ 'lookup_name'
=>$lookup_name,
+ 'type_id'
=>$type_id,
+ 'status'
=> $this->status,
+ 'start' =>$this->start
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+
+ $data = array
+ (
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+
+ 'exchange_values'
=> 'Exchange_values(this.form);',
+ 'function_exchange_values' =>
$function_exchange_values,
+ 'lang_select'
=> lang('select'),
+ 'lookup'
=> $lookup,
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+ 'lang_property_name' =>
lang('Property name'),
+ 'links'
=> $links,
+ 'allow_allrows'
=> True,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($location_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+
+ 'lang_status_statustext' =>
lang('Select the status. To do not use a status select NO STATUS'),
+ 'status_name'
=> 'status',
+ 'lang_no_status'
=> lang('No status'),
+ 'status_list'
=> $this->bo->select_status_list('filter',$this->status),
+
+ 'part_of_town_list'
=> $this->bocommon->select_part_of_town('filter',$this->part_of_town_id),
+ 'lang_no_part_of_town'
=> lang('no part of town'),
+ 'lang_town_statustext'
=> lang('Select the part of town the selection belongs to. To do not use a part
of town select NO PART OF TOWN'),
+ 'select_name_part_of_town'
=> 'part_of_town_id',
+
+ 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+ 'select_district_name' =>
'district_id',
+
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the location belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id,$type_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'owner_name'
=> 'filter',
+ 'owner_list'
=> $this->bo->get_owner_type_list('filter', $this->filter),
+ 'lang_show_all'
=> lang('Show all'),
+ 'lang_owner_statustext' =>
lang('Select the owner type. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('location');
+
+ if($lookup)
+ {
+ $lookup_list =
$GLOBALS['phpgw']->session->appsession('lookup_name',$this->currentapp);
+ $function_msg
= $lookup_list[$lookup_name];
+ }
+ else
+ {
+ if($lookup_tenant)
+ {
+ $function_msg
= lang('Tenant');
+ }
+ else
+ {
+ $function_msg
= $uicols['descr'][($type_id-1)];
+ }
+ }
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+
+ }
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $get_history =
get_var('get_history',array('POST'));
+ $change_type =
get_var('change_type',array('POST'));
+ $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $values_attribute =
get_var('values_attribute',array('POST','GET'));
+ $location = split('-',$location_code);
+
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp,'');
+
+ if($_POST['save'])
+ {
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
$values[$insert_record['location'][$i]]= $_POST[$insert_record['location'][$i]];
+ }
+
+ for ($i=0; $i<count($insert_record['extra']);
$i++)
+ {
+ $values[$insert_record['extra'][$i]]=
$_POST[$insert_record['extra'][$i]];
+ }
+ }
+
+ $type_id =
get_var('type_id',array('GET'));
+
+ if($location_code)
+ {
+ $type_id = count($location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('location','attributes_form'));
+
+ if (is_array($values) )
+ {
+ for ($i=1; $i<($type_id+1); $i++)
+ {
+ if((!$values['loc' . $i] &&
!$location[($i-1)]) || !$values['loc' . $i])
+ {
+
+
$receipt['error'][]=array('msg'=>lang('Please select a location %1 ID !',$i));
+ $error_id=true;
+ }
+
+ $values['location_code'][]=
$values['loc' . $i];
+
+ if($i<$type_id)
+ {
+ $location_parent[]=
$values['loc' . ($i)];
+ }
+ }
+
+ $values['location_code']=implode("-",
$values['location_code']);
+
+ if($values['location_code'] && !$location_code)
+ {
+
if($this->bo->check_location($values['location_code'],$type_id))
+ {
+
$receipt['error'][]=array('msg'=>lang('This location is already registered!') .
'[ '.$values['location_code'].' ]');
+ $error_location_id=true;
+ $error_id=true;
+ }
+ }
+
+ if($location_code)
+ {
+ $action='edit';
+ $values['change_type'] = $change_type;
+
+
+ if(!$values['change_type'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select change type'));
+ }
+ }
+ elseif(!$location_code && !$error_id )
+ {
+ $location_code=$values['location_code'];
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save($values,$values_attribute,$action,$type_id,$location_parent);
+ }
+ else
+ {
+ if($location_parent)
+ {
+
$location_code_parent=implode("-", $location_parent);
+ $values =
$this->bo->read_single($location_code_parent);
+ }
+ }
+ }
+
+ if(!$error_id && $location_code)
+ {
+ $values =
$this->bo->read_single($location_code,array('tenant_id'=>'lookup'));
+ $check_history =
$this->bo->check_history($location_code);
+ if($get_history)
+ {
+ $history =
$this->bo->get_history($location_code);
+ $uicols = $this->bo->uicols;
+
+ $j=0;
+ if (isSet($history) AND
is_array($history))
+ {
+ foreach($history as $entry)
+ {
+ $k=0;
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$k]['value'] =
$entry[$uicols['name'][$i]];
+
$content[$j]['row'][$k]['name'] = $uicols['name'][$i];
+
$content[$j]['row'][$k]['lookup'] = $lookup;
+ }
+
+
$content[$j]['hidden'][$k]['value'] =
$entry[$uicols['name'][$i]];
+
$content[$j]['hidden'][$k]['name'] =
$uicols['name'][$i];
+ $k++;
+ }
+ $j++;
+ }
+ }
+
+ $uicols_count =
count($uicols['descr']);
+ for ($i=0;$i<$uicols_count;$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$table_header[$i]['header'] = $uicols['descr'][$i];
+
$table_header[$i]['width'] = '5%';
+
$table_header[$i]['align'] = 'center';
+ }
+ }
+ }
+ }
+ else
+ {
+ unset($values['location_code']);
+ }
+
+ if ($values['cat_id'] > 0)
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilocation.edit',
+ 'location_code' => $location_code,
+ 'type_id' => $type_id,
+ 'lookup_tenant' => $lookup_tenant
+ );
+
+ if($values['location_code'])
+ {
+ $lookup_type='form';
+ }
+ else
+ {
+ $lookup_type='form';
+ }
+
+ $location_data=$this->bo->initiate_ui_location(array(
+ 'values' =>
$values,
+ 'type_id' =>
($type_id-1),
+ 'no_link' =>
($type_id), // disable lookup links for location type less than type_id
+ 'tenant' =>
False,
+ 'lookup_type' => $lookup_type
+ ));
+
+ $location_types = $this->bo->location_types;
+ $config = $this->bo->config;
+
+ if ($location_code)
+ {
+ $function_msg = lang('edit');
+ }
+ else
+ {
+ $function_msg = lang('add');
+ }
+
+ $function_msg .= ' '
.$location_types[($type_id-1)]['name'];
+
+ $custom_fields =
$this->soadmin_location->read_attrib(array('type_id'=>$type_id,'allrows'=>True));
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+
+ if(!is_array($insert_record))
+ {
+ $insert_record = array();
+ }
+
+ $j=0;
+ $additional_fields[$j]['input_text'] =
$location_types[($type_id-1)]['name'];
+ $additional_fields[$j]['statustext'] =
$location_types[($type_id-1)]['descr'];
+ $additional_fields[$j]['datatype'] =
'varchar';
+ $additional_fields[$j]['input_name'] = 'loc' .
$type_id;
+ $additional_fields[$j]['name'] = 'loc' . $type_id;
+ $additional_fields[$j]['value'] =
$values[$additional_fields[$j]['input_name']];
+ $additional_fields[$j]['class'] =
'th_text';
+ $insert_record['extra'][]
= $additional_fields[$j]['input_name'];
+
+ $j++;
+ $additional_fields[$j]['input_text'] = lang('name');
+ $additional_fields[$j]['statustext'] = lang('enter
the name for this location');
+ $additional_fields[$j]['datatype'] =
'varchar';
+ $additional_fields[$j]['input_name'] = 'loc' .
$type_id . '_name';
+ $additional_fields[$j]['name'] = 'loc' . $type_id .
'_name';
+ $additional_fields[$j]['value'] =
$values[$additional_fields[$j]['input_name']];
+ $insert_record['extra'][]
= $additional_fields[$j]['input_name'];
+ $j++;
+
+
+ $contacts =
CreateObject('phpgwapi.contacts');
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $sep = '/';
+ $dlarr[strpos($dateformat,'Y')] = 'Y';
+ $dlarr[strpos($dateformat,'m')] = 'm';
+ $dlarr[strpos($dateformat,'d')] = 'd';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ $input_type_array = array(
+ 'R' => 'radio',
+ 'CH' => 'checkbox',
+ 'LB' => 'listbox'
+ );
+
+ $vendor = CreateObject($this->currentapp.'.soactor');
+ $vendor->role = 'vendor';
+
+ $r=0;
+ $m=0;
+ while (is_array($custom_fields) && list(,$custom) =
each($custom_fields))
+ {
+ $location_datatype[]= array('input_name'
=> $custom['column_name'],
+ 'datatype' =>
$custom['datatype']
+ );
+
+ $attributes_values[$r]['id'] = $custom['id'];
+ $attributes_values[$r]['input_text'] =
$custom['input_text'];
+ $attributes_values[$r]['statustext'] =
$custom['statustext'];
+ $attributes_values[$r]['datatype']
= $custom['datatype'];
+ $attributes_values[$r]['name'] =
$custom['column_name'];
+ $attributes_values[$r]['input_name'] =
$custom['column_name'];
+ $attributes_values[$r]['value']
= $values[$custom['column_name']];
+ if($attributes_values[$r]['datatype']=='D' &&
$attributes_values[$r]['value'])
+ {
+ $timestamp_date=
mktime(0,0,0,date(m,strtotime($attributes_values[$r]['value'])),date(d,strtotime($attributes_values[$r]['value'])),date(y,strtotime($attributes_values[$r]['value'])));
+ $attributes_values[$r]['value'] =
$GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
+ }
+ if($attributes_values[$r]['datatype']=='AB')
+ {
+ if($attributes_values[$r]['value'])
+ {
+ $contact_data =
$contacts->read_single_entry($attributes_values[$r]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
+
$attributes_values[$r]['contact_name'] = $contact_data[0]['n_family'] . ', ' .
$contact_data[0]['n_given'];
+ }
+
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $attributes_values[$r]['name']);
+
+ $functions[$m]['name'] = 'lookup_'.
$attributes_values[$r]['name'] .'()';
+ $functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+
+ if($attributes_values[$r]['datatype']=='VENDOR')
+ {
+ if($attributes_values[$r]['value'])
+ {
+ $vendor_data =
$vendor->read_single(array('actor_id'=>$attributes_values[$r]['value']));
+
+ for
($n=0;$n<count($vendor_data['attributes']);$n++)
+ {
+
if($vendor_data['attributes'][$n]['name'] == 'org_name')
+ {
+
$attributes_values[$r]['vendor_name']= $vendor_data['attributes'][$n]['value'];
+ $n
=count($vendor_data['attributes']);
+ }
+ }
+ }
+
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $attributes_values[$r]['name']);
+
+ $lookup_functions[$m]['name'] =
'lookup_'. $attributes_values[$r]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+
+
+ if($attributes_values[$r]['datatype']=='R' ||
$attributes_values[$r]['datatype']=='CH' ||
$attributes_values[$r]['datatype']=='LB')
+ {
+ $attributes_values[$r]['choice']
=
$this->soadmin_location->read_attrib_choice($type_id,$attributes_values[$r]['id']);
+
$input_type=$input_type_array[$attributes_values[$r]['datatype']];
+
+
if($attributes_values[$r]['datatype']=='CH')
+ {
+
$attributes_values[$r]['value']=unserialize($attributes_values[$r]['value']);
+
$attributes_values[$r]['choice'] =
$this->bocommon->select_multi_list_2($attributes_values[$r]['value'],$attributes_values[$r]['choice'],$input_type);
+
+ }
+ else
+ {
+ for
($j=0;$j<count($attributes_values[$r]['choice']);$j++)
+ {
+
$attributes_values[$r]['choice'][$j]['input_type']=$input_type;
+
if($attributes_values[$r]['choice'][$j]['id']==$attributes_values[$r]['value'])
+ {
+
$attributes_values[$r]['choice'][$j]['checked']='checked';
+ }
+ }
+ }
+ }
+
+ $attributes_values[$r]['datatype_text'] =
$this->bocommon->translate_datatype($attributes_values[$r]['datatype']);
+ $attributes_values[$r]['counter'] = $r;
+ $attributes_values[$r]['type_id'] =
$type_id;
+ $r++;
+
+ for ($j=0;$j<count($functions);$j++)
+ {
+ $lookup_functions .= 'function ' .
$functions[$j]['name'] ."\r\n";
+ $lookup_functions .= '{'."\r\n";
+ $lookup_functions .=
$functions[$j]['action'] ."\r\n";
+ $lookup_functions .= '}'."\r\n";
+ }
+ }
+
+
$GLOBALS['phpgw']->session->appsession('location_datatype',$this->currentapp,$location_datatype);
+
+ $insert_record['extra'][]
= 'cat_id';
+
+ $config_count=count($config);
+ for ($j=0;$j<$config_count;$j++)
+ {
+ if($config[$j]['location_type'] == $type_id)
+ {
+
+
if($config[$j]['column_name']=='street_id')
+ {
+ $edit_street=True;
+ $insert_record['extra'][]
= 'street_id';
+ $insert_record['extra'][]
= 'street_number';
+ }
+
+
if($config[$j]['column_name']=='tenant_id')
+ {
+ $edit_tenant=True;
+ $insert_record['extra'][]
= 'tenant_id';
+ }
+
+
if($config[$j]['column_name']=='part_of_town_id')
+ {
+ $edit_part_of_town=True;
+ $select_name_part_of_town
= 'part_of_town_id';
+ $part_of_town_list
=
$this->bocommon->select_part_of_town('select',$values['part_of_town_id']);
+ $lang_town_statustext
= lang('Select the part of town the property belongs to. To do not use
a part of town - select NO PART OF TOWN');
+ $insert_record['extra'][]
= 'part_of_town_id';
+ }
+
if($config[$j]['column_name']=='owner_id')
+ {
+ $edit_owner=True;
+ $lang_owner
= lang('Owner');
+ $owner_list
= $this->bo->get_owner_list('',$values['owner_id']);
+ $lang_select_owner
= lang('Select owner');
+ $lang_owner_statustext
= lang('Select the owner');
+ $insert_record['extra'][]
= 'owner_id';
+ }
+ }
+ }
+
+
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp,$insert_record);
+
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+
$dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+
$dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
+ if($receipt)
+ {
+ $msgbox_data =
$this->bocommon->msgbox_data($receipt);
+ }
+
+
+ $entities= $this->bo->read_entity_to_link();
+
+ if (isset($entities) AND is_array($entities))
+ {
+ foreach($entities as $entity_entry)
+
+ {
+ $entities_link[] = array
+ (
+ 'entity_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.index&entity_id='
. $entity_entry['entity_id'] . '&cat_id=' . $entity_entry['cat_id'] .
'&query=' . $location_code),
+ 'lang_entity_statustext'
=> $entity_entry['descr'],
+ 'text_entity'
=> $entity_entry['name'],
+ );
+ }
+ }
+
+
+ if($location_code)
+ {
+ $change_type_list =
$this->bo->select_change_type($values['change_type']);
+ }
+
+ $data = array
+ (
+ 'lang_change_type'
=> lang('Change type'),
+ 'lang_no_change_type' =>
lang('No Change type'),
+ 'lang_change_type_statustext' => lang('Type
of changes'),
+ 'change_type_list'
=> $change_type_list,
+ 'check_history'
=> $check_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_history_statustext' =>
lang('Fetch the history for this item'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+
+ 'lang_related_info'
=> lang('related info'),
+ 'entities_link'
=> $entities_link,
+ 'edit_street'
=> $edit_street,
+ 'edit_tenant'
=> $edit_tenant,
+ 'edit_part_of_town'
=> $edit_part_of_town,
+ 'edit_owner'
=> $edit_owner,
+ 'select_name_part_of_town' =>
$select_name_part_of_town,
+ 'part_of_town_list'
=> $part_of_town_list,
+ 'lang_town_statustext' =>
$lang_town_statustext,
+ 'lang_part_of_town'
=> lang('Part of town'),
+ 'lang_no_part_of_town' =>
lang('No part of town'),
+ 'lang_owner'
=> $lang_owner,
+ 'owner_list'
=> $owner_list,
+ 'lang_select_owner'
=> $lang_select_owner,
+ 'lang_owner_statustext' =>
$lang_owner_statustext,
+ 'additional_fields'
=> $additional_fields,
+ 'attributes_values'
=> $attributes_values,
+ 'lookup_functions'
=> $lookup_functions,
+ 'lang_none'
=> lang('None'),
+
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
+ 'street_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.street'),
+ 'lang_street'
=> lang('Street'),
+ 'lang_select_street_help' =>
lang('Select the street name'),
+ 'lang_street_num_statustext' => lang('Enter
the street number'),
+ 'value_street_id'
=> $values['street_id'],
+ 'value_street_name'
=> $values['street_name'],
+ 'value_street_number' =>
$values['street_number'],
+
+ 'tenant_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.tenant'),
+ 'lang_tenant'
=> lang('tenant'),
+ 'value_tenant_id'
=> $values['tenant_id'],
+ 'value_last_name'
=> $values['last_name'],
+ 'value_first_name'
=> $values['first_name'],
+ 'lang_tenant_statustext' =>
lang('Select a tenant'),
+ 'size_last_name'
=> strlen($values['last_name']),
+ 'size_first_name'
=> strlen($values['first_name']),
+ 'lookup_type'
=> $lookup_type,
+ 'location_data'
=> $location_data,
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index&type_id='
. $type_id . '&lookup_tenant=' . $lookup_tenant),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the location'),
+ 'lang_category'
=> lang('category'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the location belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list('select',$values['cat_id'],$type_id)
+ );
+
+ $appname
= lang('location');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function delete()
+ {
+ if(!$this->acl_delete)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+
+ $location_code =
get_var('location_code',array('GET'));
+ $type_id =
get_var('type_id',array('GET',POST));
+
+
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilocation.index',
+ 'type_id' =>$type_id
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($location_code);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.delete&location_code='
. $location_code . '&type_id=' . $type_id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('location');
+ $function_msg =
lang('delete location');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view()
+ {
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $get_history =
get_var('get_history',array('POST'));
+ $lookup_tenant =
get_var('lookup_tenant',array('POST','GET'));
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $location = split('-',$location_code);
+
+ $type_id =
get_var('type_id',array('GET'));
+
+ if($location_code)
+ {
+ $type_id = count($location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('location','attributes_view'));
+
+ $values =
$this->bo->read_single($location_code,array('tenant_id'=>'lookup'));
+
+ $check_history =
$this->bo->check_history($location_code);
+ if($get_history)
+ {
+ $history =
$this->bo->get_history($location_code);
+ $uicols = $this->bo->uicols;
+
+ $j=0;
+ if (isSet($history) AND is_array($history))
+ {
+ foreach($history as $entry)
+ {
+ $k=0;
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$k]['value'] =
$entry[$uicols['name'][$i]];
+
$content[$j]['row'][$k]['name'] = $uicols['name'][$i];
+
$content[$j]['row'][$k]['lookup'] = $lookup;
+ }
+
+
$content[$j]['hidden'][$k]['value'] =
$entry[$uicols['name'][$i]];
+
$content[$j]['hidden'][$k]['name'] =
$uicols['name'][$i];
+ $k++;
+ }
+ $j++;
+ }
+ }
+
+ $uicols_count = count($uicols['descr']);
+ for ($i=0;$i<$uicols_count;$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header']
= $uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ }
+ }
+ }
+
+ $lookup_type='view';
+
+ $location_data=$this->bo->initiate_ui_location(array(
+ 'values' =>
$values,
+ 'type_id' =>
($type_id-1),
+ 'lookup_type' => $lookup_type
+ ));
+
+ $location_types = $this->bo->location_types;
+ $config = $this->bo->config;
+
+ $function_msg = lang('view');
+
+ $function_msg .= ' '
.$location_types[($type_id-1)]['name'];
+
+ $custom_fields =
$this->soadmin_location->read_attrib(array('type_id'=>$type_id,'allrows'=>True));
+
+ $j=0;
+ $additional_fields[$j]['input_text'] =
$location_types[($type_id-1)]['name'];
+ $additional_fields[$j]['input_name'] = 'loc' .
$type_id;
+ $additional_fields[$j]['datatype'] =
'varchar';
+ $additional_fields[$j]['value'] =
$values[$additional_fields[$j]['input_name']];
+ $additional_fields[$j]['class'] =
'th_text';
+
+ $j++;
+ $additional_fields[$j]['input_text'] = lang('name');
+ $additional_fields[$j]['input_name'] = 'loc' .
$type_id . '_name';
+ $additional_fields[$j]['datatype'] =
'varchar';
+ $additional_fields[$j]['value'] =
$values[$additional_fields[$j]['input_name']];
+ $j++;
+
+
+ $contacts =
CreateObject('phpgwapi.contacts');
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $sep = '/';
+ $dlarr[strpos($dateformat,'Y')] = 'Y';
+ $dlarr[strpos($dateformat,'m')] = 'm';
+ $dlarr[strpos($dateformat,'d')] = 'd';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ $input_type_array = array(
+ 'R' => 'radio',
+ 'CH' => 'checkbox',
+ 'LB' => 'listbox'
+ );
+
+ $vendor = CreateObject($this->currentapp.'.soactor');
+ $vendor->role = 'vendor';
+
+ $r=0;
+ $m=0;
+
+ while (is_array($custom_fields) && list(,$custom) =
each($custom_fields))
+ {
+ $location_datatype[]= array('input_name'
=> $custom['column_name'],
+ 'datatype' =>
$custom['datatype']
+ );
+
+ $attributes_values[$r]['id'] = $custom['id'];
+ $attributes_values[$r]['input_text'] =
$custom['input_text'];
+ $attributes_values[$r]['statustext'] =
$custom['statustext'];
+ $attributes_values[$r]['datatype']
= $custom['datatype'];
+ $attributes_values[$r]['name'] =
$custom['column_name'];
+ $attributes_values[$r]['input_name'] =
$custom['column_name'];
+ $attributes_values[$r]['value']
= $values[$custom['column_name']];
+ if($attributes_values[$r]['datatype']=='D' &&
$attributes_values[$r]['value'])
+ {
+ $timestamp_date=
mktime(0,0,0,date(m,strtotime($attributes_values[$r]['value'])),date(d,strtotime($attributes_values[$r]['value'])),date(y,strtotime($attributes_values[$r]['value'])));
+ $attributes_values[$r]['value'] =
$GLOBALS['phpgw']->common->show_date($timestamp_date,$dateformat);
+ }
+ if($attributes_values[$r]['datatype']=='AB')
+ {
+ if($attributes_values[$r]['value'])
+ {
+ $contact_data =
$contacts->read_single_entry($attributes_values[$r]['value'],array('n_given'=>'n_given','n_family'=>'n_family','email'=>'email'));
+
$attributes_values[$r]['contact_name'] = $contact_data[0]['n_family'] . ', ' .
$contact_data[0]['n_given'];
+ }
+
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook&column='
. $attributes_values[$r]['name']);
+
+ $functions[$m]['name'] = 'lookup_'.
$attributes_values[$r]['name'] .'()';
+ $functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+
+ if($attributes_values[$r]['datatype']=='VENDOR')
+ {
+ if($attributes_values[$r]['value'])
+ {
+ $vendor_data =
$vendor->read_single(array('actor_id'=>$attributes_values[$r]['value']));
+
+ for
($n=0;$n<count($vendor_data['attributes']);$n++)
+ {
+
if($vendor_data['attributes'][$n]['name'] == 'org_name')
+ {
+
$attributes_values[$r]['vendor_name']= $vendor_data['attributes'][$n]['value'];
+ $n
=count($vendor_data['attributes']);
+ }
+ }
+ }
+
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.vendor&column='
. $attributes_values[$r]['name']);
+
+ $lookup_functions[$m]['name'] =
'lookup_'. $attributes_values[$r]['name'] .'()';
+ $lookup_functions[$m]['action'] =
'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
+ $m++;
+ }
+
+ if($attributes_values[$r]['datatype']=='R' ||
$attributes_values[$r]['datatype']=='CH' ||
$attributes_values[$r]['datatype']=='LB')
+ {
+ $attributes_values[$r]['choice']
=
$this->soadmin_location->read_attrib_choice($type_id,$attributes_values[$r]['id']);
+
$input_type=$input_type_array[$attributes_values[$r]['datatype']];
+
+
if($attributes_values[$r]['datatype']=='CH')
+ {
+
$attributes_values[$r]['value']=unserialize($attributes_values[$r]['value']);
+
$attributes_values[$r]['choice'] =
$this->bocommon->select_multi_list_2($attributes_values[$r]['value'],$attributes_values[$r]['choice'],$input_type);
+
+ }
+ else
+ {
+ for
($j=0;$j<count($attributes_values[$r]['choice']);$j++)
+ {
+
$attributes_values[$r]['choice'][$j]['input_type']=$input_type;
+
if($attributes_values[$r]['choice'][$j]['id']==$attributes_values[$r]['value'])
+ {
+
$attributes_values[$r]['choice'][$j]['checked']='checked';
+ }
+ }
+ }
+ }
+
+ $attributes_values[$r]['datatype_text'] =
$this->bocommon->translate_datatype($attributes_values[$r]['datatype']);
+ $r++;
+ }
+
+
+// _debug_array($custom_fields);
+
+ for ($j=0;$j<count($config);$j++)
+ {
+ if($config[$j]['location_type'] == $type_id)
+ {
+
+
if($config[$j]['column_name']=='street_id')
+ {
+ $edit_street=True;
+ $insert_record[] =
'street_id';
+ }
+
+
if($config[$j]['column_name']=='tenant_id')
+ {
+ $edit_tenant=True;
+ $insert_record[] =
'tenant_id';
+ }
+
+
if($config[$j]['column_name']=='part_of_town_id')
+ {
+ $edit_part_of_town=True;
+ $select_name_part_of_town
= 'part_of_town_id';
+ $part_of_town_list
=
$this->bocommon->select_part_of_town('select',$values['part_of_town_id']);
+ $lang_town_statustext
= lang('Select the part of town the property belongs to. To do not use
a part of town - select NO PART OF TOWN');
+ $insert_record[] =
'part_of_town_id';
+ }
+
if($config[$j]['column_name']=='owner_id')
+ {
+ $edit_owner=True;
+ $lang_owner
= lang('Owner');
+ $owner_list
= $this->bo->get_owner_list('',$values['owner_id']);
+ $lang_select_owner
= lang('Select owner');
+ $lang_owner_statustext
= lang('Select the owner');
+ $insert_record[] =
'owner_id';
+ }
+ }
+ }
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+
+ $entities= $this->bo->read_entity_to_link();
+
+ if (isset($entities) AND is_array($entities))
+ {
+ foreach($entities as $entity_entry)
+
+ {
+ $entities_link[] = array
+ (
+ 'entity_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uientity.index&entity_id='
. $entity_entry['entity_id'] . '&cat_id=' . $entity_entry['cat_id'] .
'&query=' . $location_code),
+ 'lang_entity_statustext'
=> $entity_entry['descr'],
+ 'text_entity'
=> $entity_entry['name'],
+ );
+ }
+ }
+
+ $change_type_list =
$this->bo->select_change_type($values['change_type']);
+
+ $data = array
+ (
+ 'lang_change_type'
=> lang('Change type'),
+ 'check_history'
=> $check_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_history_statustext' =>
lang('Fetch the history for this item'),
+ 'table_header'
=> $table_header,
+ 'change_type_list'
=> $change_type_list,
+ 'values'
=> $content,
+
+ 'lang_related_info'
=> lang('related info'),
+ 'entities_link'
=> $entities_link,
+ 'edit_street'
=> $edit_street,
+ 'edit_tenant'
=> $edit_tenant,
+ 'edit_part_of_town'
=> $edit_part_of_town,
+ 'edit_owner'
=> $edit_owner,
+ 'select_name_part_of_town' =>
$select_name_part_of_town,
+ 'part_of_town_list'
=> $part_of_town_list,
+ 'lang_town_statustext' =>
$lang_town_statustext,
+ 'lang_part_of_town'
=> lang('Part of town'),
+ 'lang_no_part_of_town' =>
lang('No part of town'),
+ 'lang_owner'
=> $lang_owner,
+ 'owner_list'
=> $owner_list,
+ 'lang_select_owner'
=> $lang_select_owner,
+ 'lang_owner_statustext' =>
$lang_owner_statustext,
+ 'additional_fields'
=> $additional_fields,
+ 'lang_street'
=> lang('Street'),
+ 'lang_select_street_help' =>
lang('Select the street name'),
+ 'lang_street_num_statustext' => lang('Enter
the street number'),
+ 'value_street_id'
=> $values['street_id'],
+ 'value_street_name'
=> $values['street_name'],
+ 'value_street_number' =>
$values['street_number'],
+
+ 'attributes_view'
=> $attributes_values,
+ 'dateformat'
=> $dateformat,
+ 'lang_dateformat'
=> strtolower($dateformat),
+ 'lang_none'
=> lang('None'),
+
+ 'lang_tenant'
=> lang('tenant'),
+ 'value_tenant_id'
=> $values['tenant_id'],
+ 'value_last_name'
=> $values['last_name'],
+ 'value_first_name'
=> $values['first_name'],
+ 'lang_tenant_statustext' =>
lang('Select a tenant'),
+ 'size_last_name'
=> strlen($values['last_name']),
+ 'size_first_name'
=> strlen($values['first_name']),
+ 'lookup_type'
=> $lookup_type,
+ 'location_data'
=> $location_data,
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.index&type_id='
. $type_id . '&lookup_tenant=' . $lookup_tenant),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the location'),
+ 'lang_edit'
=> lang('Edit'),
+ 'edit_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.edit&location_code='
. $location_code . '&lookup_tenant=' . $lookup_tenant),
+ 'lang_edit_statustext' => lang('Edit
this entry'),
+ 'lang_category'
=> lang('category'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the location belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list('select',$values['cat_id'],$type_id)
+ );
+
+ $appname
= lang('location');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function update_cat()
+ {
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilocation.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $receipt= $this->bo->update_cat();
+ $lang_confirm_msg = lang('Do you really want to
update the categories again');
+ $lang_yes = lang('again');
+ }
+ else
+ {
+ $lang_confirm_msg = lang('Do you really
want to update the categories');
+ $lang_yes = lang('yes');
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('location'));
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php'),
+ 'update_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilocation.update_cat'),
+ 'message' =>
$receipt['message'],
+ 'lang_confirm_msg' =>
$lang_confirm_msg,
+ 'lang_yes' =>
$lang_yes,
+ 'lang_yes_statustext' => lang('Update the
category to not active based on if there is only nonactive apartments'),
+ 'lang_no_statustext' => lang('Back to
Admin'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname = lang('location');
+ $function_msg = lang('Update the not active category
for locations');
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('update_cat' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function stop()
+ {
+ $perm =
get_var('perm',array('POST','GET'));
+ $location =
get_var('acl_location',array('POST','GET'));
+
+ $right =
array(1=>'read',2=>'add',4=>'edit',8=>'delete',16=>'manage');
+
+ $links = $this->menu->links();
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('location','menu'));
+
+ $receipt['error'][]=array('msg'=>lang('You need the
right "%1" for this application at "%2" to access this
function',lang($right[$perm]),$location));
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links' => $links
+ );
+
+ $appname = lang('Access error');
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' : ' . $appname;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('stop' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function summary()
+ {
+ $links = $this->menu->links('summary');
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('location','menu'));
+
+ $summary_list= $this->bo->read_summary();
+ $uicols = $this->bo->uicols;
+
+ $j=0;
+ if (isSet($summary_list) AND is_array($summary_list))
+ {
+ foreach($summary_list as $summary)
+ {
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
$content[$j]['row'][$i]['value'] =
$summary[$uicols['name'][$i]];
+ $content[$j]['row'][$i]['name']
= $summary['name'][$i];
+ }
+
+ $j++;
+ }
+ }
+
+ $uicols_count = count($uicols['descr']);
+ for ($i=0;$i<$uicols_count;$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '15%';
+ $table_header[$i]['align']
= 'left';
+
+ }
+ }
+
+
+
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilocation.excel',
+ 'district_id'
=>$this->district_id,
+ 'part_of_town_id'
=>$this->part_of_town_id,
+ 'filter'
=>$this->filter,
+ 'type_id'
=>$type_id,
+ 'summary'
=>True
+ );
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilocation.summary',
+ 'district_id'
=>$this->district_id,
+ 'part_of_town_id'
=>$this->part_of_town_id,
+ 'filter'
=>$this->filter,
+ 'type_id'
=>$type_id
+ );
+
+
+ $data = array
+ (
+ 'links'
=> $links,
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'owner_name'
=> 'filter',
+ 'owner_list'
=> $this->bo->get_owner_type_list('filter', $this->filter),
+ 'lang_show_all'
=> lang('Show all'),
+ 'lang_owner_statustext' =>
lang('Select the owner type. To show all entries select SHOW ALL'),
+ 'select_name_part_of_town' =>
'part_of_town_id',
+ 'part_of_town_list'
=> $this->bocommon->select_part_of_town('filter',$this->part_of_town_id),
+ 'lang_town_statustext' =>
lang('Select the part of town the property belongs to. To do not use a part of
town - select NO PART OF TOWN'),
+ 'lang_no_part_of_town' =>
lang('No Part of town'),
+
+ 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+ 'select_district_name' =>
'district_id',
+ 'lang_excel'
=> 'excel',
+ 'link_excel'
=> $GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help'
=> lang('Download table to MS Excel'),
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+ 'table_header_summary' =>
$table_header,
+ 'values'
=> $content
+ );
+
+//_debug_array($data);
+
+ $appname = lang('Summary');
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' : ' . $appname;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('summary' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uilookup.inc.php
diff -u property/inc/class.uilookup.inc.php:1.12
property/inc/class.uilookup.inc.php:1.13
--- property/inc/class.uilookup.inc.php:1.12 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uilookup.inc.php Fri Feb 3 12:05:49 2006
@@ -1,901 +1,901 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 core
- * @version $Id: class.uilookup.inc.php,v 1.12 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uilookup
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $district_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'addressbook' => True,
- 'vendor' => True,
- 'b_account' => True,
- 'location' => True,
- 'entity' => True,
- 'ns3420' => True,
- 'street' => True,
- 'tenant' => True
- );
-
- function uilookup()
- {
- $GLOBALS['phpgw_info']['flags']['noframework'] = True;
- $GLOBALS['phpgw_info']['flags']['headonly']=true;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->bo =
CreateObject($this->currentapp.'.bolookup',True);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->part_of_town_id =
$this->bo->part_of_town_id;
- $this->district_id =
$this->bo->district_id;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' =>
$this->filter,
- 'cat_id' =>
$this->cat_id,
- 'part_of_town_id' =>
$this->part_of_town_id,
- 'district_id' => $this->district_id
- );
- $this->bo->save_sessiondata($data);
- }
-
- function addressbook()
- {
-
- $this->cats =
CreateObject('phpgwapi.categories');
- $this->cats->app_name = 'addressbook';
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-
'nextmatchs',
-
'search_field',
-
'cat_filter'));
-
- $second_display =
get_var('second_display',array('POST','GET'));
- $column = get_var('column',array('POST','GET'));
-
-
- $default_category =
$GLOBALS['phpgw_info']['user']['preferences']['addressbook']['default_category'];
-
- if ($default_category && !$second_display)
- {
- $this->bo->cat_id = $default_category;
- $this->cat_id = $default_category;
- }
-
- $addressbook_list = $this->bo->read_addressbook();
-
- while (is_array($addressbook_list) &&
list(,$addressbook_entry) = each($addressbook_list))
- {
- $content[] = array
- (
- 'id' =>
$addressbook_entry['contact_id'],
- 'contact_name' =>
$addressbook_entry['per_last_name'] . ', ' .
$addressbook_entry['per_first_name'],
- 'lang_select' =>
lang('Select'),
- 'lang_select_statustext' =>
lang('Select this contact')
- );
- }
-
- $table_header[] = array
- (
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'last_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.addressbook',
-
'cat_id' =>
$this->cat_id,
-
'column' =>
$column)
-
)),
- 'lang_name' => lang('Name'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'person_id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.addressbook',
-
'cat_id'
=>$this->cat_id,
-
'column' =>
$column)
-
)),
- 'lang_id' => lang('ID'),
- 'lang_select' => lang('Select')
- );
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Close this
window')
- );
-
- $link_select = array
- (
- 'menuaction' =>
$this->currentapp.'.uilookup.addressbook',
- 'second_display' => true,
- 'order' => $this->order,
- 'sort' => $this->sort,
- 'cat_id' =>
$this->cat_id,
- 'query' => $this->query,
- 'filter' =>
$this->filter,
- 'column' => $column
- );
-
- if($column)
- {
- $contact_id =$column;
- $contact_name =$column . '_name';
- }
- else
- {
- $contact_id ='contact_id';
- $contact_name ='contact_name';
- }
-
- $cat_data =
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id,'globals' =>
True, 'link_data' =>$link_select));
- $data = array
- (
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($addressbook_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $cat_data['cat_list'],
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_contact' =>
$table_header,
- 'values_contact'
=> $content,
- 'table_done'
=> $table_done,
- 'contact_id'
=> $contact_id,
- 'contact_name'
=> $contact_name
- );
-
- $appname
= lang('addressbook');
- $function_msg =
lang('list vendors');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_contact' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function vendor()
- {
-
- $this->cats =
CreateObject('phpgwapi.categories');
- $this->cats->app_name = 'fm_vendor';
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-
'nextmatchs',
-
'search_field',
-
'cat_filter'));
-
- $second_display =
get_var('second_display',array('POST','GET'));
- $column = get_var('column',array('POST','GET'));
-
-
- $default_category =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['default_vendor_category'];
-
- if ($default_category && !$second_display)
- {
- $this->bo->cat_id = $default_category;
- $this->cat_id = $default_category;
- }
-
- $vendor_list = $this->bo->read_vendor();
-
- while (is_array($vendor_list) && list(,$vendor_entry) =
each($vendor_list))
- {
- $content[] = array
- (
- 'id' =>
$vendor_entry['id'],
- 'vendor_name' =>
$vendor_entry['org_name'],
- 'lang_select' =>
lang('Select'),
- 'lang_select_statustext' =>
lang('Select this vendor')
- );
- }
-
- $table_header[] = array
- (
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'org_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.vendor',
-
'cat_id' =>
$this->cat_id,
-
'column' =>
$column)
-
)),
- 'lang_name' => lang('Name'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.vendor',
-
'cat_id'
=>$this->cat_id,
-
'column' =>
$column)
-
)),
- 'lang_id' => lang('ID'),
- 'lang_select' => lang('Select')
- );
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Close this
window')
- );
-
- $link_select = array
- (
- 'menuaction' =>
$this->currentapp.'.uilookup.vendor',
- 'second_display' => true,
- 'order' => $this->order,
- 'sort' => $this->sort,
- 'cat_id' =>
$this->cat_id,
- 'query' => $this->query,
- 'filter' =>
$this->filter,
- 'column' => $column
- );
-
- if($column)
- {
- $contact_id =$column;
- $org_name =$column . '_org_name';
- }
- else
- {
- $contact_id ='vendor_id';
- $org_name ='vendor_name';
- }
-
- $cat_data =
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id,'globals' =>
True, 'link_data' =>$link_select));
- $data = array
- (
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($vendor_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $cat_data['cat_list'],
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_vendor' =>
$table_header,
- 'values_vendor'
=> $content,
- 'table_done'
=> $table_done,
- 'contact_id'
=> $contact_id,
- 'org_name'
=> $org_name
- );
-
- $appname
= lang('vendor');
- $function_msg =
lang('list vendors');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_vendor' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function b_account()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-
'nextmatchs',
-
'search_field'));
-
- $b_account_list = $this->bo->read_b_account();
-
- while (is_array($b_account_list) &&
list(,$b_account_entry) = each($b_account_list))
- {
- $content[] = array
- (
- 'id' =>
$b_account_entry['id'],
- 'b_account_name' =>
$b_account_entry['descr'],
- 'lang_select' =>
lang('Select'),
- 'lang_select_statustext' =>
lang('Select this budget account')
- );
- }
-
- $table_header[] = array
- (
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'descr',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.b_account',
-
'cat_id'
=>$this->cat_id)
-
)),
- 'lang_name' => lang('Name'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.b_account',
-
'cat_id'
=>$this->cat_id)
-
)),
- 'lang_id' => lang('ID'),
- 'lang_select' => lang('Select')
- );
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Close this
window')
- );
-
- $link_select = array
- (
- 'menuaction' =>
$this->currentapp.'.uilookup.b_account',
- 'second_display' => true,
- 'order' => $this->order,
- 'sort' => $this->sort,
- 'cat_id' =>
$this->cat_id,
- 'query' => $this->query,
- 'filter' => $this->filter
- );
-
-
- $data = array
- (
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($b_account_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_b_account' =>
$table_header,
- 'values_b_account' =>
$content,
- 'table_done'
=> $table_done
- );
-
- $appname
= lang('budget account');
- $function_msg =
lang('list budget account');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_b_account' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
-
- function street()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-
'nextmatchs',
-
'search_field'));
-
- $street_list = $this->bo->read_street();
-
- while (is_array($street_list) && list(,$street_entry) =
each($street_list))
- {
- $content[] = array
- (
- 'id' =>
$street_entry['id'],
- 'street_name' =>
$street_entry['street_name'],
- 'lang_select' =>
lang('Select'),
- 'lang_select_statustext' =>
lang('Select this street')
- );
- }
-
- $table_header[] = array
- (
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'street_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.street',
-
'cat_id'
=>$this->cat_id)
-
)),
- 'lang_name' => lang('Street name'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.street',
-
'cat_id'
=>$this->cat_id)
-
)),
- 'lang_id' => lang('ID'),
- 'lang_select' => lang('Select')
- );
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Close this
window')
- );
-
- $link_select = array
- (
- 'menuaction' =>
$this->currentapp.'.uilookup.street',
- 'second_display' => true,
- 'order' => $this->order,
- 'sort' => $this->sort,
- 'cat_id' =>
$this->cat_id,
- 'query' => $this->query,
- 'filter' => $this->filter
- );
-
-
- $data = array
- (
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($street_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_street' =>
$table_header,
- 'values_street' => $content,
- 'table_done'
=> $table_done
- );
-
- $appname
= lang('street');
- $function_msg =
lang('list street');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_street' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function tenant()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-
'nextmatchs',
-
'search_field'));
-
- $tenant_list = $this->bo->read_tenant();
-
- while (is_array($tenant_list) && list(,$tenant_entry) =
each($tenant_list))
- {
- $content[] = array
- (
- 'id' =>
$tenant_entry['id'],
- 'last_name' =>
$tenant_entry['last_name'],
- 'first_name' =>
$tenant_entry['first_name'],
- 'lang_select' =>
lang('Select'),
- 'lang_select_statustext' =>
lang('Select this tenant')
- );
- }
-
- $table_header[] = array
- (
- 'sort_last_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'last_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.tenant',
-
'cat_id'
=>$this->cat_id)
-
)),
- 'sort_first_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'first_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.tenant',
-
'cat_id'
=>$this->cat_id)
-
)),
- 'lang_last_name' => lang('last
name'),
- 'lang_first_name' => lang('first
name'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.tenant',
-
'cat_id'
=>$this->cat_id)
-
)),
- 'lang_id' => lang('ID'),
- 'lang_select' => lang('Select')
- );
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Close this
window')
- );
-
- $link_select = array
- (
- 'menuaction' =>
$this->currentapp.'.uilookup.tenant',
- 'second_display' => true,
- 'order' => $this->order,
- 'sort' => $this->sort,
- 'cat_id' =>
$this->cat_id,
- 'query' => $this->query,
- 'filter' => $this->filter
- );
-
-
- $data = array
- (
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($tenant_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_tenant_new' =>
$table_header,
- 'values_tenant_new'
=> $content,
- 'table_done'
=> $table_done
- );
-
- $appname
= lang('tenant');
- $function_msg =
lang('list tenant');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_tenant' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function ns3420()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-
'nextmatchs',
-
'search_field'));
-
- $ns3420_list = $this->bo->read_ns3420();
-
- while (is_array($ns3420_list) && list(,$ns3420_entry) =
each($ns3420_list))
- {
- $content[] = array
- (
- 'id' =>
$ns3420_entry['id'],
- 'ns3420_descr' =>
$ns3420_entry['ns3420_descr'],
- 'lang_select' =>
lang('Select'),
- 'lang_select_statustext' =>
lang('Select this ns3420 - code')
- );
- }
-
- $table_header[] = array
- (
- 'sort_descr' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'tekst1',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.ns3420',
-
'query' =>$this->query)
-
)),
- 'lang_descr' => lang('ns3420
description'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.ns3420',
-
'query' =>$this->query)
-
)),
- 'lang_id' => lang('ID'),
- 'lang_select' => lang('Select')
- );
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Close this
window')
- );
-
- $link_select = array
- (
- 'menuaction' =>
$this->currentapp.'.uilookup.ns3420',
- 'second_display' => true,
- 'order' => $this->order,
- 'sort' => $this->sort,
- 'cat_id' =>
$this->cat_id,
- 'query' => $this->query,
- 'filter' => $this->filter
- );
-
-
- $data = array
- (
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($ns3420_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'lang_search'
=> lang('search'),
- 'query'
=> $this->query,
- 'table_header_ns3420' =>
$table_header,
- 'values_ns3420' => $content,
- 'table_done'
=> $table_done
- );
-
- $appname
= lang('standard description');
- $function_msg =
lang('list standard description');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_ns3420' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
-
- function entity()
- {
- $bocommon =
CreateObject($this->currentapp.'.bocommon');
- $boentity =
CreateObject($this->currentapp.'.boentity');
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- $this->start =
$boentity->start;
- $this->query =
$boentity->query;
- $this->sort =
$boentity->sort;
- $this->order =
$boentity->order;
- $this->filter =
$boentity->filter;
- $this->cat_id =
$boentity->cat_id;
- $this->part_of_town_id =
$boentity->part_of_town_id;
- $this->district_id =
$boentity->district_id;
- $this->entity_id =
$boentity->entity_id;
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
-
'nextmatchs',
-
'search_field'));
-
- $entity_list = $boentity->read(array('lookup'=>True));
-
- $input_name =
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp);
-//_debug_array($input_name);
-
- $uicols = $boentity->uicols;
-
-//_debug_array($uicols);
-
- $j=0;
-
- if (isset($entity_list) AND is_array($entity_list))
- {
- foreach($entity_list as $entity_entry)
- {
-
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
$content[$j]['row'][$i]['value'] = $entity_entry[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
- }
- }
-
- for ($i=0;$i<count($input_name);$i++)
- {
-
$content[$j]['hidden'][$i]['value'] = $entity_entry[$input_name[$i]];
-
$content[$j]['hidden'][$i]['name'] = $input_name[$i];
- }
-
- $j++;
- }
- }
-
-//_debug_array($content);
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['name'][$i]=='loc1')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'loc1',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.entity',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'district_id' =>
$this->district_id,
-
'lookup'
=>$lookup,
-
'entity_id'
=>$this->entity_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='num')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'num',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.entity',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'entity_id'
=>$this->entity_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- }
- }
-
- $table_header[$i]['width'] = '5%';
- $table_header[$i]['align'] =
'center';
- $table_header[$i]['header'] =
lang('select');
-
-
-//_debug_array($table_header);
-//_debug_array($uicols);
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Close this
window')
- );
-
- $link_select = array
- (
- 'menuaction' =>
$this->currentapp.'.uilookup.entity',
- 'order' => $this->order,
- 'sort' => $this->sort,
- 'cat_id' =>
$this->cat_id,
- 'entity_id' =>
$this->entity_id,
- 'district_id' => $this->district_id,
- 'query' => $this->query,
- 'filter' => $this->filter
- );
-
-
- for ($i=0;$i<count($input_name);$i++)
- {
- $function_exchange_values .=
'opener.document.form.' . $input_name[$i] .'.value = thisform.elements[' . $i .
'].value;' ."\r\n";
- }
-
- $function_exchange_values .='window.close()';
-
-
- $data = array
- (
- 'exchange_values'
=> 'Exchange_values(this.form);',
- 'function_exchange_values' =>
$function_exchange_values,
- 'lang_select'
=> lang('select'),
- 'lookup'
=> 1,//$lookup,
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($entity_list),
- 'all_records'
=> $boentity->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $boentity->select_category_list('filter',$this->cat_id),
- 'district_list'
=> $bocommon->select_district_list('filter',$this->district_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
- 'select_district_name' =>
'district_id',
- 'lang_select'
=> lang('Select'),
-
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_entity' =>
$table_header,
- 'values_entity'
=> $content,
- 'table_done'
=> $table_done
- );
-
-//_debug_array($content);
- if($this->entity_id)
- {
- $entity =
$boadmin_entity->read_single($this->entity_id,false);
- $appname = $entity['name'];
- }
- if($this->cat_id)
- {
- $category =
$boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
- $function_msg
= lang('lookup') . ' ' . $category['name'];
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- }
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_entity' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 core
+ * @version $Id: class.uilookup.inc.php,v 1.13 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uilookup
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $district_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'addressbook' => True,
+ 'vendor' => True,
+ 'b_account' => True,
+ 'location' => True,
+ 'entity' => True,
+ 'ns3420' => True,
+ 'street' => True,
+ 'tenant' => True
+ );
+
+ function uilookup()
+ {
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+ $GLOBALS['phpgw_info']['flags']['headonly']=true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->bo =
CreateObject($this->currentapp.'.bolookup',True);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->part_of_town_id =
$this->bo->part_of_town_id;
+ $this->district_id =
$this->bo->district_id;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' =>
$this->filter,
+ 'cat_id' =>
$this->cat_id,
+ 'part_of_town_id' =>
$this->part_of_town_id,
+ 'district_id' => $this->district_id
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function addressbook()
+ {
+
+ $this->cats =
CreateObject('phpgwapi.categories');
+ $this->cats->app_name = 'addressbook';
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
+
'nextmatchs',
+
'search_field',
+
'cat_filter'));
+
+ $second_display =
get_var('second_display',array('POST','GET'));
+ $column = get_var('column',array('POST','GET'));
+
+
+ $default_category =
$GLOBALS['phpgw_info']['user']['preferences']['addressbook']['default_category'];
+
+ if ($default_category && !$second_display)
+ {
+ $this->bo->cat_id = $default_category;
+ $this->cat_id = $default_category;
+ }
+
+ $addressbook_list = $this->bo->read_addressbook();
+
+ while (is_array($addressbook_list) &&
list(,$addressbook_entry) = each($addressbook_list))
+ {
+ $content[] = array
+ (
+ 'id' =>
$addressbook_entry['contact_id'],
+ 'contact_name' =>
$addressbook_entry['per_last_name'] . ', ' .
$addressbook_entry['per_first_name'],
+ 'lang_select' =>
lang('Select'),
+ 'lang_select_statustext' =>
lang('Select this contact')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'last_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.addressbook',
+
'cat_id' =>
$this->cat_id,
+
'column' =>
$column)
+
)),
+ 'lang_name' => lang('Name'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'person_id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.addressbook',
+
'cat_id'
=>$this->cat_id,
+
'column' =>
$column)
+
)),
+ 'lang_id' => lang('ID'),
+ 'lang_select' => lang('Select')
+ );
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Close this
window')
+ );
+
+ $link_select = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilookup.addressbook',
+ 'second_display' => true,
+ 'order' => $this->order,
+ 'sort' => $this->sort,
+ 'cat_id' =>
$this->cat_id,
+ 'query' => $this->query,
+ 'filter' =>
$this->filter,
+ 'column' => $column
+ );
+
+ if($column)
+ {
+ $contact_id =$column;
+ $contact_name =$column . '_name';
+ }
+ else
+ {
+ $contact_id ='contact_id';
+ $contact_name ='contact_name';
+ }
+
+ $cat_data =
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id,'globals' =>
True, 'link_data' =>$link_select));
+ $data = array
+ (
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($addressbook_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $cat_data['cat_list'],
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_contact' =>
$table_header,
+ 'values_contact'
=> $content,
+ 'table_done'
=> $table_done,
+ 'contact_id'
=> $contact_id,
+ 'contact_name'
=> $contact_name
+ );
+
+ $appname
= lang('addressbook');
+ $function_msg =
lang('list vendors');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_contact' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function vendor()
+ {
+
+ $this->cats =
CreateObject('phpgwapi.categories');
+ $this->cats->app_name = 'fm_vendor';
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
+
'nextmatchs',
+
'search_field',
+
'cat_filter'));
+
+ $second_display =
get_var('second_display',array('POST','GET'));
+ $column = get_var('column',array('POST','GET'));
+
+
+ $default_category =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['default_vendor_category'];
+
+ if ($default_category && !$second_display)
+ {
+ $this->bo->cat_id = $default_category;
+ $this->cat_id = $default_category;
+ }
+
+ $vendor_list = $this->bo->read_vendor();
+
+ while (is_array($vendor_list) && list(,$vendor_entry) =
each($vendor_list))
+ {
+ $content[] = array
+ (
+ 'id' =>
$vendor_entry['id'],
+ 'vendor_name' =>
$vendor_entry['org_name'],
+ 'lang_select' =>
lang('Select'),
+ 'lang_select_statustext' =>
lang('Select this vendor')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'org_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.vendor',
+
'cat_id' =>
$this->cat_id,
+
'column' =>
$column)
+
)),
+ 'lang_name' => lang('Name'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.vendor',
+
'cat_id'
=>$this->cat_id,
+
'column' =>
$column)
+
)),
+ 'lang_id' => lang('ID'),
+ 'lang_select' => lang('Select')
+ );
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Close this
window')
+ );
+
+ $link_select = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilookup.vendor',
+ 'second_display' => true,
+ 'order' => $this->order,
+ 'sort' => $this->sort,
+ 'cat_id' =>
$this->cat_id,
+ 'query' => $this->query,
+ 'filter' =>
$this->filter,
+ 'column' => $column
+ );
+
+ if($column)
+ {
+ $contact_id =$column;
+ $org_name =$column . '_org_name';
+ }
+ else
+ {
+ $contact_id ='vendor_id';
+ $org_name ='vendor_name';
+ }
+
+ $cat_data =
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id,'globals' =>
True, 'link_data' =>$link_select));
+ $data = array
+ (
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($vendor_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $cat_data['cat_list'],
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_vendor' =>
$table_header,
+ 'values_vendor'
=> $content,
+ 'table_done'
=> $table_done,
+ 'contact_id'
=> $contact_id,
+ 'org_name'
=> $org_name
+ );
+
+ $appname
= lang('vendor');
+ $function_msg =
lang('list vendors');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_vendor' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function b_account()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
+
'nextmatchs',
+
'search_field'));
+
+ $b_account_list = $this->bo->read_b_account();
+
+ while (is_array($b_account_list) &&
list(,$b_account_entry) = each($b_account_list))
+ {
+ $content[] = array
+ (
+ 'id' =>
$b_account_entry['id'],
+ 'b_account_name' =>
$b_account_entry['descr'],
+ 'lang_select' =>
lang('Select'),
+ 'lang_select_statustext' =>
lang('Select this budget account')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'descr',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.b_account',
+
'cat_id'
=>$this->cat_id)
+
)),
+ 'lang_name' => lang('Name'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.b_account',
+
'cat_id'
=>$this->cat_id)
+
)),
+ 'lang_id' => lang('ID'),
+ 'lang_select' => lang('Select')
+ );
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Close this
window')
+ );
+
+ $link_select = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilookup.b_account',
+ 'second_display' => true,
+ 'order' => $this->order,
+ 'sort' => $this->sort,
+ 'cat_id' =>
$this->cat_id,
+ 'query' => $this->query,
+ 'filter' => $this->filter
+ );
+
+
+ $data = array
+ (
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($b_account_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_b_account' =>
$table_header,
+ 'values_b_account' =>
$content,
+ 'table_done'
=> $table_done
+ );
+
+ $appname
= lang('budget account');
+ $function_msg =
lang('list budget account');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_b_account' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+
+ function street()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
+
'nextmatchs',
+
'search_field'));
+
+ $street_list = $this->bo->read_street();
+
+ while (is_array($street_list) && list(,$street_entry) =
each($street_list))
+ {
+ $content[] = array
+ (
+ 'id' =>
$street_entry['id'],
+ 'street_name' =>
$street_entry['street_name'],
+ 'lang_select' =>
lang('Select'),
+ 'lang_select_statustext' =>
lang('Select this street')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'street_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.street',
+
'cat_id'
=>$this->cat_id)
+
)),
+ 'lang_name' => lang('Street name'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.street',
+
'cat_id'
=>$this->cat_id)
+
)),
+ 'lang_id' => lang('ID'),
+ 'lang_select' => lang('Select')
+ );
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Close this
window')
+ );
+
+ $link_select = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilookup.street',
+ 'second_display' => true,
+ 'order' => $this->order,
+ 'sort' => $this->sort,
+ 'cat_id' =>
$this->cat_id,
+ 'query' => $this->query,
+ 'filter' => $this->filter
+ );
+
+
+ $data = array
+ (
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($street_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_street' =>
$table_header,
+ 'values_street' => $content,
+ 'table_done'
=> $table_done
+ );
+
+ $appname
= lang('street');
+ $function_msg =
lang('list street');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_street' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function tenant()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
+
'nextmatchs',
+
'search_field'));
+
+ $tenant_list = $this->bo->read_tenant();
+
+ while (is_array($tenant_list) && list(,$tenant_entry) =
each($tenant_list))
+ {
+ $content[] = array
+ (
+ 'id' =>
$tenant_entry['id'],
+ 'last_name' =>
$tenant_entry['last_name'],
+ 'first_name' =>
$tenant_entry['first_name'],
+ 'lang_select' =>
lang('Select'),
+ 'lang_select_statustext' =>
lang('Select this tenant')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_last_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'last_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.tenant',
+
'cat_id'
=>$this->cat_id)
+
)),
+ 'sort_first_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'first_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.tenant',
+
'cat_id'
=>$this->cat_id)
+
)),
+ 'lang_last_name' => lang('last
name'),
+ 'lang_first_name' => lang('first
name'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.tenant',
+
'cat_id'
=>$this->cat_id)
+
)),
+ 'lang_id' => lang('ID'),
+ 'lang_select' => lang('Select')
+ );
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Close this
window')
+ );
+
+ $link_select = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilookup.tenant',
+ 'second_display' => true,
+ 'order' => $this->order,
+ 'sort' => $this->sort,
+ 'cat_id' =>
$this->cat_id,
+ 'query' => $this->query,
+ 'filter' => $this->filter
+ );
+
+
+ $data = array
+ (
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($tenant_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_tenant_new' =>
$table_header,
+ 'values_tenant_new'
=> $content,
+ 'table_done'
=> $table_done
+ );
+
+ $appname
= lang('tenant');
+ $function_msg =
lang('list tenant');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_tenant' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function ns3420()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
+
'nextmatchs',
+
'search_field'));
+
+ $ns3420_list = $this->bo->read_ns3420();
+
+ while (is_array($ns3420_list) && list(,$ns3420_entry) =
each($ns3420_list))
+ {
+ $content[] = array
+ (
+ 'id' =>
$ns3420_entry['id'],
+ 'ns3420_descr' =>
$ns3420_entry['ns3420_descr'],
+ 'lang_select' =>
lang('Select'),
+ 'lang_select_statustext' =>
lang('Select this ns3420 - code')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_descr' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'tekst1',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.ns3420',
+
'query' =>$this->query)
+
)),
+ 'lang_descr' => lang('ns3420
description'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.ns3420',
+
'query' =>$this->query)
+
)),
+ 'lang_id' => lang('ID'),
+ 'lang_select' => lang('Select')
+ );
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Close this
window')
+ );
+
+ $link_select = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilookup.ns3420',
+ 'second_display' => true,
+ 'order' => $this->order,
+ 'sort' => $this->sort,
+ 'cat_id' =>
$this->cat_id,
+ 'query' => $this->query,
+ 'filter' => $this->filter
+ );
+
+
+ $data = array
+ (
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($ns3420_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'lang_search'
=> lang('search'),
+ 'query'
=> $this->query,
+ 'table_header_ns3420' =>
$table_header,
+ 'values_ns3420' => $content,
+ 'table_done'
=> $table_done
+ );
+
+ $appname
= lang('standard description');
+ $function_msg =
lang('list standard description');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_ns3420' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+
+ function entity()
+ {
+ $bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $boentity =
CreateObject($this->currentapp.'.boentity');
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ $this->start =
$boentity->start;
+ $this->query =
$boentity->query;
+ $this->sort =
$boentity->sort;
+ $this->order =
$boentity->order;
+ $this->filter =
$boentity->filter;
+ $this->cat_id =
$boentity->cat_id;
+ $this->part_of_town_id =
$boentity->part_of_town_id;
+ $this->district_id =
$boentity->district_id;
+ $this->entity_id =
$boentity->entity_id;
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
+
'nextmatchs',
+
'search_field'));
+
+ $entity_list = $boentity->read(array('lookup'=>True));
+
+ $input_name =
$GLOBALS['phpgw']->session->appsession('lookup_fields',$this->currentapp);
+//_debug_array($input_name);
+
+ $uicols = $boentity->uicols;
+
+//_debug_array($uicols);
+
+ $j=0;
+
+ if (isset($entity_list) AND is_array($entity_list))
+ {
+ foreach($entity_list as $entity_entry)
+ {
+
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$i]['value'] = $entity_entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+ }
+ }
+
+ for ($i=0;$i<count($input_name);$i++)
+ {
+
$content[$j]['hidden'][$i]['value'] = $entity_entry[$input_name[$i]];
+
$content[$j]['hidden'][$i]['name'] = $input_name[$i];
+ }
+
+ $j++;
+ }
+ }
+
+//_debug_array($content);
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['name'][$i]=='loc1')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'loc1',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.entity',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'district_id' =>
$this->district_id,
+
'lookup'
=>$lookup,
+
'entity_id'
=>$this->entity_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='num')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'num',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uilookup.entity',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'entity_id'
=>$this->entity_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ }
+ }
+
+ $table_header[$i]['width'] = '5%';
+ $table_header[$i]['align'] =
'center';
+ $table_header[$i]['header'] =
lang('select');
+
+
+//_debug_array($table_header);
+//_debug_array($uicols);
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Close this
window')
+ );
+
+ $link_select = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uilookup.entity',
+ 'order' => $this->order,
+ 'sort' => $this->sort,
+ 'cat_id' =>
$this->cat_id,
+ 'entity_id' =>
$this->entity_id,
+ 'district_id' => $this->district_id,
+ 'query' => $this->query,
+ 'filter' => $this->filter
+ );
+
+
+ for ($i=0;$i<count($input_name);$i++)
+ {
+ $function_exchange_values .=
'opener.document.form.' . $input_name[$i] .'.value = thisform.elements[' . $i .
'].value;' ."\r\n";
+ }
+
+ $function_exchange_values .='window.close()';
+
+
+ $data = array
+ (
+ 'exchange_values'
=> 'Exchange_values(this.form);',
+ 'function_exchange_values' =>
$function_exchange_values,
+ 'lang_select'
=> lang('select'),
+ 'lookup'
=> 1,//$lookup,
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($entity_list),
+ 'all_records'
=> $boentity->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $boentity->select_category_list('filter',$this->cat_id),
+ 'district_list'
=> $bocommon->select_district_list('filter',$this->district_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+ 'select_district_name' =>
'district_id',
+ 'lang_select'
=> lang('Select'),
+
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_entity' =>
$table_header,
+ 'values_entity'
=> $content,
+ 'table_done'
=> $table_done
+ );
+
+//_debug_array($content);
+ if($this->entity_id)
+ {
+ $entity =
$boadmin_entity->read_single($this->entity_id,false);
+ $appname = $entity['name'];
+ }
+ if($this->cat_id)
+ {
+ $category =
$boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
+ $function_msg
= lang('lookup') . ' ' . $category['name'];
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ }
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_entity' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ }
+?>
Index: property/inc/class.uimeter.inc.php
diff -u property/inc/class.uimeter.inc.php:1.9
property/inc/class.uimeter.inc.php:1.10
--- property/inc/class.uimeter.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uimeter.inc.php Fri Feb 3 12:05:49 2006
@@ -1,583 +1,583 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 entity
- * @version $Id: class.uimeter.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uimeter
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- );
-
- function uimeter()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.bometer');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.meter';
- $this->acl_read =
$this->acl2->check('.meter',1);
- $this->acl_add =
$this->acl2->check('.meter',2);
- $this->acl_edit =
$this->acl2->check('.meter',4);
- $this->acl_delete =
$this->acl2->check('.meter',8);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
-
- $this->menu->sub ='meter';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('meter','values','table_header',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links = $this->menu->links();
-
- $meter_list = $this->bo->read();
-
- $uicols = $this->bo->uicols;
-//_debug_array($uicols);
-
- $m = count($uicols['name']);
- $j=0;
- if (isset($meter_list) AND is_array($meter_list))
- {
- foreach($meter_list as $meter_entry)
- {
- for ($k=0;$k<$m;$k++)
- {
-
if($uicols['input_type'][$k]!='hidden')
- {
-
-
if($meter_entry['query_location'][$uicols['name'][$k]])
- {
-
$content[$j]['row'][$k]['statustext'] = lang('search');
-
$content[$j]['row'][$k]['text'] =
$meter_entry[$uicols['name'][$k]];
-
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.index&query='
. $meter_entry['query_location'][$uicols['name'][$k]] . '&lookup=' . $lookup);
- }
- else
- {
-
$content[$j]['row'][$k]['value'] =
$meter_entry[$uicols['name'][$k]];
-
$content[$j]['row'][$k]['name'] = $uicols['name'][$k];
- }
- }
- }
-
- if(!$lookup)
- {
- if($this->acl_read)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('view the
meter');
-
$content[$j]['row'][$k]['text'] = lang('view');
-
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.view&id='
. $meter_entry['meter_id']);
- $k++;
- }
-
- if($this->acl_edit)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('edit the
meter');
-
$content[$j]['row'][$k]['text'] = lang('edit');
-
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.edit&id='
. $meter_entry['meter_id']);
- $k++;
- }
-
- if($this->acl_delete)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('delete the
meter');
-
$content[$j]['row'][$k]['text'] =
lang('delete');
-
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.delete&id='
. $meter_entry['meter_id']);
- $k++;
- }
- }
- $j++;
- }
- }
-
- $m = count($uicols['descr']);
- for ($i=0;$i<$m;$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['name'][$i]=='loc1')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'location_code',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uimeter.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='num')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'num',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uimeter.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='address')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'address',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uimeter.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- }
- }
-
- if(!$lookup)
- {
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
- }
- else
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header'] =
lang('select');
- }
-
-//_debug_array($content);
- if($this->acl_add)
- {
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
meter'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.edit')
-
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uimeter.index',
- 'start' =>
$this->start,
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
-
- $data = array
- (
- 'links'
=> $links,
- 'allow_allrows'
=> False,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($meter_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the meter belongs to. To do not use a category select
NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->get_category_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('meter');
- $function_msg =
lang('list meter');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $id =
get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('meter'));
-
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
- $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
-
- for ($j=0;$j<count($insert_record_entity);$j++)
- {
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
- }
-
- if ($values['save'])
- {
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
-
- if(!$values['num'] && !$id)
- {
-
$receipt['error'][]=array('msg'=>lang('Enter a meter ID !'));
- }
-
- if($id)
- {
- $values['meter_id']=$id;
- $action='edit';
- }
- else
- {
-
if($this->bo->check_meter_num($values['num']))
- {
-
$receipt['error'][]=array('msg'=>lang('This meter id is already registered!') .
'[ '.$values['num'].' ]');
- $error_id=true;
- unset($values['num']);
- }
- else
- {
- $id = $values['meter_id'];
- }
- }
-
- if(!$values['location'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
- }
-
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save($values,$action);
- $id = $receipt['meter_id'];
- }
- else
- {
- if($values['location'])
- {
- $location_code=implode("-",
$values['location']);
- $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
- }
- if($values['extra']['p_num'])
- {
-
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
- }
- }
- }
-
- if ($id)
- {
- $values = $this->bo->read_single($id);
-// _debug_array($meter);
- $function_msg = lang('edit meter');
- $action='edit';
- }
- else
- {
- $function_msg = lang('add meter');
- $action='add';
- }
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uimeter.edit',
- 'id' => $id
- );
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' => -1,
// calculated from location_types
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
False,
- 'lookup_type' => 'form',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('meter'),
- 'entity_data' => $values['p']
- ));
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'location_data'
=> $location_data,
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.index'),
- 'lang_meter_id'
=> lang('meter ID'),
- 'lang_name'
=> lang('name'),
- 'lang_remark'
=> lang('Remark'),
- 'lang_category'
=> lang('category'),
- 'lang_access'
=> lang('private'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_meter_id'
=> $values['num'],
- 'value_name'
=> $values['name'],
- 'value_remark'
=> $values['remark'],
- 'lang_meter_id_statustext' =>
lang('Enter the meter ID'),
- 'lang_name_statustext' =>
lang('Enter the name of the meter'),
- 'lang_remark_statustext' =>
lang('Enter a remark - if any'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the meter'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the meter belongs to. To do not use a category select
NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'cat_list'
=> $this->bo->get_category_list('select',$this->cat_id)
- );
-
- $appname
= lang('meter');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
-
- $id = get_var('id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uimeter.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.delete&id='
. $id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('meter');
- $function_msg =
lang('delete meter');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
- $id =
get_var('id',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('meter'));
-
-
- $values = $this->bo->read_single($id);
- $function_msg = lang('View meter');
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uimeter.edit',
- 'id' => $id
- );
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
False,
- 'lookup_type' => 'view',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('meter'),
- 'entity_data' => $values['p']
- ));
-
- $data = array
- (
- 'location_data'
=> $location_data,
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.index'),
- 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.edit&id='
. $id),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_edit_statustext' =>
lang('Edit this meter'),
- 'lang_done'
=> lang('done'),
- 'lang_edit'
=> lang('edit'),
- 'lang_meter_id'
=> lang('meter ID'),
- 'lang_name'
=> lang('name'),
- 'lang_remark'
=> lang('Remark'),
- 'lang_category'
=> lang('category'),
- 'lang_access'
=> lang('private'),
- 'value_meter_id'
=> $id,
- 'value_name'
=> $values['name'],
- 'value_remark'
=> $values['remark'],
- 'cat_list'
=> $this->bo->get_category_list('',$this->cat_id),
- );
-
- $appname
= lang('meter');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 entity
+ * @version $Id: class.uimeter.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uimeter
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ );
+
+ function uimeter()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.bometer');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.meter';
+ $this->acl_read =
$this->acl2->check('.meter',1);
+ $this->acl_add =
$this->acl2->check('.meter',2);
+ $this->acl_edit =
$this->acl2->check('.meter',4);
+ $this->acl_delete =
$this->acl2->check('.meter',8);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+
+ $this->menu->sub ='meter';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('meter','values','table_header',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links = $this->menu->links();
+
+ $meter_list = $this->bo->read();
+
+ $uicols = $this->bo->uicols;
+//_debug_array($uicols);
+
+ $m = count($uicols['name']);
+ $j=0;
+ if (isset($meter_list) AND is_array($meter_list))
+ {
+ foreach($meter_list as $meter_entry)
+ {
+ for ($k=0;$k<$m;$k++)
+ {
+
if($uicols['input_type'][$k]!='hidden')
+ {
+
+
if($meter_entry['query_location'][$uicols['name'][$k]])
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('search');
+
$content[$j]['row'][$k]['text'] =
$meter_entry[$uicols['name'][$k]];
+
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.index&query='
. $meter_entry['query_location'][$uicols['name'][$k]] . '&lookup=' . $lookup);
+ }
+ else
+ {
+
$content[$j]['row'][$k]['value'] =
$meter_entry[$uicols['name'][$k]];
+
$content[$j]['row'][$k]['name'] = $uicols['name'][$k];
+ }
+ }
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('view the
meter');
+
$content[$j]['row'][$k]['text'] = lang('view');
+
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.view&id='
. $meter_entry['meter_id']);
+ $k++;
+ }
+
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('edit the
meter');
+
$content[$j]['row'][$k]['text'] = lang('edit');
+
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.edit&id='
. $meter_entry['meter_id']);
+ $k++;
+ }
+
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('delete the
meter');
+
$content[$j]['row'][$k]['text'] =
lang('delete');
+
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.delete&id='
. $meter_entry['meter_id']);
+ $k++;
+ }
+ }
+ $j++;
+ }
+ }
+
+ $m = count($uicols['descr']);
+ for ($i=0;$i<$m;$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['name'][$i]=='loc1')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'location_code',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uimeter.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='num')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'num',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uimeter.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='address')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'address',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uimeter.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ }
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+ }
+ else
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header'] =
lang('select');
+ }
+
+//_debug_array($content);
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
meter'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.edit')
+
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uimeter.index',
+ 'start' =>
$this->start,
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+
+ $data = array
+ (
+ 'links'
=> $links,
+ 'allow_allrows'
=> False,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($meter_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the meter belongs to. To do not use a category select
NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->get_category_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('meter');
+ $function_msg =
lang('list meter');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $id =
get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('meter'));
+
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+ $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
+
+ for ($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+
+ if ($values['save'])
+ {
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+
+ if(!$values['num'] && !$id)
+ {
+
$receipt['error'][]=array('msg'=>lang('Enter a meter ID !'));
+ }
+
+ if($id)
+ {
+ $values['meter_id']=$id;
+ $action='edit';
+ }
+ else
+ {
+
if($this->bo->check_meter_num($values['num']))
+ {
+
$receipt['error'][]=array('msg'=>lang('This meter id is already registered!') .
'[ '.$values['num'].' ]');
+ $error_id=true;
+ unset($values['num']);
+ }
+ else
+ {
+ $id = $values['meter_id'];
+ }
+ }
+
+ if(!$values['location'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
+ }
+
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save($values,$action);
+ $id = $receipt['meter_id'];
+ }
+ else
+ {
+ if($values['location'])
+ {
+ $location_code=implode("-",
$values['location']);
+ $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
+ }
+ if($values['extra']['p_num'])
+ {
+
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
+ }
+ }
+ }
+
+ if ($id)
+ {
+ $values = $this->bo->read_single($id);
+// _debug_array($meter);
+ $function_msg = lang('edit meter');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add meter');
+ $action='add';
+ }
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uimeter.edit',
+ 'id' => $id
+ );
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' => -1,
// calculated from location_types
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
False,
+ 'lookup_type' => 'form',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('meter'),
+ 'entity_data' => $values['p']
+ ));
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'location_data'
=> $location_data,
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.index'),
+ 'lang_meter_id'
=> lang('meter ID'),
+ 'lang_name'
=> lang('name'),
+ 'lang_remark'
=> lang('Remark'),
+ 'lang_category'
=> lang('category'),
+ 'lang_access'
=> lang('private'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_meter_id'
=> $values['num'],
+ 'value_name'
=> $values['name'],
+ 'value_remark'
=> $values['remark'],
+ 'lang_meter_id_statustext' =>
lang('Enter the meter ID'),
+ 'lang_name_statustext' =>
lang('Enter the name of the meter'),
+ 'lang_remark_statustext' =>
lang('Enter a remark - if any'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the meter'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the meter belongs to. To do not use a category select
NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'cat_list'
=> $this->bo->get_category_list('select',$this->cat_id)
+ );
+
+ $appname
= lang('meter');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ if(!$this->acl_delete)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+
+ $id = get_var('id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uimeter.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.delete&id='
. $id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('meter');
+ $function_msg =
lang('delete meter');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+ $id =
get_var('id',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('meter'));
+
+
+ $values = $this->bo->read_single($id);
+ $function_msg = lang('View meter');
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uimeter.edit',
+ 'id' => $id
+ );
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
False,
+ 'lookup_type' => 'view',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('meter'),
+ 'entity_data' => $values['p']
+ ));
+
+ $data = array
+ (
+ 'location_data'
=> $location_data,
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.index'),
+ 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uimeter.edit&id='
. $id),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_edit_statustext' =>
lang('Edit this meter'),
+ 'lang_done'
=> lang('done'),
+ 'lang_edit'
=> lang('edit'),
+ 'lang_meter_id'
=> lang('meter ID'),
+ 'lang_name'
=> lang('name'),
+ 'lang_remark'
=> lang('Remark'),
+ 'lang_category'
=> lang('category'),
+ 'lang_access'
=> lang('private'),
+ 'value_meter_id'
=> $id,
+ 'value_name'
=> $values['name'],
+ 'value_remark'
=> $values['remark'],
+ 'cat_list'
=> $this->bo->get_category_list('',$this->cat_id),
+ );
+
+ $appname
= lang('meter');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uip_of_town.inc.php
diff -u property/inc/class.uip_of_town.inc.php:1.9
property/inc/class.uip_of_town.inc.php:1.10
--- property/inc/class.uip_of_town.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uip_of_town.inc.php Fri Feb 3 12:05:49 2006
@@ -1,366 +1,366 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uip_of_town.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uip_of_town
- {
- var $grants;
- var $district_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uip_of_town()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.bop_of_town',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->start = $this->bo->start;
- $this->query = $this->bo->query;
- $this->sort = $this->bo->sort;
- $this->order = $this->bo->order;
- $this->filter = $this->bo->filter;
- $this->district_id =
$this->bo->district_id;
- $this->allrows = $this->bo->allrows;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'district_id' => $this->district_id,
- 'this->allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- $GLOBALS['phpgw']->xslttpl->add_file(array('p_of_town',
-
'menu',
-
'receipt',
-
'search_field',
-
'nextmatchs'));
-
- $links = $this->menu->links();
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','p_of_town_receipt');
-
$GLOBALS['phpgw']->session->appsession('session_data','p_of_town_receipt','');
-
- $p_of_towns_list = $this->bo->read();
-
- if (isSet($p_of_towns_list) AND
is_array($p_of_towns_list))
- {
- foreach($p_of_towns_list as $p_of_town)
- {
- $content[] = array
- (
- 'part_of_town_id'
=> $p_of_town['part_of_town_id'],
- 'name'
=> $p_of_town['name'],
- 'category'
=> $p_of_town['category'],
- 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.view&part_of_town_id='
. $p_of_town['part_of_town_id']),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.edit&part_of_town_id='
. $p_of_town['part_of_town_id']),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.delete&part_of_town_id='
. $p_of_town['part_of_town_id']),
- 'lang_view_statustext'
=> lang('view the p_of_town'),
- 'lang_edit_statustext'
=> lang('edit the p_of_town'),
- 'lang_delete_statustext'
=> lang('delete the p_of_town'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
- }
-
- $table_header = array
- (
- 'lang_name' => lang('name'),
- 'lang_time_created' => lang('time created'),
- 'lang_view' => lang('view'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'lang_part_of_town_id' => lang('Part
of town id'),
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uip_of_town.index',
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_part_of_town_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'part_of_town_id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uip_of_town.index',
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_category' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'descr',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uip_of_town.index',
-
'district_id'
=>$this->district_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_category' => lang('category')
- );
-
- $table_add = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add a part of
town'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.edit')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uip_of_town.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'district_id'
=>$this->district_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
- 'allow_allrows'
=> true,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($p_of_towns_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
- 'select_district_name' =>
'district_id',
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
- $this->save_sessiondata();
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('part of town') . ': ' . lang('list part of town');
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function edit()
- {
- $part_of_town_id =
get_var('part_of_town_id',array('POST','GET'));
- $values = get_var('values',array('POST'));
-
- if($GLOBALS['phpgw']->is_repost())
- {
-// $receipt['error'][]=array('msg'=>lang('Repost
!'));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('p_of_town'));
-
- if ($values['save'] || $values['apply'])
- {
- if(!$values['district_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a district !'));
- }
-
- if(!$values['name'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
- }
-
- if(!$receipt['error'])
- {
- $values['part_of_town_id'] =
$part_of_town_id;
- $receipt = $this->bo->save($values);
- $part_of_town_id =
$receipt['part_of_town_id'];
- $this->district_id =
($values['district_id']?$values['district_id']:$this->district_id);
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','p_of_town_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.index');
- }
- }
- }
-
- if ($values['cancel'])
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.index');
- }
-
-
- if ($part_of_town_id)
- {
- $values =
$this->bo->read_single($part_of_town_id);
- $this->district_id =
($values['district_id']?$values['district_id']:$this->district_id);
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uip_of_town.edit',
- 'part_of_town_id' =>
$part_of_town_id
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'abook_data'
=> $abook_data,
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_part_of_town_id' =>
lang('ID'),
- 'value_part_of_town_id' =>
$part_of_town_id,
- 'lang_name'
=> lang('name'),
- 'lang_district'
=> lang('District'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'value_name'
=> $values['name'],
- 'lang_name_statustext' =>
lang('Enter a name for this part of town'),
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the part of town untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the part of town and return back to the list'),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext'
=> lang('Select the district the part of town belongs to.'),
- 'select_district_name' =>
'values[district_id]',
- 'district_list'
=> $this->bocommon->select_district_list('select',$this->district_id)
- );
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('part of town') . ': ' . ($part_of_town_id?lang('edit part og
town'):lang('add part of town'));
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function delete()
- {
- $part_of_town_id =
get_var('part_of_town_id',array('POST','GET'));
- $delete = get_var('delete',array('POST'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uip_of_town.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($part_of_town_id);
-
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.delete&part_of_town_id='
. $part_of_town_id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('aprt of town');
- $function_msg =
lang('delete part of town');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view()
- {
- $part_of_town_id =
get_var('part_of_town_id',array('GET'));
- $action = get_var('action',array('GET'));
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('part of town') . ': ' . lang('view part of town');
-
- $GLOBALS['phpgw']->xslttpl->add_file('p_of_town');
-
- $p_of_town = $this->bo->read_single($part_of_town_id);
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.index'),
- 'lang_id' => lang('ID'),
- 'lang_name' => lang('name'),
- 'lang_district' => lang('District'),
- 'lang_done' => lang('done'),
- 'value_id' =>
$p_of_town['id'],
- 'value_name' => $p_of_town['name'],
- 'value_district' =>
$this->bo->read_district_name($p_of_town['district_id']),
- 'value_date' =>
$GLOBALS['phpgw']->common->show_date($p_of_town['entry_date'])
- );
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uip_of_town.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uip_of_town
+ {
+ var $grants;
+ var $district_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uip_of_town()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.bop_of_town',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->start = $this->bo->start;
+ $this->query = $this->bo->query;
+ $this->sort = $this->bo->sort;
+ $this->order = $this->bo->order;
+ $this->filter = $this->bo->filter;
+ $this->district_id =
$this->bo->district_id;
+ $this->allrows = $this->bo->allrows;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'district_id' => $this->district_id,
+ 'this->allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ $GLOBALS['phpgw']->xslttpl->add_file(array('p_of_town',
+
'menu',
+
'receipt',
+
'search_field',
+
'nextmatchs'));
+
+ $links = $this->menu->links();
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','p_of_town_receipt');
+
$GLOBALS['phpgw']->session->appsession('session_data','p_of_town_receipt','');
+
+ $p_of_towns_list = $this->bo->read();
+
+ if (isSet($p_of_towns_list) AND
is_array($p_of_towns_list))
+ {
+ foreach($p_of_towns_list as $p_of_town)
+ {
+ $content[] = array
+ (
+ 'part_of_town_id'
=> $p_of_town['part_of_town_id'],
+ 'name'
=> $p_of_town['name'],
+ 'category'
=> $p_of_town['category'],
+ 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.view&part_of_town_id='
. $p_of_town['part_of_town_id']),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.edit&part_of_town_id='
. $p_of_town['part_of_town_id']),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.delete&part_of_town_id='
. $p_of_town['part_of_town_id']),
+ 'lang_view_statustext'
=> lang('view the p_of_town'),
+ 'lang_edit_statustext'
=> lang('edit the p_of_town'),
+ 'lang_delete_statustext'
=> lang('delete the p_of_town'),
+ 'text_view'
=> lang('view'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+ }
+
+ $table_header = array
+ (
+ 'lang_name' => lang('name'),
+ 'lang_time_created' => lang('time created'),
+ 'lang_view' => lang('view'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'lang_part_of_town_id' => lang('Part
of town id'),
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uip_of_town.index',
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
)),
+ 'sort_part_of_town_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'part_of_town_id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uip_of_town.index',
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
)),
+ 'sort_category' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'descr',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uip_of_town.index',
+
'district_id'
=>$this->district_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_category' => lang('category')
+ );
+
+ $table_add = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add a part of
town'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.edit')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uip_of_town.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'district_id'
=>$this->district_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'allow_allrows'
=> true,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($p_of_towns_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+ 'select_district_name' =>
'district_id',
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+ $this->save_sessiondata();
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('part of town') . ': ' . lang('list part of town');
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function edit()
+ {
+ $part_of_town_id =
get_var('part_of_town_id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+
+ if($GLOBALS['phpgw']->is_repost())
+ {
+// $receipt['error'][]=array('msg'=>lang('Repost
!'));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('p_of_town'));
+
+ if ($values['save'] || $values['apply'])
+ {
+ if(!$values['district_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a district !'));
+ }
+
+ if(!$values['name'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $values['part_of_town_id'] =
$part_of_town_id;
+ $receipt = $this->bo->save($values);
+ $part_of_town_id =
$receipt['part_of_town_id'];
+ $this->district_id =
($values['district_id']?$values['district_id']:$this->district_id);
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','p_of_town_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.index');
+ }
+ }
+ }
+
+ if ($values['cancel'])
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.index');
+ }
+
+
+ if ($part_of_town_id)
+ {
+ $values =
$this->bo->read_single($part_of_town_id);
+ $this->district_id =
($values['district_id']?$values['district_id']:$this->district_id);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uip_of_town.edit',
+ 'part_of_town_id' =>
$part_of_town_id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'abook_data'
=> $abook_data,
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_part_of_town_id' =>
lang('ID'),
+ 'value_part_of_town_id' =>
$part_of_town_id,
+ 'lang_name'
=> lang('name'),
+ 'lang_district'
=> lang('District'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_apply'
=> lang('apply'),
+ 'value_name'
=> $values['name'],
+ 'lang_name_statustext' =>
lang('Enter a name for this part of town'),
+ 'lang_apply_statustext' =>
lang('Apply the values'),
+ 'lang_cancel_statustext' =>
lang('Leave the part of town untouched and return back to the list'),
+ 'lang_save_statustext' =>
lang('Save the part of town and return back to the list'),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext'
=> lang('Select the district the part of town belongs to.'),
+ 'select_district_name' =>
'values[district_id]',
+ 'district_list'
=> $this->bocommon->select_district_list('select',$this->district_id)
+ );
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('part of town') . ': ' . ($part_of_town_id?lang('edit part og
town'):lang('add part of town'));
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function delete()
+ {
+ $part_of_town_id =
get_var('part_of_town_id',array('POST','GET'));
+ $delete = get_var('delete',array('POST'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uip_of_town.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($part_of_town_id);
+
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.delete&part_of_town_id='
. $part_of_town_id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('aprt of town');
+ $function_msg =
lang('delete part of town');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view()
+ {
+ $part_of_town_id =
get_var('part_of_town_id',array('GET'));
+ $action = get_var('action',array('GET'));
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('part of town') . ': ' . lang('view part of town');
+
+ $GLOBALS['phpgw']->xslttpl->add_file('p_of_town');
+
+ $p_of_town = $this->bo->read_single($part_of_town_id);
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uip_of_town.index'),
+ 'lang_id' => lang('ID'),
+ 'lang_name' => lang('name'),
+ 'lang_district' => lang('District'),
+ 'lang_done' => lang('done'),
+ 'value_id' =>
$p_of_town['id'],
+ 'value_name' => $p_of_town['name'],
+ 'value_district' =>
$this->bo->read_district_name($p_of_town['district_id']),
+ 'value_date' =>
$GLOBALS['phpgw']->common->show_date($p_of_town['entry_date'])
+ );
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uipricebook.inc.php
diff -u property/inc/class.uipricebook.inc.php:1.13
property/inc/class.uipricebook.inc.php:1.14
--- property/inc/class.uipricebook.inc.php:1.13 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uipricebook.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1366 +1,1366 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 agreement
- * @version $Id: class.uipricebook.inc.php,v 1.13 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uipricebook
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'activity' => True,
- 'index' => True,
- 'agreement_group' => True,
- 'edit_agreement_group' => True,
- 'edit_activity' => True,
- 'activity_vendor' => True,
- 'prizing' => True,
- 'delete' => True,
- 'excel' => True,
- 'excel_2' => True
- );
-
- function uipricebook()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
-
- $this->bo =
CreateObject($this->currentapp.'.bopricebook',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
- $this->contacts =
CreateObject($this->currentapp.'.soactor');
- $this->contacts->role = 'vendor';
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.pricebook';
- $this->acl_read =
$this->acl2->check('.pricebook',1);
- $this->acl_add =
$this->acl2->check('.pricebook',2);
- $this->acl_edit =
$this->acl2->check('.pricebook',4);
- $this->acl_delete =
$this->acl2->check('.pricebook',8);
- $this->acl_manage =
$this->acl2->check('.pricebook',16);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->allrows =
$this->bo->allrows;
-
- $this->menu->sub ='agreement';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
-
- function excel()
- {
-
- $list = $this->bo->read();
-
- $name =
array('num','branch','vendor_id','m_cost','w_cost','total_cost','this_index','unit','descr','index_count');
- $descr = array(lang('Activity Num'),
-
lang('Branch'),
-
lang('Vendor'),
-
lang('Material cost'),
-
lang('Labour cost'),
-
lang('Total Cost'),
-
lang('Last index'),
-
lang('Unit'),
-
lang('Description'),
-
lang('Index Count')
- );
-
- $this->bocommon->excel($list,$name,$descr);
- }
-
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->session->appsession('referer',$this->currentapp,'');
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links = $this->menu->links('price_vendor');
-
- $values =
get_var('values',array('POST'));
- $values['date'] = get_var('date',array('POST'));
-
-//_debug_array($values);
- if($values['submit_update'])
- {
- $receipt=$this->bo->update_pricebook($values);
- }
-
-
- $pricebook_list = $this->bo->read();
-
- $i=0;
- if (isSet($pricebook_list) AND
is_array($pricebook_list))
- {
- foreach($pricebook_list as $pricebook)
- {
- if($this->acl_manage)
- {
- $link_edit
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_activity&activity_id='
. $pricebook['activity_id']);
- $link_prizing
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']
.'&cat_id=' .$this->cat_id);
- $lang_edit_statustext
= lang('edit the pricebook');
- $lang_prizing_statustext
= lang('view or edit prizing history of this element');
- $text_edit
= lang('edit');
- $text_prizing
= lang('prizing');
- }
-
- $content[] = array
- (
- 'counter'
=> $i,
- 'activity_id'
=> $pricebook['activity_id'],
- 'num'
=> $pricebook['num'],
- 'branch'
=> $pricebook['branch'],
- 'vendor_id'
=> $pricebook['vendor_id'],
- 'm_cost'
=> $pricebook['m_cost'],
- 'w_cost'
=> $pricebook['w_cost'],
- 'total_cost'
=> $pricebook['total_cost'],
- 'this_index'
=> $pricebook['this_index'],
- 'unit'
=> $pricebook['unit'],
- 'descr'
=> $pricebook['descr'],
- 'index_count'
=> $pricebook['index_count'],
- 'link_edit'
=> $link_edit,
- 'link_prizing'
=> $link_prizing,
- 'lang_edit_statustext'
=> $lang_edit_statustext,
- 'lang_prizing_statustext'
=> $lang_prizing_statustext,
- 'text_edit'
=> $text_edit,
- 'text_prizing'
=> $text_prizing
- );
-
- $i++;
- }
- }
-
- $table_header[] = array
- (
- 'sort_num' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'num',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.index',
-
'cat_id'
=>$this->cat_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_index_count' => lang('Index Count'),
- 'lang_num' =>
lang('Activity Num'),
- 'lang_branch' => lang('Branch'),
- 'lang_vendor' => lang('Vendor'),
- 'lang_select' => lang('Select'),
- 'lang_total_cost' => lang('Total Cost'),
- 'lang_prizing' => lang('Prizing'),
- 'lang_last_index' => lang('Last index'),
- 'lang_descr' => lang('Description'),
- 'lang_m_cost' => lang('Material
cost'),
- 'lang_w_cost' => lang('Labour cost'),
- 'lang_prizing' => lang('Prizing'),
- 'lang_unit' => lang('Unit'),
- 'lang_view' => lang('view'),
- 'lang_edit' => lang('edit'),
- 'sort_total_cost' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'total_cost',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.index',
-
'cat_id'
=>$this->cat_id,
-
'allrows'
=>$this->allrows)
-
))
- );
-
-
- if($this->acl_manage)
- {
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $table_update[] = array
- (
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup'
=> "Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
- 'lang_new_index'
=> lang('New index'),
- 'lang_new_index_statustext' =>
lang('Enter a new index'),
- 'lang_date_statustext' =>
lang('Select the date for the update'),
- 'lang_update'
=> lang('Update'),
- 'lang_update_statustext' =>
lang('update selected investments')
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.excel',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'allrows'
=>$this->allrows,
- 'start' =>$this->start
- );
-
- $data = array
- (
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($pricebook_list),
- 'all_records'
=> $this->bo->total_records,
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the pricebook belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->get_vendor_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_update'
=> $table_update,
- 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.index')
);
-
- $appname
= lang('pricebook');
- $function_msg =
lang('list pricebook per vendor');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function agreement_group()
- {
- if(!$this->acl_manage)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->session->appsession('referer',$this->currentapp,'');
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links =
$this->menu->links('agreement','agreement_group');
-
- $agreement_list = $this->bo->read_agreement_group();
-
- while (is_array($agreement_list) && list(,$agreement) =
each($agreement_list))
- {
- $content[] = array
- (
- 'agreement_group_id'
=> $agreement['agreement_group_id'],
- 'num'
=> $agreement['num'],
- 'status'
=> lang($agreement['status']),
- 'descr'
=> $agreement['descr'],
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_agreement_group&agreement_group_id='
. $agreement['agreement_group_id']),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method=agreement_group&agreement_group_id='
. $agreement['agreement_group_id'] .'&start=' . $this->start),
- 'lang_edit_statustext' =>
lang('edit the agreement_group'),
- 'lang_delete_statustext' =>
lang('Delete this agreement_group'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
- $table_header[] = array
- (
- 'lang_id' => lang('ID'),
- 'sort_num' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'num',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.agreement_group',
-
'cat_id'
=>$this->cat_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_num' =>
lang('Activity Num'),
- 'lang_delete' => lang('Delete'),
- 'lang_descr' => lang('Description'),
- 'lang_edit' => lang('edit')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.agreement_group',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add an
activity'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_agreement_group')
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $data = array
- (
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($agreement_list),
- 'all_records'
=> $this->bo->total_records,
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_status_statustext' =>
lang('Select the status the agreement group belongs to. To do not use a
category select NO STATUS'),
- 'status_name'
=> 'cat_id',
- 'lang_no_status'
=> lang('No status'),
- 'status_list'
=> $this->bo->select_status_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_agreement_group' =>
$table_header,
- 'values_agreement_group'
=> $content,
- 'table_add'
=> $table_add,
- 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.agreement_group')
- );
-
- $appname
= lang('pricebook');
- $function_msg =
lang('list agreement group');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('agreement_group' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit_agreement_group()
- {
- if(!$this->acl_manage)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
- $agreement_group_id =
get_var('agreement_group_id',array('POST','GET'));
- $values =
get_var('values',array('POST','GET'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('pricebook'));
-
- if ($values['save'])
- {
- $values['agreement_group_id'] =
$agreement_group_id;
-
- if(!$values['num'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter an agreement group code
!'));
- $error_id=true;
- }
- if(!$values['status'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
- }
-
-
- if($values['num'] && !$agreement_group_id)
- {
-
if($this->bo->check_agreement_group_num($values['num']))
- {
-
$receipt['error'][]=array('msg'=>lang('This agreement group code is already
registered!') . '[ '.$values['num'] .' ]');
- $error_id=true;
- }
- }
-
- if($agreement_group_id)
- {
- $action='edit';
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save_agreement_group($values,$action);
- if(!$agreement_group_id)
- {
-
$agreement_group_id=$receipt['agreement_group_id'];
- }
-
- }
-
- if($agreement_group_id)
- {
-
$values['agreement_group_id']=$agreement_group_id;
- $action='edit';
- }
- else
- {
- $agreement_group_id =
$values['agreement_group_id'];
- }
- }
- else
- {
- $values['agreement_group_id']=
$agreement_group_id;
- if($agreement_group_id)
- {
- $values =
$this->bo->read_single_agreement_group($agreement_group_id);
- }
- }
-
-//_debug_array($values);
- if ($agreement_group_id)
- {
- $function_msg = lang('edit agreement group');
- }
- else
- {
- $function_msg = lang('add agreement_group');
- }
-
- if ($values['cat_id'] > 0)
- {
- $this->cat_id = $values['cat_id'];
- }
-
- if($error_id)
- {
- unset($values['num']);
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.edit_agreement_group',
- 'agreement_group_id' => $agreement_group_id
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.agreement_group'),
- 'lang_agreement_group_id' =>
lang('Agreement group ID'),
- 'lang_num'
=> lang('Agreement group code'),
- 'lang_status'
=> lang('Status'),
- 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
- 'status_name'
=> 'values[status]',
- 'lang_no_status'
=> lang('Select status'),
-
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_descr'
=> lang('description'),
- 'value_agreement_group_id' =>
$values['agreement_group_id'],
- 'value_num'
=> $values['num'],
- 'value_descr'
=> $values['descr'],
- 'lang_num_statustext' =>
lang('A unique code for this activity'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the building'),
- 'lang_descr_statustext' =>
lang('Enter the description for this activity')
- );
-
- $appname
= lang('pricebook');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_agreement_group' =>
$data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function prizing()
- {
- if(!$this->acl_manage)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links = $this->menu->links();
-
- $cat_id =
get_var('cat_id',array('GET'));
- $activity_id =
get_var('activity_id',array('GET'));
- $vendor_id =
get_var('vendor_id',array('GET'));
- $values =
get_var('values',array('POST'));
- $values['date'] = get_var('date',array('POST'));
-
-
- $referer =
$GLOBALS['phpgw']->session->appsession('referer',$this->currentapp);
- if(!$referer)
- {
- $referer =
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] ?
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] : $GLOBALS['HTTP_REFERER'];
- $referer = $referer . '&cat_id=' . $cat_id;
-
$GLOBALS['phpgw']->session->appsession('referer',$this->currentapp,$referer);
- }
-
- if($values['submit_update'])
- {
- if(!$values['date'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please select a date !'));
- }
-
- if(!$values['new_index'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please enter a new index for calkulating next value(s)!'));
- }
-
- if(!$receipt['error'])
- {
-
$receipt=$this->bo->update_pricebook($values);
- }
- }
-
- if($values['submit_add'])
- {
- if(!$values['date'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please select a date !'));
- }
-
- if(!$values['m_cost'] && !$values['w_cost'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please enter a value for either material cost, labour cost
or both !'));
- }
-
- if(!$receipt['error'])
- {
-
$receipt=$this->bo->add_activity_first_prize($values);
- }
- }
-
-
- $pricebook_list =
$this->bo->read_activity_prize($activity_id,$vendor_id);
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- if (isSet($pricebook_list) AND
is_array($pricebook_list))
- {
- foreach($pricebook_list as $pricebook)
- {
-
- if($pricebook['current_index'])
- {
- $link_delete =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method=prize&activity_id='
. $activity_id .'&vendor_id=' . $vendor_id .'&index_count=' .
$pricebook['index_count']);
- $value_m_cost =
$pricebook['m_cost'];
- $value_w_cost =
$pricebook['w_cost'];
- $value_total_cost =
$pricebook['total_cost'];
- }
-
- $content[] = array
- (
- 'm_cost'
=> $pricebook['m_cost'],
- 'w_cost'
=> $pricebook['w_cost'],
- 'total_cost'
=> $pricebook['total_cost'],
- 'this_index'
=> $pricebook['this_index'],
- 'date'
=>
$GLOBALS['phpgw']->common->show_date($pricebook['date'],$dateformat),
- 'current_index'
=> $pricebook['current_index'],
- 'index_count'
=> $pricebook['index_count'],
- 'link_delete'
=> $link_delete,
- 'lang_delete_statustext'
=> lang('Delete this entry'),
- 'text_delete'
=> lang('delete'),
- );
- }
- }
-
-//_debug_array($content);
- $table_header[] = array
- (
- 'lang_index_count' => lang('Index Count'),
- 'lang_total_cost' => lang('Total Cost'),
- 'lang_prizing' => lang('Prizing'),
- 'lang_last_index' => lang('Last index'),
- 'lang_m_cost' => lang('Material
cost'),
- 'lang_w_cost' => lang('Labour cost'),
- 'lang_date' => lang('Date'),
- 'lang_delete' => lang('Delete')
- );
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $table_update[] = array
- (
- 'jsDateFormat' =>
$jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle' =>
lang('Select date'),
- 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
- 'lang_new_index' =>
lang('New index'),
- 'lang_new_index_statustext' => lang('Enter
a new index'),
- 'lang_date_statustext' => lang('Select
the date for the update'),
- 'lang_update' =>
lang('Update'),
- 'lang_update_statustext' => lang('update
selected investments')
- );
-
- $table_first_entry[] = array
- (
- 'jsDateFormat' =>
$jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle' =>
lang('Select date'),
- 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
- 'lang_m_cost' =>
lang('Material cost'),
- 'lang_m_cost_statustext' => lang('Enter
a value for the material cost'),
- 'lang_w_cost' =>
lang('Labour cost'),
- 'lang_w_cost_statustext' => lang('Enter
a value for the labour cost'),
- 'lang_date'
=> lang('Date'),
- 'lang_date_statustext' => lang('Select
the date for the first value'),
- 'lang_add' =>
lang('Add'),
- 'lang_add_statustext' => lang('Add first
value for this prizing')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.prizing',
- 'activity_id' =>$activity_id,
- 'vendor_id'
=>$vendor_id
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $num_records = count($pricebook_list);
-
-
- $vendor_data =
$this->contacts->read_single(array('actor_id'=>$vendor_id));
-
- if(is_array($vendor_data))
- {
- foreach($vendor_data['attributes'] as
$attribute)
- {
- if($attribute['name']=='org_name')
- {
-
$value_vendor_name=$attribute['value'];
- break;
- }
- }
- }
-
- $activity =
$this->bo->read_single_activity($activity_id);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'done_action'
=> $referer,
- 'lang_done'
=> lang('done'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> $num_records,
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_vendor'
=> lang('Vendor'),
- 'lang_activity'
=> lang('Activity'),
-
- 'value_vendor_name'
=> $value_vendor_name,
- 'value_activity_id'
=> $activity_id,
- 'value_activity_code' =>
$activity['num'],
- 'value_vendor_id'
=> $vendor_id,
- 'value_m_cost'
=> $value_m_cost,
- 'value_w_cost'
=> $value_w_cost,
- 'value_total_cost'
=> $value_total_cost,
- 'table_header_prizing' =>
$table_header,
- 'values_prizing'
=> $content,
- 'table_update'
=> $table_update,
- 'table_first_entry'
=> $table_first_entry,
- 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $activity_id . '&vendor_id=' . $vendor_id)
- );
-
- $appname
= lang('pricebook');
- $function_msg =
lang('edit pricing');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('prizing' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
-
- function excel_2()
- {
-
- $list = $this->bo->read_activities_pr_agreement_group();
-
- $name = array(
- 'activity_id',
- 'base_descr',
- 'num',
- 'descr',
- // 'branch',
- // 'dim_d',
- 'ns3420',
- 'unit',
- );
-
- $descr = array(
- 'ID',
- lang('Base'),
- lang('Activity Num'),
- lang('Description'),
- // lang('Branch'),
- // lang('Dim d'),
- lang('NS3420'),
- lang('Unit'),
- );
-
-
- $this->bocommon->excel($list,$name,$descr);
- }
-
-
- function activity()
- {
- if(!$this->acl_manage)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links = $this->menu->links('agreement','activity');
-
- $pricebook_list =
$this->bo->read_activities_pr_agreement_group();
-//_debug_array($pricebook_list);
- while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
- {
- $content[] = array
- (
- 'activity_id'
=> $pricebook['activity_id'],
- 'num'
=> $pricebook['num'],
- 'branch'
=> $pricebook['branch'],
- 'base_descr'
=> $pricebook['base_descr'],
- 'dim_d'
=> $pricebook['dim_d'],
- 'ns3420'
=> $pricebook['ns3420'],
- 'unit'
=> $pricebook['unit'],
- 'descr'
=> $pricebook['descr'],
- 'link_vendor'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.activity_vendor&activity_id='
. $pricebook['activity_id'].'&agreement_group=' . $this->cat_id),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_activity&activity_id='
. $pricebook['activity_id'].'&agreement_group=' . $this->cat_id),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method=activity&activity_id='
. $pricebook['activity_id']),
- 'lang_vendor_statustext' =>
lang('view the vendor(s) for this activity'),
- 'lang_edit_statustext' =>
lang('edit this activity'),
- 'lang_delete_statustext' =>
lang('delete this activity'),
- 'text_vendor'
=> lang('vendor'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
- $table_header[] = array
- (
- 'sort_num' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'num',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.activity',
-
'cat_id'
=>$this->cat_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_num' =>
lang('Activity Num'),
- 'lang_branch' => lang('Branch'),
- 'lang_vendor' => lang('Vendor'),
- 'lang_descr' => lang('Description'),
- 'lang_base_descr' => lang('Base'),
- 'lang_dim_d' => lang('Dim d'),
- 'lang_ns3420' => lang('NS3420'),
- 'lang_unit' => lang('Unit'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete')
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add an
activity'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_activity&agreement_group='
. $this->cat_id)
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.activity',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.excel_2',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'allrows'
=>$this->allrows,
- 'start' =>$this->start
- );
-
- $data = array
- (
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($pricebook_list),
- 'all_records'
=> $this->bo->total_records,
- 'lang_select_all'
=> lang('Select All'),
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('select agreement_group'),
- 'lang_cat_statustext' =>
lang('Select the agreement_group the pricebook belongs to. To do not use a
category select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->get_agreement_group_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_activities' =>
$table_header,
- 'values_activities'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('pricebook');
- $function_msg =
lang('list activities per agreement_group');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_activities' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function activity_vendor()
- {
- if(!$this->acl_manage)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->session->appsession('referer',$this->currentapp,'');
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $links = $this->menu->links('agreement','activity');
-
- $activity_id =
get_var('activity_id',array('GET'));
- $values =
get_var('values',array('POST'));
- $values['vendor_id'] =
get_var('vendor_id',array('POST'));
-
- if($values['add'])
- {
- if(!$values['vendor_id'])
- {
- $receipt['error'][] =
array('msg'=>lang('Please - select a vendor!'));
- }
- else
- {
- $receipt =
$this->bo->add_activity_vendor($values);
- }
- }
-
- $pricebook_list =
$this->bo->read_vendor_pr_activity($activity_id);
-
- while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
- {
- $content[] = array
- (
- 'activity_id'
=> $pricebook['activity_id'],
- 'num'
=> $pricebook['num'],
- 'branch'
=> $pricebook['branch'],
- 'vendor_name'
=> $pricebook['vendor_name'],
- 'link_prizing'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method=activity_vendor&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']),
- 'lang_prizing_statustext' =>
lang('view edit the prize for this activity'),
- 'lang_delete_statustext' =>
lang('delete this vendor from this activity'),
- 'text_prizing'
=> lang('Prizing'),
- 'text_delete'
=> lang('delete')
- );
- }
-
- $table_header[] = array
- (
- 'sort_vendor' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'org_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.activity_vendor',
-
'cat_id'
=>$this->cat_id,
-
'activity_id'
=>$activity_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_num' =>
lang('Activity Num'),
- 'lang_branch' => lang('Branch'),
- 'lang_vendor' => lang('Vendor'),
- 'lang_prizing' => lang('Prizing'),
- 'lang_delete' => lang('delete')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.activity_vendor',
- 'sort' =>
$this->sort,
- 'order' =>
$this->order,
- 'cat_id' =>
$this->cat_id,
- 'filter' =>
$this->filter,
- 'query' =>
$this->query,
- 'activity_id' => $activity_id
- );
-
-
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'vendor_id' => ''));
-
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'activity_id'
=> $activity_id,
- 'vendor_data'
=> $vendor_data,
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($pricebook_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('select agreement_group'),
- 'lang_cat_statustext' =>
lang('Select the agreement_group the pricebook belongs to. To do not use a
category select NO CATEGORY'),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_activity_vendor' =>
$table_header,
- 'values_activity_vendor' =>
$content,
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Add this vendor to this activity'),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.activity&cat_id='
. $values['cat_id']),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
-
- );
-
- $appname
= lang('pricebook');
- $function_msg =
lang('list vendors per activity');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_activity_vendor' =>
$data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit_activity()
- {
- if(!$this->acl_manage)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
- $activity_id =
get_var('activity_id',array('POST','GET'));
- $agreement_group =
get_var('agreement_group',array('GET'));
- $values =
get_var('values',array('POST','GET'));
- $values['ns3420_id']=
get_var('ns3420_id',array('POST','GET'));
-
- if(!$values['cat_id'])
- {
- $values['cat_id'] = $agreement_group;
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('pricebook'));
-
- if ($values['save'])
- {
- if(!$values['num'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter an activity code !'));
- $error_id=true;
- }
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select an agreement_group !'));
- }
-
- if(!$values['branch_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a branch !'));
- }
-
- if($values['num'] && !$activity_id)
- {
-
if($this->bo->check_activity_num($values['num'],$values['cat_id']))
- {
-
$receipt['error'][]=array('msg'=>lang('This activity code is already
registered!') . '[ '.$values['num'] .' ]');
- $error_id=true;
- }
- }
-
- if($activity_id)
- {
- $values['activity_id']=$activity_id;
- $action='edit';
- }
- else
- {
- $activity_id = $values['activity_id'];
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save_activity($values,$action);
- $activity_id= $receipt['activity_id'];
- $values['activity_id']= $activity_id;
- }
-
- }
- else
- {
- $values['activity_id']= $activity_id;
- if($activity_id)
- {
- $values =
$this->bo->read_single_activity($activity_id);
- }
- }
-
-//_debug_array($values);
- if ($activity_id)
- {
- $function_msg = lang('edit activity');
- }
- else
- {
- $function_msg = lang('add activity');
- }
-
- if ($values['cat_id'] > 0)
- {
- $this->cat_id = $values['cat_id'];
- }
-
- if($error_id)
- {
- unset($values['num']);
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.edit_activity',
- 'activity_id' => $activity_id,
- 'agreement_group' =>
$agreement_group
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.activity&cat_id='
. $values['cat_id']),
- 'lang_activity_id'
=> lang('Activity ID'),
- 'lang_num'
=> lang('Activity code'),
- 'lang_category'
=> lang('Agreement group'),
- 'lang_unit'
=> lang('Unit'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_descr'
=> lang('description'),
- 'lang_base_descr'
=> lang('Base description'),
- 'value_activity_id'
=> $values['activity_id'],
- 'value_num'
=> $values['num'],
- 'value_general_address' =>
$values['general_address'],
- 'value_access'
=> $values['access'],
- 'value_descr'
=> $values['descr'],
- 'value_base_descr'
=> $values['base_descr'],
- 'lang_num_statustext' =>
lang('A unique code for this activity'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the building'),
- 'lang_no_cat'
=> lang('Select agreement group'),
- 'lang_cat_statustext' =>
lang('Select the agreement group this activity belongs to.'),
- 'select_name'
=> 'values[cat_id]',
- 'lang_descr_statustext' =>
lang('Enter the description for this activity'),
- 'lang_base_descr_statustext' => lang('Enter
a description for prerequisitions for this activity - if any'),
- 'cat_list'
=> $this->bo->get_agreement_group_list('select',$values['cat_id']),
-
- 'lang_dim_d'
=> lang('Dim D'),
- 'dim_d_list'
=> $this->bo->get_dim_d_list($values['dim_d']),
- 'select_dim_d'
=> 'values[dim_d]',
- 'lang_no_dim_d'
=> lang('No Dim D'),
- 'lang_dim_d_statustext' =>
lang('Select the Dim D for this activity. To do not use Dim D - select NO DIM
D'),
-
- 'lang_unit'
=> lang('Unit'),
- 'unit_list'
=> $this->bo->get_unit_list($values['unit']),
- 'select_unit'
=> 'values[unit]',
- 'lang_no_unit'
=> lang('Select Unit'),
- 'lang_unit_statustext' =>
lang('Select the unit for this activity.'),
-
- 'lang_branch'
=> lang('Branch'),
- 'branch_list'
=> $this->bo->get_branch_list($values['branch_id']),
- 'select_branch'
=> 'values[branch_id]',
- 'lang_no_branch'
=> lang('Select branch'),
- 'lang_branch_statustext' =>
lang('Select the branch for this activity.'),
-
- 'ns3420_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.ns3420'),
- 'lang_ns3420'
=> lang('NS3420'),
- 'value_ns3420_id'
=> $values['ns3420_id'],
- 'lang_ns3420_statustext' =>
lang('Select a standard-code from the norwegian standard'),
- );
-
- $appname
= lang('pricebook');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_activity' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- if(!$this->acl_manage)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
-
- $method =
get_var('method',array('GET'));
- $activity_id = get_var('activity_id',array('GET'));
- $vendor_id =
get_var('vendor_id',array('GET'));
- $index_count = get_var('index_count',array('GET'));
- $agreement_group_id =
get_var('agreement_group_id',array('GET'));
- $confirm =
get_var('confirm',array('POST'));
-
- if($method=='activity_vendor')
- {
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.activity_vendor',
- 'activity_id' => $activity_id
- );
-
- $function_msg =lang('delete vendor activity');
- $delete_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id . '&vendor_id=' . $vendor_id);
-
- if (get_var('confirm',array('POST')))
- {
-
$this->bo->delete_activity_vendor($activity_id,$vendor_id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
- }
- elseif($method=='activity')
- {
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.activity'
- );
-
- $function_msg =lang('delete activity');
- $delete_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id);
-
- if (get_var('confirm',array('POST')))
- {
-
$this->bo->delete_activity($activity_id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
- }
- elseif($method=='prize')
- {
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.prizing',
- 'activity_id' => $activity_id,
- 'vendor_id' => $vendor_id
- );
-
- $function_msg =lang('delete prize-index');
- $delete_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id . '&vendor_id=' . $vendor_id .
'&index_count=' . $index_count);
-
- if (get_var('confirm',array('POST')))
- {
-
$this->bo->delete_prize_index($activity_id,$vendor_id,$index_count);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
- }
- elseif($method=='agreement_group')
- {
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uipricebook.agreement_group',
- 'start' => $this->start
- );
-
- $function_msg =lang('Delete agreement group
and all the activities associated with it!');
- $delete_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&agreement_group_id=' . $agreement_group_id . '&start=' .
$this->start);
-
- if (get_var('confirm',array('POST')))
- {
-
$this->bo->delete_agreement_group($agreement_group_id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$delete_action,
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('pricebook');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 agreement
+ * @version $Id: class.uipricebook.inc.php,v 1.14 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uipricebook
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'activity' => True,
+ 'index' => True,
+ 'agreement_group' => True,
+ 'edit_agreement_group' => True,
+ 'edit_activity' => True,
+ 'activity_vendor' => True,
+ 'prizing' => True,
+ 'delete' => True,
+ 'excel' => True,
+ 'excel_2' => True
+ );
+
+ function uipricebook()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+
+ $this->bo =
CreateObject($this->currentapp.'.bopricebook',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+ $this->contacts =
CreateObject($this->currentapp.'.soactor');
+ $this->contacts->role = 'vendor';
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.pricebook';
+ $this->acl_read =
$this->acl2->check('.pricebook',1);
+ $this->acl_add =
$this->acl2->check('.pricebook',2);
+ $this->acl_edit =
$this->acl2->check('.pricebook',4);
+ $this->acl_delete =
$this->acl2->check('.pricebook',8);
+ $this->acl_manage =
$this->acl2->check('.pricebook',16);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->allrows =
$this->bo->allrows;
+
+ $this->menu->sub ='agreement';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+
+ function excel()
+ {
+
+ $list = $this->bo->read();
+
+ $name =
array('num','branch','vendor_id','m_cost','w_cost','total_cost','this_index','unit','descr','index_count');
+ $descr = array(lang('Activity Num'),
+
lang('Branch'),
+
lang('Vendor'),
+
lang('Material cost'),
+
lang('Labour cost'),
+
lang('Total Cost'),
+
lang('Last index'),
+
lang('Unit'),
+
lang('Description'),
+
lang('Index Count')
+ );
+
+ $this->bocommon->excel($list,$name,$descr);
+ }
+
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->session->appsession('referer',$this->currentapp,'');
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links = $this->menu->links('price_vendor');
+
+ $values =
get_var('values',array('POST'));
+ $values['date'] = get_var('date',array('POST'));
+
+//_debug_array($values);
+ if($values['submit_update'])
+ {
+ $receipt=$this->bo->update_pricebook($values);
+ }
+
+
+ $pricebook_list = $this->bo->read();
+
+ $i=0;
+ if (isSet($pricebook_list) AND
is_array($pricebook_list))
+ {
+ foreach($pricebook_list as $pricebook)
+ {
+ if($this->acl_manage)
+ {
+ $link_edit
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_activity&activity_id='
. $pricebook['activity_id']);
+ $link_prizing
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']
.'&cat_id=' .$this->cat_id);
+ $lang_edit_statustext
= lang('edit the pricebook');
+ $lang_prizing_statustext
= lang('view or edit prizing history of this element');
+ $text_edit
= lang('edit');
+ $text_prizing
= lang('prizing');
+ }
+
+ $content[] = array
+ (
+ 'counter'
=> $i,
+ 'activity_id'
=> $pricebook['activity_id'],
+ 'num'
=> $pricebook['num'],
+ 'branch'
=> $pricebook['branch'],
+ 'vendor_id'
=> $pricebook['vendor_id'],
+ 'm_cost'
=> $pricebook['m_cost'],
+ 'w_cost'
=> $pricebook['w_cost'],
+ 'total_cost'
=> $pricebook['total_cost'],
+ 'this_index'
=> $pricebook['this_index'],
+ 'unit'
=> $pricebook['unit'],
+ 'descr'
=> $pricebook['descr'],
+ 'index_count'
=> $pricebook['index_count'],
+ 'link_edit'
=> $link_edit,
+ 'link_prizing'
=> $link_prizing,
+ 'lang_edit_statustext'
=> $lang_edit_statustext,
+ 'lang_prizing_statustext'
=> $lang_prizing_statustext,
+ 'text_edit'
=> $text_edit,
+ 'text_prizing'
=> $text_prizing
+ );
+
+ $i++;
+ }
+ }
+
+ $table_header[] = array
+ (
+ 'sort_num' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'num',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.index',
+
'cat_id'
=>$this->cat_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_index_count' => lang('Index Count'),
+ 'lang_num' =>
lang('Activity Num'),
+ 'lang_branch' => lang('Branch'),
+ 'lang_vendor' => lang('Vendor'),
+ 'lang_select' => lang('Select'),
+ 'lang_total_cost' => lang('Total Cost'),
+ 'lang_prizing' => lang('Prizing'),
+ 'lang_last_index' => lang('Last index'),
+ 'lang_descr' => lang('Description'),
+ 'lang_m_cost' => lang('Material
cost'),
+ 'lang_w_cost' => lang('Labour cost'),
+ 'lang_prizing' => lang('Prizing'),
+ 'lang_unit' => lang('Unit'),
+ 'lang_view' => lang('view'),
+ 'lang_edit' => lang('edit'),
+ 'sort_total_cost' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'total_cost',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.index',
+
'cat_id'
=>$this->cat_id,
+
'allrows'
=>$this->allrows)
+
))
+ );
+
+
+ if($this->acl_manage)
+ {
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $table_update[] = array
+ (
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup'
=> "Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+ 'lang_new_index'
=> lang('New index'),
+ 'lang_new_index_statustext' =>
lang('Enter a new index'),
+ 'lang_date_statustext' =>
lang('Select the date for the update'),
+ 'lang_update'
=> lang('Update'),
+ 'lang_update_statustext' =>
lang('update selected investments')
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.excel',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'allrows'
=>$this->allrows,
+ 'start' =>$this->start
+ );
+
+ $data = array
+ (
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($pricebook_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the pricebook belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->get_vendor_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_update'
=> $table_update,
+ 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.index')
);
+
+ $appname
= lang('pricebook');
+ $function_msg =
lang('list pricebook per vendor');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function agreement_group()
+ {
+ if(!$this->acl_manage)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->session->appsession('referer',$this->currentapp,'');
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links =
$this->menu->links('agreement','agreement_group');
+
+ $agreement_list = $this->bo->read_agreement_group();
+
+ while (is_array($agreement_list) && list(,$agreement) =
each($agreement_list))
+ {
+ $content[] = array
+ (
+ 'agreement_group_id'
=> $agreement['agreement_group_id'],
+ 'num'
=> $agreement['num'],
+ 'status'
=> lang($agreement['status']),
+ 'descr'
=> $agreement['descr'],
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_agreement_group&agreement_group_id='
. $agreement['agreement_group_id']),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method=agreement_group&agreement_group_id='
. $agreement['agreement_group_id'] .'&start=' . $this->start),
+ 'lang_edit_statustext' =>
lang('edit the agreement_group'),
+ 'lang_delete_statustext' =>
lang('Delete this agreement_group'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'lang_id' => lang('ID'),
+ 'sort_num' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'num',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.agreement_group',
+
'cat_id'
=>$this->cat_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_num' =>
lang('Activity Num'),
+ 'lang_delete' => lang('Delete'),
+ 'lang_descr' => lang('Description'),
+ 'lang_edit' => lang('edit')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.agreement_group',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add an
activity'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_agreement_group')
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $data = array
+ (
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($agreement_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_status_statustext' =>
lang('Select the status the agreement group belongs to. To do not use a
category select NO STATUS'),
+ 'status_name'
=> 'cat_id',
+ 'lang_no_status'
=> lang('No status'),
+ 'status_list'
=> $this->bo->select_status_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_agreement_group' =>
$table_header,
+ 'values_agreement_group'
=> $content,
+ 'table_add'
=> $table_add,
+ 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.agreement_group')
+ );
+
+ $appname
= lang('pricebook');
+ $function_msg =
lang('list agreement group');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('agreement_group' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit_agreement_group()
+ {
+ if(!$this->acl_manage)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+ $agreement_group_id =
get_var('agreement_group_id',array('POST','GET'));
+ $values =
get_var('values',array('POST','GET'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('pricebook'));
+
+ if ($values['save'])
+ {
+ $values['agreement_group_id'] =
$agreement_group_id;
+
+ if(!$values['num'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter an agreement group code
!'));
+ $error_id=true;
+ }
+ if(!$values['status'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
+ }
+
+
+ if($values['num'] && !$agreement_group_id)
+ {
+
if($this->bo->check_agreement_group_num($values['num']))
+ {
+
$receipt['error'][]=array('msg'=>lang('This agreement group code is already
registered!') . '[ '.$values['num'] .' ]');
+ $error_id=true;
+ }
+ }
+
+ if($agreement_group_id)
+ {
+ $action='edit';
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_agreement_group($values,$action);
+ if(!$agreement_group_id)
+ {
+
$agreement_group_id=$receipt['agreement_group_id'];
+ }
+
+ }
+
+ if($agreement_group_id)
+ {
+
$values['agreement_group_id']=$agreement_group_id;
+ $action='edit';
+ }
+ else
+ {
+ $agreement_group_id =
$values['agreement_group_id'];
+ }
+ }
+ else
+ {
+ $values['agreement_group_id']=
$agreement_group_id;
+ if($agreement_group_id)
+ {
+ $values =
$this->bo->read_single_agreement_group($agreement_group_id);
+ }
+ }
+
+//_debug_array($values);
+ if ($agreement_group_id)
+ {
+ $function_msg = lang('edit agreement group');
+ }
+ else
+ {
+ $function_msg = lang('add agreement_group');
+ }
+
+ if ($values['cat_id'] > 0)
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ if($error_id)
+ {
+ unset($values['num']);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.edit_agreement_group',
+ 'agreement_group_id' => $agreement_group_id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.agreement_group'),
+ 'lang_agreement_group_id' =>
lang('Agreement group ID'),
+ 'lang_num'
=> lang('Agreement group code'),
+ 'lang_status'
=> lang('Status'),
+ 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
+ 'status_name'
=> 'values[status]',
+ 'lang_no_status'
=> lang('Select status'),
+
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_descr'
=> lang('description'),
+ 'value_agreement_group_id' =>
$values['agreement_group_id'],
+ 'value_num'
=> $values['num'],
+ 'value_descr'
=> $values['descr'],
+ 'lang_num_statustext' =>
lang('A unique code for this activity'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the building'),
+ 'lang_descr_statustext' =>
lang('Enter the description for this activity')
+ );
+
+ $appname
= lang('pricebook');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_agreement_group' =>
$data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function prizing()
+ {
+ if(!$this->acl_manage)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links = $this->menu->links();
+
+ $cat_id =
get_var('cat_id',array('GET'));
+ $activity_id =
get_var('activity_id',array('GET'));
+ $vendor_id =
get_var('vendor_id',array('GET'));
+ $values =
get_var('values',array('POST'));
+ $values['date'] = get_var('date',array('POST'));
+
+
+ $referer =
$GLOBALS['phpgw']->session->appsession('referer',$this->currentapp);
+ if(!$referer)
+ {
+ $referer =
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] ?
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] : $GLOBALS['HTTP_REFERER'];
+ $referer = $referer . '&cat_id=' . $cat_id;
+
$GLOBALS['phpgw']->session->appsession('referer',$this->currentapp,$referer);
+ }
+
+ if($values['submit_update'])
+ {
+ if(!$values['date'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please select a date !'));
+ }
+
+ if(!$values['new_index'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please enter a new index for calkulating next value(s)!'));
+ }
+
+ if(!$receipt['error'])
+ {
+
$receipt=$this->bo->update_pricebook($values);
+ }
+ }
+
+ if($values['submit_add'])
+ {
+ if(!$values['date'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please select a date !'));
+ }
+
+ if(!$values['m_cost'] && !$values['w_cost'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please enter a value for either material cost, labour cost
or both !'));
+ }
+
+ if(!$receipt['error'])
+ {
+
$receipt=$this->bo->add_activity_first_prize($values);
+ }
+ }
+
+
+ $pricebook_list =
$this->bo->read_activity_prize($activity_id,$vendor_id);
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ if (isSet($pricebook_list) AND
is_array($pricebook_list))
+ {
+ foreach($pricebook_list as $pricebook)
+ {
+
+ if($pricebook['current_index'])
+ {
+ $link_delete =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method=prize&activity_id='
. $activity_id .'&vendor_id=' . $vendor_id .'&index_count=' .
$pricebook['index_count']);
+ $value_m_cost =
$pricebook['m_cost'];
+ $value_w_cost =
$pricebook['w_cost'];
+ $value_total_cost =
$pricebook['total_cost'];
+ }
+
+ $content[] = array
+ (
+ 'm_cost'
=> $pricebook['m_cost'],
+ 'w_cost'
=> $pricebook['w_cost'],
+ 'total_cost'
=> $pricebook['total_cost'],
+ 'this_index'
=> $pricebook['this_index'],
+ 'date'
=>
$GLOBALS['phpgw']->common->show_date($pricebook['date'],$dateformat),
+ 'current_index'
=> $pricebook['current_index'],
+ 'index_count'
=> $pricebook['index_count'],
+ 'link_delete'
=> $link_delete,
+ 'lang_delete_statustext'
=> lang('Delete this entry'),
+ 'text_delete'
=> lang('delete'),
+ );
+ }
+ }
+
+//_debug_array($content);
+ $table_header[] = array
+ (
+ 'lang_index_count' => lang('Index Count'),
+ 'lang_total_cost' => lang('Total Cost'),
+ 'lang_prizing' => lang('Prizing'),
+ 'lang_last_index' => lang('Last index'),
+ 'lang_m_cost' => lang('Material
cost'),
+ 'lang_w_cost' => lang('Labour cost'),
+ 'lang_date' => lang('Date'),
+ 'lang_delete' => lang('Delete')
+ );
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $table_update[] = array
+ (
+ 'jsDateFormat' =>
$jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle' =>
lang('Select date'),
+ 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+ 'lang_new_index' =>
lang('New index'),
+ 'lang_new_index_statustext' => lang('Enter
a new index'),
+ 'lang_date_statustext' => lang('Select
the date for the update'),
+ 'lang_update' =>
lang('Update'),
+ 'lang_update_statustext' => lang('update
selected investments')
+ );
+
+ $table_first_entry[] = array
+ (
+ 'jsDateFormat' =>
$jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle' =>
lang('Select date'),
+ 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+ 'lang_m_cost' =>
lang('Material cost'),
+ 'lang_m_cost_statustext' => lang('Enter
a value for the material cost'),
+ 'lang_w_cost' =>
lang('Labour cost'),
+ 'lang_w_cost_statustext' => lang('Enter
a value for the labour cost'),
+ 'lang_date'
=> lang('Date'),
+ 'lang_date_statustext' => lang('Select
the date for the first value'),
+ 'lang_add' =>
lang('Add'),
+ 'lang_add_statustext' => lang('Add first
value for this prizing')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.prizing',
+ 'activity_id' =>$activity_id,
+ 'vendor_id'
=>$vendor_id
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $num_records = count($pricebook_list);
+
+
+ $vendor_data =
$this->contacts->read_single(array('actor_id'=>$vendor_id));
+
+ if(is_array($vendor_data))
+ {
+ foreach($vendor_data['attributes'] as
$attribute)
+ {
+ if($attribute['name']=='org_name')
+ {
+
$value_vendor_name=$attribute['value'];
+ break;
+ }
+ }
+ }
+
+ $activity =
$this->bo->read_single_activity($activity_id);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'done_action'
=> $referer,
+ 'lang_done'
=> lang('done'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> $num_records,
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_vendor'
=> lang('Vendor'),
+ 'lang_activity'
=> lang('Activity'),
+
+ 'value_vendor_name'
=> $value_vendor_name,
+ 'value_activity_id'
=> $activity_id,
+ 'value_activity_code' =>
$activity['num'],
+ 'value_vendor_id'
=> $vendor_id,
+ 'value_m_cost'
=> $value_m_cost,
+ 'value_w_cost'
=> $value_w_cost,
+ 'value_total_cost'
=> $value_total_cost,
+ 'table_header_prizing' =>
$table_header,
+ 'values_prizing'
=> $content,
+ 'table_update'
=> $table_update,
+ 'table_first_entry'
=> $table_first_entry,
+ 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $activity_id . '&vendor_id=' . $vendor_id)
+ );
+
+ $appname
= lang('pricebook');
+ $function_msg =
lang('edit pricing');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('prizing' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+
+ function excel_2()
+ {
+
+ $list = $this->bo->read_activities_pr_agreement_group();
+
+ $name = array(
+ 'activity_id',
+ 'base_descr',
+ 'num',
+ 'descr',
+ // 'branch',
+ // 'dim_d',
+ 'ns3420',
+ 'unit',
+ );
+
+ $descr = array(
+ 'ID',
+ lang('Base'),
+ lang('Activity Num'),
+ lang('Description'),
+ // lang('Branch'),
+ // lang('Dim d'),
+ lang('NS3420'),
+ lang('Unit'),
+ );
+
+
+ $this->bocommon->excel($list,$name,$descr);
+ }
+
+
+ function activity()
+ {
+ if(!$this->acl_manage)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links = $this->menu->links('agreement','activity');
+
+ $pricebook_list =
$this->bo->read_activities_pr_agreement_group();
+//_debug_array($pricebook_list);
+ while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
+ {
+ $content[] = array
+ (
+ 'activity_id'
=> $pricebook['activity_id'],
+ 'num'
=> $pricebook['num'],
+ 'branch'
=> $pricebook['branch'],
+ 'base_descr'
=> $pricebook['base_descr'],
+ 'dim_d'
=> $pricebook['dim_d'],
+ 'ns3420'
=> $pricebook['ns3420'],
+ 'unit'
=> $pricebook['unit'],
+ 'descr'
=> $pricebook['descr'],
+ 'link_vendor'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.activity_vendor&activity_id='
. $pricebook['activity_id'].'&agreement_group=' . $this->cat_id),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_activity&activity_id='
. $pricebook['activity_id'].'&agreement_group=' . $this->cat_id),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method=activity&activity_id='
. $pricebook['activity_id']),
+ 'lang_vendor_statustext' =>
lang('view the vendor(s) for this activity'),
+ 'lang_edit_statustext' =>
lang('edit this activity'),
+ 'lang_delete_statustext' =>
lang('delete this activity'),
+ 'text_vendor'
=> lang('vendor'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_num' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'num',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.activity',
+
'cat_id'
=>$this->cat_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_num' =>
lang('Activity Num'),
+ 'lang_branch' => lang('Branch'),
+ 'lang_vendor' => lang('Vendor'),
+ 'lang_descr' => lang('Description'),
+ 'lang_base_descr' => lang('Base'),
+ 'lang_dim_d' => lang('Dim d'),
+ 'lang_ns3420' => lang('NS3420'),
+ 'lang_unit' => lang('Unit'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete')
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add an
activity'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_activity&agreement_group='
. $this->cat_id)
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.activity',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.excel_2',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'allrows'
=>$this->allrows,
+ 'start' =>$this->start
+ );
+
+ $data = array
+ (
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($pricebook_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'lang_select_all'
=> lang('Select All'),
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('select agreement_group'),
+ 'lang_cat_statustext' =>
lang('Select the agreement_group the pricebook belongs to. To do not use a
category select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->get_agreement_group_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' =>
'yes')),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_activities' =>
$table_header,
+ 'values_activities'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('pricebook');
+ $function_msg =
lang('list activities per agreement_group');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_activities' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function activity_vendor()
+ {
+ if(!$this->acl_manage)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->session->appsession('referer',$this->currentapp,'');
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $links = $this->menu->links('agreement','activity');
+
+ $activity_id =
get_var('activity_id',array('GET'));
+ $values =
get_var('values',array('POST'));
+ $values['vendor_id'] =
get_var('vendor_id',array('POST'));
+
+ if($values['add'])
+ {
+ if(!$values['vendor_id'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Please - select a vendor!'));
+ }
+ else
+ {
+ $receipt =
$this->bo->add_activity_vendor($values);
+ }
+ }
+
+ $pricebook_list =
$this->bo->read_vendor_pr_activity($activity_id);
+
+ while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
+ {
+ $content[] = array
+ (
+ 'activity_id'
=> $pricebook['activity_id'],
+ 'num'
=> $pricebook['num'],
+ 'branch'
=> $pricebook['branch'],
+ 'vendor_name'
=> $pricebook['vendor_name'],
+ 'link_prizing'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.prizing&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method=activity_vendor&activity_id='
. $pricebook['activity_id'].'&vendor_id=' . $pricebook['vendor_id']),
+ 'lang_prizing_statustext' =>
lang('view edit the prize for this activity'),
+ 'lang_delete_statustext' =>
lang('delete this vendor from this activity'),
+ 'text_prizing'
=> lang('Prizing'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_vendor' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'org_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uipricebook.activity_vendor',
+
'cat_id'
=>$this->cat_id,
+
'activity_id'
=>$activity_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_num' =>
lang('Activity Num'),
+ 'lang_branch' => lang('Branch'),
+ 'lang_vendor' => lang('Vendor'),
+ 'lang_prizing' => lang('Prizing'),
+ 'lang_delete' => lang('delete')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.activity_vendor',
+ 'sort' =>
$this->sort,
+ 'order' =>
$this->order,
+ 'cat_id' =>
$this->cat_id,
+ 'filter' =>
$this->filter,
+ 'query' =>
$this->query,
+ 'activity_id' => $activity_id
+ );
+
+
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'vendor_id' => ''));
+
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'activity_id'
=> $activity_id,
+ 'vendor_data'
=> $vendor_data,
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($pricebook_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('select agreement_group'),
+ 'lang_cat_statustext' =>
lang('Select the agreement_group the pricebook belongs to. To do not use a
category select NO CATEGORY'),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_activity_vendor' =>
$table_header,
+ 'values_activity_vendor' =>
$content,
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Add this vendor to this activity'),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.activity&cat_id='
. $values['cat_id']),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+
+ );
+
+ $appname
= lang('pricebook');
+ $function_msg =
lang('list vendors per activity');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_activity_vendor' =>
$data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit_activity()
+ {
+ if(!$this->acl_manage)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+ $activity_id =
get_var('activity_id',array('POST','GET'));
+ $agreement_group =
get_var('agreement_group',array('GET'));
+ $values =
get_var('values',array('POST','GET'));
+ $values['ns3420_id']=
get_var('ns3420_id',array('POST','GET'));
+
+ if(!$values['cat_id'])
+ {
+ $values['cat_id'] = $agreement_group;
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('pricebook'));
+
+ if ($values['save'])
+ {
+ if(!$values['num'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter an activity code !'));
+ $error_id=true;
+ }
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select an agreement_group !'));
+ }
+
+ if(!$values['branch_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a branch !'));
+ }
+
+ if($values['num'] && !$activity_id)
+ {
+
if($this->bo->check_activity_num($values['num'],$values['cat_id']))
+ {
+
$receipt['error'][]=array('msg'=>lang('This activity code is already
registered!') . '[ '.$values['num'] .' ]');
+ $error_id=true;
+ }
+ }
+
+ if($activity_id)
+ {
+ $values['activity_id']=$activity_id;
+ $action='edit';
+ }
+ else
+ {
+ $activity_id = $values['activity_id'];
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_activity($values,$action);
+ $activity_id= $receipt['activity_id'];
+ $values['activity_id']= $activity_id;
+ }
+
+ }
+ else
+ {
+ $values['activity_id']= $activity_id;
+ if($activity_id)
+ {
+ $values =
$this->bo->read_single_activity($activity_id);
+ }
+ }
+
+//_debug_array($values);
+ if ($activity_id)
+ {
+ $function_msg = lang('edit activity');
+ }
+ else
+ {
+ $function_msg = lang('add activity');
+ }
+
+ if ($values['cat_id'] > 0)
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ if($error_id)
+ {
+ unset($values['num']);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.edit_activity',
+ 'activity_id' => $activity_id,
+ 'agreement_group' =>
$agreement_group
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.activity&cat_id='
. $values['cat_id']),
+ 'lang_activity_id'
=> lang('Activity ID'),
+ 'lang_num'
=> lang('Activity code'),
+ 'lang_category'
=> lang('Agreement group'),
+ 'lang_unit'
=> lang('Unit'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_descr'
=> lang('description'),
+ 'lang_base_descr'
=> lang('Base description'),
+ 'value_activity_id'
=> $values['activity_id'],
+ 'value_num'
=> $values['num'],
+ 'value_general_address' =>
$values['general_address'],
+ 'value_access'
=> $values['access'],
+ 'value_descr'
=> $values['descr'],
+ 'value_base_descr'
=> $values['base_descr'],
+ 'lang_num_statustext' =>
lang('A unique code for this activity'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the building'),
+ 'lang_no_cat'
=> lang('Select agreement group'),
+ 'lang_cat_statustext' =>
lang('Select the agreement group this activity belongs to.'),
+ 'select_name'
=> 'values[cat_id]',
+ 'lang_descr_statustext' =>
lang('Enter the description for this activity'),
+ 'lang_base_descr_statustext' => lang('Enter
a description for prerequisitions for this activity - if any'),
+ 'cat_list'
=> $this->bo->get_agreement_group_list('select',$values['cat_id']),
+
+ 'lang_dim_d'
=> lang('Dim D'),
+ 'dim_d_list'
=> $this->bo->get_dim_d_list($values['dim_d']),
+ 'select_dim_d'
=> 'values[dim_d]',
+ 'lang_no_dim_d'
=> lang('No Dim D'),
+ 'lang_dim_d_statustext' =>
lang('Select the Dim D for this activity. To do not use Dim D - select NO DIM
D'),
+
+ 'lang_unit'
=> lang('Unit'),
+ 'unit_list'
=> $this->bo->get_unit_list($values['unit']),
+ 'select_unit'
=> 'values[unit]',
+ 'lang_no_unit'
=> lang('Select Unit'),
+ 'lang_unit_statustext' =>
lang('Select the unit for this activity.'),
+
+ 'lang_branch'
=> lang('Branch'),
+ 'branch_list'
=> $this->bo->get_branch_list($values['branch_id']),
+ 'select_branch'
=> 'values[branch_id]',
+ 'lang_no_branch'
=> lang('Select branch'),
+ 'lang_branch_statustext' =>
lang('Select the branch for this activity.'),
+
+ 'ns3420_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.ns3420'),
+ 'lang_ns3420'
=> lang('NS3420'),
+ 'value_ns3420_id'
=> $values['ns3420_id'],
+ 'lang_ns3420_statustext' =>
lang('Select a standard-code from the norwegian standard'),
+ );
+
+ $appname
= lang('pricebook');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_activity' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ if(!$this->acl_manage)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+
+ $method =
get_var('method',array('GET'));
+ $activity_id = get_var('activity_id',array('GET'));
+ $vendor_id =
get_var('vendor_id',array('GET'));
+ $index_count = get_var('index_count',array('GET'));
+ $agreement_group_id =
get_var('agreement_group_id',array('GET'));
+ $confirm =
get_var('confirm',array('POST'));
+
+ if($method=='activity_vendor')
+ {
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.activity_vendor',
+ 'activity_id' => $activity_id
+ );
+
+ $function_msg =lang('delete vendor activity');
+ $delete_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id . '&vendor_id=' . $vendor_id);
+
+ if (get_var('confirm',array('POST')))
+ {
+
$this->bo->delete_activity_vendor($activity_id,$vendor_id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+ }
+ elseif($method=='activity')
+ {
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.activity'
+ );
+
+ $function_msg =lang('delete activity');
+ $delete_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id);
+
+ if (get_var('confirm',array('POST')))
+ {
+
$this->bo->delete_activity($activity_id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+ }
+ elseif($method=='prize')
+ {
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.prizing',
+ 'activity_id' => $activity_id,
+ 'vendor_id' => $vendor_id
+ );
+
+ $function_msg =lang('delete prize-index');
+ $delete_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&activity_id=' . $activity_id . '&vendor_id=' . $vendor_id .
'&index_count=' . $index_count);
+
+ if (get_var('confirm',array('POST')))
+ {
+
$this->bo->delete_prize_index($activity_id,$vendor_id,$index_count);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+ }
+ elseif($method=='agreement_group')
+ {
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uipricebook.agreement_group',
+ 'start' => $this->start
+ );
+
+ $function_msg =lang('Delete agreement group
and all the activities associated with it!');
+ $delete_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&method='
. $method . '&agreement_group_id=' . $agreement_group_id . '&start=' .
$this->start);
+
+ if (get_var('confirm',array('POST')))
+ {
+
$this->bo->delete_agreement_group($agreement_group_id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$delete_action,
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('pricebook');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uiproject.inc.php
diff -u property/inc/class.uiproject.inc.php:1.23
property/inc/class.uiproject.inc.php:1.24
--- property/inc/class.uiproject.inc.php:1.23 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uiproject.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1326 +1,1326 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.uiproject.inc.php,v 1.23 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uiproject
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'excel' => True,
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'date_search'=>True
- );
-
- function uiproject()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.boproject',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.project';
- $this->acl_read =
$this->acl2->check('.project',1);
- $this->acl_add =
$this->acl2->check('.project',2);
- $this->acl_edit =
$this->acl2->check('.project',4);
- $this->acl_delete =
$this->acl2->check('.project',8);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->status_id =
$this->bo->status_id;
- $this->wo_hour_cat_id =
$this->bo->wo_hour_cat_id;
-
-
- $this->menu->sub ='project';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'status_id' => $this->status_id,
- 'wo_hour_cat_id'=> $this->wo_hour_cat_id
- );
- $this->bo->save_sessiondata($data);
- }
-
- function excel()
- {
- $start_date =
urldecode(get_var('start_date',array('POST','GET')));
- $end_date =
urldecode(get_var('end_date',array('POST','GET')));
- $list =
$this->bo->read($start_date,$end_date,$allrows=True);
- $uicols = $this->bo->uicols;
-
$this->bocommon->excel($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
- }
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('project','values','table_header',
-
'menu',
-
'nextmatchs',
-
'search_field',
-
'wo_hour_cat_filter'));
-
- $lookup =
get_var('lookup',array('POST','GET'));
- $from =
get_var('from',array('POST','GET'));
- $start_date =
urldecode(get_var('start_date',array('POST','GET')));
- $end_date =
urldecode(get_var('end_date',array('POST','GET')));
-
- $links = $this->menu->links('project');
-
- $project_list = $this->bo->read($start_date,$end_date);
- $uicols = $this->bo->uicols;
- $count_uicols_name=count($uicols['name']);
-
- $j=0;
- if (isSet($project_list) AND is_array($project_list))
- {
- foreach($project_list as $project_entry)
-
- {
- for ($k=0;$k<$count_uicols_name;$k++)
- {
-
if($uicols['input_type'][$k]=='text')
- {
-
-
if($project_entry['query_location'][$uicols['name'][$k]])
- {
-
$content[$j]['row'][]= array(
-
'statustext' => lang('search'),
- 'text'
=> $project_entry[$uicols['name'][$k]],
- 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&query='
. $project_entry['query_location'][$uicols['name'][$k]] . '&lookup=' . $lookup
. '&from=' . $from . '&filter=' . $this->filter)
- );
- }
- else
- {
-
$content[$j]['row'][]= array(
- 'value'
=> $project_entry[$uicols['name'][$k]],
- 'name'
=> $uicols['name'][$k]
- );
- }
- }
-
elseif($uicols['input_type'][$k]=='link')
- {
-
$content[$j]['row'][]= array(
- 'statustext'
=> lang('search'),
- 'text'
=> $project_entry[$uicols['name'][$k]],
- 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.view&id='
. $project_entry[$uicols['name'][$k]])
- );
- }
-
- if($lookup &&
$k==($count_uicols_name-1))
- {
- $content[$j]['row'][]=
array(
- 'lookup_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui' .
$from . '.edit&project_id=' . $project_entry['project_id'])
- );
- }
- }
-
- if(!$lookup)
- {
- if ($this->acl_read &&
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_READ))
- {
- $content[$j]['row'][]=
array(
- 'statustext'
=> lang('view the project'),
- 'text'
=> lang('view'),
- 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.view&id='
. $project_entry['project_id'])
- );
- }
- else
- {
- $content[$j]['row'][]=
array('link'=>'dummy');
- }
-
- if ($this->acl_edit &&
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_EDIT))
- {
- $content[$j]['row'][]=
array(
- 'statustext' =>
lang('edit the project'),
- 'text'
=> lang('edit'),
- 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
. $project_entry['project_id'])
- );
- }
- else
- {
- $content[$j]['row'][]=
array('link'=>'dummy');
- }
-
- if ($this->acl_delete &&
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_DELETE))
- {
- $content[$j]['row'][]=
array(
- 'statustext' =>
lang('delete the project'),
- 'text'
=> lang('delete'),
- 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&project_id='
. $project_entry['project_id'])
- );
- }
- else
- {
- $content[$j]['row'][]=
array('link'=>'dummy');
- }
- }
-
- $j++;
- }
- }
-
- $count_uicols_descr=count($uicols['descr']);
- for ($i=0;$i<$count_uicols_descr;$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['name'][$i]=='loc1')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'location_code',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiproject.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'from' =>$from,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id,
-
'start_date'=>$start_date,
-
'end_date'=>$end_date,
-
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
-
)
-
));
- }
- if($uicols['name'][$i]=='project_id')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'project_id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiproject.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'from' =>$from,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id,
-
'start_date'=>$start_date,
-
'end_date'=>$end_date,
-
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
-
)
-
));
- }
- if($uicols['name'][$i]=='address')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'address',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiproject.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'from' =>$from,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id,
-
'start_date'=>$start_date,
-
'end_date'=>$end_date,
-
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
-
)
-
));
- }
- }
- }
-
- if(!$lookup)
- {
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
- }
- else
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header'] =
lang('select');
- }
-
-//_debug_array($content);
- if($this->acl_add)
- {
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
project'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit')
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiproject.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'district_id'
=>$this->district_id,
- 'filter'
=>$this->filter,
- 'status_id'
=>$this->status_id,
- 'lookup'
=>$lookup,
- 'from' =>$from,
- 'query'
=>$this->query,
- 'start_date' =>$start_date,
- 'end_date'
=>$end_date,
- 'wo_hour_cat_id'
=>$this->wo_hour_cat_id,
- );
-
- $link_date_search
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
-
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uiproject.excel',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'district_id'
=>$this->district_id,
- 'filter'
=>$this->filter,
- 'status_id'
=>$this->status_id,
- 'lookup'
=>$lookup,
- 'from' =>$from,
- 'query'
=>$this->query,
- 'start_date'
=>$start_date,
- 'end_date'
=>$end_date,
- 'start'
=>$this->start,
- 'wo_hour_cat_id'
=>$this->wo_hour_cat_id,
- );
-
- $data = array
- (
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
-
- 'start_date'
=>$start_date,
- 'end_date'
=>$end_date,
- 'lang_none'
=>lang('None'),
- 'lang_date_search' =>
lang('Date search'),
- 'lang_date_search_help' => lang('Narrow
the search by dates'),
- 'link_date_search' =>
$link_date_search,
- 'overlib_source' =>
'./'.$this->currentapp.'/inc/overlib.js',
-
- 'lang_select'
=> lang('select'),
- 'lookup_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
- 'lookup'
=> $lookup,
- 'links'
=> $links,
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($project_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the project belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_project_list('filter',$this->cat_id),
- 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
- 'select_district_name' =>
'district_id',
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_status_statustext' =>
lang('Select the status the agreement belongs to. To do not use a category
select NO STATUS'),
- 'status_name'
=> 'status_id',
- 'lang_no_status'
=> lang('No status'),
- 'status_list'
=> $this->bo->select_status_list('filter',$this->status_id),
-
- 'lang_wo_hour_cat_statustext' =>
lang('Select the workorder hour category'),
- 'lang_no_wo_hour_cat' =>
lang('no hour category'),
- 'wo_hour_cat_list'
=> $this->bocommon->select_wo_hours_category_list($this->wo_hour_cat_id),
-
- 'lang_user_statustext' =>
lang('Select the user the project belongs to. To do not use a category select
NO USER'),
- 'select_user_name'
=> 'filter',
- 'lang_no_user'
=> lang('No user'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl2_location,array('all'),$default=$this->account),
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('Project');
- $function_msg =
lang('list Project');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_project' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function date_search()
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('date_search'));
- $GLOBALS['phpgw_info']['flags']['noframework'] = True;
- $GLOBALS['phpgw_info']['flags'][noheader] = True;
- $GLOBALS['phpgw_info']['flags'][nofooter] = True;
- $values['start_date'] =
get_var('start_date',array('POST'));
- $values['end_date'] =
get_var('end_date',array('POST'));
-
- $function_msg = lang('Date search');
- $appname = lang('project');
-
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- if(!$values['end_date'])
- {
- $values['end_date'] =
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $data = array
- (
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
- 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
-
- 'lang_start_date_statustext' => lang('Select
the estimated end date for the Project'),
- 'lang_start_date'
=> lang('Start date'),
- 'value_start_date'
=> $values['start_date'],
-
- 'lang_end_date_statustext' =>
lang('Select the estimated end date for the Project'),
- 'lang_end_date'
=> lang('End date'),
- 'value_end_date'
=> $values['end_date'],
-
- 'dateformat'
=> $dateformat,
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_submit_statustext' =>
lang('Select this dates'),
- 'lang_submit' =>
lang('Submit')
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('date_search' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
- $id =
get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
- $add_request =
get_var('add_request',array('POST'));
-
- $config =
CreateObject('phpgwapi.config');
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
- $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
-
- for ($j=0;$j<count($insert_record_entity);$j++)
- {
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('project'));
-
- $bypass =
get_var('bypass',array('POST','GET'));
-
- if($add_request)
- {
- $receipt =
$this->bo->add_request($add_request,$id);
- }
-
- if($_POST && !$bypass)
- {
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
-
- }
- else
- {
- $location_code =
get_var('location_code',array('POST','GET'));
- $tenant_id =
get_var('tenant_id',array('POST','GET'));
- $values['descr'] =
get_var('descr',array('POST','GET'));
- $p_entity_id =
get_var('p_entity_id',array('POST','GET'));
- $p_cat_id =
get_var('p_cat_id',array('POST','GET'));
- $values['p'][$p_entity_id]['p_entity_id']
= $p_entity_id;
- $values['p'][$p_entity_id]['p_cat_id']
= $p_cat_id;
- $values['p'][$p_entity_id]['p_num']
= get_var('p_num',array('POST','GET'));
-
- $origin =
get_var('origin',array('POST','GET'));
- $origin_id =
get_var('origin_id',array('POST','GET'));
-
- if($p_entity_id && $p_cat_id)
- {
-
- if(!is_object($boadmin_entity))
- {
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- }
-
- $entity_category =
$boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
-
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
- }
-
- if($location_code)
- {
- $values['location_data'] =
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
- }
-
- }
-
- if($values['origin'])
- {
- $origin = $values['origin'];
- $origin_id = $values['origin_id'];
- }
-
- if($origin)
- {
- unset($values['origin']);
- unset($values['origin_id']);
- $values['origin'][0]['type']= $origin;
-
$values['origin'][0]['link']=$this->bocommon->get_origin_link($origin);
- $values['origin'][0]['data'][]= array(
- 'id'=> $origin_id,
- 'type'=> $origin
- );
- }
-
- $values['start_date'] =
get_var('start_date',array('POST'));
- $values['end_date'] =
get_var('end_date',array('POST'));
-
- $config->read_repository();
-
- if ($values['save'])
- {
- $save=true;
-
- if(!$values['location'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
- $error_id=true;
- }
-
- if(!$values['name'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a project NAME !'));
- $error_id=true;
- }
-
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- $error_id=true;
- }
-
- if(!$values['coordinator'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a coordinator !'));
- $error_id=true;
- }
-
- if(!$values['status'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
- }
-
- if($id)
- {
- $values['project_id']=$id;
- $action='edit';
- }
-
- if(!$receipt['error'])
- {
- if(!$id)
- {
-
$values['project_id']=$this->bo->next_project_id();
- $id = $values['project_id'];
- }
-
- if($values['copy_project'])
- {
- $action='add';
- $values['project_id'] =
$this->bo->next_project_id();
- $id = $values['project_id'];
- }
- $receipt =
$this->bo->save($values,$action);
- if($receipt['error'])
- {
- unset($id);
- unset($values['project_id']);
- }
-
- if ($values['approval'] &&
$values['mail_address'])
- {
-
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
-
$from_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
- $headers = "Return-Path: <".
$from_email .">\r\n";
- $headers .= "From: " .
$from_name . "<" . $from_email .">\r\n";
- $headers .= "Bcc: " .
$from_name . "<" . $from_email .">\r\n";
- $headers .= "Content-type:
text/plain; charset=iso-8859-1\r\n";
-
- $subject = lang(Approval).": ".
$values['project_id'];
- $message = lang(Project) . " "
. $values['project_id'] ." ". lang('needs approval');
-
- $mail_method=
$config->config_data['fmwrkorder_mail'];
- if ($mail_method=='smtp'):
- {
- $bcc = $from_email;
- if
(!is_object($GLOBALS['phpgw']->send))
- {
-
$GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
- }
-
- $rcpt =
$GLOBALS['phpgw']->send->msg('email',$values['mail_address'], $subject,
stripslashes($message), '', $cc, $bcc, $from_email, $from_name, 'plain');
-
- if(!$rcpt)
- {
-
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '" .
$values['mail_address'] . "', subject='$subject' failed !!!");
-
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
-
$bypass_error=True;
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('%1 is
notified',$values['mail_address']));
- }
-
- }
- elseif
($mail_method=='sendmail'):
- {
-
$rcpt=mail($values['mail_address'],$subject,$message, $headers);
- }
- else:
- {
-
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin
section)'));
- $bypass_error=True;
- }
- endif;
- }
- }
-
- if (isset($receipt['notice_owner']) AND
is_array($receipt['notice_owner']))
- {
-
if($this->account!=$values['coordinator'] &&
$config->config_data['workorder_approval'])
- {
-
- $prefs_coordinator =
$this->bocommon->create_preferences($this->currentapp,$values['coordinator']);
- $to =
$prefs_coordinator['email'];
-
-
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
-
$from_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
-
-
foreach($receipt['notice_owner'] as $notice)
- {
- $body .= $notice . "\n";
- }
-
- $body .= lang('Altered by') .
': ' . $from_name . "\n";
-
- if
(!is_object($GLOBALS['phpgw']->send))
- {
- $GLOBALS['phpgw']->send
= CreateObject('phpgwapi.send');
- }
-
- $returncode =
$GLOBALS['phpgw']->send->msg('email',$to,$subject=lang('Project %1 is
altered',$id),$body, False,False,False, $from_email, $from_name, 'plain');
-
- if (!$returncode) // not
nice, but better than failing silently
- {
-
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '$to'
subject='$subject' failed !!!");
-
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
- $bypass_error=True;
- }
- else
- {
-
$receipt['message'][]=array('msg'=>lang('%1 is notified',$to));
- }
- }
- }
-
-
- if($receipt['error'] && !$bypass_error)
- {
- if($values['location'])
- {
- $location_code=implode("-",
$values['location']);
- $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
- }
-
- if($values['extra']['p_num'])
- {
-
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
- }
- }
- }
-
- if($bypass_error || ((!$receipt['error'] ||
$add_request) && !$bypass) && $id)
- {
- $values = $this->bo->read_single($id);
-
- if(!$values['workorder_budget'] && $save)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&project_id='
. $id);
- }
-
- if
(!$this->bocommon->check_perms($values['grants'],PHPGW_ACL_EDIT))
- {
-
$receipt['error'][]=array('msg'=>lang('You have no edit right for this
project'));
-
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiproject.view&id='
. $id);
- }
- else
- {
- $record_history =
$this->bo->read_record_history($id);
- }
- }
-
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- $table_header_workorder_budget[] = array
- (
- 'lang_workorder_id' => lang('Workorder'),
- 'lang_budget' => lang('Budget'),
- 'lang_calculation' => lang('Calculation'),
- 'lang_vendor' => lang('Vendor')
- );
-
- if ($id)
- {
- $function_msg = lang('Edit Project');
- }
- else
- {
- $function_msg = lang('Add Project');
- }
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
- $lookup_type='form';
-
-//_debug_array($values);
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' => -1,
// calculated from location_types
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' => True,
- 'lookup_type' => $lookup_type,
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
- 'entity_data' => $values['p']
- ));
-
- if($values['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
$location_data['location'][$i]['value'] = $values['contact_phone'];
- }
- }
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiproject.edit',
- 'id' => $id
- );
-
- $link_request_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uirequest.index',
- 'query' =>
$values['location_data']['loc1'],
- 'project_id' => $values['project_id']
- );
-
-
-
$supervisor_id=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['approval_from'];
- $need_approval =
$config->config_data['workorder_approval'];
-
-
$project_status=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['project_status'];
-
$project_category=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['project_category'];
- if(!$values['status'])
- {
- $values['status']=$project_status;
- }
-
- if(!$values['cat_id'])
- {
- $values['cat_id']=$project_category;
- }
-
- if(!$values['coordinator'])
- {
- $values['coordinator']=$this->account;
- }
-
- if ($supervisor_id && $need_approval=='yes')
- {
- $prefs =
$this->bocommon->create_preferences($this->currentapp,$supervisor_id);
- $supervisor_email = $prefs['email'];
- }
-
- if(!$values['start_date'])
- {
- $values['start_date'] =
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
-
- if($receipt)
- {
- $msgbox_data =
$this->bocommon->msgbox_data($receipt);
- }
-
- if($values['reserve'])
- {
-
$reserve_remainder=$values['reserve']-$values['deviation'];
- $remainder_percent=
number_format(($reserve_remainder/$values['reserve'])*100, 2, ',', '');
- }
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
-
- if (isset($values['origin']) AND
is_array($values['origin']))
- {
- for ($i=0;$i<count($values['origin']);$i++)
- {
-
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
-
if(substr($values['origin'][$i]['type'],0,6)=='entity')
- {
- $type =
explode("_",$values['origin'][$i]['type']);
- $entity_id = $type[1];
- $cat_id = $type[2];
-
- if(!is_object($boadmin_entity))
- {
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- }
- $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
- $values['origin'][$i]['descr']
= $entity_category['name'];
- }
- else
- {
- $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
-
if($values['origin'][$i]['type'] == 'request')
- {
- $selected_request =
True;
- }
- }
- }
- }
-
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-
- 'value_origin'
=> $values['origin'],
- 'value_origin_type'
=> $origin,
- 'value_origin_id'
=> $origin_id,
- 'selected_request'
=> $selected_request,
-
- 'lang_select_request' =>
lang('Select request'),
- 'lang_select_request_statustext' =>
lang('Add request for this project'),
- 'lang_request_statustext' =>
lang('Link to the request for this project'),
- 'lang_delete_request_statustext'=> lang('Check
to delete this request from this project'),
- 'link_select_request' =>
$GLOBALS['phpgw']->link('/index.php',$link_request_data),
- 'link_request'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.view'),
-
- 'add_workorder_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
- 'lang_add_workorder'
=> lang('Add Workorder'),
- 'lang_add_workorder_statustext' =>
lang('Add a workorder to this project'),
-
- 'table_header_workorder_budget' =>
$table_header_workorder_budget,
- 'lang_no_workorders' =>
lang('No workorder bugdet'),
- 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
- 'record_history'
=> $record_history,
- 'table_header_history' =>
$table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
-// 'cal_info'
=> $cal_info,
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
- 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
-
- 'lang_start_date_statustext' => lang('Select
the estimated end date for the Project'),
- 'lang_start_date'
=> lang('Project start date'),
- 'value_start_date'
=> $values['start_date'],
-
- 'lang_end_date_statustext' =>
lang('Select the estimated end date for the Project'),
- 'lang_end_date'
=> lang('Project end date'),
- 'value_end_date'
=> $values['end_date'],
-
- 'lang_copy_project'
=> lang('Copy project ?'),
- 'lang_copy_project_statustext' => lang('Choose
Copy Project to copy this project to a new project'),
-
- 'lang_charge_tenant' =>
lang('Charge tenant'),
- 'lang_charge_tenant_statustext' => lang('Choose
charge tenant if the tenant i to pay for this project'),
- 'charge_tenant'
=> $values['charge_tenant'],
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'lang_power_meter_statustext' => lang('Enter
the power_meter'),
- 'value_power_meter'
=> $values['power_meter'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $values['budget'],
- 'lang_budget_statustext' =>
lang('Enter the budget'),
-
- 'lang_reserve'
=> lang('reserve'),
- 'value_reserve'
=> $values['reserve'],
- 'lang_reserve_statustext' =>
lang('Enter the reserve'),
-
- 'lang_reserve_remainder' =>
lang('reserve remainder'),
- 'value_reserve_remainder' =>
$reserve_remainder,
- 'value_reserve_remainder_percent'=>
$remainder_percent,
-
- 'vendor_data'
=> $vendor_data,
- 'location_data'
=> $location_data,
- 'location_type'
=> 'form',
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index'),
- 'lang_year'
=> lang('Year'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_name'
=> lang('Name'),
-
- 'lang_project_id'
=> lang('Project ID'),
- 'value_project_id'
=> $values['project_id'],
- 'value_name'
=> $values['name'],
- 'lang_name_statustext' =>
lang('Enter Project Name'),
-
- 'lang_other_branch'
=> lang('Other branch'),
- 'lang_other_branch_statustext' =>
lang('Enter other branch if not found in the list'),
- 'value_other_branch'
=> $values['other_branch'],
-
- 'lang_descr_statustext' =>
lang('Enter a description of the project'),
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the project'),
- 'lang_no_cat'
=> lang('Select category'),
- 'lang_cat_statustext' =>
lang('Select the category the project belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'value_cat_id'
=> $values['cat_id'],
- 'cat_list'
=> $this->bo->select_category_project_list('select',$values['cat_id']),
-
- 'lang_workorder_id'
=> lang('Workorder ID'),
- 'sum_workorder_budget' =>
$values['sum_workorder_budget'],
- 'sum_workorder_calculation' =>
$values['sum_workorder_calculation'],
- 'workorder_budget'
=> $values['workorder_budget'],
- 'sum_workorder_actual_cost' =>
$values['sum_workorder_actual_cost'],
-
- 'lang_actual_cost'
=> lang('Actual cost'),
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_sum'
=> lang('Sum'),
- 'lang_user_statustext' =>
lang('Select the coordinator the project belongs to. To do not use a category
select NO USER'),
- 'select_user_name'
=> 'values[coordinator]',
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl2_location),
-
- 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
- 'status_name'
=> 'values[status]',
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
- 'lang_status_statustext' =>
lang('What is the current status of this project ?'),
-
- 'branch_list'
=> $this->bo->select_branch_p_list($values['project_id']),
- 'lang_branch'
=> lang('branch'),
- 'lang_branch_statustext' =>
lang('Select the branches for this project'),
-
- 'key_responsible_list'
=> $this->bo->select_branch_list($values['key_responsible']),
- 'lang_no_key_responsible'
=> lang('Select key responsible'),
- 'lang_key_responsible'
=> lang('key responsible'),
- 'lang_key_responsible_statustext'
=> lang('Select the key responsible for this project'),
-
- 'key_fetch_list'
=> $this->bo->select_key_location_list($values['key_fetch']),
- 'lang_no_key_fetch'
=> lang('Where to fetch the key'),
- 'lang_key_fetch'
=> lang('key fetch location'),
- 'lang_key_fetch_statustext'
=> lang('Select where to fetch the key'),
-
- 'key_deliver_list'
=> $this->bo->select_key_location_list($values['key_deliver']),
- 'lang_no_key_deliver'
=> lang('Where to deliver the key'),
- 'lang_key_deliver'
=> lang('key deliver location'),
- 'lang_key_deliver_statustext' =>
lang('Select where to deliver the key'),
-
- 'need_approval'
=> $need_approval,
- 'lang_ask_approval'
=> lang('Ask for approval'),
- 'lang_ask_approval_statustext' =>
lang('Check this to send a mail to your supervisor for approval'),
- 'value_approval_mail_address' =>
$supervisor_email,
-
-
- 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
- );
-
- $appname = lang('project');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
-
- $project_id = get_var('project_id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiproject.index',
- 'project_id' => $project_id
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($project_id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&project_id='
. $project_id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('project');
- $function_msg =
lang('delete project');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp);
-
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,'');
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $id = get_var('id',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('project'));
-
- $values = $this->bo->read_single($id);
-
- $record_history = $this->bo->read_record_history($id);
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- $table_header_workorder_budget[] = array
- (
- 'lang_workorder_id' => lang('Workorder'),
- 'lang_budget' => lang('Budget'),
- 'lang_calculation' => lang('Calculation'),
- 'lang_vendor' => lang('Vendor')
- );
-
- $function_msg = lang('View Project');
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
$values['location_data']['tenant_id'],
- 'lookup_type' => 'view',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
- 'entity_data' => $values['p']
- ));
-
- if($values['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
unset($location_data['location'][$i]['value']);
- }
- }
- }
-
- if($values['reserve'])
- {
-
$reserve_remainder=$values['reserve']-$values['deviation'];
- $remainder_percent=
number_format(($reserve_remainder/$values['reserve'])*100, 2, ',', '');
- }
-
-//_debug_array($values);
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- if (isset($values['origin']) AND
is_array($values['origin']))
- {
- for ($i=0;$i<count($values['origin']);$i++)
- {
-
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
-
if(substr($values['origin'][$i]['type'],0,6)=='entity')
- {
- $type =
explode("_",$values['origin'][$i]['type']);
- $entity_id = $type[1];
- $cat_id = $type[2];
-
- if(!is_object($boadmin_entity))
- {
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- }
- $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
- $values['origin'][$i]['descr']
= $entity_category['name'];
- }
- else
- {
- $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
- }
- }
- }
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-
- 'value_origin'
=> $values['origin'],
- 'value_origin_type'
=> $origin,
- 'value_origin_id'
=> $origin_id,
-
- 'table_header_workorder_budget' =>
$table_header_workorder_budget,
- 'lang_no_workorders' =>
lang('No workorder bugdet'),
- 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
- 'record_history'
=> $record_history,
- 'table_header_history' =>
$table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
- 'lang_start_date'
=> lang('Project start date'),
- 'value_start_date'
=> $values['start_date'],
-
- 'lang_end_date'
=> lang('Project end date'),
- 'value_end_date'
=> $values['end_date'],
-
- 'lang_charge_tenant' =>
lang('Charge tenant'),
- 'charge_tenant'
=> $values['charge_tenant'],
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'value_power_meter'
=> $values['power_meter'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $values['budget'],
-
- 'lang_reserve'
=> lang('reserve'),
- 'value_reserve'
=> $values['reserve'],
- 'lang_reserve_statustext' =>
lang('Enter the reserve'),
-
- 'lang_reserve_remainder' =>
lang('reserve remainder'),
- 'value_reserve_remainder' =>
$reserve_remainder,
- 'value_reserve_remainder_percent'=>
$remainder_percent,
-
- 'vendor_data'
=> $vendor_data,
- 'location_data'
=> $location_data,
- 'location_type'
=> 'view',
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index'),
- 'lang_year'
=> lang('Year'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_name'
=> lang('Name'),
-
- 'lang_project_id'
=> lang('Project ID'),
- 'value_project_id'
=> $values['project_id'],
- 'value_name'
=> $values['name'],
-
- 'lang_other_branch'
=> lang('Other branch'),
- 'value_other_branch' =>
$values['other_branch'],
-
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'select_name'
=> 'values[cat_id]',
- 'cat_list'
=> $this->bo->select_category_project_list('select',$values['cat_id']),
-
- 'lang_workorder_id'
=> lang('Workorder ID'),
- 'sum_workorder_budget' =>
$values['sum_workorder_budget'],
- 'sum_workorder_calculation' =>
$values['sum_workorder_calculation'],
- 'workorder_budget'
=> $values['workorder_budget'],
- 'sum_workorder_actual_cost' =>
$values['sum_workorder_actual_cost'],
- 'lang_actual_cost'
=> lang('Actual cost'),
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_sum'
=> lang('Sum'),
- 'select_user_name'
=> 'values[coordinator]',
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=>
$this->bocommon->get_user_list('select',$values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
-
- 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
-
- 'branch_list'
=> $this->bo->select_branch_p_list($values['project_id']),
- 'lang_branch'
=> lang('branch'),
-
- 'key_responsible_list' =>
$this->bo->select_branch_list($values['key_responsible']),
- 'lang_key_responsible' =>
lang('key responsible'),
-
- 'key_fetch_list'
=> $this->bo->select_key_location_list($values['key_fetch']),
- 'lang_key_fetch'
=> lang('key fetch location'),
-
- 'key_deliver_list'
=> $this->bo->select_key_location_list($values['key_deliver']),
- 'lang_key_deliver'
=> lang('key deliver location'),
-
- 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
. $id),
- 'lang_edit_statustext'
=> lang('Edit this entry project'),
- 'lang_edit'
=> lang('Edit'),
- 'currency'
=>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
-
- 'lang_contact_phone' =>
lang('Contact phone'),
- 'contact_phone'
=> $values['contact_phone'],
- );
-
- $appname = lang('project');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.uiproject.inc.php,v 1.24 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uiproject
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'excel' => True,
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'date_search'=>True
+ );
+
+ function uiproject()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.boproject',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.project';
+ $this->acl_read =
$this->acl2->check('.project',1);
+ $this->acl_add =
$this->acl2->check('.project',2);
+ $this->acl_edit =
$this->acl2->check('.project',4);
+ $this->acl_delete =
$this->acl2->check('.project',8);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->status_id =
$this->bo->status_id;
+ $this->wo_hour_cat_id =
$this->bo->wo_hour_cat_id;
+
+
+ $this->menu->sub ='project';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'status_id' => $this->status_id,
+ 'wo_hour_cat_id'=> $this->wo_hour_cat_id
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function excel()
+ {
+ $start_date =
urldecode(get_var('start_date',array('POST','GET')));
+ $end_date =
urldecode(get_var('end_date',array('POST','GET')));
+ $list =
$this->bo->read($start_date,$end_date,$allrows=True);
+ $uicols = $this->bo->uicols;
+
$this->bocommon->excel($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
+ }
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('project','values','table_header',
+
'menu',
+
'nextmatchs',
+
'search_field',
+
'wo_hour_cat_filter'));
+
+ $lookup =
get_var('lookup',array('POST','GET'));
+ $from =
get_var('from',array('POST','GET'));
+ $start_date =
urldecode(get_var('start_date',array('POST','GET')));
+ $end_date =
urldecode(get_var('end_date',array('POST','GET')));
+
+ $links = $this->menu->links('project');
+
+ $project_list = $this->bo->read($start_date,$end_date);
+ $uicols = $this->bo->uicols;
+ $count_uicols_name=count($uicols['name']);
+
+ $j=0;
+ if (isSet($project_list) AND is_array($project_list))
+ {
+ foreach($project_list as $project_entry)
+
+ {
+ for ($k=0;$k<$count_uicols_name;$k++)
+ {
+
if($uicols['input_type'][$k]=='text')
+ {
+
+
if($project_entry['query_location'][$uicols['name'][$k]])
+ {
+
$content[$j]['row'][]= array(
+
'statustext' => lang('search'),
+ 'text'
=> $project_entry[$uicols['name'][$k]],
+ 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&query='
. $project_entry['query_location'][$uicols['name'][$k]] . '&lookup=' . $lookup
. '&from=' . $from . '&filter=' . $this->filter)
+ );
+ }
+ else
+ {
+
$content[$j]['row'][]= array(
+ 'value'
=> $project_entry[$uicols['name'][$k]],
+ 'name'
=> $uicols['name'][$k]
+ );
+ }
+ }
+
elseif($uicols['input_type'][$k]=='link')
+ {
+
$content[$j]['row'][]= array(
+ 'statustext'
=> lang('search'),
+ 'text'
=> $project_entry[$uicols['name'][$k]],
+ 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.view&id='
. $project_entry[$uicols['name'][$k]])
+ );
+ }
+
+ if($lookup &&
$k==($count_uicols_name-1))
+ {
+ $content[$j]['row'][]=
array(
+ 'lookup_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui' .
$from . '.edit&project_id=' . $project_entry['project_id'])
+ );
+ }
+ }
+
+ if(!$lookup)
+ {
+ if ($this->acl_read &&
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_READ))
+ {
+ $content[$j]['row'][]=
array(
+ 'statustext'
=> lang('view the project'),
+ 'text'
=> lang('view'),
+ 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.view&id='
. $project_entry['project_id'])
+ );
+ }
+ else
+ {
+ $content[$j]['row'][]=
array('link'=>'dummy');
+ }
+
+ if ($this->acl_edit &&
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_EDIT))
+ {
+ $content[$j]['row'][]=
array(
+ 'statustext' =>
lang('edit the project'),
+ 'text'
=> lang('edit'),
+ 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
. $project_entry['project_id'])
+ );
+ }
+ else
+ {
+ $content[$j]['row'][]=
array('link'=>'dummy');
+ }
+
+ if ($this->acl_delete &&
$this->bocommon->check_perms($project_entry['grants'],PHPGW_ACL_DELETE))
+ {
+ $content[$j]['row'][]=
array(
+ 'statustext' =>
lang('delete the project'),
+ 'text'
=> lang('delete'),
+ 'link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&project_id='
. $project_entry['project_id'])
+ );
+ }
+ else
+ {
+ $content[$j]['row'][]=
array('link'=>'dummy');
+ }
+ }
+
+ $j++;
+ }
+ }
+
+ $count_uicols_descr=count($uicols['descr']);
+ for ($i=0;$i<$count_uicols_descr;$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['name'][$i]=='loc1')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'location_code',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiproject.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'from' =>$from,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id,
+
'start_date'=>$start_date,
+
'end_date'=>$end_date,
+
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
+
)
+
));
+ }
+ if($uicols['name'][$i]=='project_id')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'project_id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiproject.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'from' =>$from,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id,
+
'start_date'=>$start_date,
+
'end_date'=>$end_date,
+
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
+
)
+
));
+ }
+ if($uicols['name'][$i]=='address')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'address',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiproject.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'from' =>$from,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id,
+
'start_date'=>$start_date,
+
'end_date'=>$end_date,
+
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
+
)
+
));
+ }
+ }
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+ }
+ else
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header'] =
lang('select');
+ }
+
+//_debug_array($content);
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
project'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit')
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiproject.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'filter'
=>$this->filter,
+ 'status_id'
=>$this->status_id,
+ 'lookup'
=>$lookup,
+ 'from' =>$from,
+ 'query'
=>$this->query,
+ 'start_date' =>$start_date,
+ 'end_date'
=>$end_date,
+ 'wo_hour_cat_id'
=>$this->wo_hour_cat_id,
+ );
+
+ $link_date_search
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
+
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiproject.excel',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'filter'
=>$this->filter,
+ 'status_id'
=>$this->status_id,
+ 'lookup'
=>$lookup,
+ 'from' =>$from,
+ 'query'
=>$this->query,
+ 'start_date'
=>$start_date,
+ 'end_date'
=>$end_date,
+ 'start'
=>$this->start,
+ 'wo_hour_cat_id'
=>$this->wo_hour_cat_id,
+ );
+
+ $data = array
+ (
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+
+ 'start_date'
=>$start_date,
+ 'end_date'
=>$end_date,
+ 'lang_none'
=>lang('None'),
+ 'lang_date_search' =>
lang('Date search'),
+ 'lang_date_search_help' => lang('Narrow
the search by dates'),
+ 'link_date_search' =>
$link_date_search,
+ 'overlib_source' =>
'./'.$this->currentapp.'/inc/overlib.js',
+
+ 'lang_select'
=> lang('select'),
+ 'lookup_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
+ 'lookup'
=> $lookup,
+ 'links'
=> $links,
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($project_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the project belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_project_list('filter',$this->cat_id),
+ 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+ 'select_district_name' =>
'district_id',
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_status_statustext' =>
lang('Select the status the agreement belongs to. To do not use a category
select NO STATUS'),
+ 'status_name'
=> 'status_id',
+ 'lang_no_status'
=> lang('No status'),
+ 'status_list'
=> $this->bo->select_status_list('filter',$this->status_id),
+
+ 'lang_wo_hour_cat_statustext' =>
lang('Select the workorder hour category'),
+ 'lang_no_wo_hour_cat' =>
lang('no hour category'),
+ 'wo_hour_cat_list'
=> $this->bocommon->select_wo_hours_category_list($this->wo_hour_cat_id),
+
+ 'lang_user_statustext' =>
lang('Select the user the project belongs to. To do not use a category select
NO USER'),
+ 'select_user_name'
=> 'filter',
+ 'lang_no_user'
=> lang('No user'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2('filter',4,$this->filter,$this->acl2_location,array('all'),$default=$this->account),
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('Project');
+ $function_msg =
lang('list Project');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_project' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function date_search()
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('date_search'));
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+ $GLOBALS['phpgw_info']['flags'][noheader] = True;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = True;
+ $values['start_date'] =
get_var('start_date',array('POST'));
+ $values['end_date'] =
get_var('end_date',array('POST'));
+
+ $function_msg = lang('Date search');
+ $appname = lang('project');
+
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ if(!$values['end_date'])
+ {
+ $values['end_date'] =
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $data = array
+ (
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
+ 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
+
+ 'lang_start_date_statustext' => lang('Select
the estimated end date for the Project'),
+ 'lang_start_date'
=> lang('Start date'),
+ 'value_start_date'
=> $values['start_date'],
+
+ 'lang_end_date_statustext' =>
lang('Select the estimated end date for the Project'),
+ 'lang_end_date'
=> lang('End date'),
+ 'value_end_date'
=> $values['end_date'],
+
+ 'dateformat'
=> $dateformat,
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_submit_statustext' =>
lang('Select this dates'),
+ 'lang_submit' =>
lang('Submit')
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('date_search' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+ $id =
get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+ $add_request =
get_var('add_request',array('POST'));
+
+ $config =
CreateObject('phpgwapi.config');
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+ $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
+
+ for ($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('project'));
+
+ $bypass =
get_var('bypass',array('POST','GET'));
+
+ if($add_request)
+ {
+ $receipt =
$this->bo->add_request($add_request,$id);
+ }
+
+ if($_POST && !$bypass)
+ {
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+
+ }
+ else
+ {
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $tenant_id =
get_var('tenant_id',array('POST','GET'));
+ $values['descr'] =
get_var('descr',array('POST','GET'));
+ $p_entity_id =
get_var('p_entity_id',array('POST','GET'));
+ $p_cat_id =
get_var('p_cat_id',array('POST','GET'));
+ $values['p'][$p_entity_id]['p_entity_id']
= $p_entity_id;
+ $values['p'][$p_entity_id]['p_cat_id']
= $p_cat_id;
+ $values['p'][$p_entity_id]['p_num']
= get_var('p_num',array('POST','GET'));
+
+ $origin =
get_var('origin',array('POST','GET'));
+ $origin_id =
get_var('origin_id',array('POST','GET'));
+
+ if($p_entity_id && $p_cat_id)
+ {
+
+ if(!is_object($boadmin_entity))
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ }
+
+ $entity_category =
$boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
+
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
+ }
+
+ if($location_code)
+ {
+ $values['location_data'] =
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
+ }
+
+ }
+
+ if($values['origin'])
+ {
+ $origin = $values['origin'];
+ $origin_id = $values['origin_id'];
+ }
+
+ if($origin)
+ {
+ unset($values['origin']);
+ unset($values['origin_id']);
+ $values['origin'][0]['type']= $origin;
+
$values['origin'][0]['link']=$this->bocommon->get_origin_link($origin);
+ $values['origin'][0]['data'][]= array(
+ 'id'=> $origin_id,
+ 'type'=> $origin
+ );
+ }
+
+ $values['start_date'] =
get_var('start_date',array('POST'));
+ $values['end_date'] =
get_var('end_date',array('POST'));
+
+ $config->read_repository();
+
+ if ($values['save'])
+ {
+ $save=true;
+
+ if(!$values['location'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
+ $error_id=true;
+ }
+
+ if(!$values['name'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a project NAME !'));
+ $error_id=true;
+ }
+
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ $error_id=true;
+ }
+
+ if(!$values['coordinator'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a coordinator !'));
+ $error_id=true;
+ }
+
+ if(!$values['status'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
+ }
+
+ if($id)
+ {
+ $values['project_id']=$id;
+ $action='edit';
+ }
+
+ if(!$receipt['error'])
+ {
+ if(!$id)
+ {
+
$values['project_id']=$this->bo->next_project_id();
+ $id = $values['project_id'];
+ }
+
+ if($values['copy_project'])
+ {
+ $action='add';
+ $values['project_id'] =
$this->bo->next_project_id();
+ $id = $values['project_id'];
+ }
+ $receipt =
$this->bo->save($values,$action);
+ if($receipt['error'])
+ {
+ unset($id);
+ unset($values['project_id']);
+ }
+
+ if ($values['approval'] &&
$values['mail_address'])
+ {
+
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
+
$from_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
+ $headers = "Return-Path: <".
$from_email .">\r\n";
+ $headers .= "From: " .
$from_name . "<" . $from_email .">\r\n";
+ $headers .= "Bcc: " .
$from_name . "<" . $from_email .">\r\n";
+ $headers .= "Content-type:
text/plain; charset=iso-8859-1\r\n";
+
+ $subject = lang(Approval).": ".
$values['project_id'];
+ $message = lang(Project) . " "
. $values['project_id'] ." ". lang('needs approval');
+
+ $mail_method=
$config->config_data['fmwrkorder_mail'];
+ if ($mail_method=='smtp'):
+ {
+ $bcc = $from_email;
+ if
(!is_object($GLOBALS['phpgw']->send))
+ {
+
$GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
+ }
+
+ $rcpt =
$GLOBALS['phpgw']->send->msg('email',$values['mail_address'], $subject,
stripslashes($message), '', $cc, $bcc, $from_email, $from_name, 'plain');
+
+ if(!$rcpt)
+ {
+
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '" .
$values['mail_address'] . "', subject='$subject' failed !!!");
+
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
+
$bypass_error=True;
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('%1 is
notified',$values['mail_address']));
+ }
+
+ }
+ elseif
($mail_method=='sendmail'):
+ {
+
$rcpt=mail($values['mail_address'],$subject,$message, $headers);
+ }
+ else:
+ {
+
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin
section)'));
+ $bypass_error=True;
+ }
+ endif;
+ }
+ }
+
+ if (isset($receipt['notice_owner']) AND
is_array($receipt['notice_owner']))
+ {
+
if($this->account!=$values['coordinator'] &&
$config->config_data['workorder_approval'])
+ {
+
+ $prefs_coordinator =
$this->bocommon->create_preferences($this->currentapp,$values['coordinator']);
+ $to =
$prefs_coordinator['email'];
+
+
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
+
$from_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
+
+
foreach($receipt['notice_owner'] as $notice)
+ {
+ $body .= $notice . "\n";
+ }
+
+ $body .= lang('Altered by') .
': ' . $from_name . "\n";
+
+ if
(!is_object($GLOBALS['phpgw']->send))
+ {
+ $GLOBALS['phpgw']->send
= CreateObject('phpgwapi.send');
+ }
+
+ $returncode =
$GLOBALS['phpgw']->send->msg('email',$to,$subject=lang('Project %1 is
altered',$id),$body, False,False,False, $from_email, $from_name, 'plain');
+
+ if (!$returncode) // not
nice, but better than failing silently
+ {
+
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '$to'
subject='$subject' failed !!!");
+
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
+ $bypass_error=True;
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('%1 is notified',$to));
+ }
+ }
+ }
+
+
+ if($receipt['error'] && !$bypass_error)
+ {
+ if($values['location'])
+ {
+ $location_code=implode("-",
$values['location']);
+ $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
+ }
+
+ if($values['extra']['p_num'])
+ {
+
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
+ }
+ }
+ }
+
+ if($bypass_error || ((!$receipt['error'] ||
$add_request) && !$bypass) && $id)
+ {
+ $values = $this->bo->read_single($id);
+
+ if(!$values['workorder_budget'] && $save)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&project_id='
. $id);
+ }
+
+ if
(!$this->bocommon->check_perms($values['grants'],PHPGW_ACL_EDIT))
+ {
+
$receipt['error'][]=array('msg'=>lang('You have no edit right for this
project'));
+
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiproject.view&id='
. $id);
+ }
+ else
+ {
+ $record_history =
$this->bo->read_record_history($id);
+ }
+ }
+
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ $table_header_workorder_budget[] = array
+ (
+ 'lang_workorder_id' => lang('Workorder'),
+ 'lang_budget' => lang('Budget'),
+ 'lang_calculation' => lang('Calculation'),
+ 'lang_vendor' => lang('Vendor')
+ );
+
+ if ($id)
+ {
+ $function_msg = lang('Edit Project');
+ }
+ else
+ {
+ $function_msg = lang('Add Project');
+ }
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ $lookup_type='form';
+
+//_debug_array($values);
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' => -1,
// calculated from location_types
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' => True,
+ 'lookup_type' => $lookup_type,
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
+ 'entity_data' => $values['p']
+ ));
+
+ if($values['contact_phone'])
+ {
+ for
($i=0;$i<count($location_data['location']);$i++)
+ {
+
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+ {
+
$location_data['location'][$i]['value'] = $values['contact_phone'];
+ }
+ }
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiproject.edit',
+ 'id' => $id
+ );
+
+ $link_request_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uirequest.index',
+ 'query' =>
$values['location_data']['loc1'],
+ 'project_id' => $values['project_id']
+ );
+
+
+
$supervisor_id=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['approval_from'];
+ $need_approval =
$config->config_data['workorder_approval'];
+
+
$project_status=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['project_status'];
+
$project_category=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['project_category'];
+ if(!$values['status'])
+ {
+ $values['status']=$project_status;
+ }
+
+ if(!$values['cat_id'])
+ {
+ $values['cat_id']=$project_category;
+ }
+
+ if(!$values['coordinator'])
+ {
+ $values['coordinator']=$this->account;
+ }
+
+ if ($supervisor_id && $need_approval=='yes')
+ {
+ $prefs =
$this->bocommon->create_preferences($this->currentapp,$supervisor_id);
+ $supervisor_email = $prefs['email'];
+ }
+
+ if(!$values['start_date'])
+ {
+ $values['start_date'] =
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ }
+
+ if($receipt)
+ {
+ $msgbox_data =
$this->bocommon->msgbox_data($receipt);
+ }
+
+ if($values['reserve'])
+ {
+
$reserve_remainder=$values['reserve']-$values['deviation'];
+ $remainder_percent=
number_format(($reserve_remainder/$values['reserve'])*100, 2, ',', '');
+ }
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+
+ if (isset($values['origin']) AND
is_array($values['origin']))
+ {
+ for ($i=0;$i<count($values['origin']);$i++)
+ {
+
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
+
if(substr($values['origin'][$i]['type'],0,6)=='entity')
+ {
+ $type =
explode("_",$values['origin'][$i]['type']);
+ $entity_id = $type[1];
+ $cat_id = $type[2];
+
+ if(!is_object($boadmin_entity))
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ }
+ $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
+ $values['origin'][$i]['descr']
= $entity_category['name'];
+ }
+ else
+ {
+ $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
+
if($values['origin'][$i]['type'] == 'request')
+ {
+ $selected_request =
True;
+ }
+ }
+ }
+ }
+
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+
+ 'value_origin'
=> $values['origin'],
+ 'value_origin_type'
=> $origin,
+ 'value_origin_id'
=> $origin_id,
+ 'selected_request'
=> $selected_request,
+
+ 'lang_select_request' =>
lang('Select request'),
+ 'lang_select_request_statustext' =>
lang('Add request for this project'),
+ 'lang_request_statustext' =>
lang('Link to the request for this project'),
+ 'lang_delete_request_statustext'=> lang('Check
to delete this request from this project'),
+ 'link_select_request' =>
$GLOBALS['phpgw']->link('/index.php',$link_request_data),
+ 'link_request'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.view'),
+
+ 'add_workorder_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
+ 'lang_add_workorder'
=> lang('Add Workorder'),
+ 'lang_add_workorder_statustext' =>
lang('Add a workorder to this project'),
+
+ 'table_header_workorder_budget' =>
$table_header_workorder_budget,
+ 'lang_no_workorders' =>
lang('No workorder bugdet'),
+ 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history'),
+
+// 'cal_info'
=> $cal_info,
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
+ 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
+
+ 'lang_start_date_statustext' => lang('Select
the estimated end date for the Project'),
+ 'lang_start_date'
=> lang('Project start date'),
+ 'value_start_date'
=> $values['start_date'],
+
+ 'lang_end_date_statustext' =>
lang('Select the estimated end date for the Project'),
+ 'lang_end_date'
=> lang('Project end date'),
+ 'value_end_date'
=> $values['end_date'],
+
+ 'lang_copy_project'
=> lang('Copy project ?'),
+ 'lang_copy_project_statustext' => lang('Choose
Copy Project to copy this project to a new project'),
+
+ 'lang_charge_tenant' =>
lang('Charge tenant'),
+ 'lang_charge_tenant_statustext' => lang('Choose
charge tenant if the tenant i to pay for this project'),
+ 'charge_tenant'
=> $values['charge_tenant'],
+
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'lang_power_meter_statustext' => lang('Enter
the power_meter'),
+ 'value_power_meter'
=> $values['power_meter'],
+
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> $values['budget'],
+ 'lang_budget_statustext' =>
lang('Enter the budget'),
+
+ 'lang_reserve'
=> lang('reserve'),
+ 'value_reserve'
=> $values['reserve'],
+ 'lang_reserve_statustext' =>
lang('Enter the reserve'),
+
+ 'lang_reserve_remainder' =>
lang('reserve remainder'),
+ 'value_reserve_remainder' =>
$reserve_remainder,
+ 'value_reserve_remainder_percent'=>
$remainder_percent,
+
+ 'vendor_data'
=> $vendor_data,
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'form',
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index'),
+ 'lang_year'
=> lang('Year'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_name'
=> lang('Name'),
+
+ 'lang_project_id'
=> lang('Project ID'),
+ 'value_project_id'
=> $values['project_id'],
+ 'value_name'
=> $values['name'],
+ 'lang_name_statustext' =>
lang('Enter Project Name'),
+
+ 'lang_other_branch'
=> lang('Other branch'),
+ 'lang_other_branch_statustext' =>
lang('Enter other branch if not found in the list'),
+ 'value_other_branch'
=> $values['other_branch'],
+
+ 'lang_descr_statustext' =>
lang('Enter a description of the project'),
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the project'),
+ 'lang_no_cat'
=> lang('Select category'),
+ 'lang_cat_statustext' =>
lang('Select the category the project belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'value_cat_id'
=> $values['cat_id'],
+ 'cat_list'
=> $this->bo->select_category_project_list('select',$values['cat_id']),
+
+ 'lang_workorder_id'
=> lang('Workorder ID'),
+ 'sum_workorder_budget' =>
$values['sum_workorder_budget'],
+ 'sum_workorder_calculation' =>
$values['sum_workorder_calculation'],
+ 'workorder_budget'
=> $values['workorder_budget'],
+ 'sum_workorder_actual_cost' =>
$values['sum_workorder_actual_cost'],
+
+ 'lang_actual_cost'
=> lang('Actual cost'),
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_sum'
=> lang('Sum'),
+ 'lang_user_statustext' =>
lang('Select the coordinator the project belongs to. To do not use a category
select NO USER'),
+ 'select_user_name'
=> 'values[coordinator]',
+ 'lang_no_user'
=> lang('Select coordinator'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl2_location),
+
+ 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
+ 'status_name'
=> 'values[status]',
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+ 'lang_status_statustext' =>
lang('What is the current status of this project ?'),
+
+ 'branch_list'
=> $this->bo->select_branch_p_list($values['project_id']),
+ 'lang_branch'
=> lang('branch'),
+ 'lang_branch_statustext' =>
lang('Select the branches for this project'),
+
+ 'key_responsible_list'
=> $this->bo->select_branch_list($values['key_responsible']),
+ 'lang_no_key_responsible'
=> lang('Select key responsible'),
+ 'lang_key_responsible'
=> lang('key responsible'),
+ 'lang_key_responsible_statustext'
=> lang('Select the key responsible for this project'),
+
+ 'key_fetch_list'
=> $this->bo->select_key_location_list($values['key_fetch']),
+ 'lang_no_key_fetch'
=> lang('Where to fetch the key'),
+ 'lang_key_fetch'
=> lang('key fetch location'),
+ 'lang_key_fetch_statustext'
=> lang('Select where to fetch the key'),
+
+ 'key_deliver_list'
=> $this->bo->select_key_location_list($values['key_deliver']),
+ 'lang_no_key_deliver'
=> lang('Where to deliver the key'),
+ 'lang_key_deliver'
=> lang('key deliver location'),
+ 'lang_key_deliver_statustext' =>
lang('Select where to deliver the key'),
+
+ 'need_approval'
=> $need_approval,
+ 'lang_ask_approval'
=> lang('Ask for approval'),
+ 'lang_ask_approval_statustext' =>
lang('Check this to send a mail to your supervisor for approval'),
+ 'value_approval_mail_address' =>
$supervisor_email,
+
+
+ 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
+ );
+
+ $appname = lang('project');
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ if(!$this->acl_delete)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+
+ $project_id = get_var('project_id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiproject.index',
+ 'project_id' => $project_id
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($project_id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.delete&project_id='
. $project_id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('project');
+ $function_msg =
lang('delete project');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp);
+
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,'');
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $id = get_var('id',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('project'));
+
+ $values = $this->bo->read_single($id);
+
+ $record_history = $this->bo->read_record_history($id);
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ $table_header_workorder_budget[] = array
+ (
+ 'lang_workorder_id' => lang('Workorder'),
+ 'lang_budget' => lang('Budget'),
+ 'lang_calculation' => lang('Calculation'),
+ 'lang_vendor' => lang('Vendor')
+ );
+
+ $function_msg = lang('View Project');
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
$values['location_data']['tenant_id'],
+ 'lookup_type' => 'view',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
+ 'entity_data' => $values['p']
+ ));
+
+ if($values['contact_phone'])
+ {
+ for
($i=0;$i<count($location_data['location']);$i++)
+ {
+
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+ {
+
unset($location_data['location'][$i]['value']);
+ }
+ }
+ }
+
+ if($values['reserve'])
+ {
+
$reserve_remainder=$values['reserve']-$values['deviation'];
+ $remainder_percent=
number_format(($reserve_remainder/$values['reserve'])*100, 2, ',', '');
+ }
+
+//_debug_array($values);
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ if (isset($values['origin']) AND
is_array($values['origin']))
+ {
+ for ($i=0;$i<count($values['origin']);$i++)
+ {
+
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
+
if(substr($values['origin'][$i]['type'],0,6)=='entity')
+ {
+ $type =
explode("_",$values['origin'][$i]['type']);
+ $entity_id = $type[1];
+ $cat_id = $type[2];
+
+ if(!is_object($boadmin_entity))
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ }
+ $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
+ $values['origin'][$i]['descr']
= $entity_category['name'];
+ }
+ else
+ {
+ $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
+ }
+ }
+ }
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+
+ 'value_origin'
=> $values['origin'],
+ 'value_origin_type'
=> $origin,
+ 'value_origin_id'
=> $origin_id,
+
+ 'table_header_workorder_budget' =>
$table_header_workorder_budget,
+ 'lang_no_workorders' =>
lang('No workorder bugdet'),
+ 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history'),
+
+ 'lang_start_date'
=> lang('Project start date'),
+ 'value_start_date'
=> $values['start_date'],
+
+ 'lang_end_date'
=> lang('Project end date'),
+ 'value_end_date'
=> $values['end_date'],
+
+ 'lang_charge_tenant' =>
lang('Charge tenant'),
+ 'charge_tenant'
=> $values['charge_tenant'],
+
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'value_power_meter'
=> $values['power_meter'],
+
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> $values['budget'],
+
+ 'lang_reserve'
=> lang('reserve'),
+ 'value_reserve'
=> $values['reserve'],
+ 'lang_reserve_statustext' =>
lang('Enter the reserve'),
+
+ 'lang_reserve_remainder' =>
lang('reserve remainder'),
+ 'value_reserve_remainder' =>
$reserve_remainder,
+ 'value_reserve_remainder_percent'=>
$remainder_percent,
+
+ 'vendor_data'
=> $vendor_data,
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'view',
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index'),
+ 'lang_year'
=> lang('Year'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_name'
=> lang('Name'),
+
+ 'lang_project_id'
=> lang('Project ID'),
+ 'value_project_id'
=> $values['project_id'],
+ 'value_name'
=> $values['name'],
+
+ 'lang_other_branch'
=> lang('Other branch'),
+ 'value_other_branch' =>
$values['other_branch'],
+
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'select_name'
=> 'values[cat_id]',
+ 'cat_list'
=> $this->bo->select_category_project_list('select',$values['cat_id']),
+
+ 'lang_workorder_id'
=> lang('Workorder ID'),
+ 'sum_workorder_budget' =>
$values['sum_workorder_budget'],
+ 'sum_workorder_calculation' =>
$values['sum_workorder_calculation'],
+ 'workorder_budget'
=> $values['workorder_budget'],
+ 'sum_workorder_actual_cost' =>
$values['sum_workorder_actual_cost'],
+ 'lang_actual_cost'
=> lang('Actual cost'),
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_sum'
=> lang('Sum'),
+ 'select_user_name'
=> 'values[coordinator]',
+ 'lang_no_user'
=> lang('Select coordinator'),
+ 'user_list'
=>
$this->bocommon->get_user_list('select',$values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+
+ 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+
+ 'branch_list'
=> $this->bo->select_branch_p_list($values['project_id']),
+ 'lang_branch'
=> lang('branch'),
+
+ 'key_responsible_list' =>
$this->bo->select_branch_list($values['key_responsible']),
+ 'lang_key_responsible' =>
lang('key responsible'),
+
+ 'key_fetch_list'
=> $this->bo->select_key_location_list($values['key_fetch']),
+ 'lang_key_fetch'
=> lang('key fetch location'),
+
+ 'key_deliver_list'
=> $this->bo->select_key_location_list($values['key_deliver']),
+ 'lang_key_deliver'
=> lang('key deliver location'),
+
+ 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
. $id),
+ 'lang_edit_statustext'
=> lang('Edit this entry project'),
+ 'lang_edit'
=> lang('Edit'),
+ 'currency'
=>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+
+ 'lang_contact_phone' =>
lang('Contact phone'),
+ 'contact_phone'
=> $values['contact_phone'],
+ );
+
+ $appname = lang('project');
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uirequest.inc.php
diff -u property/inc/class.uirequest.inc.php:1.18
property/inc/class.uirequest.inc.php:1.19
--- property/inc/class.uirequest.inc.php:1.18 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uirequest.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1229 +1,1229 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.uirequest.inc.php,v 1.18 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uirequest
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'priority_key' => True,
- 'view_file' => True
- );
-
- function uirequest()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject($this->currentapp.'.borequest',True);
- $this->boproject =
CreateObject($this->currentapp.'.boproject');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
- $this->bolocation =
CreateObject($this->currentapp.'.bolocation');
- $this->config =
CreateObject('phpgwapi.config');
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.project';
- $this->acl_read =
$this->acl2->check('.project',1);
- $this->acl_add =
$this->acl2->check('.project',2);
- $this->acl_edit =
$this->acl2->check('.project',4);
- $this->acl_delete =
$this->acl2->check('.project',8);
- $this->acl_manage =
$this->acl2->check('.project',16);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->status_id =
$this->bo->status_id;
-
- $this->menu->sub ='project';
- $this->fakebase =
$this->bo->fakebase;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'status_id' => $this->status_id
- );
- $this->bo->save_sessiondata($data);
- }
-
- function view_file()
- {
- $GLOBALS['phpgw_info']['flags'][noheader] = True;
- $GLOBALS['phpgw_info']['flags'][nofooter] = True;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $file_name =
urldecode(get_var('file_name',array('POST','GET')));
- $location_code =
get_var('location_code',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
-
- $file = $this->fakebase. SEP . 'request' . SEP .
$location_code . SEP . $id . SEP . $file_name;
-
- if($this->bo->vfs->file_exists(array(
- 'string' => $file,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $size =
$this->bo->vfs->get_size(array(
- 'string' => $file,
- 'relatives' =>
Array(RELATIVE_NONE),
- 'checksubdirs' =>
True));
-
- $document= $this->bo->vfs->read(array(
- 'string' => $file,
- 'relatives' => Array(RELATIVE_NONE)));
-
- $filename =
basename($values['document_name']);
- $filetype = array_pop(explode('.',
basename($file)));
- $browser = CreateObject('phpgwapi.browser');
-
$browser->content_header($filename,$filetype,$size);
-
- echo $document;
-
- }
- }
-
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('request','table_header',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $project_id =
get_var('project_id',array('POST','GET')); // lookup for maintenance planning
-
- if($project_id)
- {
- $lookup = True;
- }
- $links = $this->menu->links('request');
-
- $request_list = $this->bo->read($project_id);
-
-//_debug_array($request_list);
-
- $uicols = $this->bo->uicols;
-//_debug_array($uicols);
-
- $j=0;
- while (is_array($request_list) && list(,$request_entry)
= each($request_list))
- {
- for ($k=0;$k<count($uicols['name']);$k++)
- {
- if($uicols['input_type'][$k]!='hidden')
- {
-
-
if($request_entry['query_location'][$uicols['name'][$k]])
- {
-
$content[$j]['row'][$k]['statustext'] = lang('search');
-
$content[$j]['row'][$k]['text'] =
$request_entry[$uicols['name'][$k]];
-
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.index&query='
. $request_entry['query_location'][$uicols['name'][$k]] . '&project_id=' .
$project_id);
- }
- else
- {
-
$content[$j]['row'][$k]['value'] =
$request_entry[$uicols['name'][$k]];
-
$content[$j]['row'][$k]['name'] = $uicols['name'][$k];
- }
-
- }
-
- }
-
- if(!$lookup)
- {
- if($this->acl_read)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('view the
request');
- $content[$j]['row'][$k]['text']
= lang('view');
- $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.view&id='
. $request_entry['request_id']);
- $k++;
- }
-
- if($this->acl_edit)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('edit the
request');
- $content[$j]['row'][$k]['text']
= lang('edit');
- $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.edit&id='
. $request_entry['request_id']);
- $k++;
- }
-
- if($this->acl_delete)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('delete the
request');
- $content[$j]['row'][$k]['text']
= lang('delete');
- $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.delete&id='
. $request_entry['request_id']);
- $k++;
- }
-
- }
- else
- {
- if($this->acl_read)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('view the
request');
- $content[$j]['row'][$k]['text']
= lang('view');
-
$content[$j]['row'][$k]['target'] = '_blank';
- $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.view&id='
. $request_entry['request_id']);
-
$content[$j]['row'][$k]['request_id'] =
$request_entry['request_id'];
- $k++;
- }
-
- }
-
- $j++;
- }
-
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['name'][$i]=='loc1')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'location_code',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uirequest.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'project_id'
=>$project_id,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='request_id')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'request_id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uirequest.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'project_id'
=>$project_id,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='score')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'score',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uirequest.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'project_id'
=>$project_id,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='address')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'address',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uirequest.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'project_id'
=>$project_id,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- }
- }
-
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
-
- if(!$lookup)
- {
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
- }
- else
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header'] =
lang('select');
- }
-
-//_debug_array($content);
- if($this->acl_add)
- {
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
request'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.edit')
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uirequest.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'district_id'
=>$this->district_id,
- 'filter'
=>$this->filter,
- 'status_id'
=>$this->status_id,
- 'project_id' =>$project_id,
- 'query'
=>$this->query
- );
-
-
- if($this->acl_manage)
- {
- $link_priority_key
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.priority_key');
- }
-
- $data = array
- (
- 'lang_priority_key'
=> lang('Priority key'),
- 'lang_priority_help'
=> lang('To alter the priority key'),
- 'link_priority_key'
=> $link_priority_key,
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
- 'lang_select'
=> lang('select'),
-
- 'lang_update_project'
=> lang('Update project'),
- 'lang_add_to_project_statustext' =>
lang('add selected request to project'),
- 'add_to_project_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
. $project_id),
- 'project_id'
=> $project_id,
-
- 'lookup'
=> $lookup,
- 'links'
=> $links,
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($request_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the request belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_request_list('filter',$this->cat_id),
- 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
- 'select_district_name' =>
'district_id',
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_status_statustext' =>
lang('Select the status the agreement belongs to. To do not use a category
select NO STATUS'),
- 'status_name'
=> 'status_id',
- 'lang_no_status'
=> lang('No status'),
- 'status_list'
=> $this->boproject->select_status_list('filter',$this->status_id),
-
- 'lang_user_statustext' =>
lang('Select the user the request belongs to. To do not use a category select
NO USER'),
- 'select_user_name'
=> 'filter',
- 'lang_no_user'
=> lang('No user'),
- 'user_list'
=>
$this->bocommon->get_user_list('filter',$this->filter,$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('request');
- $function_msg =
lang('list request');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
-
- function priority_key()
- {
- if(!$this->acl_manage)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
- $GLOBALS['phpgw']->xslttpl->add_file(array('request'));
- $GLOBALS['phpgw_info']['flags'][noheader] = True;
- $GLOBALS['phpgw_info']['flags'][nofooter] = True;
- $GLOBALS['phpgw_info']['flags']['noframework'] = True;
- $values = get_var('values',array('POST','GET'));
-
- if($values['update'])
- {
- $receipt =
$this->bo->update_priority_key($values);
- }
-
- $function_msg = lang('Edit priority key');
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uirequest.priority_key');
-
- $priority_key = $this->bo->read_priority_key();
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'function_msg'
=> $function_msg,
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_priority_key_statustext'
=> lang('Weight for prioritising'),
- 'lang_save'
=> lang('save'),
- 'priority_key' =>
$priority_key,
- );
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('priority_form' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
- $id =
get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
- $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
-
- for ($j=0;$j<count($insert_record_entity);$j++)
- {
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('request'));
-
- $bypass =
get_var('bypass',array('POST','GET'));
-
- if($_POST && !$bypass)
- {
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
- }
- else
- {
- $location_code =
get_var('location_code',array('POST','GET'));
- $tenant_id
= get_var('tenant_id',array('POST','GET'));
-
- $p_entity_id =
get_var('p_entity_id',array('POST','GET'));
- $p_cat_id =
get_var('p_cat_id',array('POST','GET'));
- $values['p'][$p_entity_id]['p_entity_id']
= $p_entity_id;
- $values['p'][$p_entity_id]['p_cat_id']
= $p_cat_id;
- $values['p'][$p_entity_id]['p_num']
= get_var('p_num',array('POST','GET'));
-
- $origin =
get_var('origin',array('POST','GET'));
- $origin_id =
get_var('origin_id',array('POST','GET'));
-
- if($p_entity_id && $p_cat_id)
- {
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- $entity_category =
$boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
-
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
- }
-
-
- if($location_code)
- {
- $values['location_data'] =
$this->bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
- }
-
- }
-
- if($values['origin'])
- {
- $origin = $values['origin'];
- $origin_id = $values['origin_id'];
- }
-
- if($origin)
- {
- unset($values['origin']);
- unset($values['origin_id']);
- $values['origin'][0]['type']= $origin;
-
$values['origin'][0]['link']=$this->bocommon->get_origin_link($origin);
- $values['origin'][0]['data'][]= array(
- 'id'=> $origin_id,
- 'type'=> $origin
- );
- }
-
- $values['start_date'] =
get_var('start_date',array('POST'));
- $values['end_date'] =
get_var('end_date',array('POST'));
-
-//_debug_array($values);
- $this->config->read_repository();
-
- if ($values['save'])
- {
- if(!$values['location'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
- $error_id=true;
- }
-
- if(!$values['title'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a request TITLE !'));
- $error_id=true;
- }
-
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- $error_id=true;
- }
-
- if(!$values['status'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
- }
-
- if($id)
- {
- $values['request_id']=$id;
- $action='edit';
- }
- else
- {
-
$values['request_id']=$this->bo->next_id();
- }
-
- $values['file_name']=str_replace("
","_",$_FILES['file']['name']);
- $to_file = $this->fakebase. SEP . 'request' .
SEP . implode("-",$values['location']) . SEP . $values['request_id'] . SEP .
$values['file_name'];
-
- if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
- 'string' => $to_file,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->create_home_dir($receipt);
-
- if($values['copy_request'])
- {
- $action='add';
- $values['request_id'] =
$this->bo->next_id();
- $id = $values['request_id'];
- }
- $receipt =
$this->bo->save($values,$action);
-//_debug_array($values);
-
- if($values['file_name'])
- {
-
$this->bo->create_document_dir(implode("-",$values['location']),
$values['request_id']);
- $this->bo->vfs->override_acl =
1;
-
- if(!$this->bo->vfs->cp (array (
- 'from' =>
$_FILES['file']['tmp_name'],
- 'to' => $to_file,
- 'relatives' =>
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
- {
-
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
- }
- $this->bo->vfs->override_acl =
0;
- }
-
- $id = $values['request_id'];
- $function_msg = lang('Edit request');
-
- if ($values['notify'])
- {
-
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
-
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
- $headers = "Return-Path: <".
$coordinator_email .">\r\n";
- $headers .= "From: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
- $headers .= "Bcc: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
- $headers .= "Content-type:
text/plain; charset=iso-8859-1\r\n";
-
- $subject = lang(notify).": ".
$values['request_id'];
- $message = lang(request) . " "
. $values['request_id'] ." ". lang('is registered');
-
- $mail_method=
$this->config->config_data['fmwrkorder_mail'];
- if ($mail_method=='smtp'):
- {
- $bcc =
$coordinator_email;
- $send =
CreateObject('phpgwapi.send');
- $rcpt =
$send->msg('email', $values['mail_address'], $subject, stripslashes($message),
'', $cc, $bcc, $coordinator_email, $coordinator_name, 'plain');
- }
- elseif
($mail_method=='sendmail'):
- {
-
$rcpt=mail($values['mail_address'],$subject,$message, $headers);
- }
- else:
- {
-
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin
section)'));
- }
- endif;
- }
-
- if($rcpt)
- {
-
$receipt['message'][]=array('msg'=>lang('%1 is
notified',$values['mail_address']));
- }
- }
- else
- {
- if($values['location'])
- {
- $location_code=implode("-",
$values['location']);
- $values['location_data'] =
$this->bolocation->read_single($location_code,$values['extra']);
- }
-
- if($values['extra']['p_num'])
- {
-
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
- }
- }
- }
-
- if(!$receipt['error'] && !$bypass && $id)
- {
- $values = $this->bo->read_single($id);
- $record_history =
$this->bo->read_record_history($id);
- }
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- if ($id)
- {
- $function_msg = lang('Edit request');
- }
- else
- {
- $function_msg = lang('Add request');
- }
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
- $lookup_type='form';
-
-
$location_data=$this->bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' => -1,
// calculated from location_types
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' => True,
- 'lookup_type' => $lookup_type,
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('request'),
- 'entity_data' => $values['p']
- ));
-
-
- if($values['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
$location_data['location'][$i]['value'] = $values['contact_phone'];
- }
- }
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uirequest.edit',
- 'id' => $id
- );
-
- if(!$values['coordinator'])
- {
- $values['coordinator']=$this->account;
- }
-
-
$supervisor_id=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['approval_from'];
-
- $notify =
$this->config->config_data['workorder_approval'];
-
- if ($supervisor_id && ($notify=='yes'))
- {
- $prefs =
$this->bocommon->create_preferences($this->currentapp,$supervisor_id);
- $supervisor_email = $prefs['email'];
- }
-
-
-
- $table_header_importance[] = array
- (
- 'lang_subject' =>
lang('Subject'),
- 'lang_condition_degree' => lang('Condidtion
degree'),
- 'lang_prob_worsening' => lang('Probability'),
- 'lang_consequence' =>
lang('Consequence')
- );
-
-
- if($values['project_id'])
- {
- $project_lookup_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiproject.view'
- );
- }
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $link_file_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uirequest.view_file',
- 'location_code'
=>$values['location_data']['location_code'],
- 'id' =>$id
- );
-
- $link_to_files =
$this->config->config_data['files_url'];
-
- $j = count($values['files']);
- for ($i=0;$i<$j;$i++)
- {
-
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
- }
-
- if (isset($values['origin']) AND
is_array($values['origin']))
- {
- for ($i=0;$i<count($values['origin']);$i++)
- {
-
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
-
if(substr($values['origin'][$i]['type'],0,6)=='entity')
- {
- $type =
explode("_",$values['origin'][$i]['type']);
- $entity_id = $type[1];
- $cat_id = $type[2];
-
- if(!is_object($boadmin_entity))
- {
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- }
- $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
- $values['origin'][$i]['descr']
= $entity_category['name'];
- }
- else
- {
- $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
- }
- }
- }
-
- $data = array
- (
- 'fileupload'
=> True,
- 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
- 'link_to_files'
=> $link_to_files,
- 'files'
=> $values['files'],
- 'lang_files'
=> lang('files'),
- 'lang_filename'
=> lang('Filename'),
- 'lang_delete_file'
=> lang('Delete file'),
- 'lang_view_file_statustext' =>
lang('Klick to view file'),
- 'lang_delete_file_statustext' => lang('Check
to delete file'),
- 'lang_upload_file'
=> lang('Upload file'),
- 'lang_file_statustext' =>
lang('Select file to upload'),
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-
- 'value_origin'
=> $values['origin'],
- 'value_origin_type'
=> $origin,
- 'value_origin_id'
=> $origin_id,
- 'lang_origin_statustext' =>
lang('Link to the origin for this request'),
-
- 'generate_project_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit'),
- 'lang_generate_project'
=> lang('Generate project'),
- 'lang_generate_project_statustext' =>
lang('Generate a project from this request'),
- 'location_code'
=> $values['location_code'],
- 'p_num'
=> $values['p_num'],
- 'p_entity_id'
=> $values['p_entity_id'],
- 'p_cat_id'
=> $values['p_cat_id'],
- 'tenant_id'
=> $values['tenant_id'],
-
- 'lang_importance'
=> lang('Importance'),
- 'table_header_importance' =>
$table_header_importance,
- 'importance_weight'
=> $importance_weight,
-
- 'lang_no_workorders' =>
lang('No workorder bugdet'),
- 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
- 'record_history'
=> $record_history,
- 'table_header_history' =>
$table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
- 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
-
- 'lang_start_date_statustext' => lang('Select
the estimated end date for the request'),
- 'lang_start_date'
=> lang('request start date'),
- 'value_start_date'
=> $values['start_date'],
-
- 'lang_end_date_statustext' =>
lang('Select the estimated end date for the request'),
- 'lang_end_date'
=> lang('request end date'),
- 'value_end_date'
=> $values['end_date'],
-
- 'lang_copy_request'
=> lang('Copy request ?'),
- 'lang_copy_request_statustext' => lang('Choose
Copy request to copy this request to a new request'),
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'lang_power_meter_statustext' => lang('Enter
the power_meter'),
- 'value_power_meter'
=> $values['power_meter'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $values['budget'],
- 'lang_budget_statustext' =>
lang('Enter the budget'),
-
- 'location_data'
=> $location_data,
- 'location_type'
=> 'form',
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.index'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
-
- 'lang_request_id'
=> lang('request ID'),
- 'value_request_id'
=> $values['request_id'],
-
- 'lang_title'
=> lang('Title'),
- 'value_title'
=> $values['title'],
- 'lang_title_statustext' =>
lang('Enter request Title'),
-
- 'lang_descr_statustext' =>
lang('Enter a description of the request'),
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_score'
=> lang('Score'),
- 'value_score'
=> $values['score'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the request'),
- 'lang_no_cat'
=> lang('Select category'),
- 'lang_cat_statustext' =>
lang('Select the category the request belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'value_cat_id'
=> $values['cat_id'],
- 'cat_list'
=> $this->bo->select_category_request_list('select',$values['cat_id']),
-
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_user_statustext' =>
lang('Select the coordinator the request belongs to. To do not use a category
select NO USER'),
- 'select_user_name'
=> 'values[coordinator]',
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl2_location),
-
- 'status_list'
=> $this->boproject->select_status_list('select',$values['status']),
- 'status_name'
=> 'values[status]',
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
- 'lang_status_statustext' =>
lang('What is the current status of this request ?'),
-
- 'branch_list'
=> $this->boproject->select_branch_list($values['branch_id']),
- 'lang_branch'
=> lang('branch'),
- 'lang_no_branch'
=> lang('Select branch'),
- 'lang_branch_statustext' =>
lang('Select the branches for this request'),
-
- 'notify'
=> $notify,
- 'lang_notify'
=> lang('Notify'),
- 'lang_notify_statustext' =>
lang('Check this to notify your supervisor by email'),
- 'value_notify_mail_address' =>
$supervisor_email,
-
- 'currency' =>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
-
- 'lang_authorities_demands'
=> lang('Authorities Demands'),
- 'lang_authorities_demands_statustext'
=> lang('Is there a demand from the authorities to correct this condition?'),
- 'authorities_demands'
=> $values['authorities_demands'],
-
- 'condition_list'
=> $this->bo->select_conditions($id),
-
- );
-
- $appname
= lang('request');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
-
- $id = get_var('id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uirequest.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.delete&id='
. $id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('request');
- $function_msg =
lang('delete request');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $id =
get_var('id',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('request'));
-
- $values = $this->bo->read_single($id);
-
- $record_history = $this->bo->read_record_history($id);
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- $function_msg = lang('View request');
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
-
$location_data=$this->bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
$values['location_data']['tenant_id'],
- 'lookup_type' => 'view',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
- 'entity_data' => $values['p']
- ));
-
- if($values['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
unset($location_data['location'][$i]['value']);
- }
- }
- }
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uirequest.edit',
- 'id' => $id
- );
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
-
- $table_header_importance[] = array
- (
- 'lang_subject' =>
lang('Subject'),
- 'lang_condition_degree' => lang('Condidtion
degree'),
- 'lang_prob_worsening' => lang('Probability'),
- 'lang_consequence' =>
lang('Consequence')
- );
-
-
-
- if($values['origin']== 'tts')
- {
- $origin_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitts.view',
- 'id' =>
$values['origin_id']
- );
- }
-
- if($values['project_id'])
- {
- $project_lookup_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiproject.view'
- );
- }
-
- $link_file_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uirequest.view_file',
- 'location_code'
=>$values['location_data']['location_code'],
- 'id' =>$id
- );
-
- $this->config->read_repository();
- $link_to_files =
$this->config->config_data['files_url'];
-
- $j = count($values['files']);
- for ($i=0;$i<$j;$i++)
- {
-
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
- }
-
- if (isset($values['origin']) AND
is_array($values['origin']))
- {
- for ($i=0;$i<count($values['origin']);$i++)
- {
-
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
-
if(substr($values['origin'][$i]['type'],0,6)=='entity')
- {
- $type =
explode("_",$values['origin'][$i]['type']);
- $entity_id = $type[1];
- $cat_id = $type[2];
-
- if(!is_object($boadmin_entity))
- {
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- }
- $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
- $values['origin'][$i]['descr']
= $entity_category['name'];
- }
- else
- {
- $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
- }
- }
- }
-
- $data = array
- (
- 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
- 'link_to_files'
=> $link_to_files,
- 'files'
=> $values['files'],
- 'lang_files'
=> lang('files'),
- 'lang_filename'
=> lang('Filename'),
- 'lang_view_file_statustext' =>
lang('Klick to view file'),
-
- 'value_origin'
=> $values['origin'],
- 'value_origin_type'
=> $origin,
- 'value_origin_id'
=> $origin_id,
-
- 'lang_project'
=> lang('Project'),
- 'lang_project_statustext' =>
lang('Link to the project originatet from this request'),
- 'link_project'
=> $GLOBALS['phpgw']->link('/index.php',$project_lookup_data),
- 'value_project_id'
=> $values['project_id'],
-
- 'lang_importance'
=> lang('Importance'),
- 'table_header_importance' =>
$table_header_importance,
- 'importance_weight_view' =>
$importance_weight,
-
- 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
- 'record_history'
=> $record_history,
- 'table_header_history' =>
$table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
- 'lang_start_date'
=> lang('request start date'),
- 'value_start_date'
=> $values['start_date'],
-
- 'lang_end_date'
=> lang('request end date'),
- 'value_end_date'
=> $values['end_date'],
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'value_power_meter'
=> $values['power_meter'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $values['budget'],
-
- 'location_data'
=> $location_data,
- 'location_type'
=> 'view',
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.index'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
-
- 'lang_request_id'
=> lang('request ID'),
- 'value_request_id'
=> $values['request_id'],
-
- 'lang_title'
=> lang('Title'),
- 'value_title'
=> $values['title'],
-
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_score'
=> lang('Score'),
- 'value_score'
=> $values['score'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'value_cat_id'
=> $values['cat_id'],
- 'cat_list'
=> $this->bo->select_category_request_list('select',$values['cat_id']),
-
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=>
$this->bocommon->get_user_list('select',$values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
-
- 'status_list'
=> $this->boproject->select_status_list('select',$values['status']),
- 'lang_status'
=> lang('Status'),
-
- 'branch_list'
=> $this->boproject->select_branch_list($values['branch_id']),
- 'lang_branch'
=> lang('branch'),
-
- 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.edit&id='
. $id),
- 'lang_edit_statustext'
=> lang('Edit this entry request'),
- 'lang_edit'
=> lang('Edit'),
- 'currency'
=>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
- 'lang_contact_phone' =>
lang('Contact phone'),
- 'contact_phone'
=> $values['contact_phone'],
-
- 'lang_authorities_demands'
=> lang('Authorities Demands'),
- 'authorities_demands'
=> $values['authorities_demands'],
-
- 'condition_list_view'
=> $this->bo->select_conditions($id),
- );
-
- $appname
= lang('request');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.uirequest.inc.php,v 1.19 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uirequest
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'priority_key' => True,
+ 'view_file' => True
+ );
+
+ function uirequest()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bo =
CreateObject($this->currentapp.'.borequest',True);
+ $this->boproject =
CreateObject($this->currentapp.'.boproject');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+ $this->bolocation =
CreateObject($this->currentapp.'.bolocation');
+ $this->config =
CreateObject('phpgwapi.config');
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.project';
+ $this->acl_read =
$this->acl2->check('.project',1);
+ $this->acl_add =
$this->acl2->check('.project',2);
+ $this->acl_edit =
$this->acl2->check('.project',4);
+ $this->acl_delete =
$this->acl2->check('.project',8);
+ $this->acl_manage =
$this->acl2->check('.project',16);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->status_id =
$this->bo->status_id;
+
+ $this->menu->sub ='project';
+ $this->fakebase =
$this->bo->fakebase;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'status_id' => $this->status_id
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function view_file()
+ {
+ $GLOBALS['phpgw_info']['flags'][noheader] = True;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = True;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $file_name =
urldecode(get_var('file_name',array('POST','GET')));
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+
+ $file = $this->fakebase. SEP . 'request' . SEP .
$location_code . SEP . $id . SEP . $file_name;
+
+ if($this->bo->vfs->file_exists(array(
+ 'string' => $file,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $size =
$this->bo->vfs->get_size(array(
+ 'string' => $file,
+ 'relatives' =>
Array(RELATIVE_NONE),
+ 'checksubdirs' =>
True));
+
+ $document= $this->bo->vfs->read(array(
+ 'string' => $file,
+ 'relatives' => Array(RELATIVE_NONE)));
+
+ $filename =
basename($values['document_name']);
+ $filetype = array_pop(explode('.',
basename($file)));
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($filename,$filetype,$size);
+
+ echo $document;
+
+ }
+ }
+
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('request','table_header',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $project_id =
get_var('project_id',array('POST','GET')); // lookup for maintenance planning
+
+ if($project_id)
+ {
+ $lookup = True;
+ }
+ $links = $this->menu->links('request');
+
+ $request_list = $this->bo->read($project_id);
+
+//_debug_array($request_list);
+
+ $uicols = $this->bo->uicols;
+//_debug_array($uicols);
+
+ $j=0;
+ while (is_array($request_list) && list(,$request_entry)
= each($request_list))
+ {
+ for ($k=0;$k<count($uicols['name']);$k++)
+ {
+ if($uicols['input_type'][$k]!='hidden')
+ {
+
+
if($request_entry['query_location'][$uicols['name'][$k]])
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('search');
+
$content[$j]['row'][$k]['text'] =
$request_entry[$uicols['name'][$k]];
+
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.index&query='
. $request_entry['query_location'][$uicols['name'][$k]] . '&project_id=' .
$project_id);
+ }
+ else
+ {
+
$content[$j]['row'][$k]['value'] =
$request_entry[$uicols['name'][$k]];
+
$content[$j]['row'][$k]['name'] = $uicols['name'][$k];
+ }
+
+ }
+
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('view the
request');
+ $content[$j]['row'][$k]['text']
= lang('view');
+ $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.view&id='
. $request_entry['request_id']);
+ $k++;
+ }
+
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('edit the
request');
+ $content[$j]['row'][$k]['text']
= lang('edit');
+ $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.edit&id='
. $request_entry['request_id']);
+ $k++;
+ }
+
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('delete the
request');
+ $content[$j]['row'][$k]['text']
= lang('delete');
+ $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.delete&id='
. $request_entry['request_id']);
+ $k++;
+ }
+
+ }
+ else
+ {
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('view the
request');
+ $content[$j]['row'][$k]['text']
= lang('view');
+
$content[$j]['row'][$k]['target'] = '_blank';
+ $content[$j]['row'][$k]['link']
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.view&id='
. $request_entry['request_id']);
+
$content[$j]['row'][$k]['request_id'] =
$request_entry['request_id'];
+ $k++;
+ }
+
+ }
+
+ $j++;
+ }
+
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['name'][$i]=='loc1')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'location_code',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uirequest.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'project_id'
=>$project_id,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='request_id')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'request_id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uirequest.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'project_id'
=>$project_id,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='score')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'score',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uirequest.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'project_id'
=>$project_id,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='address')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'address',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uirequest.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'project_id'
=>$project_id,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ }
+ }
+
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+ }
+ else
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header'] =
lang('select');
+ }
+
+//_debug_array($content);
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
request'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.edit')
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uirequest.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'filter'
=>$this->filter,
+ 'status_id'
=>$this->status_id,
+ 'project_id' =>$project_id,
+ 'query'
=>$this->query
+ );
+
+
+ if($this->acl_manage)
+ {
+ $link_priority_key
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.priority_key');
+ }
+
+ $data = array
+ (
+ 'lang_priority_key'
=> lang('Priority key'),
+ 'lang_priority_help'
=> lang('To alter the priority key'),
+ 'link_priority_key'
=> $link_priority_key,
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+ 'lang_select'
=> lang('select'),
+
+ 'lang_update_project'
=> lang('Update project'),
+ 'lang_add_to_project_statustext' =>
lang('add selected request to project'),
+ 'add_to_project_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
. $project_id),
+ 'project_id'
=> $project_id,
+
+ 'lookup'
=> $lookup,
+ 'links'
=> $links,
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($request_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the request belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_request_list('filter',$this->cat_id),
+ 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+ 'select_district_name' =>
'district_id',
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_status_statustext' =>
lang('Select the status the agreement belongs to. To do not use a category
select NO STATUS'),
+ 'status_name'
=> 'status_id',
+ 'lang_no_status'
=> lang('No status'),
+ 'status_list'
=> $this->boproject->select_status_list('filter',$this->status_id),
+
+ 'lang_user_statustext' =>
lang('Select the user the request belongs to. To do not use a category select
NO USER'),
+ 'select_user_name'
=> 'filter',
+ 'lang_no_user'
=> lang('No user'),
+ 'user_list'
=>
$this->bocommon->get_user_list('filter',$this->filter,$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('request');
+ $function_msg =
lang('list request');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+
+ function priority_key()
+ {
+ if(!$this->acl_manage)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+ $GLOBALS['phpgw']->xslttpl->add_file(array('request'));
+ $GLOBALS['phpgw_info']['flags'][noheader] = True;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = True;
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+ $values = get_var('values',array('POST','GET'));
+
+ if($values['update'])
+ {
+ $receipt =
$this->bo->update_priority_key($values);
+ }
+
+ $function_msg = lang('Edit priority key');
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uirequest.priority_key');
+
+ $priority_key = $this->bo->read_priority_key();
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'function_msg'
=> $function_msg,
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_priority_key_statustext'
=> lang('Weight for prioritising'),
+ 'lang_save'
=> lang('save'),
+ 'priority_key' =>
$priority_key,
+ );
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('priority_form' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+ $id =
get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+ $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
+
+ for ($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('request'));
+
+ $bypass =
get_var('bypass',array('POST','GET'));
+
+ if($_POST && !$bypass)
+ {
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+ }
+ else
+ {
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $tenant_id
= get_var('tenant_id',array('POST','GET'));
+
+ $p_entity_id =
get_var('p_entity_id',array('POST','GET'));
+ $p_cat_id =
get_var('p_cat_id',array('POST','GET'));
+ $values['p'][$p_entity_id]['p_entity_id']
= $p_entity_id;
+ $values['p'][$p_entity_id]['p_cat_id']
= $p_cat_id;
+ $values['p'][$p_entity_id]['p_num']
= get_var('p_num',array('POST','GET'));
+
+ $origin =
get_var('origin',array('POST','GET'));
+ $origin_id =
get_var('origin_id',array('POST','GET'));
+
+ if($p_entity_id && $p_cat_id)
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ $entity_category =
$boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
+
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
+ }
+
+
+ if($location_code)
+ {
+ $values['location_data'] =
$this->bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
+ }
+
+ }
+
+ if($values['origin'])
+ {
+ $origin = $values['origin'];
+ $origin_id = $values['origin_id'];
+ }
+
+ if($origin)
+ {
+ unset($values['origin']);
+ unset($values['origin_id']);
+ $values['origin'][0]['type']= $origin;
+
$values['origin'][0]['link']=$this->bocommon->get_origin_link($origin);
+ $values['origin'][0]['data'][]= array(
+ 'id'=> $origin_id,
+ 'type'=> $origin
+ );
+ }
+
+ $values['start_date'] =
get_var('start_date',array('POST'));
+ $values['end_date'] =
get_var('end_date',array('POST'));
+
+//_debug_array($values);
+ $this->config->read_repository();
+
+ if ($values['save'])
+ {
+ if(!$values['location'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
+ $error_id=true;
+ }
+
+ if(!$values['title'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a request TITLE !'));
+ $error_id=true;
+ }
+
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ $error_id=true;
+ }
+
+ if(!$values['status'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
+ }
+
+ if($id)
+ {
+ $values['request_id']=$id;
+ $action='edit';
+ }
+ else
+ {
+
$values['request_id']=$this->bo->next_id();
+ }
+
+ $values['file_name']=str_replace("
","_",$_FILES['file']['name']);
+ $to_file = $this->fakebase. SEP . 'request' .
SEP . implode("-",$values['location']) . SEP . $values['request_id'] . SEP .
$values['file_name'];
+
+ if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
+ 'string' => $to_file,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->create_home_dir($receipt);
+
+ if($values['copy_request'])
+ {
+ $action='add';
+ $values['request_id'] =
$this->bo->next_id();
+ $id = $values['request_id'];
+ }
+ $receipt =
$this->bo->save($values,$action);
+//_debug_array($values);
+
+ if($values['file_name'])
+ {
+
$this->bo->create_document_dir(implode("-",$values['location']),
$values['request_id']);
+ $this->bo->vfs->override_acl =
1;
+
+ if(!$this->bo->vfs->cp (array (
+ 'from' =>
$_FILES['file']['tmp_name'],
+ 'to' => $to_file,
+ 'relatives' =>
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+ {
+
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
+ }
+ $this->bo->vfs->override_acl =
0;
+ }
+
+ $id = $values['request_id'];
+ $function_msg = lang('Edit request');
+
+ if ($values['notify'])
+ {
+
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
+
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
+ $headers = "Return-Path: <".
$coordinator_email .">\r\n";
+ $headers .= "From: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
+ $headers .= "Bcc: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
+ $headers .= "Content-type:
text/plain; charset=iso-8859-1\r\n";
+
+ $subject = lang(notify).": ".
$values['request_id'];
+ $message = lang(request) . " "
. $values['request_id'] ." ". lang('is registered');
+
+ $mail_method=
$this->config->config_data['fmwrkorder_mail'];
+ if ($mail_method=='smtp'):
+ {
+ $bcc =
$coordinator_email;
+ $send =
CreateObject('phpgwapi.send');
+ $rcpt =
$send->msg('email', $values['mail_address'], $subject, stripslashes($message),
'', $cc, $bcc, $coordinator_email, $coordinator_name, 'plain');
+ }
+ elseif
($mail_method=='sendmail'):
+ {
+
$rcpt=mail($values['mail_address'],$subject,$message, $headers);
+ }
+ else:
+ {
+
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin
section)'));
+ }
+ endif;
+ }
+
+ if($rcpt)
+ {
+
$receipt['message'][]=array('msg'=>lang('%1 is
notified',$values['mail_address']));
+ }
+ }
+ else
+ {
+ if($values['location'])
+ {
+ $location_code=implode("-",
$values['location']);
+ $values['location_data'] =
$this->bolocation->read_single($location_code,$values['extra']);
+ }
+
+ if($values['extra']['p_num'])
+ {
+
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
+ }
+ }
+ }
+
+ if(!$receipt['error'] && !$bypass && $id)
+ {
+ $values = $this->bo->read_single($id);
+ $record_history =
$this->bo->read_record_history($id);
+ }
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ if ($id)
+ {
+ $function_msg = lang('Edit request');
+ }
+ else
+ {
+ $function_msg = lang('Add request');
+ }
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+ $lookup_type='form';
+
+
$location_data=$this->bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' => -1,
// calculated from location_types
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' => True,
+ 'lookup_type' => $lookup_type,
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('request'),
+ 'entity_data' => $values['p']
+ ));
+
+
+ if($values['contact_phone'])
+ {
+ for
($i=0;$i<count($location_data['location']);$i++)
+ {
+
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+ {
+
$location_data['location'][$i]['value'] = $values['contact_phone'];
+ }
+ }
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uirequest.edit',
+ 'id' => $id
+ );
+
+ if(!$values['coordinator'])
+ {
+ $values['coordinator']=$this->account;
+ }
+
+
$supervisor_id=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['approval_from'];
+
+ $notify =
$this->config->config_data['workorder_approval'];
+
+ if ($supervisor_id && ($notify=='yes'))
+ {
+ $prefs =
$this->bocommon->create_preferences($this->currentapp,$supervisor_id);
+ $supervisor_email = $prefs['email'];
+ }
+
+
+
+ $table_header_importance[] = array
+ (
+ 'lang_subject' =>
lang('Subject'),
+ 'lang_condition_degree' => lang('Condidtion
degree'),
+ 'lang_prob_worsening' => lang('Probability'),
+ 'lang_consequence' =>
lang('Consequence')
+ );
+
+
+ if($values['project_id'])
+ {
+ $project_lookup_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiproject.view'
+ );
+ }
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $link_file_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uirequest.view_file',
+ 'location_code'
=>$values['location_data']['location_code'],
+ 'id' =>$id
+ );
+
+ $link_to_files =
$this->config->config_data['files_url'];
+
+ $j = count($values['files']);
+ for ($i=0;$i<$j;$i++)
+ {
+
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
+ }
+
+ if (isset($values['origin']) AND
is_array($values['origin']))
+ {
+ for ($i=0;$i<count($values['origin']);$i++)
+ {
+
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
+
if(substr($values['origin'][$i]['type'],0,6)=='entity')
+ {
+ $type =
explode("_",$values['origin'][$i]['type']);
+ $entity_id = $type[1];
+ $cat_id = $type[2];
+
+ if(!is_object($boadmin_entity))
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ }
+ $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
+ $values['origin'][$i]['descr']
= $entity_category['name'];
+ }
+ else
+ {
+ $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
+ }
+ }
+ }
+
+ $data = array
+ (
+ 'fileupload'
=> True,
+ 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
+ 'link_to_files'
=> $link_to_files,
+ 'files'
=> $values['files'],
+ 'lang_files'
=> lang('files'),
+ 'lang_filename'
=> lang('Filename'),
+ 'lang_delete_file'
=> lang('Delete file'),
+ 'lang_view_file_statustext' =>
lang('Klick to view file'),
+ 'lang_delete_file_statustext' => lang('Check
to delete file'),
+ 'lang_upload_file'
=> lang('Upload file'),
+ 'lang_file_statustext' =>
lang('Select file to upload'),
+
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+
+ 'value_origin'
=> $values['origin'],
+ 'value_origin_type'
=> $origin,
+ 'value_origin_id'
=> $origin_id,
+ 'lang_origin_statustext' =>
lang('Link to the origin for this request'),
+
+ 'generate_project_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit'),
+ 'lang_generate_project'
=> lang('Generate project'),
+ 'lang_generate_project_statustext' =>
lang('Generate a project from this request'),
+ 'location_code'
=> $values['location_code'],
+ 'p_num'
=> $values['p_num'],
+ 'p_entity_id'
=> $values['p_entity_id'],
+ 'p_cat_id'
=> $values['p_cat_id'],
+ 'tenant_id'
=> $values['tenant_id'],
+
+ 'lang_importance'
=> lang('Importance'),
+ 'table_header_importance' =>
$table_header_importance,
+ 'importance_weight'
=> $importance_weight,
+
+ 'lang_no_workorders' =>
lang('No workorder bugdet'),
+ 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history'),
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
+ 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
+
+ 'lang_start_date_statustext' => lang('Select
the estimated end date for the request'),
+ 'lang_start_date'
=> lang('request start date'),
+ 'value_start_date'
=> $values['start_date'],
+
+ 'lang_end_date_statustext' =>
lang('Select the estimated end date for the request'),
+ 'lang_end_date'
=> lang('request end date'),
+ 'value_end_date'
=> $values['end_date'],
+
+ 'lang_copy_request'
=> lang('Copy request ?'),
+ 'lang_copy_request_statustext' => lang('Choose
Copy request to copy this request to a new request'),
+
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'lang_power_meter_statustext' => lang('Enter
the power_meter'),
+ 'value_power_meter'
=> $values['power_meter'],
+
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> $values['budget'],
+ 'lang_budget_statustext' =>
lang('Enter the budget'),
+
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'form',
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.index'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+
+ 'lang_request_id'
=> lang('request ID'),
+ 'value_request_id'
=> $values['request_id'],
+
+ 'lang_title'
=> lang('Title'),
+ 'value_title'
=> $values['title'],
+ 'lang_title_statustext' =>
lang('Enter request Title'),
+
+ 'lang_descr_statustext' =>
lang('Enter a description of the request'),
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_score'
=> lang('Score'),
+ 'value_score'
=> $values['score'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the request'),
+ 'lang_no_cat'
=> lang('Select category'),
+ 'lang_cat_statustext' =>
lang('Select the category the request belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'value_cat_id'
=> $values['cat_id'],
+ 'cat_list'
=> $this->bo->select_category_request_list('select',$values['cat_id']),
+
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_user_statustext' =>
lang('Select the coordinator the request belongs to. To do not use a category
select NO USER'),
+ 'select_user_name'
=> 'values[coordinator]',
+ 'lang_no_user'
=> lang('Select coordinator'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl2_location),
+
+ 'status_list'
=> $this->boproject->select_status_list('select',$values['status']),
+ 'status_name'
=> 'values[status]',
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+ 'lang_status_statustext' =>
lang('What is the current status of this request ?'),
+
+ 'branch_list'
=> $this->boproject->select_branch_list($values['branch_id']),
+ 'lang_branch'
=> lang('branch'),
+ 'lang_no_branch'
=> lang('Select branch'),
+ 'lang_branch_statustext' =>
lang('Select the branches for this request'),
+
+ 'notify'
=> $notify,
+ 'lang_notify'
=> lang('Notify'),
+ 'lang_notify_statustext' =>
lang('Check this to notify your supervisor by email'),
+ 'value_notify_mail_address' =>
$supervisor_email,
+
+ 'currency' =>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+
+ 'lang_authorities_demands'
=> lang('Authorities Demands'),
+ 'lang_authorities_demands_statustext'
=> lang('Is there a demand from the authorities to correct this condition?'),
+ 'authorities_demands'
=> $values['authorities_demands'],
+
+ 'condition_list'
=> $this->bo->select_conditions($id),
+
+ );
+
+ $appname
= lang('request');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ if(!$this->acl_delete)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+
+ $id = get_var('id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uirequest.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.delete&id='
. $id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('request');
+ $function_msg =
lang('delete request');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $id =
get_var('id',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('request'));
+
+ $values = $this->bo->read_single($id);
+
+ $record_history = $this->bo->read_record_history($id);
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ $function_msg = lang('View request');
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+
$location_data=$this->bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
$values['location_data']['tenant_id'],
+ 'lookup_type' => 'view',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
+ 'entity_data' => $values['p']
+ ));
+
+ if($values['contact_phone'])
+ {
+ for
($i=0;$i<count($location_data['location']);$i++)
+ {
+
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+ {
+
unset($location_data['location'][$i]['value']);
+ }
+ }
+ }
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uirequest.edit',
+ 'id' => $id
+ );
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+
+ $table_header_importance[] = array
+ (
+ 'lang_subject' =>
lang('Subject'),
+ 'lang_condition_degree' => lang('Condidtion
degree'),
+ 'lang_prob_worsening' => lang('Probability'),
+ 'lang_consequence' =>
lang('Consequence')
+ );
+
+
+
+ if($values['origin']== 'tts')
+ {
+ $origin_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitts.view',
+ 'id' =>
$values['origin_id']
+ );
+ }
+
+ if($values['project_id'])
+ {
+ $project_lookup_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiproject.view'
+ );
+ }
+
+ $link_file_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uirequest.view_file',
+ 'location_code'
=>$values['location_data']['location_code'],
+ 'id' =>$id
+ );
+
+ $this->config->read_repository();
+ $link_to_files =
$this->config->config_data['files_url'];
+
+ $j = count($values['files']);
+ for ($i=0;$i<$j;$i++)
+ {
+
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
+ }
+
+ if (isset($values['origin']) AND
is_array($values['origin']))
+ {
+ for ($i=0;$i<count($values['origin']);$i++)
+ {
+
$values['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $values['origin'][$i]['link']);
+
if(substr($values['origin'][$i]['type'],0,6)=='entity')
+ {
+ $type =
explode("_",$values['origin'][$i]['type']);
+ $entity_id = $type[1];
+ $cat_id = $type[2];
+
+ if(!is_object($boadmin_entity))
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ }
+ $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
+ $values['origin'][$i]['descr']
= $entity_category['name'];
+ }
+ else
+ {
+ $values['origin'][$i]['descr']=
lang($values['origin'][$i]['type']);
+ }
+ }
+ }
+
+ $data = array
+ (
+ 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
+ 'link_to_files'
=> $link_to_files,
+ 'files'
=> $values['files'],
+ 'lang_files'
=> lang('files'),
+ 'lang_filename'
=> lang('Filename'),
+ 'lang_view_file_statustext' =>
lang('Klick to view file'),
+
+ 'value_origin'
=> $values['origin'],
+ 'value_origin_type'
=> $origin,
+ 'value_origin_id'
=> $origin_id,
+
+ 'lang_project'
=> lang('Project'),
+ 'lang_project_statustext' =>
lang('Link to the project originatet from this request'),
+ 'link_project'
=> $GLOBALS['phpgw']->link('/index.php',$project_lookup_data),
+ 'value_project_id'
=> $values['project_id'],
+
+ 'lang_importance'
=> lang('Importance'),
+ 'table_header_importance' =>
$table_header_importance,
+ 'importance_weight_view' =>
$importance_weight,
+
+ 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit'),
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history'),
+
+ 'lang_start_date'
=> lang('request start date'),
+ 'value_start_date'
=> $values['start_date'],
+
+ 'lang_end_date'
=> lang('request end date'),
+ 'value_end_date'
=> $values['end_date'],
+
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'value_power_meter'
=> $values['power_meter'],
+
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> $values['budget'],
+
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'view',
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.index'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+
+ 'lang_request_id'
=> lang('request ID'),
+ 'value_request_id'
=> $values['request_id'],
+
+ 'lang_title'
=> lang('Title'),
+ 'value_title'
=> $values['title'],
+
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_score'
=> lang('Score'),
+ 'value_score'
=> $values['score'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'value_cat_id'
=> $values['cat_id'],
+ 'cat_list'
=> $this->bo->select_category_request_list('select',$values['cat_id']),
+
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_no_user'
=> lang('Select coordinator'),
+ 'user_list'
=>
$this->bocommon->get_user_list('select',$values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+
+ 'status_list'
=> $this->boproject->select_status_list('select',$values['status']),
+ 'lang_status'
=> lang('Status'),
+
+ 'branch_list'
=> $this->boproject->select_branch_list($values['branch_id']),
+ 'lang_branch'
=> lang('branch'),
+
+ 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uirequest.edit&id='
. $id),
+ 'lang_edit_statustext'
=> lang('Edit this entry request'),
+ 'lang_edit'
=> lang('Edit'),
+ 'currency'
=>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+ 'lang_contact_phone' =>
lang('Contact phone'),
+ 'contact_phone'
=> $values['contact_phone'],
+
+ 'lang_authorities_demands'
=> lang('Authorities Demands'),
+ 'authorities_demands'
=> $values['authorities_demands'],
+
+ 'condition_list_view'
=> $this->bo->select_conditions($id),
+ );
+
+ $appname
= lang('request');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uis_agreement.inc.php
diff -u property/inc/class.uis_agreement.inc.php:1.23
property/inc/class.uis_agreement.inc.php:1.24
--- property/inc/class.uis_agreement.inc.php:1.23 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uis_agreement.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1762 +1,1762 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 agreement
- * @version $Id: class.uis_agreement.inc.php,v 1.23 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uis_agreement
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'list_attribute'=> True,
- 'edit_attrib' => True,
- 'columns' => True,
- 'edit_item' => True,
- 'view_item' => True,
- 'view_file' => True,
- 'excel' => True
- );
-
- function uis_agreement()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.bos_agreement',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->role = $this->bo->role;
-
- $this->cats =
CreateObject('phpgwapi.categories');
- $this->cats->app_name = 'fm_vendor';
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location= '.s_agreement';
-
- $this->acl_read =
$this->acl2->check($this->acl2_location,1);
- $this->acl_add =
$this->acl2->check($this->acl2_location,2);
- $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
- $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
- $this->acl_manage =
$this->acl2->check($this->acl2_location,16);
-
- $this->start = $this->bo->start;
- $this->query = $this->bo->query;
- $this->sort = $this->bo->sort;
- $this->order = $this->bo->order;
- $this->filter = $this->bo->filter;
- $this->cat_id = $this->bo->cat_id;
- $this->vendor_id = $this->bo->vendor_id;
- $this->allrows = $this->bo->allrows;
- $this->member_id = $this->bo->member_id;
- $this->fakebase = $this->bo->fakebase;
-
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'vendor_id' => $this->vendor_id,
- 'allrows' => $this->allrows,
- 'member_id' => $this->member_id
- );
- $this->bo->save_sessiondata($data);
- }
-
- function columns()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
-
- $GLOBALS['phpgw_info']['flags']['noframework'] = True;
-
- $values =
get_var('values',array('POST','GET'));
-
- if ($values['save'])
- {
-
-
$GLOBALS['phpgw']->preferences->account_id=$this->account;
-
$GLOBALS['phpgw']->preferences->read_repository();
-
$GLOBALS['phpgw']->preferences->add($this->currentapp,'s_agreement_columns',$values['columns'],'user');
-
$GLOBALS['phpgw']->preferences->save_repository();
-
- $receipt['message'][] = array('msg' =>
lang('columns is updated'));
- }
-
- $function_msg = lang('Select Column');
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.columns',
- 'role' => $this->role
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'column_list' =>
$this->bo->column_list($values['columns'],$allrows=True),
- 'function_msg' => $function_msg,
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_columns' => lang('columns'),
- 'lang_none' => lang('None'),
- 'lang_save' => lang('save'),
- 'select_name' => 'period'
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
$function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view_file()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw_info']['flags'][noheader] = True;
- $GLOBALS['phpgw_info']['flags'][nofooter] = True;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
-
- $file_name =
urldecode(get_var('file_name',array('POST','GET')));
- $id = get_var('id',array('POST','GET'));
-
- $file = $this->fakebase. SEP . 'service_agreement' .
SEP . $id . SEP . $file_name;
-
- if($this->bo->vfs->file_exists(array(
- 'string' => $file,
- 'relatives' => Array(RELATIVE_NONE)
- )))
- {
- $size =
$this->bo->vfs->get_size(array(
- 'string' => $file,
- 'relatives' =>
Array(RELATIVE_NONE),
- 'checksubdirs' =>
True));
-
- $document= $this->bo->vfs->read(array(
- 'string' => $file,
- 'relatives' => Array(RELATIVE_NONE)));
-
- $filename =
basename($values['document_name']);
- $filetype = array_pop(explode('.',
basename($file)));
- $browser = CreateObject('phpgwapi.browser');
-
$browser->content_header($filename,$filetype,$size);
-
- echo $document;
- }
- }
-
- function index()
- {
- $this->menu->sub = 'agreement';
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement',
-
'menu',
-
'receipt',
-
'search_field',
-
'nextmatchs',
-
'filter_member_of'));
-
- $links = $this->menu->links('s_agreement');
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt');
-
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt','');
-
- $list = $this->bo->read();
-
- $uicols = $this->bo->uicols;
-
- $j=0;
-
- if (isset($list) AND is_array($list))
- {
- foreach($list as $entry)
- {
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
- }
- }
-
- if($this->acl_read)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
- $content[$j]['row'][$i]['text']
= lang('view');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.view&id='
. $entry['id'] .'&role=' . $this->role);
- }
- if($this->acl_edit)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('edit the
s_agreement');
- $content[$j]['row'][$i]['text']
= lang('edit');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&id='
. $entry['id'] .'&role=' . $this->role);
- }
- if($this->acl_delete)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('delete the
s_agreement');
- $content[$j]['row'][$i]['text']
= lang('delete');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.delete&s_agreement_id='
. $entry['id'] .'&role=' . $this->role);
- }
-
- $j++;
- }
- }
-
-//html_print_r($content);
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['datatype'][$i]!='T' &&
$uicols['datatype'][$i]!='CH')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
- (
- 'sort' =>
$this->sort,
- 'var' =>
$uicols['name'][$i],
- 'order' =>
$this->order,
- 'extra'
=> array('menuaction' => $this->currentapp.'.uis_agreement.index',
-
'query' =>$this->query,
-
'lookup' =>$lookup,
-
'district_id' => $this->district_id,
-
'start_date' => $start_date,
-
'role' => $this->role,
-
'member_id' => $this->member_id,
-
'allrows' => $this->allrows,
-
'end_date' => $end_date
-
)
- ));
- }
- }
- }
-
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
-
-
- if($this->acl_add)
- {
- $table_add = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
s_agreement'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&role='
. $this->role)
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'role' =>
$this->role,
- 'member_id' =>
$this->member_id
-
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $link_columns = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.columns',
- 'role' =>
$this->role
- );
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => $link_data));
-
-//_debug_array($member_of_data);
- $data = array
- (
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
- 'lang_columns'
=> lang('columns'),
- 'link_columns'
=> $GLOBALS['phpgw']->link('/index.php',$link_columns),
- 'lang_columns_help'
=> lang('Choose columns'),
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the s_agreement belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_no_vendor'
=> lang('no vendor'),
- 'lang_vendor_statustext' =>
lang('Select the vendor the s_agreement belongs to.'),
- 'vendor_list'
=> $this->bo->select_vendor_list('filter',$this->vendor_id),
-
- 'lang_no_member'
=> lang('no member'),
- 'member_of_name'
=> 'member_id',
- 'member_of_list'
=> $member_of_data['cat_list'],
-
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
- $this->save_sessiondata();
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('service agreement') . ': ' . lang('list ' . $this->role);
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function list_content($list,$uicols,$edit_item='',$view_only='')
- {
- $j=0;
-
- if (isset($list) AND is_array($list))
- {
- foreach($list as $entry)
- {
- $content[$j]['id']
= $entry['id'];
- $content[$j]['item_id'] =
$entry['item_id'];
- $content[$j]['index_count'] =
$entry['index_count'];
- $content[$j]['cost'] =
$entry['cost'];
- for
($i=0;$i<count($uicols['name']);$i++)
- {
-
if($uicols['input_type'][$i]!='hidden')
- {
-
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
-
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
- }
- }
-
- if($this->acl_read && !$edit_item &&
!$view_only)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
- $content[$j]['row'][$i]['text']
= lang('view');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.view_item&s_agreement_id='
. $entry['agreement_id'] .'&id=' . $entry['id']);
- }
- if($this->acl_edit && !$edit_item &&
!$view_only)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('edit the
s_agreement');
- $content[$j]['row'][$i]['text']
= lang('edit');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_item&s_agreement_id='
. $entry['agreement_id'] .'&id=' . $entry['id']);
- }
- if($this->acl_delete && !$edit_item &&
!$view_only)
- {
-
$content[$j]['row'][$i]['statustext'] = lang('delete this
item');
- $content[$j]['row'][$i]['text']
= lang('delete');
-
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&delete_item=1&id='
. $entry['agreement_id'] .'&item_id=' . $entry['id']);
- }
-
- $j++;
- }
- }
-
-//html_print_r($content);
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- }
- }
-
- if($this->acl_read && !$edit_item && !$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit && !$edit_item && !$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete && !$edit_item && !$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
- if($this->acl_manage && !$edit_item && !$view_only)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('Update');
- $i++;
- }
-
- return
array('content'=>$content,'table_header'=>$table_header);
- }
-
-
- function edit()
- {
- $id = get_var('id',array('POST','GET'));
- $values = get_var('values',array('POST'));
- $delete_item = get_var('delete_item',array('GET'));
- $item_id = get_var('item_id',array('GET'));
-
- $config =
CreateObject('phpgwapi.config',$this->currentapp);
- $boalarm =
CreateObject($this->currentapp.'.boalarm');
-
- if($delete_item && $id && $item_id)
- {
- $this->bo->delete_item($id,$item_id);
- }
-
- $values_attribute =
get_var('values_attribute',array('POST'));
-
- $insert_record_s_agreement =
$GLOBALS['phpgw']->session->appsession('insert_record_s_agreement',$this->currentapp);
-
-//_debug_array($insert_record_s_agreement);
- for ($j=0;$j<count($insert_record_s_agreement);$j++)
- {
-
$insert_record['extra'][$insert_record_s_agreement[$j]] =
$insert_record_s_agreement[$j];
- }
-
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement','attributes_form'));
-
- if (is_array($values))
- {
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
-//_debug_array($values);
-
- if ($values['save'] || $values['apply']):
- {
- $values['vendor_id'] =
get_var('vendor_id',array('POST'));
- $values['vendor_name'] =
get_var('vendor_name',array('POST'));
- $values['b_account_id'] =
get_var('b_account_id',array('POST'));
- $values['b_account_name'] =
get_var('b_account_name',array('POST'));
- $values['start_date'] =
get_var('start_date',array('POST'));
- $values['end_date']
= get_var('end_date',array('POST'));
- $values['termination_date'] =
get_var('termination_date',array('POST'));
-
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- }
-
- if(!$values['last_name'])
- {
-//
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
- }
-
-
- if($id)
- {
- $values['s_agreement_id']=$id;
- $action='edit';
- }
- else
- {
-
$values['s_agreement_id']=$this->bo->request_next_id();
- }
-
-
$values['file_name']=$_FILES['file']['name'];
- $to_file = $this->fakebase. SEP .
'service_agreement' . SEP . $values['s_agreement_id'] . SEP .
$values['file_name'];
-
- if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
- 'string' => $to_file,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
- {
-
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
- }
-
-
- if(!$receipt['error'])
- {
-// $values['s_agreement_id']
= $id;
- $receipt =
$this->bo->create_home_dir($receipt);
- $receipt =
$this->bo->save($values,$values_attribute,$action);
- $id =
$receipt['s_agreement_id'];
- $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
- if($values['file_name'])
- {
-
$this->bo->create_document_dir($id);
-
$this->bo->vfs->override_acl = 1;
-
- if(!$this->bo->vfs->cp
(array (
- 'from' =>
$_FILES['file']['tmp_name'],
- 'to' =>
$to_file,
- 'relatives'
=> array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
- {
-
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
- }
-
$this->bo->vfs->override_acl = 0;
- }
-
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.index&role='
. $this->role);
- }
- }
- }
- elseif($values['update']):
- {
- $values['date'] =
get_var('date',array('POST'));
-
- if(!$values['date'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
- }
- if(!$values['new_index'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a index !'));
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->update($values);
- }
-
- }
- elseif($values['delete_alarm'] &&
count($values['alarm'])):
- {
-
- if(!$receipt['error'])
- {
- $receipt =
$boalarm->delete_alarm('s_agreement',$values['alarm']);
- }
-
- }
- elseif(($values['enable_alarm'] ||
$values['disable_alarm']) && count($values['alarm'])):
- {
-
- if(!$receipt['error'])
- {
- $receipt =
$boalarm->enable_alarm('s_agreement',$values['alarm'],$values['enable_alarm']);
- }
-
- }
- elseif($values['add_alarm']):
- {
- $time =
intval($values['time']['days'])*24*3600 +
-
intval($values['time']['hours'])*3600 +
-
intval($values['time']['mins'])*60;
-
- if ($time > 0)
- {
- $receipt =
$boalarm->add_alarm('s_agreement',$this->bo->read_event(array('s_agreement_id'=>$id)),$time,$values['user_id']);
- }
- }
- elseif (!$values['save'] && !$values['apply']
&& !$values['update']):
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.index&role='
. $this->role);
- }
- endif;
- }
-
-
- $s_agreement =
$this->bo->read_single(array('s_agreement_id'=>$id));
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- if ($id)
- {
- $this->cat_id =
($s_agreement['cat_id']?$s_agreement['cat_id']:$this->cat_id);
- $this->member_id =
($s_agreement['member_of']?$s_agreement['member_of']:$this->member_id);
- $list = $this->bo->read_details($id);
-
- $uicols = $this->bo->uicols;
- $list =
$this->list_content($list,$uicols);
- $content = $list['content'];
- $table_header=$list['table_header'];
- for ($i=0;
$i<count($list['content'][0]['row']); $i++)
- {
- $set_column[]=True;
- }
-
- if ($content)
- {
- $table_update[] = array
- (
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup'
=> "Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat
. "',button : 'date-trigger'});",
-
- 'lang_new_index'
=> lang('New index'),
- 'lang_new_index_statustext'
=> lang('Enter a new index'),
- 'lang_date_statustext'
=> lang('Select the date for the update'),
- 'lang_update'
=> lang('Update'),
- 'lang_update_statustext'
=> lang('update selected investments')
- );
- }
-
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.edit',
- 'id' => $id,
- 'role' => $this->role
- );
-
-
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'vendor_id' =>
$s_agreement['vendor_id'],
- 'vendor_name' =>
$s_agreement['vendor_name']));
-
-
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
- 'b_account_id' =>
$s_agreement['b_account_id'],
- 'b_account_name' =>
$s_agreement['b_account_name']));
-
-
- $alarm_data=$this->bocommon->initiate_ui_alarm(array(
-
'acl_location'=>$this->acl2_location,
- 'alarm_type'=> 's_agreement',
- 'type' => 'form',
- 'text' => 'Email
notification',
- 'times' => $times,
- 'id' => $id,
- 'method' => $method,
- 'data' => $data,
- 'account_id'=> $account_id
- ));
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- switch(substr($dateformat,0,1))
- {
- case 'M':
- $dateformat_validate=
"javascript:vDateType='1'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
- $onBlur =
"DateFormat(this,this.value,event,true,'1')";
- break;
- case 'y':
-
$dateformat_validate="javascript:vDateType='2'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
- $onBlur =
"DateFormat(this,this.value,event,true,'2')";
- break;
- case 'D':
-
$dateformat_validate="javascript:vDateType='3'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
- $onBlur =
"DateFormat(this,this.value,event,true,'3')";
- break;
- }
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => array()));
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add detail'),
- 'lang_add_standardtext' => lang('add an item to
the details'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_item&s_agreement_id='
. $id)
- );
-
-
- $link_file_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.view_file',
- 'id' =>$id
- );
-
- $config->read_repository();
- $link_to_files = $config->config_data['files_url'];
-
- $j = count($s_agreement['files']);
- for ($i=0;$i<$j;$i++)
- {
-
$s_agreement['files'][$i]['file_name']=urlencode($s_agreement['files'][$i]['name']);
- }
-
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.excel',
- 'id'
=>$id
- );
-
-
- $data = array
- (
-
- 'alarm_data' =>
$alarm_data,
- 'lang_alarm' =>
lang('Alarm'),
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
-
- 'fileupload'
=> True,
- 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
- 'link_to_files'
=> $link_to_files,
- 'files'
=> $s_agreement['files'],
- 'lang_files'
=> lang('files'),
- 'lang_filename'
=> lang('Filename'),
- 'lang_delete_file'
=> lang('Delete file'),
- 'lang_view_file_statustext' =>
lang('Klick to view file'),
- 'lang_delete_file_statustext' => lang('Check
to delete file'),
- 'lang_upload_file'
=> lang('Upload file'),
- 'lang_file_statustext' =>
lang('Select file to upload'),
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_id'
=> lang('ID'),
- 'value_s_agreement_id' => $id,
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'value_cat'
=> $s_agreement['cat'],
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the service agreement untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the s_agreement and return back to the list'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the s_agreement belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
-
- 'lang_member_of'
=> lang('member of'),
- 'member_of_name'
=> 'member_id',
- 'member_of_list'
=> $member_of_data['cat_list'],
-
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp'
=> $onKeyUp,
- 'onBlur'
=> $onBlur,
- 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
- 'lang_attributes'
=> lang('Attributes'),
- 'attributes_header'
=> $attributes_header,
- 'attributes_values'
=> $s_agreement['attributes'],
- 'lookup_functions'
=> $s_agreement['lookup_functions'],
- 'dateformat'
=> $dateformat,
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
- 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
- 'calendar_setup_termination'
=> "Calendar.setup({inputField : 'termination_date',ifFormat : '" .
$jsDateFormat . "',button : 'termination_date-trigger'});",
-
- 'lang_start_date_statustext' => lang('Select
the estimated end date for the Project'),
- 'lang_start_date'
=> lang('start date'),
- 'value_start_date'
=> $s_agreement['start_date'],
-
- 'lang_end_date_statustext' =>
lang('Select the estimated end date for the Project'),
- 'lang_end_date'
=> lang('end date'),
- 'value_end_date'
=> $s_agreement['end_date'],
-
- 'lang_termination_date_statustext'
=> lang('Select the estimated termination date'),
- 'lang_termination_date'
=> lang('termination date'),
- 'value_termination_date'
=> $s_agreement['termination_date'],
-
- 'vendor_data'
=> $vendor_data,
- 'b_account_data'
=> $b_account_data,
- 'lang_name'
=> lang('name'),
- 'lang_name_statustext' =>
lang('name'),
- 'value_name'
=> $s_agreement['name'],
- 'lang_descr'
=> lang('descr'),
- 'lang_descr_statustext' =>
lang('descr'),
- 'value_descr'
=> $s_agreement['descr'],
- 'table_add'
=> $table_add,
- 'values'
=> $content,
- 'table_header'
=> $table_header,
- 'acl_manage'
=> $this->acl_manage,
- 'table_update'
=> $table_update,
- 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&id='
. $id),
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
- 'check_all_script'
=> $check_all_script,
- 'set_column'
=> $set_column,
-
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('service agreement') . ': ' . ($id?lang('edit') . ' ' .
lang($this->role):lang('add') . ' ' . lang($this->role));
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function excel()
- {
- $id = get_var('id',array('POST','GET'));
- $list = $this->bo->read_details($id);
- $uicols = $this->bo->uicols;
-
$this->bocommon->excel($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
- }
-
- function edit_item()
- {
- $s_agreement_id =
get_var('s_agreement_id',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $values = get_var('values',array('POST'));
- $delete_last = get_var('delete_last',array('GET'));
- if($delete_last)
- {
-
$this->bo->delete_last_index($s_agreement_id,$id);
- }
-
-
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $values_attribute =
get_var('values_attribute',array('POST'));
-
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
- $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
-
- $insert_record_s_agreement1 =
$GLOBALS['phpgw']->session->appsession('insert_record_s_agreement1',$this->currentapp);
-
-//_debug_array($insert_record_s_agreement1);
-
- for ($j=0;$j<count($insert_record_entity);$j++)
- {
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
- }
-
- for ($j=0;$j<count($insert_record_s_agreement1);$j++)
- {
-
$insert_record['extra'][$insert_record_s_agreement1[$j]] =
$insert_record_s_agreement1[$j];
- }
-
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement','attributes_form'));
-
- if (is_array($values))
- {
-
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
-
-//_debug_array($values);
- if ($values['save'] || $values['apply']):
- {
-
- if(!$receipt['error'])
- {
- $values['s_agreement_id']
= $s_agreement_id;
- $values['id'] = $id;
- $receipt =
$this->bo->save_item($values,$values_attribute);
- $s_agreement_id =
$receipt['s_agreement_id'];
- $id =
$receipt['id'];
- $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&id='
. $s_agreement_id);
- }
- }
- else
- {
- if($values['location'])
- {
-
$location_code=implode("-", $values['location']);
-
$values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
- }
- if($values['extra']['p_num'])
- {
-
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
- }
- }
- }
- elseif($values['update']):
- {
- $values['date'] =
get_var('date',array('POST'));
-
- if(!$values['date'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
- }
- if(!$values['new_index'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a index !'));
- }
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->update($values);
- }
-
- }
- elseif (!$values['save'] && !$values['apply']
&& !$values['update']):
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&id='
. $s_agreement_id);
- }
- endif;
- }
-
- $s_agreement =
$this->bo->read_single(array('s_agreement_id'=>$s_agreement_id));
- $values =
$this->bo->read_single_item(array('s_agreement_id'=>$s_agreement_id,'id'=>$id));
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.edit_item',
- 's_agreement_id' => $s_agreement_id,
- 'id' => $id,
- 'role' => $this->role
- );
-
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- switch(substr($dateformat,0,1))
- {
- case 'M':
- $dateformat_validate=
"javascript:vDateType='1'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
- $onBlur =
"DateFormat(this,this.value,event,true,'1')";
- break;
- case 'y':
-
$dateformat_validate="javascript:vDateType='2'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
- $onBlur =
"DateFormat(this,this.value,event,true,'2')";
- break;
- case 'D':
-
$dateformat_validate="javascript:vDateType='3'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
- $onBlur =
"DateFormat(this,this.value,event,true,'3')";
- break;
- }
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => array()));
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add detail'),
- 'lang_add_standardtext' => lang('add an item to
the details'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_item&s_agreement_id='
. $s_agreement_id)
- );
-
-
- if($id)
- {
- $list =
$this->bo->read_prizing(array('s_agreement_id'=>$s_agreement_id,'item_id'=>$id));
- }
-
- $uicols = $this->bo->uicols;
- $list =
$this->list_content($list,$uicols,$edit_item=True);
- $content = $list['content'];
- $table_header=$list['table_header'];
-
- for ($i=0; $i<count($list['content'][0]['row']); $i++)
- {
- $set_column[]=True;
- }
-//_debug_array($list);
-
- $table_update[] = array
- (
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
-
- 'lang_new_index' =>
lang('New index'),
- 'lang_new_index_statustext' => lang('Enter
a new index'),
- 'lang_date_statustext' => lang('Select
the date for the update'),
- 'lang_update' =>
lang('Update'),
- 'lang_update_statustext' => lang('update
selected investments')
- );
-
-
- $lookup_type='form';
-
-//_debug_array($values);
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' => -1,
// calculated from location_types
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
False,
- 'lookup_type' => $lookup_type,
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('s_agreement'),
- 'entity_data' => $values['p']
- ));
-
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_id'
=> lang('ID'),
- 'value_id'
=> $values['id'],
- 'value_s_agreement_id' =>
$s_agreement_id,
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the service agreement untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the s_agreement and return back to the list'),
-
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp'
=> $onKeyUp,
- 'onBlur'
=> $onBlur,
- 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
- 'lang_attributes'
=> lang('Attributes'),
- 'attributes_header'
=> $attributes_header,
- 'attributes_values'
=> $values['attributes'],
- 'lookup_functions'
=> $values['lookup_functions'],
- 'dateformat'
=> $dateformat,
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
- 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
-
- 'lang_agreement'
=> lang('Agreement'),
- 'agreement_name'
=> $s_agreement['name'],
-
- 'table_add'
=> $table_add,
- 'values'
=> $content,
- 'table_header'
=> $table_header,
- 'acl_manage'
=> $this->acl_manage,
- 'table_update'
=> $table_update,
- 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_item&s_agreement_id='
. $s_agreement_id . '&id=' . $id),
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
- 'location_data'
=> $location_data,
-
- 'lang_cost'
=> lang('cost'),
- 'lang_cost_statustext' =>
lang('cost'),
- 'value_cost'
=> $values['cost'],
- 'set_column'
=> $set_column,
- 'lang_delete_last'
=> lang('delete last index'),
- 'lang_delete_last_statustext' => lang('delete
the last index'),
- 'delete_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_item&delete_last=1&s_agreement_id='
. $s_agreement_id . '&id=' . $id),
-
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('service agreement') . ': ' . ($values['id']?lang('edit item') . ' ' .
$s_agreement['name']:lang('add item') . ' ' . $s_agreement['name']);
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_item' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view_item()
- {
- $s_agreement_id =
get_var('s_agreement_id',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
-
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement','attributes_view'));
-
- $s_agreement =
$this->bo->read_single(array('s_agreement_id'=>$s_agreement_id));
- $values =
$this->bo->read_single_item(array('s_agreement_id'=>$s_agreement_id,'id'=>$id));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.edit',
- 'id' =>
$s_agreement_id
- );
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- if($id)
- {
- $list =
$this->bo->read_prizing(array('s_agreement_id'=>$s_agreement_id,'item_id'=>$id));
- }
-
- $uicols = $this->bo->uicols;
- $list =
$this->list_content($list,$uicols,$edit_item=True);
- $content = $list['content'];
- $table_header=$list['table_header'];
-
- $lookup_type='view';
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' => -1,
// calculated from location_types
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
False,
- 'lookup_type' => $lookup_type,
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('s_agreement'),
- 'entity_data' => $values['p']
- ));
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_id'
=> lang('ID'),
- 'value_id'
=> $values['id'],
- 'value_s_agreement_id' =>
$s_agreement_id,
- 'lang_category'
=> lang('category'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_cancel_statustext' =>
lang('Leave the service agreement untouched and return back to the list'),
-
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'attributes_view'
=> $values['attributes'],
-
- 'lang_agreement'
=> lang('Agreement'),
- 'agreement_name'
=> $s_agreement['name'],
-
- 'table_add'
=> $table_add,
- 'values'
=> $content,
- 'table_header'
=> $table_header,
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
- 'location_data'
=> $location_data,
-
- 'lang_cost'
=> lang('cost'),
- 'lang_cost_statustext' =>
lang('cost'),
- 'value_cost'
=> $values['cost'],
- 'set_column'
=> $set_column,
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('service agreement') . ': ' . lang('view item') . ' ' .
$s_agreement['name'];
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view_item' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function delete()
- {
- $attrib = get_var('attrib',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $s_agreement_id =
get_var('s_agreement_id',array('POST','GET'));
- $delete = get_var('delete',array('POST'));
- $confirm = get_var('confirm',array('POST'));
-
-
- if($attrib)
- {
- $function='list_attribute';
- }
- else
- {
- $function='index';
- }
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.'.$function,
- 'role' => $this->role
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($s_agreement_id,$id,$attrib);
-// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
-
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.delete&s_agreement_id='
. $s_agreement_id. '&id=' . $id . '&attrib=' . $attrib . '&role=' .
$this->role),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('service agreement');
- $function_msg =
lang('delete') . ' ' . lang($this->role);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
-
- function view()
- {
- $s_agreement_id = get_var('id',array('POST','GET'));
- $config =
CreateObject('phpgwapi.config',$this->currentapp);
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement','attributes_view'));
-
-
- $s_agreement =
$this->bo->read_single(array('s_agreement_id'=>$s_agreement_id));
-
-
- if ($s_agreement_id)
- {
- $this->cat_id =
($s_agreement['cat_id']?$s_agreement['cat_id']:$this->cat_id);
- $this->member_id =
($s_agreement['member_of']?$s_agreement['member_of']:$this->member_id);
- $list =
$this->bo->read_details($s_agreement_id);
- $total_records = count($list);
-
- $uicols = $this->bo->uicols;
- $list =
$this->list_content($list,$uicols,$edit_item=False,$view_only=True);
- $content = $list['content'];
- $table_header=$list['table_header'];
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.index',
- 's_agreement_id' => $s_agreement_id,
- );
-
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'vendor_id' =>
$s_agreement['vendor_id'],
- 'vendor_name' =>
$s_agreement['vendor_name'],
- 'type' =>
'view'));
-
-
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
- 'b_account_id' =>
$s_agreement['b_account_id'],
- 'b_account_name' =>
$s_agreement['b_account_name'],
- 'type' =>
'view'));
-
-
- $alarm_data=$this->bocommon->initiate_ui_alarm(array(
-
'acl_location'=>$this->acl2_location,
- 'alarm_type'=> 's_agreement',
- 'type' => 'view',
- 'text' => 'Email
notification',
- 'times' => $times,
- 'id' =>
$s_agreement_id,
- 'method' => $method,
- 'data' => $data,
- 'account_id'=> $account_id
- ));
-
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => array()));
-
- $link_file_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.view_file',
- 'id'
=>$s_agreement_id
- );
-
-
- $config->read_repository();
- $link_to_files = $config->config_data['files_url'];
-
- $j = count($s_agreement['files']);
- for ($i=0;$i<$j;$i++)
- {
-
$s_agreement['files'][$i]['file_name']=urlencode($s_agreement['files'][$i]['name']);
- }
-
-
- $data = array
- (
- 'lang_total_records' =>
lang('Total'),
- 'total_records'
=> $total_records,
- 'alarm_data'
=> $alarm_data,
- 'lang_alarm'
=> lang('Alarm'),
- 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
- 'link_to_files'
=> $link_to_files,
- 'files'
=> $s_agreement['files'],
- 'lang_files'
=> lang('files'),
- 'lang_filename'
=> lang('Filename'),
- 'lang_view_file_statustext' =>
lang('Klick to view file'),
-
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_id'
=> lang('ID'),
- 'value_s_agreement_id' =>
$s_agreement_id,
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('done'),
- 'lang_apply'
=> lang('apply'),
- 'value_cat'
=> $s_agreement['cat'],
- 'lang_cancel_statustext' =>
lang('return back to the list'),
- 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
-
- 'lang_member_of'
=> lang('member of'),
- 'member_of_name'
=> 'member_id',
- 'member_of_list'
=> $member_of_data['cat_list'],
-
- 'lang_dateformat'
=> lang(strtolower($dateformat)),
- 'attributes_view'
=> $s_agreement['attributes'],
- 'dateformat'
=> $dateformat,
-
- 'lang_start_date'
=> lang('start date'),
- 'value_start_date'
=> $s_agreement['start_date'],
-
- 'lang_end_date'
=> lang('end date'),
- 'value_end_date'
=> $s_agreement['end_date'],
-
- 'lang_termination_date' =>
lang('termination date'),
- 'value_termination_date' =>
$s_agreement['termination_date'],
-
- 'vendor_data'
=> $vendor_data,
- 'b_account_data'
=> $b_account_data,
- 'lang_name'
=> lang('name'),
- 'value_name'
=> $s_agreement['name'],
- 'lang_descr'
=> lang('descr'),
- 'value_descr'
=> $s_agreement['descr'],
- 'table_add'
=> $table_add,
- 'values'
=> $content,
- 'table_header'
=> $table_header,
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('service agreement') . ': ' . lang('view');
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function list_attribute()
- {
- $id = get_var('id',array('POST','GET'));
- $resort = get_var('resort',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array(
- 's_agreement',
- 'nextmatchs',
-
'search_field'));
-
- if($resort)
- {
-
$this->bo->resort_attrib(array('resort'=>$resort,'id'=>$id));
- }
-
- $attrib_list = $this->bo->read_attrib();
-
- while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
- {
- $content[] = array
- (
- 'name'
=> $attrib['name'],
- 'type_name'
=> $attrib['type_name'],
- 'datatype'
=> $attrib['datatype'],
- 'column_name'
=> $attrib['column_name'],
- 'input_text'
=> $attrib['input_text'],
- 'sorting'
=> $attrib['attrib_sort'],
- 'search'
=> $attrib['search'],
- 'link_up'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.list_attribute&resort=up&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
- 'link_down'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.list_attribute&resort=down&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_attrib&id='
. $attrib['id'] . '&role=' . $this->role),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.delete&id='
. $attrib['id'].'&attrib=true&role=' . $this->role),
- 'lang_view_attribtext' =>
lang('view the attrib'),
- 'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang('location'),
- 'lang_edit_attribtext' =>
lang('edit the attrib'),
- 'lang_delete_attribtext' =>
lang('delete the attrib'),
- 'text_attribute'
=> lang('Attributes'),
- 'text_up'
=> lang('up'),
- 'text_down'
=> lang('down'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
- //html_print_r($content);
-
- $table_header[] = array
- (
- 'lang_descr' => lang('Descr'),
- 'lang_datatype' => lang('Datatype'),
- 'lang_sorting' => lang('sorting'),
- 'lang_search' => lang('search'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_sorting' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'attrib_sort',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uis_agreement.list_attribute',
-
'allrows'=>$this->allrows,
-
'role' => $this->role)
-
)),
-
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'column_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uis_agreement.list_attribute',
-
'allrows'=>$this->allrows,
-
'role' => $this->role)
-
)),
- 'lang_name' => lang('Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_attribtext' => lang('add a attrib'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_attrib&role='
. $this->role),
- 'lang_done' =>
lang('done'),
- 'lang_done_attribtext' => lang('back to
admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php'),
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.list_attribute',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'query'
=>$this->query,
- 'role' =>
$this->role
-
- );
-
- $data = array
- (
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($attrib_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_attribtext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_attrib' =>
$table_header,
- 'values_attrib'
=> $content,
- 'table_add2'
=> $table_add
- );
-
- $appname
= lang('service agreement');
- $function_msg =
lang('list attribute') . ': ' . lang($this->role);
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function edit_attrib()
- {
- $id =
get_var('id',array('POST','GET'));
- $values = get_var('values',array('POST'));
- // $GLOBALS['phpgw']->common->msgbox(lang('Altering
ColumnName OR Datatype - deletes your data in this Column'));
- //html_print_r($values);
-
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement','choice',));
-
- if ($values['save'])
- {
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- $type_id =
$values['type_id'];
-
- if (!$values['column_name'])
- {
- $receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
- }
-
- if (!$values['input_text'])
- {
- $receipt['error'][] =
array('msg'=>lang('Input text not entered!'));
- }
- if (!$values['statustext'])
- {
- $receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
- }
-
- if (!$values['column_info']['type'])
- {
- $receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
- }
-
-
if(!ctype_digit($values['column_info']['precision']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
-
unset($values['column_info']['precision']);
- }
-
-
if(!ctype_digit($values['column_info']['scale']))
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
- unset($values['column_info']['scale']);
- }
-
- if (!$values['column_info']['nullable'])
- {
- $receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
- }
-
-
- if (!$receipt['error'])
- {
- $receipt =
$this->bo->save_attrib($values,$action);
-
- if(!$id)
- {
- $id=$receipt['id'];
- }
- }
- else
- {
- $receipt['error'][] = array('msg'
=> lang('Attribute has NOT been saved'));
- }
-
- }
-
- if ($id)
- {
- $values = $this->bo->read_single_attrib($id);
- $function_msg = lang('edit attribute') . ': ' .
lang($this->role);
- $action='edit';
- }
- else
- {
- $function_msg = lang('add attribute') . ': ' .
lang($this->role);
- $action='add';
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uis_agreement.edit_attrib',
- 'id' => $id,
- 'role' => $this->role
-
- );
- //html_print_r($values);
-
- if($values['column_info']['type']=='R' ||
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
- {
- $multiple_choice= True;
- }
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'lang_choice' =>
lang('Choice'),
- 'lang_new_value' =>
lang('New value'),
- 'lang_new_value_statustext' => lang('New
value for mulitple choice'),
- 'multiple_choice' =>
$multiple_choice,
- 'value_choice' =>
$values['choice'],
- 'lang_delete_value' =>
lang('Delete value'),
- 'lang_value' =>
lang('value'),
- 'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.list_attribute&type_id='.$type_id
. '&role=' . $this->role),
- 'lang_id'
=> lang('Attribute ID'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
-
- 'lang_column_name'
=> lang('Column name'),
- 'value_column_name'
=> $values['column_name'],
- 'lang_column_name_statustext' => lang('enter
the name for the column'),
-
- 'lang_input_text'
=> lang('input text'),
- 'value_input_text'
=> $values['input_text'],
- 'lang_input_name_statustext' => lang('enter
the input text for records'),
-
- 'lang_id_attribtext' => lang('Enter
the attribute ID'),
- 'lang_entity_statustext' => lang('Select
a s_agreement type'),
-
- 'lang_statustext' =>
lang('Statustext'),
- 'lang_statustext_attribtext'=> lang('Enter a
statustext for the inputfield in forms'),
- 'value_statustext' =>
$values['statustext'],
-
- 'lang_done_attribtext' => lang('Back
to the list'),
- 'lang_save_attribtext' => lang('Save
the attribute'),
-
- 'lang_datatype' =>
lang('Datatype'),
- 'lang_datatype_statustext' => lang('Select
a datatype'),
- 'lang_no_datatype' =>
lang('No datatype'),
- 'datatype_list' =>
$this->bocommon->select_datatype($values['column_info']['type']),
-
- 'lang_precision' =>
lang('Precision'),
- 'lang_precision_statustext' => lang('enter
the record length'),
- 'value_precision' =>
$values['column_info']['precision'],
-
- 'lang_scale' =>
lang('scale'),
- 'lang_scale_statustext' => lang('enter
the scale if type is decimal'),
- 'value_scale' =>
$values['column_info']['scale'],
-
- 'lang_default' =>
lang('default'),
- 'lang_default_statustext' => lang('enter
the default value'),
- 'value_default' =>
$values['column_info']['default'],
-
- 'lang_nullable' =>
lang('Nullable'),
- 'lang_nullable_statustext' => lang('Chose
if this column is nullable'),
- 'lang_select_nullable' => lang('Select
nullable'),
- 'nullable_list' =>
$this->bocommon->select_nullable($values['column_info']['nullable']),
-
- 'value_list' =>
$values['list'],
- 'lang_list'
=> lang('show in list'),
- 'lang_list_statustext' => lang('check
to show this attribute in location list'),
-
- 'value_search' =>
$values['search'],
- 'lang_include_search' =>
lang('Include in search'),
- 'lang_include_search_statustext'=> lang('check
to show this attribute in location list'),
-
-
- );
- //html_print_r($data);
-
- $appname
= lang('service agreement');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
\ No newline at end of file
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 agreement
+ * @version $Id: class.uis_agreement.inc.php,v 1.24 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uis_agreement
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'list_attribute'=> True,
+ 'edit_attrib' => True,
+ 'columns' => True,
+ 'edit_item' => True,
+ 'view_item' => True,
+ 'view_file' => True,
+ 'excel' => True
+ );
+
+ function uis_agreement()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.bos_agreement',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->role = $this->bo->role;
+
+ $this->cats =
CreateObject('phpgwapi.categories');
+ $this->cats->app_name = 'fm_vendor';
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location= '.s_agreement';
+
+ $this->acl_read =
$this->acl2->check($this->acl2_location,1);
+ $this->acl_add =
$this->acl2->check($this->acl2_location,2);
+ $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
+ $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
+ $this->acl_manage =
$this->acl2->check($this->acl2_location,16);
+
+ $this->start = $this->bo->start;
+ $this->query = $this->bo->query;
+ $this->sort = $this->bo->sort;
+ $this->order = $this->bo->order;
+ $this->filter = $this->bo->filter;
+ $this->cat_id = $this->bo->cat_id;
+ $this->vendor_id = $this->bo->vendor_id;
+ $this->allrows = $this->bo->allrows;
+ $this->member_id = $this->bo->member_id;
+ $this->fakebase = $this->bo->fakebase;
+
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'vendor_id' => $this->vendor_id,
+ 'allrows' => $this->allrows,
+ 'member_id' => $this->member_id
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function columns()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('columns'));
+
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+
+ $values =
get_var('values',array('POST','GET'));
+
+ if ($values['save'])
+ {
+
+
$GLOBALS['phpgw']->preferences->account_id=$this->account;
+
$GLOBALS['phpgw']->preferences->read_repository();
+
$GLOBALS['phpgw']->preferences->add($this->currentapp,'s_agreement_columns',$values['columns'],'user');
+
$GLOBALS['phpgw']->preferences->save_repository();
+
+ $receipt['message'][] = array('msg' =>
lang('columns is updated'));
+ }
+
+ $function_msg = lang('Select Column');
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.columns',
+ 'role' => $this->role
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'column_list' =>
$this->bo->column_list($values['columns'],$allrows=True),
+ 'function_msg' => $function_msg,
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_columns' => lang('columns'),
+ 'lang_none' => lang('None'),
+ 'lang_save' => lang('save'),
+ 'select_name' => 'period'
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
$function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('columns' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view_file()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw_info']['flags'][noheader] = True;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = True;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
+
+ $file_name =
urldecode(get_var('file_name',array('POST','GET')));
+ $id = get_var('id',array('POST','GET'));
+
+ $file = $this->fakebase. SEP . 'service_agreement' .
SEP . $id . SEP . $file_name;
+
+ if($this->bo->vfs->file_exists(array(
+ 'string' => $file,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $size =
$this->bo->vfs->get_size(array(
+ 'string' => $file,
+ 'relatives' =>
Array(RELATIVE_NONE),
+ 'checksubdirs' =>
True));
+
+ $document= $this->bo->vfs->read(array(
+ 'string' => $file,
+ 'relatives' => Array(RELATIVE_NONE)));
+
+ $filename =
basename($values['document_name']);
+ $filetype = array_pop(explode('.',
basename($file)));
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($filename,$filetype,$size);
+
+ echo $document;
+ }
+ }
+
+ function index()
+ {
+ $this->menu->sub = 'agreement';
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement',
+
'menu',
+
'receipt',
+
'search_field',
+
'nextmatchs',
+
'filter_member_of'));
+
+ $links = $this->menu->links('s_agreement');
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt');
+
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt','');
+
+ $list = $this->bo->read();
+
+ $uicols = $this->bo->uicols;
+
+ $j=0;
+
+ if (isset($list) AND is_array($list))
+ {
+ foreach($list as $entry)
+ {
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+ }
+ }
+
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
+ $content[$j]['row'][$i]['text']
= lang('view');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.view&id='
. $entry['id'] .'&role=' . $this->role);
+ }
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('edit the
s_agreement');
+ $content[$j]['row'][$i]['text']
= lang('edit');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&id='
. $entry['id'] .'&role=' . $this->role);
+ }
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('delete the
s_agreement');
+ $content[$j]['row'][$i]['text']
= lang('delete');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.delete&s_agreement_id='
. $entry['id'] .'&role=' . $this->role);
+ }
+
+ $j++;
+ }
+ }
+
+//html_print_r($content);
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['datatype'][$i]!='T' &&
$uicols['datatype'][$i]!='CH')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+ (
+ 'sort' =>
$this->sort,
+ 'var' =>
$uicols['name'][$i],
+ 'order' =>
$this->order,
+ 'extra'
=> array('menuaction' => $this->currentapp.'.uis_agreement.index',
+
'query' =>$this->query,
+
'lookup' =>$lookup,
+
'district_id' => $this->district_id,
+
'start_date' => $start_date,
+
'role' => $this->role,
+
'member_id' => $this->member_id,
+
'allrows' => $this->allrows,
+
'end_date' => $end_date
+
)
+ ));
+ }
+ }
+ }
+
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+
+
+ if($this->acl_add)
+ {
+ $table_add = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
s_agreement'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&role='
. $this->role)
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'role' =>
$this->role,
+ 'member_id' =>
$this->member_id
+
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $link_columns = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.columns',
+ 'role' =>
$this->role
+ );
+
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => $link_data));
+
+//_debug_array($member_of_data);
+ $data = array
+ (
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+ 'lang_columns'
=> lang('columns'),
+ 'link_columns'
=> $GLOBALS['phpgw']->link('/index.php',$link_columns),
+ 'lang_columns_help'
=> lang('Choose columns'),
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the s_agreement belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_no_vendor'
=> lang('no vendor'),
+ 'lang_vendor_statustext' =>
lang('Select the vendor the s_agreement belongs to.'),
+ 'vendor_list'
=> $this->bo->select_vendor_list('filter',$this->vendor_id),
+
+ 'lang_no_member'
=> lang('no member'),
+ 'member_of_name'
=> 'member_id',
+ 'member_of_list'
=> $member_of_data['cat_list'],
+
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+ $this->save_sessiondata();
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('service agreement') . ': ' . lang('list ' . $this->role);
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function list_content($list,$uicols,$edit_item='',$view_only='')
+ {
+ $j=0;
+
+ if (isset($list) AND is_array($list))
+ {
+ foreach($list as $entry)
+ {
+ $content[$j]['id']
= $entry['id'];
+ $content[$j]['item_id'] =
$entry['item_id'];
+ $content[$j]['index_count'] =
$entry['index_count'];
+ $content[$j]['cost'] =
$entry['cost'];
+ for
($i=0;$i<count($uicols['name']);$i++)
+ {
+
if($uicols['input_type'][$i]!='hidden')
+ {
+
$content[$j]['row'][$i]['value'] =
$entry[$uicols['name'][$i]];
+
$content[$j]['row'][$i]['name'] = $uicols['name'][$i];
+ }
+ }
+
+ if($this->acl_read && !$edit_item &&
!$view_only)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('view the
entity');
+ $content[$j]['row'][$i]['text']
= lang('view');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.view_item&s_agreement_id='
. $entry['agreement_id'] .'&id=' . $entry['id']);
+ }
+ if($this->acl_edit && !$edit_item &&
!$view_only)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('edit the
s_agreement');
+ $content[$j]['row'][$i]['text']
= lang('edit');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_item&s_agreement_id='
. $entry['agreement_id'] .'&id=' . $entry['id']);
+ }
+ if($this->acl_delete && !$edit_item &&
!$view_only)
+ {
+
$content[$j]['row'][$i]['statustext'] = lang('delete this
item');
+ $content[$j]['row'][$i]['text']
= lang('delete');
+
$content[$j]['row'][$i++]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&delete_item=1&id='
. $entry['agreement_id'] .'&item_id=' . $entry['id']);
+ }
+
+ $j++;
+ }
+ }
+
+//html_print_r($content);
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ }
+ }
+
+ if($this->acl_read && !$edit_item && !$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit && !$edit_item && !$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete && !$edit_item && !$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+ if($this->acl_manage && !$edit_item && !$view_only)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('Update');
+ $i++;
+ }
+
+ return
array('content'=>$content,'table_header'=>$table_header);
+ }
+
+
+ function edit()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+ $delete_item = get_var('delete_item',array('GET'));
+ $item_id = get_var('item_id',array('GET'));
+
+ $config =
CreateObject('phpgwapi.config',$this->currentapp);
+ $boalarm =
CreateObject($this->currentapp.'.boalarm');
+
+ if($delete_item && $id && $item_id)
+ {
+ $this->bo->delete_item($id,$item_id);
+ }
+
+ $values_attribute =
get_var('values_attribute',array('POST'));
+
+ $insert_record_s_agreement =
$GLOBALS['phpgw']->session->appsession('insert_record_s_agreement',$this->currentapp);
+
+//_debug_array($insert_record_s_agreement);
+ for ($j=0;$j<count($insert_record_s_agreement);$j++)
+ {
+
$insert_record['extra'][$insert_record_s_agreement[$j]] =
$insert_record_s_agreement[$j];
+ }
+
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement','attributes_form'));
+
+ if (is_array($values))
+ {
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+//_debug_array($values);
+
+ if ($values['save'] || $values['apply']):
+ {
+ $values['vendor_id'] =
get_var('vendor_id',array('POST'));
+ $values['vendor_name'] =
get_var('vendor_name',array('POST'));
+ $values['b_account_id'] =
get_var('b_account_id',array('POST'));
+ $values['b_account_name'] =
get_var('b_account_name',array('POST'));
+ $values['start_date'] =
get_var('start_date',array('POST'));
+ $values['end_date']
= get_var('end_date',array('POST'));
+ $values['termination_date'] =
get_var('termination_date',array('POST'));
+
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ }
+
+ if(!$values['last_name'])
+ {
+//
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
+ }
+
+
+ if($id)
+ {
+ $values['s_agreement_id']=$id;
+ $action='edit';
+ }
+ else
+ {
+
$values['s_agreement_id']=$this->bo->request_next_id();
+ }
+
+
$values['file_name']=$_FILES['file']['name'];
+ $to_file = $this->fakebase. SEP .
'service_agreement' . SEP . $values['s_agreement_id'] . SEP .
$values['file_name'];
+
+ if(!$values['document_name_orig'] &&
$this->bo->vfs->file_exists(array(
+ 'string' => $to_file,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
+ }
+
+
+ if(!$receipt['error'])
+ {
+// $values['s_agreement_id']
= $id;
+ $receipt =
$this->bo->create_home_dir($receipt);
+ $receipt =
$this->bo->save($values,$values_attribute,$action);
+ $id =
$receipt['s_agreement_id'];
+ $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
+
+ if($values['file_name'])
+ {
+
$this->bo->create_document_dir($id);
+
$this->bo->vfs->override_acl = 1;
+
+ if(!$this->bo->vfs->cp
(array (
+ 'from' =>
$_FILES['file']['tmp_name'],
+ 'to' =>
$to_file,
+ 'relatives'
=> array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+ {
+
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
+ }
+
$this->bo->vfs->override_acl = 0;
+ }
+
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.index&role='
. $this->role);
+ }
+ }
+ }
+ elseif($values['update']):
+ {
+ $values['date'] =
get_var('date',array('POST'));
+
+ if(!$values['date'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
+ }
+ if(!$values['new_index'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a index !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->update($values);
+ }
+
+ }
+ elseif($values['delete_alarm'] &&
count($values['alarm'])):
+ {
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$boalarm->delete_alarm('s_agreement',$values['alarm']);
+ }
+
+ }
+ elseif(($values['enable_alarm'] ||
$values['disable_alarm']) && count($values['alarm'])):
+ {
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$boalarm->enable_alarm('s_agreement',$values['alarm'],$values['enable_alarm']);
+ }
+
+ }
+ elseif($values['add_alarm']):
+ {
+ $time =
intval($values['time']['days'])*24*3600 +
+
intval($values['time']['hours'])*3600 +
+
intval($values['time']['mins'])*60;
+
+ if ($time > 0)
+ {
+ $receipt =
$boalarm->add_alarm('s_agreement',$this->bo->read_event(array('s_agreement_id'=>$id)),$time,$values['user_id']);
+ }
+ }
+ elseif (!$values['save'] && !$values['apply']
&& !$values['update']):
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.index&role='
. $this->role);
+ }
+ endif;
+ }
+
+
+ $s_agreement =
$this->bo->read_single(array('s_agreement_id'=>$id));
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ if ($id)
+ {
+ $this->cat_id =
($s_agreement['cat_id']?$s_agreement['cat_id']:$this->cat_id);
+ $this->member_id =
($s_agreement['member_of']?$s_agreement['member_of']:$this->member_id);
+ $list = $this->bo->read_details($id);
+
+ $uicols = $this->bo->uicols;
+ $list =
$this->list_content($list,$uicols);
+ $content = $list['content'];
+ $table_header=$list['table_header'];
+ for ($i=0;
$i<count($list['content'][0]['row']); $i++)
+ {
+ $set_column[]=True;
+ }
+
+ if ($content)
+ {
+ $table_update[] = array
+ (
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup'
=> "Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat
. "',button : 'date-trigger'});",
+
+ 'lang_new_index'
=> lang('New index'),
+ 'lang_new_index_statustext'
=> lang('Enter a new index'),
+ 'lang_date_statustext'
=> lang('Select the date for the update'),
+ 'lang_update'
=> lang('Update'),
+ 'lang_update_statustext'
=> lang('update selected investments')
+ );
+ }
+
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.edit',
+ 'id' => $id,
+ 'role' => $this->role
+ );
+
+
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'vendor_id' =>
$s_agreement['vendor_id'],
+ 'vendor_name' =>
$s_agreement['vendor_name']));
+
+
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
+ 'b_account_id' =>
$s_agreement['b_account_id'],
+ 'b_account_name' =>
$s_agreement['b_account_name']));
+
+
+ $alarm_data=$this->bocommon->initiate_ui_alarm(array(
+
'acl_location'=>$this->acl2_location,
+ 'alarm_type'=> 's_agreement',
+ 'type' => 'form',
+ 'text' => 'Email
notification',
+ 'times' => $times,
+ 'id' => $id,
+ 'method' => $method,
+ 'data' => $data,
+ 'account_id'=> $account_id
+ ));
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+
$dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+
$dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => array()));
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add detail'),
+ 'lang_add_standardtext' => lang('add an item to
the details'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_item&s_agreement_id='
. $id)
+ );
+
+
+ $link_file_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.view_file',
+ 'id' =>$id
+ );
+
+ $config->read_repository();
+ $link_to_files = $config->config_data['files_url'];
+
+ $j = count($s_agreement['files']);
+ for ($i=0;$i<$j;$i++)
+ {
+
$s_agreement['files'][$i]['file_name']=urlencode($s_agreement['files'][$i]['name']);
+ }
+
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.excel',
+ 'id'
=>$id
+ );
+
+
+ $data = array
+ (
+
+ 'alarm_data' =>
$alarm_data,
+ 'lang_alarm' =>
lang('Alarm'),
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+
+ 'fileupload'
=> True,
+ 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
+ 'link_to_files'
=> $link_to_files,
+ 'files'
=> $s_agreement['files'],
+ 'lang_files'
=> lang('files'),
+ 'lang_filename'
=> lang('Filename'),
+ 'lang_delete_file'
=> lang('Delete file'),
+ 'lang_view_file_statustext' =>
lang('Klick to view file'),
+ 'lang_delete_file_statustext' => lang('Check
to delete file'),
+ 'lang_upload_file'
=> lang('Upload file'),
+ 'lang_file_statustext' =>
lang('Select file to upload'),
+
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_id'
=> lang('ID'),
+ 'value_s_agreement_id' => $id,
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_apply'
=> lang('apply'),
+ 'value_cat'
=> $s_agreement['cat'],
+ 'lang_apply_statustext' =>
lang('Apply the values'),
+ 'lang_cancel_statustext' =>
lang('Leave the service agreement untouched and return back to the list'),
+ 'lang_save_statustext' =>
lang('Save the s_agreement and return back to the list'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the s_agreement belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
+
+ 'lang_member_of'
=> lang('member of'),
+ 'member_of_name'
=> 'member_id',
+ 'member_of_list'
=> $member_of_data['cat_list'],
+
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
+ 'lang_attributes'
=> lang('Attributes'),
+ 'attributes_header'
=> $attributes_header,
+ 'attributes_values'
=> $s_agreement['attributes'],
+ 'lookup_functions'
=> $s_agreement['lookup_functions'],
+ 'dateformat'
=> $dateformat,
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
+ 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
+ 'calendar_setup_termination'
=> "Calendar.setup({inputField : 'termination_date',ifFormat : '" .
$jsDateFormat . "',button : 'termination_date-trigger'});",
+
+ 'lang_start_date_statustext' => lang('Select
the estimated end date for the Project'),
+ 'lang_start_date'
=> lang('start date'),
+ 'value_start_date'
=> $s_agreement['start_date'],
+
+ 'lang_end_date_statustext' =>
lang('Select the estimated end date for the Project'),
+ 'lang_end_date'
=> lang('end date'),
+ 'value_end_date'
=> $s_agreement['end_date'],
+
+ 'lang_termination_date_statustext'
=> lang('Select the estimated termination date'),
+ 'lang_termination_date'
=> lang('termination date'),
+ 'value_termination_date'
=> $s_agreement['termination_date'],
+
+ 'vendor_data'
=> $vendor_data,
+ 'b_account_data'
=> $b_account_data,
+ 'lang_name'
=> lang('name'),
+ 'lang_name_statustext' =>
lang('name'),
+ 'value_name'
=> $s_agreement['name'],
+ 'lang_descr'
=> lang('descr'),
+ 'lang_descr_statustext' =>
lang('descr'),
+ 'value_descr'
=> $s_agreement['descr'],
+ 'table_add'
=> $table_add,
+ 'values'
=> $content,
+ 'table_header'
=> $table_header,
+ 'acl_manage'
=> $this->acl_manage,
+ 'table_update'
=> $table_update,
+ 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&id='
. $id),
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+ 'check_all_script'
=> $check_all_script,
+ 'set_column'
=> $set_column,
+
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('service agreement') . ': ' . ($id?lang('edit') . ' ' .
lang($this->role):lang('add') . ' ' . lang($this->role));
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function excel()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $list = $this->bo->read_details($id);
+ $uicols = $this->bo->uicols;
+
$this->bocommon->excel($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
+ }
+
+ function edit_item()
+ {
+ $s_agreement_id =
get_var('s_agreement_id',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+ $delete_last = get_var('delete_last',array('GET'));
+ if($delete_last)
+ {
+
$this->bo->delete_last_index($s_agreement_id,$id);
+ }
+
+
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $values_attribute =
get_var('values_attribute',array('POST'));
+
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+ $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
+
+ $insert_record_s_agreement1 =
$GLOBALS['phpgw']->session->appsession('insert_record_s_agreement1',$this->currentapp);
+
+//_debug_array($insert_record_s_agreement1);
+
+ for ($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+
+ for ($j=0;$j<count($insert_record_s_agreement1);$j++)
+ {
+
$insert_record['extra'][$insert_record_s_agreement1[$j]] =
$insert_record_s_agreement1[$j];
+ }
+
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement','attributes_form'));
+
+ if (is_array($values))
+ {
+
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+
+//_debug_array($values);
+ if ($values['save'] || $values['apply']):
+ {
+
+ if(!$receipt['error'])
+ {
+ $values['s_agreement_id']
= $s_agreement_id;
+ $values['id'] = $id;
+ $receipt =
$this->bo->save_item($values,$values_attribute);
+ $s_agreement_id =
$receipt['s_agreement_id'];
+ $id =
$receipt['id'];
+ $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','s_agreement_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&id='
. $s_agreement_id);
+ }
+ }
+ else
+ {
+ if($values['location'])
+ {
+
$location_code=implode("-", $values['location']);
+
$values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
+ }
+ if($values['extra']['p_num'])
+ {
+
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
+ }
+ }
+ }
+ elseif($values['update']):
+ {
+ $values['date'] =
get_var('date',array('POST'));
+
+ if(!$values['date'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
+ }
+ if(!$values['new_index'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a index !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->update($values);
+ }
+
+ }
+ elseif (!$values['save'] && !$values['apply']
&& !$values['update']):
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit&id='
. $s_agreement_id);
+ }
+ endif;
+ }
+
+ $s_agreement =
$this->bo->read_single(array('s_agreement_id'=>$s_agreement_id));
+ $values =
$this->bo->read_single_item(array('s_agreement_id'=>$s_agreement_id,'id'=>$id));
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.edit_item',
+ 's_agreement_id' => $s_agreement_id,
+ 'id' => $id,
+ 'role' => $this->role
+ );
+
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+
$dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+
$dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => array()));
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add detail'),
+ 'lang_add_standardtext' => lang('add an item to
the details'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_item&s_agreement_id='
. $s_agreement_id)
+ );
+
+
+ if($id)
+ {
+ $list =
$this->bo->read_prizing(array('s_agreement_id'=>$s_agreement_id,'item_id'=>$id));
+ }
+
+ $uicols = $this->bo->uicols;
+ $list =
$this->list_content($list,$uicols,$edit_item=True);
+ $content = $list['content'];
+ $table_header=$list['table_header'];
+
+ for ($i=0; $i<count($list['content'][0]['row']); $i++)
+ {
+ $set_column[]=True;
+ }
+//_debug_array($list);
+
+ $table_update[] = array
+ (
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup' =>
"Calendar.setup({inputField : 'date',ifFormat : '" . $jsDateFormat .
"',button : 'date-trigger'});",
+
+ 'lang_new_index' =>
lang('New index'),
+ 'lang_new_index_statustext' => lang('Enter
a new index'),
+ 'lang_date_statustext' => lang('Select
the date for the update'),
+ 'lang_update' =>
lang('Update'),
+ 'lang_update_statustext' => lang('update
selected investments')
+ );
+
+
+ $lookup_type='form';
+
+//_debug_array($values);
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' => -1,
// calculated from location_types
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
False,
+ 'lookup_type' => $lookup_type,
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('s_agreement'),
+ 'entity_data' => $values['p']
+ ));
+
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_id'
=> lang('ID'),
+ 'value_id'
=> $values['id'],
+ 'value_s_agreement_id' =>
$s_agreement_id,
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_apply'
=> lang('apply'),
+ 'lang_apply_statustext' =>
lang('Apply the values'),
+ 'lang_cancel_statustext' =>
lang('Leave the service agreement untouched and return back to the list'),
+ 'lang_save_statustext' =>
lang('Save the s_agreement and return back to the list'),
+
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
+ 'lang_attributes'
=> lang('Attributes'),
+ 'attributes_header'
=> $attributes_header,
+ 'attributes_values'
=> $values['attributes'],
+ 'lookup_functions'
=> $values['lookup_functions'],
+ 'dateformat'
=> $dateformat,
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
+ 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
+
+ 'lang_agreement'
=> lang('Agreement'),
+ 'agreement_name'
=> $s_agreement['name'],
+
+ 'table_add'
=> $table_add,
+ 'values'
=> $content,
+ 'table_header'
=> $table_header,
+ 'acl_manage'
=> $this->acl_manage,
+ 'table_update'
=> $table_update,
+ 'update_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_item&s_agreement_id='
. $s_agreement_id . '&id=' . $id),
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+ 'location_data'
=> $location_data,
+
+ 'lang_cost'
=> lang('cost'),
+ 'lang_cost_statustext' =>
lang('cost'),
+ 'value_cost'
=> $values['cost'],
+ 'set_column'
=> $set_column,
+ 'lang_delete_last'
=> lang('delete last index'),
+ 'lang_delete_last_statustext' => lang('delete
the last index'),
+ 'delete_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_item&delete_last=1&s_agreement_id='
. $s_agreement_id . '&id=' . $id),
+
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('service agreement') . ': ' . ($values['id']?lang('edit item') . ' ' .
$s_agreement['name']:lang('add item') . ' ' . $s_agreement['name']);
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_item' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view_item()
+ {
+ $s_agreement_id =
get_var('s_agreement_id',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement','attributes_view'));
+
+ $s_agreement =
$this->bo->read_single(array('s_agreement_id'=>$s_agreement_id));
+ $values =
$this->bo->read_single_item(array('s_agreement_id'=>$s_agreement_id,'id'=>$id));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.edit',
+ 'id' =>
$s_agreement_id
+ );
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ if($id)
+ {
+ $list =
$this->bo->read_prizing(array('s_agreement_id'=>$s_agreement_id,'item_id'=>$id));
+ }
+
+ $uicols = $this->bo->uicols;
+ $list =
$this->list_content($list,$uicols,$edit_item=True);
+ $content = $list['content'];
+ $table_header=$list['table_header'];
+
+ $lookup_type='view';
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' => -1,
// calculated from location_types
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
False,
+ 'lookup_type' => $lookup_type,
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('s_agreement'),
+ 'entity_data' => $values['p']
+ ));
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_id'
=> lang('ID'),
+ 'value_id'
=> $values['id'],
+ 'value_s_agreement_id' =>
$s_agreement_id,
+ 'lang_category'
=> lang('category'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_cancel_statustext' =>
lang('Leave the service agreement untouched and return back to the list'),
+
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'attributes_view'
=> $values['attributes'],
+
+ 'lang_agreement'
=> lang('Agreement'),
+ 'agreement_name'
=> $s_agreement['name'],
+
+ 'table_add'
=> $table_add,
+ 'values'
=> $content,
+ 'table_header'
=> $table_header,
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+ 'location_data'
=> $location_data,
+
+ 'lang_cost'
=> lang('cost'),
+ 'lang_cost_statustext' =>
lang('cost'),
+ 'value_cost'
=> $values['cost'],
+ 'set_column'
=> $set_column,
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('service agreement') . ': ' . lang('view item') . ' ' .
$s_agreement['name'];
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view_item' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function delete()
+ {
+ $attrib = get_var('attrib',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $s_agreement_id =
get_var('s_agreement_id',array('POST','GET'));
+ $delete = get_var('delete',array('POST'));
+ $confirm = get_var('confirm',array('POST'));
+
+
+ if($attrib)
+ {
+ $function='list_attribute';
+ }
+ else
+ {
+ $function='index';
+ }
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.'.$function,
+ 'role' => $this->role
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($s_agreement_id,$id,$attrib);
+// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.delete&s_agreement_id='
. $s_agreement_id. '&id=' . $id . '&attrib=' . $attrib . '&role=' .
$this->role),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('service agreement');
+ $function_msg =
lang('delete') . ' ' . lang($this->role);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+
+ function view()
+ {
+ $s_agreement_id = get_var('id',array('POST','GET'));
+ $config =
CreateObject('phpgwapi.config',$this->currentapp);
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement','attributes_view'));
+
+
+ $s_agreement =
$this->bo->read_single(array('s_agreement_id'=>$s_agreement_id));
+
+
+ if ($s_agreement_id)
+ {
+ $this->cat_id =
($s_agreement['cat_id']?$s_agreement['cat_id']:$this->cat_id);
+ $this->member_id =
($s_agreement['member_of']?$s_agreement['member_of']:$this->member_id);
+ $list =
$this->bo->read_details($s_agreement_id);
+ $total_records = count($list);
+
+ $uicols = $this->bo->uicols;
+ $list =
$this->list_content($list,$uicols,$edit_item=False,$view_only=True);
+ $content = $list['content'];
+ $table_header=$list['table_header'];
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.index',
+ 's_agreement_id' => $s_agreement_id,
+ );
+
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'vendor_id' =>
$s_agreement['vendor_id'],
+ 'vendor_name' =>
$s_agreement['vendor_name'],
+ 'type' =>
'view'));
+
+
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
+ 'b_account_id' =>
$s_agreement['b_account_id'],
+ 'b_account_name' =>
$s_agreement['b_account_name'],
+ 'type' =>
'view'));
+
+
+ $alarm_data=$this->bocommon->initiate_ui_alarm(array(
+
'acl_location'=>$this->acl2_location,
+ 'alarm_type'=> 's_agreement',
+ 'type' => 'view',
+ 'text' => 'Email
notification',
+ 'times' => $times,
+ 'id' =>
$s_agreement_id,
+ 'method' => $method,
+ 'data' => $data,
+ 'account_id'=> $account_id
+ ));
+
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ $member_of_data =
$this->cats->formatted_xslt_list(array('selected' => $this->member_id,'globals'
=> True,link_data => array()));
+
+ $link_file_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.view_file',
+ 'id'
=>$s_agreement_id
+ );
+
+
+ $config->read_repository();
+ $link_to_files = $config->config_data['files_url'];
+
+ $j = count($s_agreement['files']);
+ for ($i=0;$i<$j;$i++)
+ {
+
$s_agreement['files'][$i]['file_name']=urlencode($s_agreement['files'][$i]['name']);
+ }
+
+
+ $data = array
+ (
+ 'lang_total_records' =>
lang('Total'),
+ 'total_records'
=> $total_records,
+ 'alarm_data'
=> $alarm_data,
+ 'lang_alarm'
=> lang('Alarm'),
+ 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
+ 'link_to_files'
=> $link_to_files,
+ 'files'
=> $s_agreement['files'],
+ 'lang_files'
=> lang('files'),
+ 'lang_filename'
=> lang('Filename'),
+ 'lang_view_file_statustext' =>
lang('Klick to view file'),
+
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_id'
=> lang('ID'),
+ 'value_s_agreement_id' =>
$s_agreement_id,
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('done'),
+ 'lang_apply'
=> lang('apply'),
+ 'value_cat'
=> $s_agreement['cat'],
+ 'lang_cancel_statustext' =>
lang('return back to the list'),
+ 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
+
+ 'lang_member_of'
=> lang('member of'),
+ 'member_of_name'
=> 'member_id',
+ 'member_of_list'
=> $member_of_data['cat_list'],
+
+ 'lang_dateformat'
=> lang(strtolower($dateformat)),
+ 'attributes_view'
=> $s_agreement['attributes'],
+ 'dateformat'
=> $dateformat,
+
+ 'lang_start_date'
=> lang('start date'),
+ 'value_start_date'
=> $s_agreement['start_date'],
+
+ 'lang_end_date'
=> lang('end date'),
+ 'value_end_date'
=> $s_agreement['end_date'],
+
+ 'lang_termination_date' =>
lang('termination date'),
+ 'value_termination_date' =>
$s_agreement['termination_date'],
+
+ 'vendor_data'
=> $vendor_data,
+ 'b_account_data'
=> $b_account_data,
+ 'lang_name'
=> lang('name'),
+ 'value_name'
=> $s_agreement['name'],
+ 'lang_descr'
=> lang('descr'),
+ 'value_descr'
=> $s_agreement['descr'],
+ 'table_add'
=> $table_add,
+ 'values'
=> $content,
+ 'table_header'
=> $table_header,
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('service agreement') . ': ' . lang('view');
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function list_attribute()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $resort = get_var('resort',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array(
+ 's_agreement',
+ 'nextmatchs',
+
'search_field'));
+
+ if($resort)
+ {
+
$this->bo->resort_attrib(array('resort'=>$resort,'id'=>$id));
+ }
+
+ $attrib_list = $this->bo->read_attrib();
+
+ while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
+ {
+ $content[] = array
+ (
+ 'name'
=> $attrib['name'],
+ 'type_name'
=> $attrib['type_name'],
+ 'datatype'
=> $attrib['datatype'],
+ 'column_name'
=> $attrib['column_name'],
+ 'input_text'
=> $attrib['input_text'],
+ 'sorting'
=> $attrib['attrib_sort'],
+ 'search'
=> $attrib['search'],
+ 'link_up'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.list_attribute&resort=up&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
+ 'link_down'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.list_attribute&resort=down&id='
. $attrib['id'] . '&allrows=' . $this->allrows . '&role=' . $this->role),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_attrib&id='
. $attrib['id'] . '&role=' . $this->role),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.delete&id='
. $attrib['id'].'&attrib=true&role=' . $this->role),
+ 'lang_view_attribtext' =>
lang('view the attrib'),
+ 'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang('location'),
+ 'lang_edit_attribtext' =>
lang('edit the attrib'),
+ 'lang_delete_attribtext' =>
lang('delete the attrib'),
+ 'text_attribute'
=> lang('Attributes'),
+ 'text_up'
=> lang('up'),
+ 'text_down'
=> lang('down'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+ //html_print_r($content);
+
+ $table_header[] = array
+ (
+ 'lang_descr' => lang('Descr'),
+ 'lang_datatype' => lang('Datatype'),
+ 'lang_sorting' => lang('sorting'),
+ 'lang_search' => lang('search'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_sorting' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'attrib_sort',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uis_agreement.list_attribute',
+
'allrows'=>$this->allrows,
+
'role' => $this->role)
+
)),
+
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'column_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uis_agreement.list_attribute',
+
'allrows'=>$this->allrows,
+
'role' => $this->role)
+
)),
+ 'lang_name' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_attribtext' => lang('add a attrib'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.edit_attrib&role='
. $this->role),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_attribtext' => lang('back to
admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php'),
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.list_attribute',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'query'
=>$this->query,
+ 'role' =>
$this->role
+
+ );
+
+ $data = array
+ (
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($attrib_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_attribtext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_attrib' =>
$table_header,
+ 'values_attrib'
=> $content,
+ 'table_add2'
=> $table_add
+ );
+
+ $appname
= lang('service agreement');
+ $function_msg =
lang('list attribute') . ': ' . lang($this->role);
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function edit_attrib()
+ {
+ $id =
get_var('id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+ // $GLOBALS['phpgw']->common->msgbox(lang('Altering
ColumnName OR Datatype - deletes your data in this Column'));
+ //html_print_r($values);
+
$GLOBALS['phpgw']->xslttpl->add_file(array('s_agreement','choice',));
+
+ if ($values['save'])
+ {
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ $type_id =
$values['type_id'];
+
+ if (!$values['column_name'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Column name not entered!'));
+ }
+
+ if (!$values['input_text'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Input text not entered!'));
+ }
+ if (!$values['statustext'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Statustext not entered!'));
+ }
+
+ if (!$values['column_info']['type'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Datatype type not choosen!'));
+ }
+
+
if(!ctype_digit($values['column_info']['precision']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter precision as integer !'));
+
unset($values['column_info']['precision']);
+ }
+
+ if($values['column_info']['scale'] &&
!ctype_digit($values['column_info']['scale']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter scale as integer !'));
+ unset($values['column_info']['scale']);
+ }
+
+ if (!$values['column_info']['nullable'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('Nullable not choosen!'));
+ }
+
+
+ if (!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_attrib($values,$action);
+
+ if(!$id)
+ {
+ $id=$receipt['id'];
+ }
+ }
+ else
+ {
+ $receipt['error'][] = array('msg'
=> lang('Attribute has NOT been saved'));
+ }
+
+ }
+
+ if ($id)
+ {
+ $values = $this->bo->read_single_attrib($id);
+ $function_msg = lang('edit attribute') . ': ' .
lang($this->role);
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add attribute') . ': ' .
lang($this->role);
+ $action='add';
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uis_agreement.edit_attrib',
+ 'id' => $id,
+ 'role' => $this->role
+
+ );
+ //html_print_r($values);
+
+ if($values['column_info']['type']=='R' ||
$values['column_info']['type']=='CH' || $values['column_info']['type']=='LB')
+ {
+ $multiple_choice= True;
+ }
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'lang_choice' =>
lang('Choice'),
+ 'lang_new_value' =>
lang('New value'),
+ 'lang_new_value_statustext' => lang('New
value for mulitple choice'),
+ 'multiple_choice' =>
$multiple_choice,
+ 'value_choice' =>
$values['choice'],
+ 'lang_delete_value' =>
lang('Delete value'),
+ 'lang_value' =>
lang('value'),
+ 'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uis_agreement.list_attribute&type_id='.$type_id
. '&role=' . $this->role),
+ 'lang_id'
=> lang('Attribute ID'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id'
=> $id,
+
+ 'lang_column_name'
=> lang('Column name'),
+ 'value_column_name'
=> $values['column_name'],
+ 'lang_column_name_statustext' => lang('enter
the name for the column'),
+
+ 'lang_input_text'
=> lang('input text'),
+ 'value_input_text'
=> $values['input_text'],
+ 'lang_input_name_statustext' => lang('enter
the input text for records'),
+
+ 'lang_id_attribtext' => lang('Enter
the attribute ID'),
+ 'lang_entity_statustext' => lang('Select
a s_agreement type'),
+
+ 'lang_statustext' =>
lang('Statustext'),
+ 'lang_statustext_attribtext'=> lang('Enter a
statustext for the inputfield in forms'),
+ 'value_statustext' =>
$values['statustext'],
+
+ 'lang_done_attribtext' => lang('Back
to the list'),
+ 'lang_save_attribtext' => lang('Save
the attribute'),
+
+ 'lang_datatype' =>
lang('Datatype'),
+ 'lang_datatype_statustext' => lang('Select
a datatype'),
+ 'lang_no_datatype' =>
lang('No datatype'),
+ 'datatype_list' =>
$this->bocommon->select_datatype($values['column_info']['type']),
+
+ 'lang_precision' =>
lang('Precision'),
+ 'lang_precision_statustext' => lang('enter
the record length'),
+ 'value_precision' =>
$values['column_info']['precision'],
+
+ 'lang_scale' =>
lang('scale'),
+ 'lang_scale_statustext' => lang('enter
the scale if type is decimal'),
+ 'value_scale' =>
$values['column_info']['scale'],
+
+ 'lang_default' =>
lang('default'),
+ 'lang_default_statustext' => lang('enter
the default value'),
+ 'value_default' =>
$values['column_info']['default'],
+
+ 'lang_nullable' =>
lang('Nullable'),
+ 'lang_nullable_statustext' => lang('Chose
if this column is nullable'),
+ 'lang_select_nullable' => lang('Select
nullable'),
+ 'nullable_list' =>
$this->bocommon->select_nullable($values['column_info']['nullable']),
+
+ 'value_list' =>
$values['list'],
+ 'lang_list'
=> lang('show in list'),
+ 'lang_list_statustext' => lang('check
to show this attribute in location list'),
+
+ 'value_search' =>
$values['search'],
+ 'lang_include_search' =>
lang('Include in search'),
+ 'lang_include_search_statustext'=> lang('check
to show this attribute in location list'),
+
+
+ );
+ //html_print_r($data);
+
+ $appname
= lang('service agreement');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uistandard_2.inc.php
diff -u property/inc/class.uistandard_2.inc.php:1.9
property/inc/class.uistandard_2.inc.php:1.10
--- property/inc/class.uistandard_2.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uistandard_2.inc.php Fri Feb 3 12:05:49 2006
@@ -1,277 +1,277 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uistandard_2.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uistandard_2
- {
- var $grants;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uistandard_2()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject($this->currentapp.'.bostandard_2',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->allrows =
$this->bo->allrows;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'allrows' => $this->allrows,
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- $type = get_var('type',array('POST','GET'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_2','nextmatchs',
-
'search_field'));
-
- $standard_list = $this->bo->read($type);
-
- while (is_array($standard_list) && list(,$standard) =
each($standard_list))
- {
- $words = split(' ',$standard['descr']);
- $first = "$words[0] $words[1] $words[2]
$words[3]";
-
- $content[] = array
- (
- 'id'
=> $standard['id'],
- 'first'
=> $first,
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.edit&id='
. $standard['id'].'&type='.$type),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.delete&id='
. $standard['id'].'&type='.$type),
- 'lang_view_standardtext' =>
lang('view the standard'),
- 'lang_edit_standardtext' =>
lang('edit the standard'),
- 'lang_delete_standardtext' =>
lang('delete the standard'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
-//_debug_array($content);
-
- $table_header[] = array
- (
-
- 'lang_descr' => lang('Descr'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_2.index',
-
'type' =>$type)
-
)),
- 'lang_id' => lang('standard id'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_standardtext' => lang('add a
standard'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.edit&type='.$type),
- 'lang_done' =>
lang('done'),
- 'lang_done_standardtext' => lang('back
to admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
-
- $data = array
- (
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($standard_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.index&type='.$type),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang($type);
- $function_msg =
lang('list '.$type.' standard');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit()
- {
- $type = get_var('type',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_2'));
-
- if ($values['save'])
- {
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- else
- {
- $id = $values['id'];
- }
-
-
- $receipt =
$this->bo->save($values,$action,$type);
- }
-
- if ($id)
- {
- $standard = $this->bo->read_single($id,$type);
- $function_msg = lang('edit standard');
- $action='edit';
- }
- else
- {
- $function_msg = lang('add standard');
- $action='add';
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uistandard_2.edit',
- 'id' => $id,
- 'type' => $type
- );
-//_debug_array($link_data);
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.index&type='.$type),
- 'lang_id'
=> lang('standard ID'),
- 'lang_name'
=> lang('name'),
- 'lang_descr'
=> lang('Descr'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
- 'value_name'
=> $standard['name'],
- 'value_generaladdress'
=> $standard['general_address'],
- 'lang_id_standardtext'
=> lang('Enter the standard ID'),
- 'lang_descr_standardtext'
=> lang('Enter a description the standard'),
- 'lang_generaladdress_standardtext' =>
lang('Enter the general address'),
- 'lang_done_standardtext'
=> lang('Back to the list'),
- 'lang_save_standardtext'
=> lang('Save the standard'),
- 'type_id'
=> $standard['type_id'],
- 'location_code'
=> $standard['location_code'],
- 'value_descr'
=> $standard['descr']
- );
-
- $appname
= lang($type);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- $type = get_var('type',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $confirm =
get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uistandard_2.index',
- 'type' => $type
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id,$type);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.delete&id='
. $id.'&type='.$type),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_standardtext' => lang('Delete the
entry'),
- 'lang_no_standardtext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang($type);
- $function_msg =
lang('delete '.$type.' standard');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uistandard_2.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uistandard_2
+ {
+ var $grants;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uistandard_2()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bo =
CreateObject($this->currentapp.'.bostandard_2',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->allrows =
$this->bo->allrows;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'allrows' => $this->allrows,
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ $type = get_var('type',array('POST','GET'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_2','nextmatchs',
+
'search_field'));
+
+ $standard_list = $this->bo->read($type);
+
+ while (is_array($standard_list) && list(,$standard) =
each($standard_list))
+ {
+ $words = split(' ',$standard['descr']);
+ $first = "$words[0] $words[1] $words[2]
$words[3]";
+
+ $content[] = array
+ (
+ 'id'
=> $standard['id'],
+ 'first'
=> $first,
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.edit&id='
. $standard['id'].'&type='.$type),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.delete&id='
. $standard['id'].'&type='.$type),
+ 'lang_view_standardtext' =>
lang('view the standard'),
+ 'lang_edit_standardtext' =>
lang('edit the standard'),
+ 'lang_delete_standardtext' =>
lang('delete the standard'),
+ 'text_view'
=> lang('view'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+
+ 'lang_descr' => lang('Descr'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_2.index',
+
'type' =>$type)
+
)),
+ 'lang_id' => lang('standard id'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_standardtext' => lang('add a
standard'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.edit&type='.$type),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_standardtext' => lang('back
to admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+
+ $data = array
+ (
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($standard_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.index&type='.$type),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang($type);
+ $function_msg =
lang('list '.$type.' standard');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit()
+ {
+ $type = get_var('type',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_2'));
+
+ if ($values['save'])
+ {
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ else
+ {
+ $id = $values['id'];
+ }
+
+
+ $receipt =
$this->bo->save($values,$action,$type);
+ }
+
+ if ($id)
+ {
+ $standard = $this->bo->read_single($id,$type);
+ $function_msg = lang('edit standard');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add standard');
+ $action='add';
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uistandard_2.edit',
+ 'id' => $id,
+ 'type' => $type
+ );
+//_debug_array($link_data);
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.index&type='.$type),
+ 'lang_id'
=> lang('standard ID'),
+ 'lang_name'
=> lang('name'),
+ 'lang_descr'
=> lang('Descr'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id'
=> $id,
+ 'value_name'
=> $standard['name'],
+ 'value_generaladdress'
=> $standard['general_address'],
+ 'lang_id_standardtext'
=> lang('Enter the standard ID'),
+ 'lang_descr_standardtext'
=> lang('Enter a description the standard'),
+ 'lang_generaladdress_standardtext' =>
lang('Enter the general address'),
+ 'lang_done_standardtext'
=> lang('Back to the list'),
+ 'lang_save_standardtext'
=> lang('Save the standard'),
+ 'type_id'
=> $standard['type_id'],
+ 'location_code'
=> $standard['location_code'],
+ 'value_descr'
=> $standard['descr']
+ );
+
+ $appname
= lang($type);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ $type = get_var('type',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $confirm =
get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uistandard_2.index',
+ 'type' => $type
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id,$type);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_2.delete&id='
. $id.'&type='.$type),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_standardtext' => lang('Delete the
entry'),
+ 'lang_no_standardtext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang($type);
+ $function_msg =
lang('delete '.$type.' standard');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uistandard_3.inc.php
diff -u property/inc/class.uistandard_3.inc.php:1.9
property/inc/class.uistandard_3.inc.php:1.10
--- property/inc/class.uistandard_3.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uistandard_3.inc.php Fri Feb 3 12:05:49 2006
@@ -1,276 +1,276 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uistandard_3.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uistandard_3
- {
- var $grants;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uistandard_3()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject($this->currentapp.'.bostandard_3',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->allrows =
$this->bo->allrows;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'allrows' => $this->allrows,
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- $type = get_var('type',array('POST','GET'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_3','nextmatchs',
-
'search_field'));
-
- $standard_list = $this->bo->read($type);
-
- while (is_array($standard_list) && list(,$standard) =
each($standard_list))
- {
- $words = split(' ',$standard['descr']);
- $first = "$words[0] $words[1] $words[2]
$words[3]";
-
- $content[] = array
- (
- 'id'
=> $standard['id'],
- 'num'
=> $standard['num'],
- 'first'
=> $first,
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.edit&id='
. $standard['id'].'&type='.$type),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.delete&id='
. $standard['id'].'&type='.$type),
- 'lang_view_standardtext' =>
lang('view the standard'),
- 'lang_edit_standardtext' =>
lang('edit the standard'),
- 'lang_delete_standardtext' =>
lang('delete the standard'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
-//_debug_array($content);
-
- $table_header[] = array
- (
-
- 'lang_descr' => lang('Descr'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_3.index',
-
'type' =>$type)
-
)),
- 'lang_id' => lang('standard id'),
- 'sort_num' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'num',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_3.index',
-
'type' =>$type)
-
)),
- 'lang_num' => lang('Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_standardtext' => lang('add a
standard'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.edit&type='.$type),
- 'lang_done' =>
lang('done'),
- 'lang_done_standardtext' => lang('back
to admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
- );
-
-
- $data = array
- (
- 'allow_allrows'
=> False,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($standard_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.index&type='.$type),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('Standard');
- $function_msg =
lang('list '.$type.' attribute');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit()
- {
- $type = get_var('type',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_3'));
-
- if ($values['save'])
- {
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- else
- {
- $id = $values['id'];
- }
-
- $receipt =
$this->bo->save($values,$action,$type);
- }
-
- if ($id)
- {
- $standard = $this->bo->read_single($id,$type);
- $function_msg = lang('edit standard');
- $action='edit';
- }
- else
- {
- $function_msg = lang('add standard');
- $action='add';
- }
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uistandard_3.edit',
- 'id' => $id,
- 'type' => $type
- );
-//_debug_array($link_data);
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.index&type='.$type),
- 'lang_id'
=> lang('standard ID'),
- 'lang_num'
=> lang('Name'),
- 'lang_descr'
=> lang('Descr'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
- 'value_num'
=> $standard['num'],
- 'value_generaladdress' =>
$standard['general_address'],
- 'lang_id_standardtext' =>
lang('Enter the standard ID'),
- 'lang_descr_standardtext' =>
lang('Enter a description the standard'),
- 'lang_done_standardtext' =>
lang('Back to the list'),
- 'lang_save_standardtext' =>
lang('Save the standard'),
- 'type_id'
=> $standard['type_id'],
- 'location_code'
=> $standard['location_code'],
- 'value_descr'
=> $standard['descr']
- );
-
- $appname
= lang($type);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- $type = get_var('type',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $confirm =
get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uistandard_3.index',
- 'type' => $type
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id,$type);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.delete&id='
. $id.'&type='.$type),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_standardtext' => lang('Delete the
entry'),
- 'lang_no_standardtext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang($type);
- $function_msg =
lang('delete '.$type.' standard');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uistandard_3.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uistandard_3
+ {
+ var $grants;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uistandard_3()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->bo =
CreateObject($this->currentapp.'.bostandard_3',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->allrows =
$this->bo->allrows;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'allrows' => $this->allrows,
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ $type = get_var('type',array('POST','GET'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_3','nextmatchs',
+
'search_field'));
+
+ $standard_list = $this->bo->read($type);
+
+ while (is_array($standard_list) && list(,$standard) =
each($standard_list))
+ {
+ $words = split(' ',$standard['descr']);
+ $first = "$words[0] $words[1] $words[2]
$words[3]";
+
+ $content[] = array
+ (
+ 'id'
=> $standard['id'],
+ 'num'
=> $standard['num'],
+ 'first'
=> $first,
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.edit&id='
. $standard['id'].'&type='.$type),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.delete&id='
. $standard['id'].'&type='.$type),
+ 'lang_view_standardtext' =>
lang('view the standard'),
+ 'lang_edit_standardtext' =>
lang('edit the standard'),
+ 'lang_delete_standardtext' =>
lang('delete the standard'),
+ 'text_view'
=> lang('view'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+
+ 'lang_descr' => lang('Descr'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_3.index',
+
'type' =>$type)
+
)),
+ 'lang_id' => lang('standard id'),
+ 'sort_num' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'num',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_3.index',
+
'type' =>$type)
+
)),
+ 'lang_num' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_standardtext' => lang('add a
standard'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.edit&type='.$type),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_standardtext' => lang('back
to admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
+ );
+
+
+ $data = array
+ (
+ 'allow_allrows'
=> False,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($standard_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.index&type='.$type),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('Standard');
+ $function_msg =
lang('list '.$type.' attribute');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit()
+ {
+ $type = get_var('type',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_3'));
+
+ if ($values['save'])
+ {
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ else
+ {
+ $id = $values['id'];
+ }
+
+ $receipt =
$this->bo->save($values,$action,$type);
+ }
+
+ if ($id)
+ {
+ $standard = $this->bo->read_single($id,$type);
+ $function_msg = lang('edit standard');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add standard');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uistandard_3.edit',
+ 'id' => $id,
+ 'type' => $type
+ );
+//_debug_array($link_data);
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.index&type='.$type),
+ 'lang_id'
=> lang('standard ID'),
+ 'lang_num'
=> lang('Name'),
+ 'lang_descr'
=> lang('Descr'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id'
=> $id,
+ 'value_num'
=> $standard['num'],
+ 'value_generaladdress' =>
$standard['general_address'],
+ 'lang_id_standardtext' =>
lang('Enter the standard ID'),
+ 'lang_descr_standardtext' =>
lang('Enter a description the standard'),
+ 'lang_done_standardtext' =>
lang('Back to the list'),
+ 'lang_save_standardtext' =>
lang('Save the standard'),
+ 'type_id'
=> $standard['type_id'],
+ 'location_code'
=> $standard['location_code'],
+ 'value_descr'
=> $standard['descr']
+ );
+
+ $appname
= lang($type);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ $type = get_var('type',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $confirm =
get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uistandard_3.index',
+ 'type' => $type
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id,$type);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_3.delete&id='
. $id.'&type='.$type),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_standardtext' => lang('Delete the
entry'),
+ 'lang_no_standardtext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang($type);
+ $function_msg =
lang('delete '.$type.' standard');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uistandard_entity.inc.php
diff -u property/inc/class.uistandard_entity.inc.php:1.9
property/inc/class.uistandard_entity.inc.php:1.10
--- property/inc/class.uistandard_entity.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uistandard_entity.inc.php Fri Feb 3 12:05:49 2006
@@ -1,519 +1,519 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: class.uistandard_entity.inc.php,v 1.9 2006/01/27
14:05:43 sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uistandard_entity
- {
- var $grants;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'list_attribute' => True,
- 'edit_attrib' => True,
- );
-
- function uistandard_entity()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.bostandard_entity',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- $type = get_var('type',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array(
-
'standard_entity',
-
'nextmatchs',
-
'menu',
-
'search_field'));
- $links = $this->menu->links();
-
- $standard_list = $this->bo->read($type);
-
- while (is_array($standard_list) && list(,$standard) =
each($standard_list))
- {
- $words = split(' ',$standard['descr']);
- $first = "$words[0] $words[1] $words[2]
$words[3]";
-
- $content[] = array
- (
- 'id'
=> $standard['id'],
- 'name'
=> $standard['name'],
- 'prefix'
=> $standard['prefix'],
- 'first'
=> $first,
- 'link_attribute'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.list_attribute&type_id='
. $standard['id'].'&type='.$type),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.edit&id='
. $standard['id'].'&type='.$type),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.delete&id='
. $standard['id'].'&type='.$type),
- 'lang_view_standardtext' =>
lang('view the standard'),
- 'lang_attribute_standardtext' =>
lang('attributes for the standard'). ' ' . lang($type),
- 'lang_edit_standardtext' =>
lang('edit the standard'),
- 'lang_delete_standardtext' =>
lang('delete the standard'),
- 'text_attribute'
=> lang('Attributes'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
-//_debug_array($content);
-
- $table_header[] = array
- (
-
- 'lang_descr' => lang('Descr'),
- 'lang_prefix' => lang('prefix'),
- 'lang_attribute' => lang('Attributes'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_entity.index',
-
'type' =>$type)
-
)),
- 'lang_id' => lang('standard id'),
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_entity.index',
-
'type' =>$type)
-
)),
- 'lang_name' => lang('Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_standardtext' => lang('add a
standard'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.edit&type='.$type),
- 'lang_done' =>
lang('done'),
- 'lang_done_standardtext' => lang('back
to admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
- );
-
-
- $data = array
- (
- 'links'
=> $links,
- 'allow_allrows'
=> False,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($standard_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.index&type='.$type),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang($type);
- $function_msg =
lang('list '.$type.' standard');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit()
- {
- $type = get_var('type',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_entity'));
-
- if ($values['save'])
- {
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- else
- {
- // $id =
$values['id'];
- $standard['name'] =
$values['name'];
- $standard['descr'] =
$values['descr'];
- $standard['prefix'] =
$values['prefix'];
- }
-
-
- $receipt =
$this->bo->save($values,$action,$type);
- if(!$id)
- {
- $id=$receipt['id'];
- }
-
- }
-
- if ($id)
- {
- $standard = $this->bo->read_single($id,$type);
- $function_msg = lang('edit standard');
- $action='edit';
- }
- else
- {
- $function_msg = lang('add standard');
- $action='add';
- }
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uistandard_entity.edit',
- 'id' => $id,
- 'type' => $type
- );
-//_debug_array($link_data);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'lang_prefix'
=> lang('Standard prefix'),
- 'lang_prefix_standardtext' =>
lang('Enter a standard prefix for the id'),
- 'lang_name_standardtext' =>
lang('Enter a name of the standard'),
-
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.index&type='.$type),
- 'lang_id'
=> lang('standard ID'),
- 'lang_name'
=> lang('Name'),
- 'lang_descr'
=> lang('Descr'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_id'
=> $id,
- 'value_name'
=> $standard['name'],
- 'value_prefix'
=> $standard['prefix'],
- 'lang_id_standardtext' =>
lang('Enter the standard ID'),
- 'lang_descr_standardtext' =>
lang('Enter a description of the standard'),
- 'lang_done_standardtext' =>
lang('Back to the list'),
- 'lang_save_standardtext' =>
lang('Save the standard'),
- 'type_id'
=> $standard['type_id'],
- 'value_descr'
=> $standard['descr']
-
-
- );
-
- $appname
= lang($type);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- $attrib = get_var('attrib',array('POST','GET'));
- $type = get_var('type',array('POST','GET'));
- $type_id =
get_var('type_id',array('POST','GET'));
- $id =
get_var('id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- if($attrib)
- {
- $function='list_attribute';
- }
- else
- {
- $function='index';
- }
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uistandard_entity.'.$function,
- 'type' => $type,
- 'type_id' => $type_id
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id,$type,$attrib);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.delete&id='
. $id.'&type='.$type.'&type_id='.$type_id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_standardtext' => lang('Delete the
entry'),
- 'lang_no_standardtext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang($type);
- $function_msg =
lang('delete '.$type.' standard');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function list_attribute()
- {
- $type = get_var('type',array('POST','GET'));
- $type_id =
get_var('type_id',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array(
-
'standard_entity',
-
'nextmatchs',
-
'search_field'));
-
- $attrib_list = $this->bo->read_attrib($type,$type_id);
-
- while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
- {
- $words = split(' ',$attrib['descr']);
- $first = "$words[0] $words[1] $words[2]
$words[3]";
-
-
- $content[] = array
- (
- 'name'
=> $attrib['name'],
- 'type_name'
=> $attrib['type_name'],
- 'datatype'
=> $attrib['datatype'],
- 'first'
=> $first,
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.edit_attrib&id='
. $attrib['id'].'&type='.$type.'&type_id='.$type_id),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.delete&id='
. $attrib['id'].'&type='.$type.'&type_id='.$type_id.'&attrib=true'),
- 'lang_view_attribtext' =>
lang('view the attrib'),
- 'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang($type),
- 'lang_edit_attribtext' =>
lang('edit the attrib'),
- 'lang_delete_attribtext' =>
lang('delete the attrib'),
- 'text_attribute'
=> lang('Attributes'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
-
-//_debug_array($content);
-
- $table_header[] = array
- (
- 'lang_type_name' => lang('Type'),
- 'lang_descr' => lang('Descr'),
- 'lang_datatype' => lang('Datatype'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_entity.list_attribute',
-
'type' =>$type,
-
'type_id'
=>$type_id)
-
)),
- 'lang_name' => lang('Name'),
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_attribtext' => lang('add a attrib'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.edit_attrib&type='.$type.'&type_id='.$type_id),
- 'lang_done' =>
lang('done'),
- 'lang_done_attribtext' => lang('back to
admin'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.index&type='.$type),
- );
-
-
- $data = array
- (
- 'allow_allrows'
=> False,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($attrib_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.list_attribute&type='.$type
.'&type_id=' . $type_id),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_attribtext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_attrib' =>
$table_header,
- 'values_attrib'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('attribute');
- $function_msg =
lang('list '.$type.' attribute');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit_attrib()
- {
- $type_id =
get_var('type_id',array('POST','GET'));
- $type = get_var('type',array('POST','GET'));
- $id =
get_var('id',array('POST','GET'));
- $values = get_var('values',array('POST'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_entity'));
-
- if ($values['save'])
- {
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
- $attrib['name'] = $values['name'];
- $attrib['descr'] = $values['descr'];
- $type_id =
$values['type_id'];
-
- $receipt =
$this->bo->save_attrib($values,$action,$type);
-//_debug_array($receipt);
-
- if(!$id)
- {
- $id=$receipt['id'];
- }
-
- }
-
- if ($id)
- {
- $attrib =
$this->bo->read_single_attrib($id,$type);
- $type_name=$attrib['type_name'];
- $function_msg = lang('edit attribute'). ' ' .
lang($type_name);
- $action='edit';
- }
- else
- {
- $function_msg = lang('add attribute');
- $action='add';
- }
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uistandard_entity.edit_attrib',
- 'id' => $id,
- 'type' => $type
- );
-//_debug_array($link_data);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- if($attrib['datatype']=='R' ||
$attrib['datatype']=='CH')
- {
- $multiple_choice= True;
- }
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.list_attribute&type='.$type.'&type_id='.$type_id),
- 'lang_id'
=> lang('Attribute ID'),
- 'lang_name'
=> lang('Name'),
- 'lang_descr' =>
lang('Descr'),
- 'lang_entity_type' =>
lang('Type'),
- 'lang_no_entity_type' => lang('No
entity type'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_choice' =>
lang('Choice'),
- 'lang_new_value' =>
lang('New value'),
- 'lang_new_value_statustext' => lang('New
value for mulitple choice'),
- 'multiple_choice' =>
$multiple_choice,
- 'value_choice' =>
$attrib['choice'],
-
- 'lang_delete_value' =>
lang('Delete value'),
- 'lang_value' =>
lang('value'),
- 'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
- 'value_id'
=> $id,
- 'value_name'
=> $attrib['name'],
- 'lang_id_attribtext' => lang('Enter
the attribute ID'),
- 'lang_entity_statustext' => lang('Select
a entity type'),
- 'lang_descr_attribtext' => lang('Enter
a description the attribute'),
- 'lang_done_attribtext' => lang('Back
to the list'),
- 'lang_save_attribtext' => lang('Save
the attribute'),
- 'type_id'
=> $attrib['type_id'],
- 'value_descr' =>
$attrib['descr'],
- 'entity_list' =>
$this->bo->select_entity_type($type,$type_id),
- 'select_entity_type' =>
'values[type_id]',
- 'lang_datatype' =>
lang('Datatype'),
- 'lang_datatype_statustext' => lang('Select
a datatype'),
- 'lang_no_datatype' =>
lang('No datatype'),
- 'datatype_list' =>
$this->bo->select_datatype($attrib['datatype']),
- 'select_datatype' =>
'values[datatype]',
-// 'value_list' =>
$values['list'],
-// 'lang_list'
=> lang('show in list'),
-// 'lang_list_statustext' => lang('check
to show this attribute in list')
- );
-//_debug_array($data);
-
- $appname
= lang($type);
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: class.uistandard_entity.inc.php,v 1.10 2006/02/03
12:05:49 sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uistandard_entity
+ {
+ var $grants;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'list_attribute' => True,
+ 'edit_attrib' => True,
+ );
+
+ function uistandard_entity()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.bostandard_entity',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ $type = get_var('type',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array(
+
'standard_entity',
+
'nextmatchs',
+
'menu',
+
'search_field'));
+ $links = $this->menu->links();
+
+ $standard_list = $this->bo->read($type);
+
+ while (is_array($standard_list) && list(,$standard) =
each($standard_list))
+ {
+ $words = split(' ',$standard['descr']);
+ $first = "$words[0] $words[1] $words[2]
$words[3]";
+
+ $content[] = array
+ (
+ 'id'
=> $standard['id'],
+ 'name'
=> $standard['name'],
+ 'prefix'
=> $standard['prefix'],
+ 'first'
=> $first,
+ 'link_attribute'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.list_attribute&type_id='
. $standard['id'].'&type='.$type),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.edit&id='
. $standard['id'].'&type='.$type),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.delete&id='
. $standard['id'].'&type='.$type),
+ 'lang_view_standardtext' =>
lang('view the standard'),
+ 'lang_attribute_standardtext' =>
lang('attributes for the standard'). ' ' . lang($type),
+ 'lang_edit_standardtext' =>
lang('edit the standard'),
+ 'lang_delete_standardtext' =>
lang('delete the standard'),
+ 'text_attribute'
=> lang('Attributes'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+
+ 'lang_descr' => lang('Descr'),
+ 'lang_prefix' => lang('prefix'),
+ 'lang_attribute' => lang('Attributes'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_entity.index',
+
'type' =>$type)
+
)),
+ 'lang_id' => lang('standard id'),
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_entity.index',
+
'type' =>$type)
+
)),
+ 'lang_name' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_standardtext' => lang('add a
standard'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.edit&type='.$type),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_standardtext' => lang('back
to admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/admin/index.php')
+ );
+
+
+ $data = array
+ (
+ 'links'
=> $links,
+ 'allow_allrows'
=> False,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($standard_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.index&type='.$type),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_standardtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_standardtext' =>
lang('Submit the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang($type);
+ $function_msg =
lang('list '.$type.' standard');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit()
+ {
+ $type = get_var('type',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_entity'));
+
+ if ($values['save'])
+ {
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ else
+ {
+ // $id =
$values['id'];
+ $standard['name'] =
$values['name'];
+ $standard['descr'] =
$values['descr'];
+ $standard['prefix'] =
$values['prefix'];
+ }
+
+
+ $receipt =
$this->bo->save($values,$action,$type);
+ if(!$id)
+ {
+ $id=$receipt['id'];
+ }
+
+ }
+
+ if ($id)
+ {
+ $standard = $this->bo->read_single($id,$type);
+ $function_msg = lang('edit standard');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add standard');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uistandard_entity.edit',
+ 'id' => $id,
+ 'type' => $type
+ );
+//_debug_array($link_data);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_prefix'
=> lang('Standard prefix'),
+ 'lang_prefix_standardtext' =>
lang('Enter a standard prefix for the id'),
+ 'lang_name_standardtext' =>
lang('Enter a name of the standard'),
+
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.index&type='.$type),
+ 'lang_id'
=> lang('standard ID'),
+ 'lang_name'
=> lang('Name'),
+ 'lang_descr'
=> lang('Descr'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_id'
=> $id,
+ 'value_name'
=> $standard['name'],
+ 'value_prefix'
=> $standard['prefix'],
+ 'lang_id_standardtext' =>
lang('Enter the standard ID'),
+ 'lang_descr_standardtext' =>
lang('Enter a description of the standard'),
+ 'lang_done_standardtext' =>
lang('Back to the list'),
+ 'lang_save_standardtext' =>
lang('Save the standard'),
+ 'type_id'
=> $standard['type_id'],
+ 'value_descr'
=> $standard['descr']
+
+
+ );
+
+ $appname
= lang($type);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ $attrib = get_var('attrib',array('POST','GET'));
+ $type = get_var('type',array('POST','GET'));
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $id =
get_var('id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ if($attrib)
+ {
+ $function='list_attribute';
+ }
+ else
+ {
+ $function='index';
+ }
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uistandard_entity.'.$function,
+ 'type' => $type,
+ 'type_id' => $type_id
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id,$type,$attrib);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.delete&id='
. $id.'&type='.$type.'&type_id='.$type_id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_standardtext' => lang('Delete the
entry'),
+ 'lang_no_standardtext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang($type);
+ $function_msg =
lang('delete '.$type.' standard');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function list_attribute()
+ {
+ $type = get_var('type',array('POST','GET'));
+ $type_id =
get_var('type_id',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array(
+
'standard_entity',
+
'nextmatchs',
+
'search_field'));
+
+ $attrib_list = $this->bo->read_attrib($type,$type_id);
+
+ while (is_array($attrib_list) && list(,$attrib) =
each($attrib_list))
+ {
+ $words = split(' ',$attrib['descr']);
+ $first = "$words[0] $words[1] $words[2]
$words[3]";
+
+
+ $content[] = array
+ (
+ 'name'
=> $attrib['name'],
+ 'type_name'
=> $attrib['type_name'],
+ 'datatype'
=> $attrib['datatype'],
+ 'first'
=> $first,
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.edit_attrib&id='
. $attrib['id'].'&type='.$type.'&type_id='.$type_id),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.delete&id='
. $attrib['id'].'&type='.$type.'&type_id='.$type_id.'&attrib=true'),
+ 'lang_view_attribtext' =>
lang('view the attrib'),
+ 'lang_attribute_attribtext' =>
lang('attributes for the attrib'). ' ' . lang($type),
+ 'lang_edit_attribtext' =>
lang('edit the attrib'),
+ 'lang_delete_attribtext' =>
lang('delete the attrib'),
+ 'text_attribute'
=> lang('Attributes'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+ 'lang_type_name' => lang('Type'),
+ 'lang_descr' => lang('Descr'),
+ 'lang_datatype' => lang('Datatype'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uistandard_entity.list_attribute',
+
'type' =>$type,
+
'type_id'
=>$type_id)
+
)),
+ 'lang_name' => lang('Name'),
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_attribtext' => lang('add a attrib'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.edit_attrib&type='.$type.'&type_id='.$type_id),
+ 'lang_done' =>
lang('done'),
+ 'lang_done_attribtext' => lang('back to
admin'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.index&type='.$type),
+ );
+
+
+ $data = array
+ (
+ 'allow_allrows'
=> False,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($attrib_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.list_attribute&type='.$type
.'&type_id=' . $type_id),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_searchfield_attribtext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_attribtext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_attrib' =>
$table_header,
+ 'values_attrib'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('attribute');
+ $function_msg =
lang('list '.$type.' attribute');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_attribute' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit_attrib()
+ {
+ $type_id =
get_var('type_id',array('POST','GET'));
+ $type = get_var('type',array('POST','GET'));
+ $id =
get_var('id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('standard_entity'));
+
+ if ($values['save'])
+ {
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+ $attrib['name'] = $values['name'];
+ $attrib['descr'] = $values['descr'];
+ $type_id =
$values['type_id'];
+
+ $receipt =
$this->bo->save_attrib($values,$action,$type);
+//_debug_array($receipt);
+
+ if(!$id)
+ {
+ $id=$receipt['id'];
+ }
+
+ }
+
+ if ($id)
+ {
+ $attrib =
$this->bo->read_single_attrib($id,$type);
+ $type_name=$attrib['type_name'];
+ $function_msg = lang('edit attribute'). ' ' .
lang($type_name);
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add attribute');
+ $action='add';
+ }
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uistandard_entity.edit_attrib',
+ 'id' => $id,
+ 'type' => $type
+ );
+//_debug_array($link_data);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ if($attrib['datatype']=='R' ||
$attrib['datatype']=='CH')
+ {
+ $multiple_choice= True;
+ }
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uistandard_entity.list_attribute&type='.$type.'&type_id='.$type_id),
+ 'lang_id'
=> lang('Attribute ID'),
+ 'lang_name'
=> lang('Name'),
+ 'lang_descr' =>
lang('Descr'),
+ 'lang_entity_type' =>
lang('Type'),
+ 'lang_no_entity_type' => lang('No
entity type'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_choice' =>
lang('Choice'),
+ 'lang_new_value' =>
lang('New value'),
+ 'lang_new_value_statustext' => lang('New
value for mulitple choice'),
+ 'multiple_choice' =>
$multiple_choice,
+ 'value_choice' =>
$attrib['choice'],
+
+ 'lang_delete_value' =>
lang('Delete value'),
+ 'lang_value' =>
lang('value'),
+ 'lang_delete_choice_statustext'=> lang('Delete
this value from the list of multiple choice'),
+ 'value_id'
=> $id,
+ 'value_name'
=> $attrib['name'],
+ 'lang_id_attribtext' => lang('Enter
the attribute ID'),
+ 'lang_entity_statustext' => lang('Select
a entity type'),
+ 'lang_descr_attribtext' => lang('Enter
a description the attribute'),
+ 'lang_done_attribtext' => lang('Back
to the list'),
+ 'lang_save_attribtext' => lang('Save
the attribute'),
+ 'type_id'
=> $attrib['type_id'],
+ 'value_descr' =>
$attrib['descr'],
+ 'entity_list' =>
$this->bo->select_entity_type($type,$type_id),
+ 'select_entity_type' =>
'values[type_id]',
+ 'lang_datatype' =>
lang('Datatype'),
+ 'lang_datatype_statustext' => lang('Select
a datatype'),
+ 'lang_no_datatype' =>
lang('No datatype'),
+ 'datatype_list' =>
$this->bo->select_datatype($attrib['datatype']),
+ 'select_datatype' =>
'values[datatype]',
+// 'value_list' =>
$values['list'],
+// 'lang_list'
=> lang('show in list'),
+// 'lang_list_statustext' => lang('check
to show this attribute in list')
+ );
+//_debug_array($data);
+
+ $appname
= lang($type);
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_attrib' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uitemplate.inc.php
diff -u property/inc/class.uitemplate.inc.php:1.9
property/inc/class.uitemplate.inc.php:1.10
--- property/inc/class.uitemplate.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uitemplate.inc.php Fri Feb 3 12:05:49 2006
@@ -1,734 +1,734 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.uitemplate.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uitemplate
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit_template' => True,
- 'edit_hour' => True,
- 'delete' => True,
- 'hour' => True
- );
-
- function uitemplate()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->bo =
CreateObject($this->currentapp.'.botemplate',True);
- $this->bowo_hour =
CreateObject($this->currentapp.'.bowo_hour');
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->chapter_id =
$this->bo->chapter_id;
- $this->allrows =
$this->bo->allrows;
-
- $this->menu->sub ='project';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' =>
$this->filter,
- 'cat_id' =>
$this->cat_id,
- 'chapter_id' => $this->chapter_id,
- 'allrows' =>
$this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index()
- {
- $GLOBALS['phpgw']->xslttpl->add_file(array('template',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
- $lookup = get_var('lookup',array('POST','GET'));
-
- $links = $this->menu->links('template');
-
- $template_list = $this->bo->read();
-
- while (is_array($template_list) && list(,$template) =
each($template_list))
- {
- $content_template[] = array
- (
- 'workorder_id' =>
$workorder_id,
- 'template_id' =>
$template['template_id'],
- 'name'
=> $template['name'],
- 'descr'
=> $template['descr'],
- 'owner'
=> $template['owner'],
- 'entry_date' =>
$template['entry_date'],
- 'chapter'
=> $template['chapter'],
- 'lang_select' =>
lang('Select'),
- 'form_action_select' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.template'),
- 'lang_select_statustext' =>
lang('Select this template to view the details'),
- 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.hour&template_id='
. $template['template_id']),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_template&template_id='
. $template['template_id']),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.delete&id='
. $template['template_id']),
- 'lang_view_statustext' =>
lang('view the template'),
- 'lang_edit_statustext' =>
lang('edit the template'),
- 'lang_delete_statustext' =>
lang('delete the template'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
-
- $i++;
- }
-
- $table_header_template[] = array
- (
-
- 'sort_template_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'fm_template.id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.index',
-
'chapter_id'
=>$this->chapter_id,
-
'query'
=>$this->query,
-
'workorder_id'
=>$workorder_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_template_id' =>
lang('ID'),
- 'lang_name' => lang('Name'),
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.index',
-
'chapter_id'
=>$this->chapter_id,
-
'query'
=>$this->query,
-
'workorder_id'
=>$workorder_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_name' => lang('Name'),
- 'lang_chapter' => lang('Chapter'),
- 'lang_owner' => lang('owner'),
- 'lang_entry_date' => lang('Entry Date'),
- 'lang_descr' => lang('Description'),
- 'lang_view' => lang('view'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'lang_select' => lang('select')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitemplate.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'chapter_id'
=>$this->chapter_id,
- 'workorder_id' =>$workorder_id,
- 'query'
=>$this->query
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add a
template'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_template')
- );
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Back to list'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
- );
-
- $data = array
- (
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_add_statustext' =>
lang('Add the selected items'),
- 'lang_add'
=> lang('Add'),
- 'link_delete'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_delete),
-
- 'chapter_list'
=> $this->bowo_hour->get_chapter_list('filter',$this->chapter_id),
- 'select_chapter'
=> 'chapter_id',
- 'lang_no_chapter'
=> lang('Select chapter'),
- 'lang_chapter_statustext' =>
lang('Select the template-chapter'),
-
- 'lookup'
=> $lookup,
- 'function'
=> 'template',
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($template_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_user_statustext' =>
lang('Select the user the template belongs to. To do not use a category select
NO USER'),
- 'select_user_name'
=> 'filter',
- 'lang_no_user'
=> lang('No user'),
- 'user_list'
=>
$this->bocommon->get_user_list('filter',$this->filter,$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header_template' =>
$table_header_template,
- 'values_template'
=> $content_template,
- 'table_add'
=> $table_add,
- 'table_done'
=> $table_done
- );
-
- $appname
= lang('template');
- $function_msg =
lang('list template');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function hour()
- {
- $GLOBALS['phpgw']->xslttpl->add_file(array('template',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $delete = get_var('delete',array('POST','GET'));
- $hour_id = get_var('hour_id',array('POST','GET'));
-
- $template_id =
get_var('template_id',array('POST','GET'));
-
- if($delete && $hour_id)
- {
- $receipt =
$this->bo->delete_hour($hour_id,$template_id);
- }
-
- $links = $this->menu->links();
-
- $template_list =
$this->bo->read_template_hour($template_id);
-
- $i=0;
- $grouping_descr_old='';
-
- while (is_array($template_list) && list(,$template) =
each($template_list))
- {
-
-
if($template['grouping_descr']!=$grouping_descr_old)
- {
- $new_grouping = true;
- }
- else
- {
- $new_grouping = false;
- }
-
- $grouping_descr_old =
$template['grouping_descr'];
-
- if($template['activity_num'])
- {
- $code = $template['activity_num'];
- }
- else
- {
- $code =
str_replace("-",$template['tolerance'],$template['ns3420_id']);
- }
-
-
- $content[] = array
- (
- 'counter'
=> $i,
- 'record'
=> $template['record'],
- 'chapter_id' =>
$template['chapter_id'],
- 'grouping_descr' =>
$template['grouping_descr'],
- 'building_part' =>
$template['building_part'],
- 'new_grouping' =>
$new_grouping,
- 'code'
=> $code,
- 'activity_id' =>
$template['activity_id'],
- 'activity_num' =>
$template['activity_num'],
- 'hours_descr' =>
$template['hours_descr'],
- 'remark'
=> $template['remark'],
- 'ns3420_id'
=> $template['ns3420_id'],
- 'tolerance'
=> $template['tolerance'],
- 'cost'
=> $template['cost'],
- 'unit'
=> $template['unit'],
- 'billperae'
=> $template['billperae'],
- 'building_part' =>
$template['building_part'],
- 'dim_d'
=> $template['dim_d'],
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_hour&hour_id='
. $template['hour_id'] . '&template_id=' . $template_id),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.hour&delete=true&template_id='
. $template_id . '&hour_id=' . $template['hour_id']),
- 'lang_edit_statustext' =>
lang('edit the template'),
- 'lang_delete_statustext' =>
lang('delete the template'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
-
- $i++;
- }
-
- $table_header[] = array
- (
- 'lang_record' => lang('Record'),
- 'lang_code' => lang('Code'),
- 'lang_descr' => lang('Description'),
- 'lang_unit' => lang('Unit'),
- 'lang_quantity' => lang('Quantity'),
- 'lang_billperae' => lang('Bill per
unit'),
- 'lang_cost' => lang('Cost'),
-
- 'sort_billperae' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'billperae',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.hour',
-
'workorder_id'
=>$workorder_id,
-
'template_id'
=>$template_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_select' => lang('Select'),
- 'sort_building_part' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'building_part',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.hour',
-
'workorder_id'
=>$workorder_id,
-
'template_id'
=>$template_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_building_part' =>
lang('Building part'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete')
- );
-
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Back to list'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.index')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitemplate.hour',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'workorder_id' =>$workorder_id,
- 'template_id' =>$template_id,
- 'allrows'
=>$this->allrows,
- 'query'
=>$this->query
- );
-
- $link_data_nextmatch = array
- (
- 'menuaction' =>
$this->currentapp.'.uitemplate.hour',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'workorder_id' =>$workorder_id,
- 'template_id' =>$template_id,
- 'query'
=>$this->query
- );
-
- $link_data_delete = array
- (
- 'menuaction' =>
$this->currentapp.'.uitemplate.hour',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'workorder_id' =>$workorder_id,
- 'allrows'
=>$this->allrows,
- 'delete' =>true,
- 'query'
=>$this->query
- );
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add a hour'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_hour&template_id='
. $template_id)
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_add_statustext' =>
lang('Add the selected items'),
- 'lang_add'
=> lang('Add'),
- 'link_delete'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_delete),
-
- 'function'
=> 'template',
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($template_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_nextmatch),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'workorder_data'
=> $common_data['workorder_data'],
- 'table_header_template_hour' =>
$table_header,
- 'values_template_hour' =>
$content,
- 'table_add'
=> $table_add,
- 'table_done'
=> $table_done
- );
- $appname
= lang('template');
- $function_msg =
lang('view template detail');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_template_hour' =>
$data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit_template()
- {
- $template_id =
get_var('template_id',array('POST','GET'));
- $values =
get_var('values',array('POST','GET'));
-
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('template'));
-
- if ($values['save'])
- {
- $values['template_id'] = $template_id;
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save_template($values);
-
- $template_id=$receipt['template_id'];
- }
- }
-
- if ($template_id)
- {
- $values =
$this->bo->read_single_template($template_id);
- $function_msg = lang('Edit template');
- }
- else
- {
- $function_msg = lang('Add template');
- }
-
- if($error_id)
- {
- unset($values['template_id']);
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitemplate.edit_template',
- 'template_id' => $template_id
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.index&template_id='
. $template_id),
-
- 'lang_template_id'
=> lang('Template ID'),
- 'value_template_id'
=> $template_id,
-
- 'lang_name'
=> lang('Name'),
- 'value_name'
=> $values['name'],
-
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_descr'
=> lang('description'),
- 'value_descr'
=> $values['descr'],
- 'lang_descr_statustext' =>
lang('Enter the description for this template'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the building'),
-
- 'lang_remark'
=> lang('Remark'),
- 'value_remark'
=> $values['remark'],
- 'lang_remark_statustext' =>
lang('Enter additional remarks to the description - if any'),
-
- 'lang_chapter'
=> lang('chapter'),
- 'chapter_list'
=> $this->bowo_hour->get_chapter_list('select',$values['chapter_id']),
- 'select_chapter'
=> 'values[chapter_id]',
- 'lang_no_chapter'
=> lang('Select chapter'),
- 'lang_chapter_statustext' =>
lang('Select the chapter (for tender) for this activity.'),
- 'lang_add'
=> lang('add a hour'),
- 'lang_add_statustext' =>
lang('add a hour to this template'),
- 'add_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_hour&template_id='
. $template_id)
- );
-
- $appname
= lang('Workorder template');
- $function_msg =
lang('view ticket detail');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_template' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function edit_hour()
- {
- $template_id =
get_var('template_id',array('POST','GET'));
- $activity_id =
get_var('activity_id',array('POST','GET'));
- $hour_id =
get_var('hour_id',array('POST','GET'));
- $values =
get_var('values',array('POST','GET'));
- $values['ns3420_id'] =
get_var('ns3420_id',array('POST','GET'));
- $values['ns3420_descr'] =
get_var('ns3420_descr',array('POST','GET'));
-
- $bopricebook =
CreateObject($this->currentapp.'.bopricebook');
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('template'));
-
- if ($values['save'])
- {
- if($values['copy_hour'])
- {
- unset($hour_id);
- }
-
- $values['hour_id'] = $hour_id;
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save_hour($values,$template_id);
-
- $hour_id=$receipt['hour_id'];
- }
- }
-
- if ($hour_id)
- {
- $values = $this->bo->read_single_hour($hour_id);
- $function_msg = lang('Edit hour');
- }
- else
- {
- $function_msg = lang('Add hour');
- }
-
- $template =
$this->bo->read_single_template($template_id);
-
- if($error_id)
- {
- unset($values['hour_id']);
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitemplate.edit_hour',
- 'template_id' => $template_id,
- 'hour_id' => $hour_id
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.hour&template_id='
. $template_id),
- 'lang_template'
=> lang('template'),
- 'value_template_id'
=> $template['template_id'],
- 'value_template_name' =>
$template['name'],
-
- 'lang_hour_id'
=> lang('Hour ID'),
- 'value_hour_id'
=> $hour_id,
-
- 'lang_copy_hour' =>
lang('Copy hour ?'),
- 'lang_copy_hour_statustext' => lang('Choose
Copy Hour to copy this hour to a new hour'),
-
- 'lang_activity_num'
=> lang('Activity code'),
- 'value_activity_num' =>
$values['activity_num'],
- 'value_activity_id'
=> $values['activity_id'],
-
- 'lang_unit'
=> lang('Unit'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_descr'
=> lang('description'),
- 'value_descr'
=> $values['hours_descr'],
- 'lang_descr_statustext' =>
lang('Enter the description for this activity'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the building'),
-
- 'lang_remark'
=> lang('Remark'),
- 'value_remark'
=> $values['remark'],
- 'lang_remark_statustext' =>
lang('Enter additional remarks to the description - if any'),
-
- 'lang_quantity'
=> lang('quantity'),
- 'value_quantity'
=> $values['quantity'],
- 'lang_quantity_statustext' =>
lang('Enter quantity of unit'),
-
- 'lang_billperae'
=> lang('Cost per unit'),
- 'value_billperae'
=> $values['billperae'],
- 'lang_billperae_statustext' =>
lang('Enter the cost per unit'),
-
- 'lang_total_cost'
=> lang('Total cost'),
- 'value_total_cost'
=> $values['cost'],
- 'lang_total_cost_statustext' => lang('Enter
the total cost of this activity - if not to be calculated from unit-cost'),
-
- 'lang_dim_d'
=> lang('Dim D'),
- 'dim_d_list'
=> $bopricebook->get_dim_d_list($values['dim_d']),
- 'select_dim_d'
=> 'values[dim_d]',
- 'lang_no_dim_d'
=> lang('No Dim D'),
- 'lang_dim_d_statustext' =>
lang('Select the Dim D for this activity. To do not use Dim D - select NO DIM
D'),
-
- 'lang_unit'
=> lang('Unit'),
- 'unit_list'
=> $bopricebook->get_unit_list($values['unit']),
- 'select_unit'
=> 'values[unit]',
- 'lang_no_unit'
=> lang('Select Unit'),
- 'lang_unit_statustext' =>
lang('Select the unit for this activity.'),
-
- 'lang_chapter'
=> lang('chapter'),
- 'chapter_list'
=> $this->bowo_hour->get_chapter_list('select',$template['chapter_id']),
- 'select_chapter'
=> 'values[chapter_id]',
- 'lang_no_chapter'
=> lang('Select chapter'),
- 'lang_chapter_statustext' =>
lang('Select the chapter (for tender) for this activity.'),
-
- 'lang_tolerance'
=> lang('tolerance'),
- 'tolerance_list'
=> $this->bowo_hour->get_tolerance_list($values['tolerance_id']),
- 'select_tolerance'
=> 'values[tolerance_id]',
- 'lang_no_tolerance'
=> lang('Select tolerance'),
- 'lang_tolerance_statustext' =>
lang('Select the tolerance for this activity.'),
-
- 'lang_grouping'
=> lang('grouping'),
- 'grouping_list'
=> $this->bo->get_grouping_list($values['grouping_id'],$template_id),
- 'select_grouping'
=> 'values[grouping_id]',
- 'lang_no_grouping'
=> lang('Select grouping'),
- 'lang_grouping_statustext' =>
lang('Select the grouping for this activity.'),
-
- 'lang_new_grouping'
=> lang('New grouping'),
- 'lang_new_grouping_statustext' =>
lang('Enter a new grouping for this activity if not found in the list'),
-
- 'lang_building_part'
=> lang('building_part'),
- 'building_part_list'
=> $this->bowo_hour->get_building_part_list($values['building_part_id']),
- 'select_building_part'
=> 'values[building_part_id]',
- 'lang_no_building_part'
=> lang('Select building part'),
- 'lang_building_part_statustext' =>
lang('Select the building part for this activity.'),
-
-
- 'ns3420_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.ns3420'),
- 'lang_ns3420'
=> lang('NS3420'),
- 'value_ns3420_id'
=> $values['ns3420_id'],
- 'lang_ns3420_statustext' =>
lang('Select a standard-code from the norwegian standard'),
- 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
-
- );
-
- $appname
= lang('Workorder template');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_hour' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- $id = get_var('id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitemplate.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.delete&id='
. $id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('Workorder template');
- $function_msg =
lang('delete template');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.uitemplate.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uitemplate
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit_template' => True,
+ 'edit_hour' => True,
+ 'delete' => True,
+ 'hour' => True
+ );
+
+ function uitemplate()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->bo =
CreateObject($this->currentapp.'.botemplate',True);
+ $this->bowo_hour =
CreateObject($this->currentapp.'.bowo_hour');
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->chapter_id =
$this->bo->chapter_id;
+ $this->allrows =
$this->bo->allrows;
+
+ $this->menu->sub ='project';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' =>
$this->filter,
+ 'cat_id' =>
$this->cat_id,
+ 'chapter_id' => $this->chapter_id,
+ 'allrows' =>
$this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index()
+ {
+ $GLOBALS['phpgw']->xslttpl->add_file(array('template',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+ $lookup = get_var('lookup',array('POST','GET'));
+
+ $links = $this->menu->links('template');
+
+ $template_list = $this->bo->read();
+
+ while (is_array($template_list) && list(,$template) =
each($template_list))
+ {
+ $content_template[] = array
+ (
+ 'workorder_id' =>
$workorder_id,
+ 'template_id' =>
$template['template_id'],
+ 'name'
=> $template['name'],
+ 'descr'
=> $template['descr'],
+ 'owner'
=> $template['owner'],
+ 'entry_date' =>
$template['entry_date'],
+ 'chapter'
=> $template['chapter'],
+ 'lang_select' =>
lang('Select'),
+ 'form_action_select' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.template'),
+ 'lang_select_statustext' =>
lang('Select this template to view the details'),
+ 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.hour&template_id='
. $template['template_id']),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_template&template_id='
. $template['template_id']),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.delete&id='
. $template['template_id']),
+ 'lang_view_statustext' =>
lang('view the template'),
+ 'lang_edit_statustext' =>
lang('edit the template'),
+ 'lang_delete_statustext' =>
lang('delete the template'),
+ 'text_view'
=> lang('view'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+
+ $i++;
+ }
+
+ $table_header_template[] = array
+ (
+
+ 'sort_template_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'fm_template.id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.index',
+
'chapter_id'
=>$this->chapter_id,
+
'query'
=>$this->query,
+
'workorder_id'
=>$workorder_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_template_id' =>
lang('ID'),
+ 'lang_name' => lang('Name'),
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.index',
+
'chapter_id'
=>$this->chapter_id,
+
'query'
=>$this->query,
+
'workorder_id'
=>$workorder_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_name' => lang('Name'),
+ 'lang_chapter' => lang('Chapter'),
+ 'lang_owner' => lang('owner'),
+ 'lang_entry_date' => lang('Entry Date'),
+ 'lang_descr' => lang('Description'),
+ 'lang_view' => lang('view'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'lang_select' => lang('select')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitemplate.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'chapter_id'
=>$this->chapter_id,
+ 'workorder_id' =>$workorder_id,
+ 'query'
=>$this->query
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add a
template'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_template')
+ );
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Back to list'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
+ );
+
+ $data = array
+ (
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_add_statustext' =>
lang('Add the selected items'),
+ 'lang_add'
=> lang('Add'),
+ 'link_delete'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_delete),
+
+ 'chapter_list'
=> $this->bowo_hour->get_chapter_list('filter',$this->chapter_id),
+ 'select_chapter'
=> 'chapter_id',
+ 'lang_no_chapter'
=> lang('Select chapter'),
+ 'lang_chapter_statustext' =>
lang('Select the template-chapter'),
+
+ 'lookup'
=> $lookup,
+ 'function'
=> 'template',
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($template_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_user_statustext' =>
lang('Select the user the template belongs to. To do not use a category select
NO USER'),
+ 'select_user_name'
=> 'filter',
+ 'lang_no_user'
=> lang('No user'),
+ 'user_list'
=>
$this->bocommon->get_user_list('filter',$this->filter,$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header_template' =>
$table_header_template,
+ 'values_template'
=> $content_template,
+ 'table_add'
=> $table_add,
+ 'table_done'
=> $table_done
+ );
+
+ $appname
= lang('template');
+ $function_msg =
lang('list template');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function hour()
+ {
+ $GLOBALS['phpgw']->xslttpl->add_file(array('template',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $delete = get_var('delete',array('POST','GET'));
+ $hour_id = get_var('hour_id',array('POST','GET'));
+
+ $template_id =
get_var('template_id',array('POST','GET'));
+
+ if($delete && $hour_id)
+ {
+ $receipt =
$this->bo->delete_hour($hour_id,$template_id);
+ }
+
+ $links = $this->menu->links();
+
+ $template_list =
$this->bo->read_template_hour($template_id);
+
+ $i=0;
+ $grouping_descr_old='';
+
+ while (is_array($template_list) && list(,$template) =
each($template_list))
+ {
+
+
if($template['grouping_descr']!=$grouping_descr_old)
+ {
+ $new_grouping = true;
+ }
+ else
+ {
+ $new_grouping = false;
+ }
+
+ $grouping_descr_old =
$template['grouping_descr'];
+
+ if($template['activity_num'])
+ {
+ $code = $template['activity_num'];
+ }
+ else
+ {
+ $code =
str_replace("-",$template['tolerance'],$template['ns3420_id']);
+ }
+
+
+ $content[] = array
+ (
+ 'counter'
=> $i,
+ 'record'
=> $template['record'],
+ 'chapter_id' =>
$template['chapter_id'],
+ 'grouping_descr' =>
$template['grouping_descr'],
+ 'building_part' =>
$template['building_part'],
+ 'new_grouping' =>
$new_grouping,
+ 'code'
=> $code,
+ 'activity_id' =>
$template['activity_id'],
+ 'activity_num' =>
$template['activity_num'],
+ 'hours_descr' =>
$template['hours_descr'],
+ 'remark'
=> $template['remark'],
+ 'ns3420_id'
=> $template['ns3420_id'],
+ 'tolerance'
=> $template['tolerance'],
+ 'cost'
=> $template['cost'],
+ 'unit'
=> $template['unit'],
+ 'billperae'
=> $template['billperae'],
+ 'building_part' =>
$template['building_part'],
+ 'dim_d'
=> $template['dim_d'],
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_hour&hour_id='
. $template['hour_id'] . '&template_id=' . $template_id),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.hour&delete=true&template_id='
. $template_id . '&hour_id=' . $template['hour_id']),
+ 'lang_edit_statustext' =>
lang('edit the template'),
+ 'lang_delete_statustext' =>
lang('delete the template'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+
+ $i++;
+ }
+
+ $table_header[] = array
+ (
+ 'lang_record' => lang('Record'),
+ 'lang_code' => lang('Code'),
+ 'lang_descr' => lang('Description'),
+ 'lang_unit' => lang('Unit'),
+ 'lang_quantity' => lang('Quantity'),
+ 'lang_billperae' => lang('Bill per
unit'),
+ 'lang_cost' => lang('Cost'),
+
+ 'sort_billperae' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'billperae',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.hour',
+
'workorder_id'
=>$workorder_id,
+
'template_id'
=>$template_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_select' => lang('Select'),
+ 'sort_building_part' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'building_part',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitemplate.hour',
+
'workorder_id'
=>$workorder_id,
+
'template_id'
=>$template_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_building_part' =>
lang('Building part'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete')
+ );
+
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Back to list'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.index')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitemplate.hour',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'workorder_id' =>$workorder_id,
+ 'template_id' =>$template_id,
+ 'allrows'
=>$this->allrows,
+ 'query'
=>$this->query
+ );
+
+ $link_data_nextmatch = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitemplate.hour',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'workorder_id' =>$workorder_id,
+ 'template_id' =>$template_id,
+ 'query'
=>$this->query
+ );
+
+ $link_data_delete = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitemplate.hour',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'workorder_id' =>$workorder_id,
+ 'allrows'
=>$this->allrows,
+ 'delete' =>true,
+ 'query'
=>$this->query
+ );
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add a hour'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_hour&template_id='
. $template_id)
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_add_statustext' =>
lang('Add the selected items'),
+ 'lang_add'
=> lang('Add'),
+ 'link_delete'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_delete),
+
+ 'function'
=> 'template',
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($template_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_nextmatch),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'workorder_data'
=> $common_data['workorder_data'],
+ 'table_header_template_hour' =>
$table_header,
+ 'values_template_hour' =>
$content,
+ 'table_add'
=> $table_add,
+ 'table_done'
=> $table_done
+ );
+ $appname
= lang('template');
+ $function_msg =
lang('view template detail');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_template_hour' =>
$data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit_template()
+ {
+ $template_id =
get_var('template_id',array('POST','GET'));
+ $values =
get_var('values',array('POST','GET'));
+
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('template'));
+
+ if ($values['save'])
+ {
+ $values['template_id'] = $template_id;
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_template($values);
+
+ $template_id=$receipt['template_id'];
+ }
+ }
+
+ if ($template_id)
+ {
+ $values =
$this->bo->read_single_template($template_id);
+ $function_msg = lang('Edit template');
+ }
+ else
+ {
+ $function_msg = lang('Add template');
+ }
+
+ if($error_id)
+ {
+ unset($values['template_id']);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitemplate.edit_template',
+ 'template_id' => $template_id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.index&template_id='
. $template_id),
+
+ 'lang_template_id'
=> lang('Template ID'),
+ 'value_template_id'
=> $template_id,
+
+ 'lang_name'
=> lang('Name'),
+ 'value_name'
=> $values['name'],
+
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_descr'
=> lang('description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_descr_statustext' =>
lang('Enter the description for this template'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the building'),
+
+ 'lang_remark'
=> lang('Remark'),
+ 'value_remark'
=> $values['remark'],
+ 'lang_remark_statustext' =>
lang('Enter additional remarks to the description - if any'),
+
+ 'lang_chapter'
=> lang('chapter'),
+ 'chapter_list'
=> $this->bowo_hour->get_chapter_list('select',$values['chapter_id']),
+ 'select_chapter'
=> 'values[chapter_id]',
+ 'lang_no_chapter'
=> lang('Select chapter'),
+ 'lang_chapter_statustext' =>
lang('Select the chapter (for tender) for this activity.'),
+ 'lang_add'
=> lang('add a hour'),
+ 'lang_add_statustext' =>
lang('add a hour to this template'),
+ 'add_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.edit_hour&template_id='
. $template_id)
+ );
+
+ $appname
= lang('Workorder template');
+ $function_msg =
lang('view ticket detail');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_template' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function edit_hour()
+ {
+ $template_id =
get_var('template_id',array('POST','GET'));
+ $activity_id =
get_var('activity_id',array('POST','GET'));
+ $hour_id =
get_var('hour_id',array('POST','GET'));
+ $values =
get_var('values',array('POST','GET'));
+ $values['ns3420_id'] =
get_var('ns3420_id',array('POST','GET'));
+ $values['ns3420_descr'] =
get_var('ns3420_descr',array('POST','GET'));
+
+ $bopricebook =
CreateObject($this->currentapp.'.bopricebook');
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('template'));
+
+ if ($values['save'])
+ {
+ if($values['copy_hour'])
+ {
+ unset($hour_id);
+ }
+
+ $values['hour_id'] = $hour_id;
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_hour($values,$template_id);
+
+ $hour_id=$receipt['hour_id'];
+ }
+ }
+
+ if ($hour_id)
+ {
+ $values = $this->bo->read_single_hour($hour_id);
+ $function_msg = lang('Edit hour');
+ }
+ else
+ {
+ $function_msg = lang('Add hour');
+ }
+
+ $template =
$this->bo->read_single_template($template_id);
+
+ if($error_id)
+ {
+ unset($values['hour_id']);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitemplate.edit_hour',
+ 'template_id' => $template_id,
+ 'hour_id' => $hour_id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.hour&template_id='
. $template_id),
+ 'lang_template'
=> lang('template'),
+ 'value_template_id'
=> $template['template_id'],
+ 'value_template_name' =>
$template['name'],
+
+ 'lang_hour_id'
=> lang('Hour ID'),
+ 'value_hour_id'
=> $hour_id,
+
+ 'lang_copy_hour' =>
lang('Copy hour ?'),
+ 'lang_copy_hour_statustext' => lang('Choose
Copy Hour to copy this hour to a new hour'),
+
+ 'lang_activity_num'
=> lang('Activity code'),
+ 'value_activity_num' =>
$values['activity_num'],
+ 'value_activity_id'
=> $values['activity_id'],
+
+ 'lang_unit'
=> lang('Unit'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_descr'
=> lang('description'),
+ 'value_descr'
=> $values['hours_descr'],
+ 'lang_descr_statustext' =>
lang('Enter the description for this activity'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the building'),
+
+ 'lang_remark'
=> lang('Remark'),
+ 'value_remark'
=> $values['remark'],
+ 'lang_remark_statustext' =>
lang('Enter additional remarks to the description - if any'),
+
+ 'lang_quantity'
=> lang('quantity'),
+ 'value_quantity'
=> $values['quantity'],
+ 'lang_quantity_statustext' =>
lang('Enter quantity of unit'),
+
+ 'lang_billperae'
=> lang('Cost per unit'),
+ 'value_billperae'
=> $values['billperae'],
+ 'lang_billperae_statustext' =>
lang('Enter the cost per unit'),
+
+ 'lang_total_cost'
=> lang('Total cost'),
+ 'value_total_cost'
=> $values['cost'],
+ 'lang_total_cost_statustext' => lang('Enter
the total cost of this activity - if not to be calculated from unit-cost'),
+
+ 'lang_dim_d'
=> lang('Dim D'),
+ 'dim_d_list'
=> $bopricebook->get_dim_d_list($values['dim_d']),
+ 'select_dim_d'
=> 'values[dim_d]',
+ 'lang_no_dim_d'
=> lang('No Dim D'),
+ 'lang_dim_d_statustext' =>
lang('Select the Dim D for this activity. To do not use Dim D - select NO DIM
D'),
+
+ 'lang_unit'
=> lang('Unit'),
+ 'unit_list'
=> $bopricebook->get_unit_list($values['unit']),
+ 'select_unit'
=> 'values[unit]',
+ 'lang_no_unit'
=> lang('Select Unit'),
+ 'lang_unit_statustext' =>
lang('Select the unit for this activity.'),
+
+ 'lang_chapter'
=> lang('chapter'),
+ 'chapter_list'
=> $this->bowo_hour->get_chapter_list('select',$template['chapter_id']),
+ 'select_chapter'
=> 'values[chapter_id]',
+ 'lang_no_chapter'
=> lang('Select chapter'),
+ 'lang_chapter_statustext' =>
lang('Select the chapter (for tender) for this activity.'),
+
+ 'lang_tolerance'
=> lang('tolerance'),
+ 'tolerance_list'
=> $this->bowo_hour->get_tolerance_list($values['tolerance_id']),
+ 'select_tolerance'
=> 'values[tolerance_id]',
+ 'lang_no_tolerance'
=> lang('Select tolerance'),
+ 'lang_tolerance_statustext' =>
lang('Select the tolerance for this activity.'),
+
+ 'lang_grouping'
=> lang('grouping'),
+ 'grouping_list'
=> $this->bo->get_grouping_list($values['grouping_id'],$template_id),
+ 'select_grouping'
=> 'values[grouping_id]',
+ 'lang_no_grouping'
=> lang('Select grouping'),
+ 'lang_grouping_statustext' =>
lang('Select the grouping for this activity.'),
+
+ 'lang_new_grouping'
=> lang('New grouping'),
+ 'lang_new_grouping_statustext' =>
lang('Enter a new grouping for this activity if not found in the list'),
+
+ 'lang_building_part'
=> lang('building_part'),
+ 'building_part_list'
=> $this->bowo_hour->get_building_part_list($values['building_part_id']),
+ 'select_building_part'
=> 'values[building_part_id]',
+ 'lang_no_building_part'
=> lang('Select building part'),
+ 'lang_building_part_statustext' =>
lang('Select the building part for this activity.'),
+
+
+ 'ns3420_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.ns3420'),
+ 'lang_ns3420'
=> lang('NS3420'),
+ 'value_ns3420_id'
=> $values['ns3420_id'],
+ 'lang_ns3420_statustext' =>
lang('Select a standard-code from the norwegian standard'),
+ 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
+
+ );
+
+ $appname
= lang('Workorder template');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_hour' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ $id = get_var('id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitemplate.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.delete&id='
. $id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('Workorder template');
+ $function_msg =
lang('delete template');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uitenant_claim.inc.php
diff -u property/inc/class.uitenant_claim.inc.php:1.9
property/inc/class.uitenant_claim.inc.php:1.10
--- property/inc/class.uitenant_claim.inc.php:1.9 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uitenant_claim.inc.php Fri Feb 3 12:05:49 2006
@@ -1,840 +1,840 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.uitenant_claim.inc.php,v 1.9 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
-
- class uitenant_claim
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
-
- var $public_functions = array
- (
- 'index' => True,
- 'check' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uitenant_claim()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.botenant_claim',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location= '.tenant_claim';
-
- $this->acl_read =
$this->acl2->check($this->acl2_location,1);
- $this->acl_add =
$this->acl2->check($this->acl2_location,2);
- $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
- $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
- $this->acl_manage =
$this->acl2->check($this->acl2_location,16);
-
- $this->start = $this->bo->start;
- $this->query = $this->bo->query;
- $this->sort = $this->bo->sort;
- $this->order = $this->bo->order;
- $this->filter = $this->bo->filter;
- $this->status = $this->bo->status;
- $this->cat_id = $this->bo->cat_id;
- $this->allrows = $this->bo->allrows;
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'status' => $this->status,
- 'cat_id' => $this->cat_id,
- 'this->allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function index($project_id='')
- {
-
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim',
-
'menu',
-
'receipt',
-
'search_field',
-
'nextmatchs'));
-
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
- $this->menu->sub = 'project';
- $links = $this->menu->links('tenant_claim');
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt');
-
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt','');
-
- $claim_list = $this->bo->read(array('project_id' =>
$project_id));
-
- while (is_array($claim_list) && list(,$claim) =
each($claim_list))
- {
- if($claim['tenant_id'])
- {
- $tenant=
$this->bocommon->read_single_tenant($claim['tenant_id']);
- $name = $tenant['last_name'] . ', ' .
$tenant['first_name'];
- }
-
- $content[] = array
- (
- 'claim_id'
=> $claim['claim_id'],
- 'project_id'
=> $claim['project_id'],
- 'status'
=> lang($claim['status']),
- 'name'
=> $name,
- 'entry_date'
=> $claim['entry_date'],
- 'category'
=> $claim['category'],
- 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.view&claim_id='
. $claim['claim_id']),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.edit&claim_id='
. $claim['claim_id']),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.delete&claim_id='
. $claim['claim_id']),
- 'lang_view_statustext' =>
lang('view the claim'),
- 'lang_edit_statustext' =>
lang('edit the claim'),
- 'lang_delete_statustext' =>
lang('delete the claim'),
- 'text_view'
=> lang('view'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- unset ($tenant);
- unset ($name);
- }
-
- $table_header = array
- (
- 'lang_project' => lang('Project'),
- 'lang_name' => lang('name'),
- 'lang_status' => lang('Status'),
- 'lang_time_created' => lang('time created'),
- 'lang_view' => lang('view'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'lang_claim_id' => lang('claim id'),
- 'sort_project' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'project_id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
-
'cat_id' =>
$this->cat_id,
-
'query'
=>$this->query,
-
'status'
=>$this->status,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_name' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'org_name',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
-
'cat_id' =>
$this->cat_id,
-
'query'
=>$this->query,
-
'status'
=>$this->status,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_claim_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'claim_id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
-
'cat_id' =>
$this->cat_id,
-
'query'
=>$this->query,
-
'status'
=>$this->status,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_time_created' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'entry_date',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
-
'cat_id'
=>$this->cat_id,
-
'query'
=>$this->query,
-
'status'
=>$this->status,
-
'allrows'
=>$this->allrows)
-
)),
- 'sort_category' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'descr',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
-
'cat_id'
=>$this->cat_id,
-
'query'
=>$this->query,
-
'status'
=>$this->status,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_category' => lang('category')
- );
-
- if ($project_id)
- {
- $lang_add = lang('add another');
- $add_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.edit&project_id='
. $project_id);
- }
- else
- {
- $lang_add = lang('add');
- $add_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&lookup=true&from=tenant_claim');
-
- }
-
- $table_add = array
- (
- 'lang_add' =>
$lang_add,
- 'lang_add_statustext' => lang('add a claim'),
- 'add_action' => $add_action
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitenant_claim.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'status' =>$this->status,
- 'query'
=>$this->query
- );
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'links'
=> $links,
- 'allow_allrows'
=> true,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($claim_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the claim belongs to. To do not use a category select
NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
-
- 'status_name'
=> 'status',
- 'status_list'
=> $this->bo->get_status_list(array('format' => 'filter', 'selected' =>
$this->status,'default' => 'open')),
- 'lang_no_status'
=> lang('Open'),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
- $this->save_sessiondata();
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Tenant claim') . ': ' . lang('list claim');
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function check()
- {
- $project_id =
get_var('project_id',array('POST','GET'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim'));
-
- $claim = $this->bo->check_claim_project($project_id);
- $total_records = $this->bo->total_records;
-
- if($total_records > 0)
- {
- $receipt['message'][] = array('msg'=>lang('%1
claim is already registered for this project',$total_records));
-
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt',$receipt);
- $this->bo->status = 'all';
- $this->status = 'all';
- $this->index($project_id);
- }
- else
- {
- $this->edit($project_id);
- }
-
- return;
- }
-
- function edit($project_id='')
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $claim_id =
get_var('claim_id',array('POST','GET'));
-
- $values = get_var('values',array('POST'));
- $values['project_id'] =
get_var('project_id',array('POST','GET'));
- $values['b_account_id'] =
get_var('b_account_id',array('POST'));
- $values['b_account_name'] =
get_var('b_account_name',array('POST'));
- $values['tenant_id'] =
get_var('tenant_id',array('POST'));
- $values['last_name'] =
get_var('last_name',array('POST'));
- $values['first_name'] =
get_var('first_name',array('POST'));
-
- if($project_id)
- {
- $values['project_id'] = $project_id;
- }
-
- $this->boproject=
CreateObject($this->currentapp.'.boproject');
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim'));
-
- if ($values['save'] || $values['apply'])
- {
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- }
-
- if(!$values['b_account_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a budget account !'));
- }
-
- if(!$values['workorder'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a workorder !'));
- }
-
- if(!$receipt['error'])
- {
- $values['claim_id'] = $claim_id;
- $receipt = $this->bo->save($values);
- $claim_id = $receipt['claim_id'];
- $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
- if ($values['save'])
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt',$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.index');
- }
- }
- }
-
- if ($values['cancel'])
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.index');
- }
-
-
- if ($claim_id)
- {
- $values = $this->bo->read_single($claim_id);
- }
-
-//_debug_array($values);
-
- $project_values =
$this->boproject->read_single($values['project_id']);
-
-//_debug_array($project_values);
-
- $table_header_workorder[] = array
- (
- 'lang_workorder_id' =>
lang('Workorder'),
- 'lang_budget' =>
lang('Budget'),
- 'lang_calculation' =>
lang('Calculation'),
- 'lang_vendor' =>
lang('Vendor'),
- 'lang_charge_tenant' => lang('Charge
tenant'),
- 'lang_select' =>
lang('Select')
- );
-
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$project_values['location_data'],
- 'type_id' =>
count(explode('-',$project_values['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
$project_values['location_data']['tenant_id'],
- 'lookup_type' => 'view',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
- 'entity_data' =>
$project_values['p']
- ));
-
- if($project_values['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
unset($location_data['location'][$i]['value']);
- }
- }
- }
-
-
- if($project_values['location_data']['tenant_id'] &&
!$values['tenant_id']):
- {
- $values['tenant_id'] =
$project_values['location_data']['tenant_id'];
- $values['last_name'] =
$project_values['location_data']['last_name'];
- $values['first_name'] =
$project_values['location_data']['first_name'];
- }
- elseif($values['tenant_id']):
- {
- $tenant=
$this->bocommon->read_single_tenant($values['tenant_id']);
- $values['last_name'] =
$tenant['last_name'];
- $values['first_name'] =
$tenant['first_name'];
- }
- endif;
-
-
- if($values['workorder'] &&
$project_values['workorder_budget'])
- {
- foreach ($values['workorder'] as $workorder_id)
- {
- for
($i=0;$i<count($project_values['workorder_budget']);$i++)
- {
-
if($project_values['workorder_budget'][$i]['workorder_id'] == $workorder_id)
- {
-
$project_values['workorder_budget'][$i]['selected'] = True;
- }
- }
- }
- }
-
-
- for
($i=0;$i<count($project_values['workorder_budget']);$i++)
- {
- $claimed=
$this->bo->check_claim_workorder($project_values['workorder_budget'][$i]['workorder_id']);
-
- if($claimed)
- {
-
$project_values['workorder_budget'][$i]['claimed'] = $claimed;
- }
- }
-
-
-
- $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
-
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
- 'b_account_id' =>
$values['b_account_id'],
- 'b_account_name' =>
$values['b_account_name']));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitenant_claim.edit',
- 'claim_id' => $claim_id,
- 'project_id' => $values['project_id']
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'table_header_workorder' =>
$table_header_workorder,
- 'lang_no_workorders' =>
lang('No workorder bugdet'),
- 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
- 'lang_start_date'
=> lang('Project start date'),
- 'value_start_date'
=> $project_values['start_date'],
-
- 'lang_end_date'
=> lang('Project end date'),
- 'value_end_date'
=> $project_values['end_date'],
-
- 'lang_charge_tenant' =>
lang('Charge tenant'),
- 'charge_tenant'
=> $project_values['charge_tenant'],
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'value_power_meter'
=> $project_values['power_meter'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $project_values['budget'],
-
- 'lang_reserve'
=> lang('reserve'),
- 'value_reserve'
=> $project_values['reserve'],
- 'lang_reserve_statustext' =>
lang('Enter the reserve'),
-
- 'lang_reserve_remainder' =>
lang('reserve remainder'),
- 'value_reserve_remainder' =>
$reserve_remainder,
- 'value_reserve_remainder_percent'=>
$remainder_percent,
-
- 'vendor_data'
=> $vendor_data,
- 'location_data'
=> $location_data,
- 'location_type'
=> 'view',
-
- 'lang_project_id'
=> lang('Project ID'),
- 'value_project_id'
=> $project_values['project_id'],
- 'lang_name'
=> lang('Name'),
- 'value_name'
=> $project_values['name'],
-
- 'lang_descr'
=> lang('Description'),
-
- 'sum_workorder_budget' =>
$project_values['sum_workorder_budget'],
- 'sum_workorder_calculation' =>
$project_values['sum_workorder_calculation'],
- 'workorder_budget'
=> $project_values['workorder_budget'],
- 'sum_workorder_actual_cost' =>
$project_values['sum_workorder_actual_cost'],
- 'lang_actual_cost'
=> lang('Actual cost'),
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_sum'
=> lang('Sum'),
- 'select_user_name'
=> 'project_values[coordinator]',
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=>
$this->bocommon->get_user_list('select',$project_values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
-
- 'status_list'
=> $this->boproject->select_status_list('select',$project_values['status']),
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
-
- 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
-
- 'lang_contact_phone' =>
lang('Contact phone'),
- 'contact_phone'
=> $project_values['contact_phone'],
-
- 'b_account_data'
=> $b_account_data,
-
- 'lang_select_workorder_statustext' =>
lang('Include the workorder to this claim'),
-
- 'cat_list_project'
=>
$this->boproject->select_category_project_list('select',$project_values['cat_id']),
-
-//------------------
-
- 'lang_status'
=> lang('Status'),
- 'lang_status_statustext' =>
lang('Select status'),
- 'status_list'
=> $this->bo->get_status_list(array('format' => 'select', 'selected' =>
$values['status'],'default' => 'open')),
- 'lang_no_status'
=> lang('No status'),
- 'status_name'
=> 'values[status]',
-
- 'lang_amount'
=> lang('amount'),
- 'lang_amount_statustext' =>
lang('The total amount to claim'),
- 'value_amount'
=> $values['amount'],
-
- 'tenant_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.tenant'),
- 'lang_tenant'
=> lang('tenant'),
- 'value_tenant_id'
=> $values['tenant_id'],
- 'value_last_name'
=> $values['last_name'],
- 'value_first_name'
=> $values['first_name'],
- 'lang_tenant_statustext' =>
lang('Select a tenant'),
- 'size_last_name'
=> strlen($values['last_name']),
- 'size_first_name'
=> strlen($values['first_name']),
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_claim_id'
=> lang('ID'),
- 'value_claim_id'
=> $claim_id,
- 'lang_remark'
=> lang('remark'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'value_remark'
=> $values['remark'],
- 'value_cat'
=> $values['cat'],
- 'lang_remark_statustext' =>
lang('Enter a remark for this claim'),
- 'lang_apply_statustext' =>
lang('Apply the values'),
- 'lang_cancel_statustext' =>
lang('Leave the claim untouched and return back to the list'),
- 'lang_save_statustext' =>
lang('Save the claim and return back to the list'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the claim belongs to. To do not use a category select
NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id)
- );
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Tenant claim') . ': ' . ($claim_id?lang('edit claim'):lang('add claim'));
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function delete()
- {
-
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
-
-
- $claim_id =
get_var('claim_id',array('POST','GET'));
- $delete = get_var('delete',array('POST'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitenant_claim.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($claim_id);
-// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
-
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.delete&claim_id='
. $claim_id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('Tenant claim');
- $function_msg =
lang('delete claim');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $claim_id =
get_var('claim_id',array('POST','GET'));
-
- $this->boproject=
CreateObject($this->currentapp.'.boproject');
-
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim'));
-
- $values = $this->bo->read_single($claim_id);
-
- $project_values =
$this->boproject->read_single($values['project_id']);
-
- $table_header_workorder[] = array
- (
- 'lang_workorder_id' =>
lang('Workorder'),
- 'lang_budget' =>
lang('Budget'),
- 'lang_calculation' =>
lang('Calculation'),
- 'lang_vendor' =>
lang('Vendor'),
- 'lang_charge_tenant' => lang('Charge
tenant'),
- 'lang_select' =>
lang('Select')
- );
-
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$project_values['location_data'],
- 'type_id' =>
count(explode('-',$project_values['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
$project_values['location_data']['tenant_id'],
- 'lookup_type' => 'view',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
- 'entity_data' =>
$project_values['p']
- ));
-
- if($project_values['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
unset($location_data['location'][$i]['value']);
- }
- }
- }
-
-
- if($project_values['location_data']['tenant_id'] &&
!$values['tenant_id']):
- {
- $values['tenant_id'] =
$project_values['location_data']['tenant_id'];
- $values['last_name'] =
$project_values['location_data']['last_name'];
- $values['first_name'] =
$project_values['location_data']['first_name'];
- }
- elseif($values['tenant_id']):
- {
- $tenant=
$this->bocommon->read_single_tenant($values['tenant_id']);
- $values['last_name'] =
$tenant['last_name'];
- $values['first_name'] =
$tenant['first_name'];
- }
- endif;
-
-
- if($values['workorder'] &&
$project_values['workorder_budget'])
- {
- foreach ($values['workorder'] as $workorder_id)
- {
- for
($i=0;$i<count($project_values['workorder_budget']);$i++)
- {
-
if($project_values['workorder_budget'][$i]['workorder_id'] == $workorder_id)
- {
-
$project_values['workorder_budget'][$i]['selected'] = True;
- }
- }
- }
- }
-
-
- for
($i=0;$i<count($project_values['workorder_budget']);$i++)
- {
- $claimed=
$this->bo->check_claim_workorder($project_values['workorder_budget'][$i]['workorder_id']);
-
- if($claimed)
- {
-
$project_values['workorder_budget'][$i]['claimed'] = $claimed;
- }
- }
-
-
-
-
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
- 'b_account_id' =>
$values['b_account_id'],
- 'b_account_name' =>
$values['b_account_name'],
- 'type' => 'view'));
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'table_header_workorder' =>
$table_header_workorder,
- 'lang_no_workorders' =>
lang('No workorder bugdet'),
- 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
- 'lang_start_date'
=> lang('Project start date'),
- 'value_start_date'
=> $project_values['start_date'],
-
- 'lang_end_date'
=> lang('Project end date'),
- 'value_end_date'
=> $project_values['end_date'],
-
- 'lang_charge_tenant' =>
lang('Charge tenant'),
- 'charge_tenant'
=> $project_values['charge_tenant'],
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'value_power_meter'
=> $project_values['power_meter'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $project_values['budget'],
-
- 'lang_reserve'
=> lang('reserve'),
- 'value_reserve'
=> $project_values['reserve'],
- 'lang_reserve_statustext' =>
lang('Enter the reserve'),
-
- 'lang_reserve_remainder' =>
lang('reserve remainder'),
- 'value_reserve_remainder' =>
$reserve_remainder,
- 'value_reserve_remainder_percent'=>
$remainder_percent,
-
- 'location_data'
=> $location_data,
- 'location_type'
=> 'view',
-
- 'lang_project_id'
=> lang('Project ID'),
- 'value_project_id'
=> $project_values['project_id'],
- 'lang_name'
=> lang('Name'),
- 'value_name'
=> $project_values['name'],
-
- 'lang_descr'
=> lang('Description'),
-
- 'sum_workorder_budget' =>
$project_values['sum_workorder_budget'],
- 'sum_workorder_calculation' =>
$project_values['sum_workorder_calculation'],
- 'workorder_budget'
=> $project_values['workorder_budget'],
- 'sum_workorder_actual_cost' =>
$project_values['sum_workorder_actual_cost'],
- 'lang_actual_cost'
=> lang('Actual cost'),
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_sum'
=> lang('Sum'),
- 'select_user_name'
=> 'project_values[coordinator]',
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=>
$this->bocommon->get_user_list('select',$project_values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
-
- 'status_list'
=> $this->boproject->select_status_list('select',$project_values['status']),
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
-
- 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
-
- 'lang_contact_phone' =>
lang('Contact phone'),
- 'contact_phone'
=> $project_values['contact_phone'],
-
- 'b_account_data'
=> $b_account_data,
-
- 'cat_list_project'
=>
$this->boproject->select_category_project_list('select',$project_values['cat_id']),
-
-//------------------
-
- 'lang_status'
=> lang('Status'),
- 'status_list'
=> $this->bo->get_status_list(array('format' => 'select', 'selected' =>
$values['status'],'default' => 'open')),
-
- 'lang_amount'
=> lang('amount'),
- 'value_amount'
=> $values['amount'],
-
- 'lang_tenant'
=> lang('tenant'),
- 'value_tenant_id'
=> $values['tenant_id'],
- 'value_last_name'
=> $values['last_name'],
- 'value_first_name'
=> $values['first_name'],
- 'size_last_name'
=> strlen($values['last_name']),
- 'size_first_name'
=> strlen($values['first_name']),
-
- 'lang_claim_id'
=> lang('ID'),
- 'value_claim_id'
=> $claim_id,
- 'lang_remark'
=> lang('remark'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_apply'
=> lang('apply'),
- 'value_remark'
=> $values['remark'],
- 'value_cat'
=> $values['cat'],
- 'cat_list'
=> $this->bo->select_category_list('select',$values['cat_id']),
-
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.index'),
- 'lang_done' => lang('done'),
- 'value_date' =>
$GLOBALS['phpgw']->common->show_date($tenant_claim['entry_date'])
-
- );
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Tenant claim') . ': ' . ($claim_id?lang('edit claim'):lang('add claim'));
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
-
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.uitenant_claim.inc.php,v 1.10 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+
+ class uitenant_claim
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'check' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uitenant_claim()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.botenant_claim',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location= '.tenant_claim';
+
+ $this->acl_read =
$this->acl2->check($this->acl2_location,1);
+ $this->acl_add =
$this->acl2->check($this->acl2_location,2);
+ $this->acl_edit =
$this->acl2->check($this->acl2_location,4);
+ $this->acl_delete =
$this->acl2->check($this->acl2_location,8);
+ $this->acl_manage =
$this->acl2->check($this->acl2_location,16);
+
+ $this->start = $this->bo->start;
+ $this->query = $this->bo->query;
+ $this->sort = $this->bo->sort;
+ $this->order = $this->bo->order;
+ $this->filter = $this->bo->filter;
+ $this->status = $this->bo->status;
+ $this->cat_id = $this->bo->cat_id;
+ $this->allrows = $this->bo->allrows;
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'status' => $this->status,
+ 'cat_id' => $this->cat_id,
+ 'this->allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function index($project_id='')
+ {
+
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim',
+
'menu',
+
'receipt',
+
'search_field',
+
'nextmatchs'));
+
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
+ $this->menu->sub = 'project';
+ $links = $this->menu->links('tenant_claim');
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt');
+
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt','');
+
+ $claim_list = $this->bo->read(array('project_id' =>
$project_id));
+
+ while (is_array($claim_list) && list(,$claim) =
each($claim_list))
+ {
+ if($claim['tenant_id'])
+ {
+ $tenant=
$this->bocommon->read_single_tenant($claim['tenant_id']);
+ $name = $tenant['last_name'] . ', ' .
$tenant['first_name'];
+ }
+
+ $content[] = array
+ (
+ 'claim_id'
=> $claim['claim_id'],
+ 'project_id'
=> $claim['project_id'],
+ 'status'
=> lang($claim['status']),
+ 'name'
=> $name,
+ 'entry_date'
=> $claim['entry_date'],
+ 'category'
=> $claim['category'],
+ 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.view&claim_id='
. $claim['claim_id']),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.edit&claim_id='
. $claim['claim_id']),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.delete&claim_id='
. $claim['claim_id']),
+ 'lang_view_statustext' =>
lang('view the claim'),
+ 'lang_edit_statustext' =>
lang('edit the claim'),
+ 'lang_delete_statustext' =>
lang('delete the claim'),
+ 'text_view'
=> lang('view'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ unset ($tenant);
+ unset ($name);
+ }
+
+ $table_header = array
+ (
+ 'lang_project' => lang('Project'),
+ 'lang_name' => lang('name'),
+ 'lang_status' => lang('Status'),
+ 'lang_time_created' => lang('time created'),
+ 'lang_view' => lang('view'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'lang_claim_id' => lang('claim id'),
+ 'sort_project' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'project_id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
+
'cat_id' =>
$this->cat_id,
+
'query'
=>$this->query,
+
'status'
=>$this->status,
+
'allrows'
=>$this->allrows)
+
)),
+ 'sort_name' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'org_name',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
+
'cat_id' =>
$this->cat_id,
+
'query'
=>$this->query,
+
'status'
=>$this->status,
+
'allrows'
=>$this->allrows)
+
)),
+ 'sort_claim_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'claim_id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
+
'cat_id' =>
$this->cat_id,
+
'query'
=>$this->query,
+
'status'
=>$this->status,
+
'allrows'
=>$this->allrows)
+
)),
+ 'sort_time_created' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'entry_date',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
+
'cat_id'
=>$this->cat_id,
+
'query'
=>$this->query,
+
'status'
=>$this->status,
+
'allrows'
=>$this->allrows)
+
)),
+ 'sort_category' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'descr',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitenant_claim.index',
+
'cat_id'
=>$this->cat_id,
+
'query'
=>$this->query,
+
'status'
=>$this->status,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_category' => lang('category')
+ );
+
+ if ($project_id)
+ {
+ $lang_add = lang('add another');
+ $add_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.edit&project_id='
. $project_id);
+ }
+ else
+ {
+ $lang_add = lang('add');
+ $add_action =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&lookup=true&from=tenant_claim');
+
+ }
+
+ $table_add = array
+ (
+ 'lang_add' =>
$lang_add,
+ 'lang_add_statustext' => lang('add a claim'),
+ 'add_action' => $add_action
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitenant_claim.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'status' =>$this->status,
+ 'query'
=>$this->query
+ );
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'links'
=> $links,
+ 'allow_allrows'
=> true,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($claim_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the claim belongs to. To do not use a category select
NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'filter_list'
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+
+ 'status_name'
=> 'status',
+ 'status_list'
=> $this->bo->get_status_list(array('format' => 'filter', 'selected' =>
$this->status,'default' => 'open')),
+ 'lang_no_status'
=> lang('Open'),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+ $this->save_sessiondata();
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Tenant claim') . ': ' . lang('list claim');
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function check()
+ {
+ $project_id =
get_var('project_id',array('POST','GET'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim'));
+
+ $claim = $this->bo->check_claim_project($project_id);
+ $total_records = $this->bo->total_records;
+
+ if($total_records > 0)
+ {
+ $receipt['message'][] = array('msg'=>lang('%1
claim is already registered for this project',$total_records));
+
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt',$receipt);
+ $this->bo->status = 'all';
+ $this->status = 'all';
+ $this->index($project_id);
+ }
+ else
+ {
+ $this->edit($project_id);
+ }
+
+ return;
+ }
+
+ function edit($project_id='')
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $claim_id =
get_var('claim_id',array('POST','GET'));
+
+ $values = get_var('values',array('POST'));
+ $values['project_id'] =
get_var('project_id',array('POST','GET'));
+ $values['b_account_id'] =
get_var('b_account_id',array('POST'));
+ $values['b_account_name'] =
get_var('b_account_name',array('POST'));
+ $values['tenant_id'] =
get_var('tenant_id',array('POST'));
+ $values['last_name'] =
get_var('last_name',array('POST'));
+ $values['first_name'] =
get_var('first_name',array('POST'));
+
+ if($project_id)
+ {
+ $values['project_id'] = $project_id;
+ }
+
+ $this->boproject=
CreateObject($this->currentapp.'.boproject');
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim'));
+
+ if ($values['save'] || $values['apply'])
+ {
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ }
+
+ if(!$values['b_account_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a budget account !'));
+ }
+
+ if(!$values['workorder'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a workorder !'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $values['claim_id'] = $claim_id;
+ $receipt = $this->bo->save($values);
+ $claim_id = $receipt['claim_id'];
+ $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.index');
+ }
+ }
+ }
+
+ if ($values['cancel'])
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.index');
+ }
+
+
+ if ($claim_id)
+ {
+ $values = $this->bo->read_single($claim_id);
+ }
+
+//_debug_array($values);
+
+ $project_values =
$this->boproject->read_single($values['project_id']);
+
+//_debug_array($project_values);
+
+ $table_header_workorder[] = array
+ (
+ 'lang_workorder_id' =>
lang('Workorder'),
+ 'lang_budget' =>
lang('Budget'),
+ 'lang_calculation' =>
lang('Calculation'),
+ 'lang_vendor' =>
lang('Vendor'),
+ 'lang_charge_tenant' => lang('Charge
tenant'),
+ 'lang_select' =>
lang('Select')
+ );
+
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$project_values['location_data'],
+ 'type_id' =>
count(explode('-',$project_values['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
$project_values['location_data']['tenant_id'],
+ 'lookup_type' => 'view',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
+ 'entity_data' =>
$project_values['p']
+ ));
+
+ if($project_values['contact_phone'])
+ {
+ for
($i=0;$i<count($location_data['location']);$i++)
+ {
+
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+ {
+
unset($location_data['location'][$i]['value']);
+ }
+ }
+ }
+
+
+ if($project_values['location_data']['tenant_id'] &&
!$values['tenant_id']):
+ {
+ $values['tenant_id'] =
$project_values['location_data']['tenant_id'];
+ $values['last_name'] =
$project_values['location_data']['last_name'];
+ $values['first_name'] =
$project_values['location_data']['first_name'];
+ }
+ elseif($values['tenant_id']):
+ {
+ $tenant=
$this->bocommon->read_single_tenant($values['tenant_id']);
+ $values['last_name'] =
$tenant['last_name'];
+ $values['first_name'] =
$tenant['first_name'];
+ }
+ endif;
+
+
+ if($values['workorder'] &&
$project_values['workorder_budget'])
+ {
+ foreach ($values['workorder'] as $workorder_id)
+ {
+ for
($i=0;$i<count($project_values['workorder_budget']);$i++)
+ {
+
if($project_values['workorder_budget'][$i]['workorder_id'] == $workorder_id)
+ {
+
$project_values['workorder_budget'][$i]['selected'] = True;
+ }
+ }
+ }
+ }
+
+
+ for
($i=0;$i<count($project_values['workorder_budget']);$i++)
+ {
+ $claimed=
$this->bo->check_claim_workorder($project_values['workorder_budget'][$i]['workorder_id']);
+
+ if($claimed)
+ {
+
$project_values['workorder_budget'][$i]['claimed'] = $claimed;
+ }
+ }
+
+
+
+ $this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
+
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
+ 'b_account_id' =>
$values['b_account_id'],
+ 'b_account_name' =>
$values['b_account_name']));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitenant_claim.edit',
+ 'claim_id' => $claim_id,
+ 'project_id' => $values['project_id']
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'table_header_workorder' =>
$table_header_workorder,
+ 'lang_no_workorders' =>
lang('No workorder bugdet'),
+ 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
+ 'lang_start_date'
=> lang('Project start date'),
+ 'value_start_date'
=> $project_values['start_date'],
+
+ 'lang_end_date'
=> lang('Project end date'),
+ 'value_end_date'
=> $project_values['end_date'],
+
+ 'lang_charge_tenant' =>
lang('Charge tenant'),
+ 'charge_tenant'
=> $project_values['charge_tenant'],
+
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'value_power_meter'
=> $project_values['power_meter'],
+
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> $project_values['budget'],
+
+ 'lang_reserve'
=> lang('reserve'),
+ 'value_reserve'
=> $project_values['reserve'],
+ 'lang_reserve_statustext' =>
lang('Enter the reserve'),
+
+ 'lang_reserve_remainder' =>
lang('reserve remainder'),
+ 'value_reserve_remainder' =>
$reserve_remainder,
+ 'value_reserve_remainder_percent'=>
$remainder_percent,
+
+ 'vendor_data'
=> $vendor_data,
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'view',
+
+ 'lang_project_id'
=> lang('Project ID'),
+ 'value_project_id'
=> $project_values['project_id'],
+ 'lang_name'
=> lang('Name'),
+ 'value_name'
=> $project_values['name'],
+
+ 'lang_descr'
=> lang('Description'),
+
+ 'sum_workorder_budget' =>
$project_values['sum_workorder_budget'],
+ 'sum_workorder_calculation' =>
$project_values['sum_workorder_calculation'],
+ 'workorder_budget'
=> $project_values['workorder_budget'],
+ 'sum_workorder_actual_cost' =>
$project_values['sum_workorder_actual_cost'],
+ 'lang_actual_cost'
=> lang('Actual cost'),
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_sum'
=> lang('Sum'),
+ 'select_user_name'
=> 'project_values[coordinator]',
+ 'lang_no_user'
=> lang('Select coordinator'),
+ 'user_list'
=>
$this->bocommon->get_user_list('select',$project_values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+
+ 'status_list'
=> $this->boproject->select_status_list('select',$project_values['status']),
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+
+ 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+
+ 'lang_contact_phone' =>
lang('Contact phone'),
+ 'contact_phone'
=> $project_values['contact_phone'],
+
+ 'b_account_data'
=> $b_account_data,
+
+ 'lang_select_workorder_statustext' =>
lang('Include the workorder to this claim'),
+
+ 'cat_list_project'
=>
$this->boproject->select_category_project_list('select',$project_values['cat_id']),
+
+//------------------
+
+ 'lang_status'
=> lang('Status'),
+ 'lang_status_statustext' =>
lang('Select status'),
+ 'status_list'
=> $this->bo->get_status_list(array('format' => 'select', 'selected' =>
$values['status'],'default' => 'open')),
+ 'lang_no_status'
=> lang('No status'),
+ 'status_name'
=> 'values[status]',
+
+ 'lang_amount'
=> lang('amount'),
+ 'lang_amount_statustext' =>
lang('The total amount to claim'),
+ 'value_amount'
=> $values['amount'],
+
+ 'tenant_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.tenant'),
+ 'lang_tenant'
=> lang('tenant'),
+ 'value_tenant_id'
=> $values['tenant_id'],
+ 'value_last_name'
=> $values['last_name'],
+ 'value_first_name'
=> $values['first_name'],
+ 'lang_tenant_statustext' =>
lang('Select a tenant'),
+ 'size_last_name'
=> strlen($values['last_name']),
+ 'size_first_name'
=> strlen($values['first_name']),
+
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'edit_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_claim_id'
=> lang('ID'),
+ 'value_claim_id'
=> $claim_id,
+ 'lang_remark'
=> lang('remark'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_apply'
=> lang('apply'),
+ 'value_remark'
=> $values['remark'],
+ 'value_cat'
=> $values['cat'],
+ 'lang_remark_statustext' =>
lang('Enter a remark for this claim'),
+ 'lang_apply_statustext' =>
lang('Apply the values'),
+ 'lang_cancel_statustext' =>
lang('Leave the claim untouched and return back to the list'),
+ 'lang_save_statustext' =>
lang('Save the claim and return back to the list'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the claim belongs to. To do not use a category select
NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id)
+ );
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Tenant claim') . ': ' . ($claim_id?lang('edit claim'):lang('add claim'));
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function delete()
+ {
+
+ if(!$this->acl_delete)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+
+
+ $claim_id =
get_var('claim_id',array('POST','GET'));
+ $delete = get_var('delete',array('POST'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitenant_claim.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($claim_id);
+// Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.delete&claim_id='
. $claim_id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('Tenant claim');
+ $function_msg =
lang('delete claim');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function view()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $claim_id =
get_var('claim_id',array('POST','GET'));
+
+ $this->boproject=
CreateObject($this->currentapp.'.boproject');
+
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim'));
+
+ $values = $this->bo->read_single($claim_id);
+
+ $project_values =
$this->boproject->read_single($values['project_id']);
+
+ $table_header_workorder[] = array
+ (
+ 'lang_workorder_id' =>
lang('Workorder'),
+ 'lang_budget' =>
lang('Budget'),
+ 'lang_calculation' =>
lang('Calculation'),
+ 'lang_vendor' =>
lang('Vendor'),
+ 'lang_charge_tenant' => lang('Charge
tenant'),
+ 'lang_select' =>
lang('Select')
+ );
+
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$project_values['location_data'],
+ 'type_id' =>
count(explode('-',$project_values['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
$project_values['location_data']['tenant_id'],
+ 'lookup_type' => 'view',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
+ 'entity_data' =>
$project_values['p']
+ ));
+
+ if($project_values['contact_phone'])
+ {
+ for
($i=0;$i<count($location_data['location']);$i++)
+ {
+
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+ {
+
unset($location_data['location'][$i]['value']);
+ }
+ }
+ }
+
+
+ if($project_values['location_data']['tenant_id'] &&
!$values['tenant_id']):
+ {
+ $values['tenant_id'] =
$project_values['location_data']['tenant_id'];
+ $values['last_name'] =
$project_values['location_data']['last_name'];
+ $values['first_name'] =
$project_values['location_data']['first_name'];
+ }
+ elseif($values['tenant_id']):
+ {
+ $tenant=
$this->bocommon->read_single_tenant($values['tenant_id']);
+ $values['last_name'] =
$tenant['last_name'];
+ $values['first_name'] =
$tenant['first_name'];
+ }
+ endif;
+
+
+ if($values['workorder'] &&
$project_values['workorder_budget'])
+ {
+ foreach ($values['workorder'] as $workorder_id)
+ {
+ for
($i=0;$i<count($project_values['workorder_budget']);$i++)
+ {
+
if($project_values['workorder_budget'][$i]['workorder_id'] == $workorder_id)
+ {
+
$project_values['workorder_budget'][$i]['selected'] = True;
+ }
+ }
+ }
+ }
+
+
+ for
($i=0;$i<count($project_values['workorder_budget']);$i++)
+ {
+ $claimed=
$this->bo->check_claim_workorder($project_values['workorder_budget'][$i]['workorder_id']);
+
+ if($claimed)
+ {
+
$project_values['workorder_budget'][$i]['claimed'] = $claimed;
+ }
+ }
+
+
+
+
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
+ 'b_account_id' =>
$values['b_account_id'],
+ 'b_account_name' =>
$values['b_account_name'],
+ 'type' => 'view'));
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'table_header_workorder' =>
$table_header_workorder,
+ 'lang_no_workorders' =>
lang('No workorder bugdet'),
+ 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
+ 'lang_start_date'
=> lang('Project start date'),
+ 'value_start_date'
=> $project_values['start_date'],
+
+ 'lang_end_date'
=> lang('Project end date'),
+ 'value_end_date'
=> $project_values['end_date'],
+
+ 'lang_charge_tenant' =>
lang('Charge tenant'),
+ 'charge_tenant'
=> $project_values['charge_tenant'],
+
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'value_power_meter'
=> $project_values['power_meter'],
+
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> $project_values['budget'],
+
+ 'lang_reserve'
=> lang('reserve'),
+ 'value_reserve'
=> $project_values['reserve'],
+ 'lang_reserve_statustext' =>
lang('Enter the reserve'),
+
+ 'lang_reserve_remainder' =>
lang('reserve remainder'),
+ 'value_reserve_remainder' =>
$reserve_remainder,
+ 'value_reserve_remainder_percent'=>
$remainder_percent,
+
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'view',
+
+ 'lang_project_id'
=> lang('Project ID'),
+ 'value_project_id'
=> $project_values['project_id'],
+ 'lang_name'
=> lang('Name'),
+ 'value_name'
=> $project_values['name'],
+
+ 'lang_descr'
=> lang('Description'),
+
+ 'sum_workorder_budget' =>
$project_values['sum_workorder_budget'],
+ 'sum_workorder_calculation' =>
$project_values['sum_workorder_calculation'],
+ 'workorder_budget'
=> $project_values['workorder_budget'],
+ 'sum_workorder_actual_cost' =>
$project_values['sum_workorder_actual_cost'],
+ 'lang_actual_cost'
=> lang('Actual cost'),
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_sum'
=> lang('Sum'),
+ 'select_user_name'
=> 'project_values[coordinator]',
+ 'lang_no_user'
=> lang('Select coordinator'),
+ 'user_list'
=>
$this->bocommon->get_user_list('select',$project_values['coordinator'],$extra=False,$default=False,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
+
+ 'status_list'
=> $this->boproject->select_status_list('select',$project_values['status']),
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+
+ 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+
+ 'lang_contact_phone' =>
lang('Contact phone'),
+ 'contact_phone'
=> $project_values['contact_phone'],
+
+ 'b_account_data'
=> $b_account_data,
+
+ 'cat_list_project'
=>
$this->boproject->select_category_project_list('select',$project_values['cat_id']),
+
+//------------------
+
+ 'lang_status'
=> lang('Status'),
+ 'status_list'
=> $this->bo->get_status_list(array('format' => 'select', 'selected' =>
$values['status'],'default' => 'open')),
+
+ 'lang_amount'
=> lang('amount'),
+ 'value_amount'
=> $values['amount'],
+
+ 'lang_tenant'
=> lang('tenant'),
+ 'value_tenant_id'
=> $values['tenant_id'],
+ 'value_last_name'
=> $values['last_name'],
+ 'value_first_name'
=> $values['first_name'],
+ 'size_last_name'
=> strlen($values['last_name']),
+ 'size_first_name'
=> strlen($values['first_name']),
+
+ 'lang_claim_id'
=> lang('ID'),
+ 'value_claim_id'
=> $claim_id,
+ 'lang_remark'
=> lang('remark'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel'
=> lang('cancel'),
+ 'lang_apply'
=> lang('apply'),
+ 'value_remark'
=> $values['remark'],
+ 'value_cat'
=> $values['cat'],
+ 'cat_list'
=> $this->bo->select_category_list('select',$values['cat_id']),
+
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.index'),
+ 'lang_done' => lang('done'),
+ 'value_date' =>
$GLOBALS['phpgw']->common->show_date($tenant_claim['entry_date'])
+
+ );
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('Tenant claim') . ': ' . ($claim_id?lang('edit claim'):lang('add claim'));
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+
+
+ }
+?>
Index: property/inc/class.uitts.inc.php
diff -u property/inc/class.uitts.inc.php:1.28
property/inc/class.uitts.inc.php:1.29
--- property/inc/class.uitts.inc.php:1.28 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uitts.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1121 +1,1121 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 helpdesk
- * @version $Id: class.uitts.inc.php,v 1.28 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uitts
- {
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'add' => True,
- 'delete' => True,
- 'excel' => True
- );
-
- function uitts()
- {
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
-
- $this->bo =
CreateObject($this->currentapp.'.botts',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.ticket';
- $this->acl_read =
$this->acl2->check('.ticket',1);
- $this->acl_add =
$this->acl2->check('.ticket',2);
- $this->acl_edit =
$this->acl2->check('.ticket',4);
- $this->acl_delete =
$this->acl2->check('.ticket',8);
- $this->acl_manage =
$this->acl2->check('.ticket',16);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->user_filter =
$this->bo->user_filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->district_id =
$this->bo->district_id;
- $this->allrows =
$this->bo->allrows;
- $this->start_date =
$this->bo->start_date;
- $this->end_date =
$this->bo->end_date;
-
- $this->menu->sub ='ticket';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'user_filter'=> $this->user_filter,
- 'cat_id' => $this->cat_id,
- 'district_id' => $this->district_id,
- 'allrows' => $this->allrows,
- 'start_date' => $this->start_date,
- 'end_date' => $this->end_date
- );
- $this->bo->save_sessiondata($data);
- }
-
-
- function excel()
- {
- $start_date = urldecode($this->start_date);
- $end_date = urldecode($this->end_date);
-
- $this->bo->allrows = True;
- $list = $this->bo->read($start_date,$end_date);
-
- if (isset($list) AND is_array($list))
- {
- $i=0;
- foreach($list as $entry)
- {
- if($entry['subject'])
- {
- $list[$i]['category'] =
$entry['subject'];
- }
-
- if (isset($entry['child_date']) AND
is_array($entry['child_date']))
- {
- $j=0;
- foreach($entry['child_date'] as
$date)
- {
-
if($date['date_info'][0]['descr'])
- {
-
$list[$i]['date_' . $j]=$date['date_info'][0]['entry_date'];
-
$name_temp['date_' . $j]=True;
-
$descr_temp[$date['date_info'][0]['descr']]=True;
- }
- $j++;
- }
- }
- $i++;
- }
- }
-//_debug_array($descr_temp);
-
- $name = array('id',
- 'category',
- 'location_code',
- 'address',
- 'user',
- 'assignedto',
- 'timestampopened'
- );
-
- while (is_array($name_temp) && list($name_entry,) =
each($name_temp))
- {
- array_push($name,$name_entry);
- }
-
- array_push($name,'finnish_date','delay');
-
- $descr = array(lang('ID'),
- lang('category'),
- lang('location'),
- lang('address'),
- lang('user'),
- lang('Assigned to'),
- lang('Started')
- );
-
- while (is_array($descr_temp) && list($descr_entry,) =
each($descr_temp))
- {
- array_push($descr,$descr_entry);
- }
-
- array_push($descr,lang('finnish date'),lang('delay'));
-
-//_debug_array($descr);
-
- $this->bocommon->excel($list,$name,$descr);
- }
-
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- if(get_var('edit_status',array('POST','GET')))
- {
- if(!$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=4&acl_location='
. $this->acl2_location);
- }
-
- $new_status =
get_var('new_status',array('POST','GET'));
- $id = get_var('id',array('POST','GET'));
- $so2 =
CreateObject($this->currentapp.'.sotts2');
- $receipt =
$so2->update_status(array('status'=>$new_status),$id);
-
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('tts',
-
'menu',
-
'nextmatchs'));
-
-
- $second_display =
get_var('second_display',array('POST','GET'));
-
- $default_category =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['default_district'];
- $default_status =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_status'];
- $start_date = urldecode($this->start_date);
- $end_date = urldecode($this->end_date);
-
- if ($default_category && !$second_display &&
!$this->district_id)
- {
- $this->bo->district_id = $default_category;
- $this->district_id =
$default_category;
- }
-
- if ($default_status && !$second_display)
- {
- $this->bo->filter = $default_status;
- $this->filter = $default_status;
- }
-
- $bgcolor['1'] = '#dadada';
- $bgcolor['2'] = '#dad0d0';
- $bgcolor['3'] = '#dacaca';
- $bgcolor['4'] = '#dac0c0';
- $bgcolor['5'] = '#dababa';
- $bgcolor['6'] = '#dab0b0';
- $bgcolor['7'] = '#daaaaa';
- $bgcolor['8'] = '#da9090';
- $bgcolor['9'] = '#da8a8a';
- $bgcolor['10'] = '#da7a7a';
-
-
- $links = $this->menu->links();
-
- $ticket_list = $this->bo->read($start_date,$end_date);
-
- $uicols=$this->bo->uicols;
-
-//_debug_array($uicols);
-//_debug_array($ticket_list);
- while (is_array($ticket_list) && list(,$ticket) =
each($ticket_list))
- {
- if($ticket['subject'])
- {
- $first= $ticket['subject'];
- }
- else
- {
- $first= $ticket['category'];
- }
-
- if ($ticket['status']=='O')
- {
- $status = lang('Open');
- $text_edit_status = lang('Close');
- $new_status = 'X';
- }
- else
- {
- $status = lang('Closed');
- $text_edit_status = lang('Open');
- $new_status = 'O';
- }
-
-
- $link_status_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitts.index',
- 'id'
=> $ticket['id'],
- 'edit_status' => true,
- 'new_status' =>
$new_status,
- 'second_display'
=> true,
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'user_filter'
=>$this->user_filter,
- 'query'
=>$this->query,
- 'district_id' =>
$this->district_id,
- 'allrows'
=>$this->allrows
- );
-
-
- $content[] = array
- (
- 'id'
=> $ticket['id'],
- 'bgcolor'
=> $bgcolor[$ticket['priority']],
- 'new_ticket'
=> $ticket['new_ticket'],
- 'priostr'
=> str_repeat("||", $ticket['priority']),
- 'first'
=> $first,
- 'location_code'
=> $ticket['location_code'],
- 'address'
=> $ticket['address'],
- 'date'
=> $ticket['timestampopened'],
- 'finnish_date'
=> $ticket['finnish_date'],
- 'delay'
=> $ticket['delay'],
- 'user'
=> $ticket['user'],
- 'assignedto'
=> $ticket['assignedto'],
- 'child_date'
=> $ticket['child_date'],
- 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.view&id='
. $ticket['id']),
- 'lang_view_statustext' =>
lang('view the ticket'),
- 'text_view'
=> lang('view'),
- 'status'
=> $status,
- 'link_edit_status'
=> $GLOBALS['phpgw']->link('/index.php',$link_status_data),
- 'lang_edit_status'
=> lang('Edit status'),
- 'text_edit_status'
=> $text_edit_status
- );
- }
-
- $table_header[] = array
- (
- 'sort_priority' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'priority',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'user_filter'
=>$this->user_filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows,
-
'start_date'
=>$start_date,
-
'end_date'
=>$end_date
-
)
-
)),
-
- 'lang_priority' => lang('Priority'),
- 'lang_priority_statustext' =>
lang('Sort the tickets by their priority'),
-
- 'sort_id' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'fm_tts_tickets.id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'user_filter'
=>$this->user_filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows,
-
'start_date'
=>$start_date,
-
'end_date'
=>$end_date
-
)
-
)),
-
- 'lang_id' => lang('ID'),
- 'lang_id_statustext' => lang('Sort
the tickets by their ID'),
-
- 'lang_subject' =>
lang('Subject'),
- 'lang_time_created' => lang('Started'),
- 'lang_view' => lang('view'),
- 'lang_location_code' => lang('Location'),
- 'lang_address' => lang('Address'),
- 'lang_user' => lang('user'),
- 'sort_assigned_to' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'assignedto',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'user_filter'
=>$this->user_filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows,
-
'start_date'
=>$start_date,
-
'end_date'
=>$end_date
-
)
-
)),
- 'lang_assigned_to' =>
lang('Assigned to'),
- 'sort_opened_by' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'user_lid',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'user_filter'
=>$this->user_filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows,
-
'start_date'
=>$start_date,
-
'end_date'
=>$end_date
-
)
-
)),
- 'sort_date' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'fm_tts_tickets.entry_date',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'user_filter'
=>$this->user_filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows,
-
'start_date'
=>$start_date,
-
'end_date'
=>$end_date
-
)
-
)),
- 'sort_finnish_date' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'finnish_date',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'user_filter'
=>$this->user_filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows,
-
'start_date'
=>$start_date,
-
'end_date'
=>$end_date
-
)
-
)),
- 'lang_finnish_date' =>
lang('finnish date'),
- 'lang_delay' =>
lang('delay'),
- 'lang_finnish_statustext'=> lang('presumed
finnish date'),
- 'lang_opened_by' => lang('Opened
by'),
- 'lang_status' => lang('Status')
- );
-
- for ($i=0;$i<count($uicols);$i++)
- {
- $table_header[0]['extra'][$i]['header']
= $uicols[$i];
- }
-
- $table_add[] = array
- (
- 'lang_add' =>
lang('add'),
- 'lang_add_statustext' => lang('add a ticket'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.add')
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitts.index',
- 'second_display' => true,
- 'sort' =>$this->sort,
- 'order' =>$this->order,
- 'cat_id' =>$this->cat_id,
- 'filter' =>$this->filter,
- 'user_filter'
=>$this->user_filter,
- 'query' =>$this->query,
- 'district_id' =>
$this->district_id,
- 'start_date' =>$start_date,
- 'end_date' =>$end_date,
- 'allrows' =>$this->allrows
- );
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp);
-
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,'');
-
- $GLOBALS['phpgw']->preferences->read_repository();
- if
($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'])
- {
- $autorefresh =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'].';
URL='.$GLOBALS['phpgw']->link('/index.php',$link_data);
- }
-
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $link_date_search =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
-
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uitts.excel',
- 'second_display' => true,
- 'sort' =>$this->sort,
- 'order' =>$this->order,
- 'cat_id' =>$this->cat_id,
- 'filter' =>$this->filter,
- 'user_filter'
=>$this->user_filter,
- 'query' =>$this->query,
- 'district_id' =>
$this->district_id,
- 'allrows'
=>$this->allrows,
- 'start_date' =>$start_date,
- 'end_date' =>$end_date,
- 'start' =>$this->start
- );
-
-
if($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'])
- {
- $group_filters = 'select';
-
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field_grouped'));
- }
- else
- {
- $group_filters = 'filter';
-
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
- }
-
- $data = array
- (
- 'group_filters' =>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'],
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
-
- 'start_date'
=>$start_date,
- 'end_date'
=>$end_date,
- 'lang_none'
=>lang('None'),
- 'lang_date_search' =>
lang('Date search'),
- 'lang_date_search_help' =>
lang('Narrow the search by dates'),
- 'link_date_search' =>
$link_date_search,
-
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'autorefresh'
=> $autorefresh,
- 'links'
=> $links,
- 'allow_allrows'
=> True,
- 'allrows'
=> $this->allrows,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($ticket_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the ticket belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list($group_filters,$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'filter_name'
=> 'filter',
- 'filter_list'
=> $this->bo->filter(array('format' => $group_filters, 'filter'=>
$this->filter,'default' => 'open')),
- 'lang_show_all'
=> lang('Open'),
- 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add,
-
- 'district_list'
=> $this->bocommon->select_district_list($group_filters,$this->district_id),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
- 'select_district_name' =>
'district_id',
-
- 'lang_user_statustext' =>
lang('Assigned to'),
- 'select_user_name'
=> 'user_filter',
- 'lang_no_user'
=> lang('No user'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2($group_filters,4,$this->user_filter,$this->acl2_location,'',$default='')
- );
-
- $appname
= lang('helpdesk');
- $function_msg =
lang('list ticket');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function add()
- {
- if(!$this->acl_add)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $values = get_var('values',array('POST'));
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
- $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
-
- for ($j=0;$j<count($insert_record_entity);$j++)
- {
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('tts'));
-
-//_debug_array($insert_record);
- if ($values['save'])
- {
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
-
-/* if(!$values['subject'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please type a subject for this ticket
!'));
- }
-
-*/ if(!$values['assignedto'] &&
!$values['group_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a person or a group to
handle the ticket !'));
- }
-
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- }
-
-/* if(!$values['details'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please give som details !'));
- }
-*/
- if(!$values['location']['loc1'] &&
!$values['extra']['p_num'])
- {
-
$receipt['error'][]=array('msg'=>lang('Pleace select a location - or an entity
!'));
- }
-
- if(!$receipt['error'])
- {
- $receipt = $this->bo->add($values);
-
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
-
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts','');
- header('Location: '.
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.index'));
- }
- else
- {
- if($values['location'])
- {
- $location_code=implode("-",
$values['location']);
- $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
- }
- if($values['extra']['p_num'])
- {
-
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
- }
- }
- }
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' => -1,
// calculated from location_types
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' => True,
- 'lookup_type' => 'form',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('ticket'),
- 'entity_data' => $values['p']
- ));
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uitts.add'
- );
-
- if(!$values['assignedto'])
- {
- $values['assignedto']=
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['assigntodefault'];
- }
- if(!$values['group_id'])
- {
- $values['group_id']=
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['groupdefault'];
- }
-
- if(!$values['cat_id'])
- {
- $this->cat_id =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_category'];
- }
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- switch(substr($dateformat,0,1))
- {
- case 'M':
- $dateformat_validate=
"javascript:vDateType='1'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
- $onBlur =
"DateFormat(this,this.value,event,true,'1')";
- break;
- case 'y':
-
$dateformat_validate="javascript:vDateType='2'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
- $onBlur =
"DateFormat(this,this.value,event,true,'2')";
- break;
- case 'D':
-
$dateformat_validate="javascript:vDateType='3'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
- $onBlur =
"DateFormat(this,this.value,event,true,'3')";
- break;
- }
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'lang_dateformat'
=> strtolower($dateformat),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp'
=> $onKeyUp,
- 'onBlur'
=> $onBlur,
- 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'location_data'
=> $location_data,
- 'lang_assign_to'
=> lang('Assign to'),
- 'lang_no_user'
=> lang('Select user'),
- 'lang_user_statustext' =>
lang('Select the user the selection belongs to. To do not use a user select NO
USER'),
- 'select_user_name'
=> 'values[assignedto]',
- 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$values['assignedto'],$this->acl2_location),
-
- 'lang_group'
=> lang('Group'),
- 'lang_no_group'
=> lang('No group'),
- 'group_list'
=>
$this->bocommon->get_group_list('select',$values['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
- 'select_group_name'
=> 'values[group_id]',
-
- 'lang_priority'
=> lang('Priority'),
- 'lang_priority_statustext' =>
lang('Select the priority the selection belongs to.'),
- 'select_priority_name' =>
'values[priority]',
- 'priority_list'
=> $this->bo->get_priority_list($values['priority']),
-
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.index'),
- 'lang_subject'
=> lang('Subject'),
- 'lang_subject_statustext' =>
lang('Enter the subject of this ticket'),
-
- 'lang_details'
=> lang('Details'),
- 'lang_details_statustext' =>
lang('Enter the details of this ticket'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_details'
=> $values['details'],
- 'value_subject'
=> $values['subject'],
-
- 'lang_finnish_date'
=> lang('finnish date'),
- 'value_finnish_date' =>
$values['finnish_date'],
-
- 'lang_done_statustext' =>
lang('Back to the ticket list'),
- 'lang_save_statustext' =>
lang('Save the ticket'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'lang_town_statustext' =>
lang('Select the part of town the building belongs to. To do not use a part of
town - select NO PART OF TOWN'),
- 'lang_part_of_town'
=> lang('Part of town'),
- 'lang_no_part_of_town' =>
lang('No part of town'),
- 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
- 'mailnotification'
=> $this->bo->config->config_data['mailnotification'],
- 'lang_mailnotification' =>
lang('Send e-mail'),
- 'lang_mailnotification_statustext' =>
lang('Choose to send mailnotification'),
- 'pref_send_mail'
=>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_user_mailnotification'],
- );
-
-//_debug_array($data);
- $appname
= lang('helpdesk');
- $function_msg =
lang('add ticket');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add'
=> $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $id = get_var('id',array('GET'));
- $values = get_var('values',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('tts'));
-
- if($values['save'])
- {
- if(!$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=4&acl_location='
. $this->acl2_location);
- }
-
- $so2 =
CreateObject($this->currentapp.'.sotts2');
- $receipt = $so2->update_ticket($values,$id);
- }
-
- $ticket = $this->bo->read_single($id);
-
- $additional_notes =
$this->bo->read_additional_notes($id);
- $record_history = $this->bo->read_record_history($id);
-
- $request_link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uirequest.edit',
- 'bypass' => true,
- 'location_code' =>
$ticket['location_code'],
- 'p_num' =>
$ticket['p_num'],
- 'p_entity_id' =>
$ticket['p_entity_id'],
- 'p_cat_id' =>
$ticket['p_cat_id'],
- 'tenant_id' =>
$ticket['tenant_id'],
- 'origin' => 'tts',
- 'origin_id' => $id
- );
-
- for ($i=0;$i<count($ticket['origin']);$i++)
- {
- if($ticket['origin'][$i]['type'] ==
'project')
- {
- $order_link_data = array
- (
- 'menuaction'
=> $this->currentapp.'.uiproject.edit',
- 'id'
=> $ticket['origin'][$i]['data'][0]['id']
- );
- break;
- }
- }
-
-
- if(!$order_link_data)
- {
- $order_link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiproject.edit',
- 'bypass' => true,
- 'location_code' =>
$ticket['location_code'],
- 'p_num' =>
$ticket['p_num'],
- 'p_entity_id' =>
$ticket['p_entity_id'],
- 'p_cat_id' =>
$ticket['p_cat_id'],
- 'tenant_id' =>
$ticket['tenant_id'],
- 'origin' =>
'tts',
- 'origin_id' => $id
- );
- }
-
- $form_link = array
- (
- 'menuaction' =>
$this->currentapp.'.uitts.view',
- 'id' => $id
- );
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- $table_header_additional_notes[] = array
- (
- 'lang_count' => '#',
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_note' => lang('Note'),
- );
-
-//_debug_array($ticket['location_data']);
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$ticket['location_data'],
- 'type_id' =>
count(explode('-',$ticket['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
$ticket['location_data']['tenant_id'],
- 'lookup_type' => 'view',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('ticket'),
- 'entity_data' => $ticket['p']
- ));
-
-
- if($ticket['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
unset($location_data['location'][$i]['value']);
- }
- }
- }
-
-
- if ($ticket['cat_id'])
- {
- $this->cat_id = $ticket['cat_id'];
- }
-
-
-/*
- if($ticket['request_id'])
- {
- $request_lookup_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uirequest.view'
- );
- }
- if($ticket['project_id'])
- {
- $project_lookup_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiproject.view'
- );
- }
-
-*/
- $start_entity =
$this->bocommon->get_start_entity('ticket');
-//_debug_array($start_entity);
-
- if (isset($start_entity) AND is_array($start_entity))
- {
- $i=0;
- foreach($start_entity as $entry)
- {
- $link_entity[$i]['link'] =
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
$this->currentapp.'.uientity.edit',
- 'bypass'
=> true,
- 'location_code' =>
$ticket['location_code'],
- 'entity_id'
=> $entry['id'],
- 'p_num'
=> $ticket['p_num'],
- 'p_entity_id' =>
$ticket['p_entity_id'],
- 'p_cat_id'
=> $ticket['p_cat_id'],
- 'tenant_id'
=> $ticket['tenant_id'],
- 'origin'
=> 'tts',
- 'origin_id'
=> $id
- ));
- $link_entity[$i]['name'] =
$entry['name'];
- $i++;
- }
- }
-
-//_debug_array($link_entity);
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
- switch(substr($dateformat,0,1))
- {
- case 'M':
- $dateformat_validate=
"javascript:vDateType='1'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
- $onBlur =
"DateFormat(this,this.value,event,true,'1')";
- break;
- case 'y':
-
$dateformat_validate="javascript:vDateType='2'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
- $onBlur =
"DateFormat(this,this.value,event,true,'2')";
- break;
- case 'D':
-
$dateformat_validate="javascript:vDateType='3'";
- $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
- $onBlur =
"DateFormat(this,this.value,event,true,'3')";
- break;
- }
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-
- if (isset($ticket['origin']) AND
is_array($ticket['origin']))
- {
- for ($i=0;$i<count($ticket['origin']);$i++)
- {
-
$ticket['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $ticket['origin'][$i]['link']);
-
if(substr($ticket['origin'][$i]['type'],0,6)=='entity')
- {
- $type =
explode("_",$ticket['origin'][$i]['type']);
- $entity_id = $type[1];
- $cat_id = $type[2];
-
- if(!is_object($boadmin_entity))
- {
- $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
- }
- $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
- $ticket['origin'][$i]['descr']
= $entity_category['name'];
- }
- else
- {
- $ticket['origin'][$i]['descr']=
lang($ticket['origin'][$i]['type']);
- }
- }
- }
-
- $data = array
- (
- 'value_origin'
=> $ticket['origin'],
- 'value_origin_type'
=> $origin,
- 'value_origin_id'
=> $origin_id,
-
- 'lang_dateformat'
=> strtolower($dateformat),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp'
=> $onKeyUp,
- 'onBlur'
=> $onBlur,
- 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
- 'lang_finnish_date'
=> lang('finnish date'),
- 'value_finnish_date' =>
$ticket['finnish_date'],
-
- 'link_entity'
=> $link_entity,
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-
- 'lang_request'
=> lang('Request'),
- 'lang_request_statustext' =>
lang('Link to the request originatet from this ticket'),
- 'link_request'
=> $GLOBALS['phpgw']->link('/index.php',$request_lookup_data),
- 'value_request_id'
=> $ticket['request_id'],
-
- 'lang_project'
=> lang('Project'),
- 'lang_project_statustext' =>
lang('Link to the project originatet from this ticket'),
- 'link_project'
=> $GLOBALS['phpgw']->link('/index.php',$project_lookup_data),
- 'value_project_id'
=> $ticket['project_id'],
-
- 'location_data'
=> $location_data,
- 'lang_location_code' =>
lang('Location Code'),
-
- 'lang_ticket'
=> lang('Ticket'),
- 'table_header_additional_notes' =>
$table_header_additional_notes,
- 'table_header_history' =>
$table_header_history,
- 'lang_status'
=> lang('Status'),
- 'status_name'
=> 'values[status]',
- 'status_list'
=> $this->bo->get_status_list($ticket['status']),
- 'lang_status_statustext' =>
lang('Set the status of the ticket'),
-
- 'lang_no_user'
=> lang('Select user'),
- 'lang_user_statustext' =>
lang('Select the user the selection belongs to. To do not use a user select NO
USER'),
- 'select_user_name'
=> 'values[assignedto]',
- 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$ticket['assignedto'],$this->acl2_location),
-
- 'lang_group'
=> lang('Group'),
- 'lang_no_group'
=> lang('No group'),
- 'group_list'
=>
$this->bocommon->get_group_list('select',$ticket['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
- 'select_group_name'
=> 'values[group_id]',
-
- 'lang_priority'
=> lang('Priority'),
- 'value_priority'
=> $ticket['priority'],
- 'lang_priority_statustext' =>
lang('Select the priority the selection belongs to.'),
- 'select_priority_name' =>
'values[priority]',
- 'priority_list'
=> $this->bo->get_priority_list($ticket['priority']),
-
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
- 'lang_category'
=> lang('category'),
- 'value_category_name' =>
$ticket['category_name'],
-
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$form_link),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.index'),
- 'value_subject'
=> $ticket['subject'],
- 'lang_subject_statustext' =>
lang('update subject'),
- 'value_id'
=> '[ #'. $id . ' ] - ',
-
- 'lang_details'
=> lang('Details'),
- 'value_details'
=> $ticket['details'],
- 'lang_details_statustext' =>
lang('Add new comments'),
-
- 'lang_additional_notes' =>
lang('Additional notes'),
-
- 'lang_new_note'
=> lang('New Note'),
- 'lang_opendate'
=> lang('Open Date'),
- 'value_opendate'
=> $ticket['timestampopened'],
-
- 'lang_assignedfrom'
=> lang('Assigned from'),
- 'value_assignedfrom' =>
$ticket['user_name'],
- 'lang_assignedto'
=> lang('Assigned to'),
- 'value_assignedto'
=> $ticket['assignedto_name'],
-
- 'lang_no_additional_notes' =>
lang('No additional notes'),
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history for this record'),
- 'additional_notes'
=> $additional_notes,
- 'record_history'
=> $record_history,
- 'request_link'
=> $GLOBALS['phpgw']->link('/index.php',$request_link_data),
- 'order_link'
=> $GLOBALS['phpgw']->link('/index.php',$order_link_data),
-
- 'lang_generate_request' =>
lang('Generate Request'),
- 'lang_generate_request_statustext'
=> lang('Klick this to generate a request with this information'),
- 'lang_generate_order' =>
lang('Generate order'),
- 'lang_generate_order_statustext'
=> lang('Klick this to generate an order with this information'),
-
- 'lang_save'
=> lang('save'),
- 'lang_name'
=> lang('name'),
- 'lang_done'
=> lang('done'),
- 'lang_contact_phone' =>
lang('Contact phone'),
- 'contact_phone'
=> $ticket['contact_phone'],
- 'mailnotification'
=> $this->bo->config->config_data['mailnotification'],
- 'lang_mailnotification' =>
lang('Send e-mail'),
- 'lang_mailnotification_statustext' =>
lang('Choose to send mailnotification'),
- 'pref_send_mail'
=>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_user_mailnotification'],
- );
-
- $appname
= lang('helpdesk');
- $function_msg =
lang('view ticket detail');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 helpdesk
+ * @version $Id: class.uitts.inc.php,v 1.29 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uitts
+ {
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'add' => True,
+ 'delete' => True,
+ 'excel' => True
+ );
+
+ function uitts()
+ {
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+
+ $this->bo =
CreateObject($this->currentapp.'.botts',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.ticket';
+ $this->acl_read =
$this->acl2->check('.ticket',1);
+ $this->acl_add =
$this->acl2->check('.ticket',2);
+ $this->acl_edit =
$this->acl2->check('.ticket',4);
+ $this->acl_delete =
$this->acl2->check('.ticket',8);
+ $this->acl_manage =
$this->acl2->check('.ticket',16);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->user_filter =
$this->bo->user_filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->district_id =
$this->bo->district_id;
+ $this->allrows =
$this->bo->allrows;
+ $this->start_date =
$this->bo->start_date;
+ $this->end_date =
$this->bo->end_date;
+
+ $this->menu->sub ='ticket';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'user_filter'=> $this->user_filter,
+ 'cat_id' => $this->cat_id,
+ 'district_id' => $this->district_id,
+ 'allrows' => $this->allrows,
+ 'start_date' => $this->start_date,
+ 'end_date' => $this->end_date
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+
+ function excel()
+ {
+ $start_date = urldecode($this->start_date);
+ $end_date = urldecode($this->end_date);
+
+ $this->bo->allrows = True;
+ $list = $this->bo->read($start_date,$end_date);
+
+ if (isset($list) AND is_array($list))
+ {
+ $i=0;
+ foreach($list as $entry)
+ {
+ if($entry['subject'])
+ {
+ $list[$i]['category'] =
$entry['subject'];
+ }
+
+ if (isset($entry['child_date']) AND
is_array($entry['child_date']))
+ {
+ $j=0;
+ foreach($entry['child_date'] as
$date)
+ {
+
if($date['date_info'][0]['descr'])
+ {
+
$list[$i]['date_' . $j]=$date['date_info'][0]['entry_date'];
+
$name_temp['date_' . $j]=True;
+
$descr_temp[$date['date_info'][0]['descr']]=True;
+ }
+ $j++;
+ }
+ }
+ $i++;
+ }
+ }
+//_debug_array($descr_temp);
+
+ $name = array('id',
+ 'category',
+ 'location_code',
+ 'address',
+ 'user',
+ 'assignedto',
+ 'timestampopened'
+ );
+
+ while (is_array($name_temp) && list($name_entry,) =
each($name_temp))
+ {
+ array_push($name,$name_entry);
+ }
+
+ array_push($name,'finnish_date','delay');
+
+ $descr = array(lang('ID'),
+ lang('category'),
+ lang('location'),
+ lang('address'),
+ lang('user'),
+ lang('Assigned to'),
+ lang('Started')
+ );
+
+ while (is_array($descr_temp) && list($descr_entry,) =
each($descr_temp))
+ {
+ array_push($descr,$descr_entry);
+ }
+
+ array_push($descr,lang('finnish date'),lang('delay'));
+
+//_debug_array($descr);
+
+ $this->bocommon->excel($list,$name,$descr);
+ }
+
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ if(get_var('edit_status',array('POST','GET')))
+ {
+ if(!$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=4&acl_location='
. $this->acl2_location);
+ }
+
+ $new_status =
get_var('new_status',array('POST','GET'));
+ $id = get_var('id',array('POST','GET'));
+ $so2 =
CreateObject($this->currentapp.'.sotts2');
+ $receipt =
$so2->update_status(array('status'=>$new_status),$id);
+
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('tts',
+
'menu',
+
'nextmatchs'));
+
+
+ $second_display =
get_var('second_display',array('POST','GET'));
+
+ $default_category =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['default_district'];
+ $default_status =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_status'];
+ $start_date = urldecode($this->start_date);
+ $end_date = urldecode($this->end_date);
+
+ if ($default_category && !$second_display &&
!$this->district_id)
+ {
+ $this->bo->district_id = $default_category;
+ $this->district_id =
$default_category;
+ }
+
+ if ($default_status && !$second_display)
+ {
+ $this->bo->filter = $default_status;
+ $this->filter = $default_status;
+ }
+
+ $bgcolor['1'] = '#dadada';
+ $bgcolor['2'] = '#dad0d0';
+ $bgcolor['3'] = '#dacaca';
+ $bgcolor['4'] = '#dac0c0';
+ $bgcolor['5'] = '#dababa';
+ $bgcolor['6'] = '#dab0b0';
+ $bgcolor['7'] = '#daaaaa';
+ $bgcolor['8'] = '#da9090';
+ $bgcolor['9'] = '#da8a8a';
+ $bgcolor['10'] = '#da7a7a';
+
+
+ $links = $this->menu->links();
+
+ $ticket_list = $this->bo->read($start_date,$end_date);
+
+ $uicols=$this->bo->uicols;
+
+//_debug_array($uicols);
+//_debug_array($ticket_list);
+ while (is_array($ticket_list) && list(,$ticket) =
each($ticket_list))
+ {
+ if($ticket['subject'])
+ {
+ $first= $ticket['subject'];
+ }
+ else
+ {
+ $first= $ticket['category'];
+ }
+
+ if ($ticket['status']=='O')
+ {
+ $status = lang('Open');
+ $text_edit_status = lang('Close');
+ $new_status = 'X';
+ }
+ else
+ {
+ $status = lang('Closed');
+ $text_edit_status = lang('Open');
+ $new_status = 'O';
+ }
+
+
+ $link_status_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitts.index',
+ 'id'
=> $ticket['id'],
+ 'edit_status' => true,
+ 'new_status' =>
$new_status,
+ 'second_display'
=> true,
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'filter'
=>$this->filter,
+ 'user_filter'
=>$this->user_filter,
+ 'query'
=>$this->query,
+ 'district_id' =>
$this->district_id,
+ 'allrows'
=>$this->allrows
+ );
+
+
+ $content[] = array
+ (
+ 'id'
=> $ticket['id'],
+ 'bgcolor'
=> $bgcolor[$ticket['priority']],
+ 'new_ticket'
=> $ticket['new_ticket'],
+ 'priostr'
=> str_repeat("||", $ticket['priority']),
+ 'first'
=> $first,
+ 'location_code'
=> $ticket['location_code'],
+ 'address'
=> $ticket['address'],
+ 'date'
=> $ticket['timestampopened'],
+ 'finnish_date'
=> $ticket['finnish_date'],
+ 'delay'
=> $ticket['delay'],
+ 'user'
=> $ticket['user'],
+ 'assignedto'
=> $ticket['assignedto'],
+ 'child_date'
=> $ticket['child_date'],
+ 'link_view'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.view&id='
. $ticket['id']),
+ 'lang_view_statustext' =>
lang('view the ticket'),
+ 'text_view'
=> lang('view'),
+ 'status'
=> $status,
+ 'link_edit_status'
=> $GLOBALS['phpgw']->link('/index.php',$link_status_data),
+ 'lang_edit_status'
=> lang('Edit status'),
+ 'text_edit_status'
=> $text_edit_status
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_priority' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'priority',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'user_filter'
=>$this->user_filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows,
+
'start_date'
=>$start_date,
+
'end_date'
=>$end_date
+
)
+
)),
+
+ 'lang_priority' => lang('Priority'),
+ 'lang_priority_statustext' =>
lang('Sort the tickets by their priority'),
+
+ 'sort_id' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'fm_tts_tickets.id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'user_filter'
=>$this->user_filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows,
+
'start_date'
=>$start_date,
+
'end_date'
=>$end_date
+
)
+
)),
+
+ 'lang_id' => lang('ID'),
+ 'lang_id_statustext' => lang('Sort
the tickets by their ID'),
+
+ 'lang_subject' =>
lang('Subject'),
+ 'lang_time_created' => lang('Started'),
+ 'lang_view' => lang('view'),
+ 'lang_location_code' => lang('Location'),
+ 'lang_address' => lang('Address'),
+ 'lang_user' => lang('user'),
+ 'sort_assigned_to' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'assignedto',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'user_filter'
=>$this->user_filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows,
+
'start_date'
=>$start_date,
+
'end_date'
=>$end_date
+
)
+
)),
+ 'lang_assigned_to' =>
lang('Assigned to'),
+ 'sort_opened_by' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'user_lid',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'user_filter'
=>$this->user_filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows,
+
'start_date'
=>$start_date,
+
'end_date'
=>$end_date
+
)
+
)),
+ 'sort_date' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'fm_tts_tickets.entry_date',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'user_filter'
=>$this->user_filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows,
+
'start_date'
=>$start_date,
+
'end_date'
=>$end_date
+
)
+
)),
+ 'sort_finnish_date' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'finnish_date',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'user_filter'
=>$this->user_filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows,
+
'start_date'
=>$start_date,
+
'end_date'
=>$end_date
+
)
+
)),
+ 'lang_finnish_date' =>
lang('finnish date'),
+ 'lang_delay' =>
lang('delay'),
+ 'lang_finnish_statustext'=> lang('presumed
finnish date'),
+ 'lang_opened_by' => lang('Opened
by'),
+ 'lang_status' => lang('Status')
+ );
+
+ for ($i=0;$i<count($uicols);$i++)
+ {
+ $table_header[0]['extra'][$i]['header']
= $uicols[$i];
+ }
+
+ $table_add[] = array
+ (
+ 'lang_add' =>
lang('add'),
+ 'lang_add_statustext' => lang('add a ticket'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.add')
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitts.index',
+ 'second_display' => true,
+ 'sort' =>$this->sort,
+ 'order' =>$this->order,
+ 'cat_id' =>$this->cat_id,
+ 'filter' =>$this->filter,
+ 'user_filter'
=>$this->user_filter,
+ 'query' =>$this->query,
+ 'district_id' =>
$this->district_id,
+ 'start_date' =>$start_date,
+ 'end_date' =>$end_date,
+ 'allrows' =>$this->allrows
+ );
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp);
+
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,'');
+
+ $GLOBALS['phpgw']->preferences->read_repository();
+ if
($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'])
+ {
+ $autorefresh =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'].';
URL='.$GLOBALS['phpgw']->link('/index.php',$link_data);
+ }
+
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $link_date_search =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
+
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitts.excel',
+ 'second_display' => true,
+ 'sort' =>$this->sort,
+ 'order' =>$this->order,
+ 'cat_id' =>$this->cat_id,
+ 'filter' =>$this->filter,
+ 'user_filter'
=>$this->user_filter,
+ 'query' =>$this->query,
+ 'district_id' =>
$this->district_id,
+ 'allrows'
=>$this->allrows,
+ 'start_date' =>$start_date,
+ 'end_date' =>$end_date,
+ 'start' =>$this->start
+ );
+
+
if($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'])
+ {
+ $group_filters = 'select';
+
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field_grouped'));
+ }
+ else
+ {
+ $group_filters = 'filter';
+
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
+ }
+
+ $data = array
+ (
+ 'group_filters' =>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'],
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+
+ 'start_date'
=>$start_date,
+ 'end_date'
=>$end_date,
+ 'lang_none'
=>lang('None'),
+ 'lang_date_search' =>
lang('Date search'),
+ 'lang_date_search_help' =>
lang('Narrow the search by dates'),
+ 'link_date_search' =>
$link_date_search,
+
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'autorefresh'
=> $autorefresh,
+ 'links'
=> $links,
+ 'allow_allrows'
=> True,
+ 'allrows'
=> $this->allrows,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($ticket_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the ticket belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list($group_filters,$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'filter_name'
=> 'filter',
+ 'filter_list'
=> $this->bo->filter(array('format' => $group_filters, 'filter'=>
$this->filter,'default' => 'open')),
+ 'lang_show_all'
=> lang('Open'),
+ 'lang_filter_statustext' =>
lang('Select the filter. To show all entries select SHOW ALL'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add,
+
+ 'district_list'
=> $this->bocommon->select_district_list($group_filters,$this->district_id),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+ 'select_district_name' =>
'district_id',
+
+ 'lang_user_statustext' =>
lang('Assigned to'),
+ 'select_user_name'
=> 'user_filter',
+ 'lang_no_user'
=> lang('No user'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2($group_filters,4,$this->user_filter,$this->acl2_location,'',$default='')
+ );
+
+ $appname
= lang('helpdesk');
+ $function_msg =
lang('list ticket');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function add()
+ {
+ if(!$this->acl_add)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $values = get_var('values',array('POST'));
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record',$this->currentapp);
+ $insert_record_entity =
$GLOBALS['phpgw']->session->appsession('insert_record_entity',$this->currentapp);
+
+ for ($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('tts'));
+
+//_debug_array($insert_record);
+ if ($values['save'])
+ {
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+
+/* if(!$values['subject'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please type a subject for this ticket
!'));
+ }
+
+*/ if(!$values['assignedto'] &&
!$values['group_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a person or a group to
handle the ticket !'));
+ }
+
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ }
+
+/* if(!$values['details'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please give som details !'));
+ }
+*/
+ if(!$values['location']['loc1'] &&
!$values['extra']['p_num'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Pleace select a location - or an entity
!'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt = $this->bo->add($values);
+
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
+
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts','');
+ header('Location: '.
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.index'));
+ }
+ else
+ {
+ if($values['location'])
+ {
+ $location_code=implode("-",
$values['location']);
+ $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
+ }
+ if($values['extra']['p_num'])
+ {
+
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
+ }
+ }
+ }
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' => -1,
// calculated from location_types
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' => True,
+ 'lookup_type' => 'form',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('ticket'),
+ 'entity_data' => $values['p']
+ ));
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitts.add'
+ );
+
+ if(!$values['assignedto'])
+ {
+ $values['assignedto']=
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['assigntodefault'];
+ }
+ if(!$values['group_id'])
+ {
+ $values['group_id']=
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['groupdefault'];
+ }
+
+ if(!$values['cat_id'])
+ {
+ $this->cat_id =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_category'];
+ }
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+
$dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+
$dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'lang_dateformat'
=> strtolower($dateformat),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'location_data'
=> $location_data,
+ 'lang_assign_to'
=> lang('Assign to'),
+ 'lang_no_user'
=> lang('Select user'),
+ 'lang_user_statustext' =>
lang('Select the user the selection belongs to. To do not use a user select NO
USER'),
+ 'select_user_name'
=> 'values[assignedto]',
+ 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$values['assignedto'],$this->acl2_location),
+
+ 'lang_group'
=> lang('Group'),
+ 'lang_no_group'
=> lang('No group'),
+ 'group_list'
=>
$this->bocommon->get_group_list('select',$values['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
+ 'select_group_name'
=> 'values[group_id]',
+
+ 'lang_priority'
=> lang('Priority'),
+ 'lang_priority_statustext' =>
lang('Select the priority the selection belongs to.'),
+ 'select_priority_name' =>
'values[priority]',
+ 'priority_list'
=> $this->bo->get_priority_list($values['priority']),
+
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.index'),
+ 'lang_subject'
=> lang('Subject'),
+ 'lang_subject_statustext' =>
lang('Enter the subject of this ticket'),
+
+ 'lang_details'
=> lang('Details'),
+ 'lang_details_statustext' =>
lang('Enter the details of this ticket'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_details'
=> $values['details'],
+ 'value_subject'
=> $values['subject'],
+
+ 'lang_finnish_date'
=> lang('finnish date'),
+ 'value_finnish_date' =>
$values['finnish_date'],
+
+ 'lang_done_statustext' =>
lang('Back to the ticket list'),
+ 'lang_save_statustext' =>
lang('Save the ticket'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'lang_town_statustext' =>
lang('Select the part of town the building belongs to. To do not use a part of
town - select NO PART OF TOWN'),
+ 'lang_part_of_town'
=> lang('Part of town'),
+ 'lang_no_part_of_town' =>
lang('No part of town'),
+ 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
+ 'mailnotification'
=> $this->bo->config->config_data['mailnotification'],
+ 'lang_mailnotification' =>
lang('Send e-mail'),
+ 'lang_mailnotification_statustext' =>
lang('Choose to send mailnotification'),
+ 'pref_send_mail'
=>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_user_mailnotification'],
+ );
+
+//_debug_array($data);
+ $appname
= lang('helpdesk');
+ $function_msg =
lang('add ticket');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add'
=> $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+
+ function view()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $id = get_var('id',array('GET'));
+ $values = get_var('values',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('tts'));
+
+ if($values['save'])
+ {
+ if(!$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=4&acl_location='
. $this->acl2_location);
+ }
+
+ $so2 =
CreateObject($this->currentapp.'.sotts2');
+ $receipt = $so2->update_ticket($values,$id);
+ }
+
+ $ticket = $this->bo->read_single($id);
+
+ $additional_notes =
$this->bo->read_additional_notes($id);
+ $record_history = $this->bo->read_record_history($id);
+
+ $request_link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uirequest.edit',
+ 'bypass' => true,
+ 'location_code' =>
$ticket['location_code'],
+ 'p_num' =>
$ticket['p_num'],
+ 'p_entity_id' =>
$ticket['p_entity_id'],
+ 'p_cat_id' =>
$ticket['p_cat_id'],
+ 'tenant_id' =>
$ticket['tenant_id'],
+ 'origin' => 'tts',
+ 'origin_id' => $id
+ );
+
+ for ($i=0;$i<count($ticket['origin']);$i++)
+ {
+ if($ticket['origin'][$i]['type'] ==
'project')
+ {
+ $order_link_data = array
+ (
+ 'menuaction'
=> $this->currentapp.'.uiproject.edit',
+ 'id'
=> $ticket['origin'][$i]['data'][0]['id']
+ );
+ break;
+ }
+ }
+
+
+ if(!$order_link_data)
+ {
+ $order_link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiproject.edit',
+ 'bypass' => true,
+ 'location_code' =>
$ticket['location_code'],
+ 'p_num' =>
$ticket['p_num'],
+ 'p_entity_id' =>
$ticket['p_entity_id'],
+ 'p_cat_id' =>
$ticket['p_cat_id'],
+ 'tenant_id' =>
$ticket['tenant_id'],
+ 'origin' =>
'tts',
+ 'origin_id' => $id
+ );
+ }
+
+ $form_link = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uitts.view',
+ 'id' => $id
+ );
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ $table_header_additional_notes[] = array
+ (
+ 'lang_count' => '#',
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_note' => lang('Note'),
+ );
+
+//_debug_array($ticket['location_data']);
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$ticket['location_data'],
+ 'type_id' =>
count(explode('-',$ticket['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
$ticket['location_data']['tenant_id'],
+ 'lookup_type' => 'view',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('ticket'),
+ 'entity_data' => $ticket['p']
+ ));
+
+
+ if($ticket['contact_phone'])
+ {
+ for
($i=0;$i<count($location_data['location']);$i++)
+ {
+
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+ {
+
unset($location_data['location'][$i]['value']);
+ }
+ }
+ }
+
+
+ if ($ticket['cat_id'])
+ {
+ $this->cat_id = $ticket['cat_id'];
+ }
+
+
+/*
+ if($ticket['request_id'])
+ {
+ $request_lookup_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uirequest.view'
+ );
+ }
+ if($ticket['project_id'])
+ {
+ $project_lookup_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiproject.view'
+ );
+ }
+
+*/
+ $start_entity =
$this->bocommon->get_start_entity('ticket');
+//_debug_array($start_entity);
+
+ if (isset($start_entity) AND is_array($start_entity))
+ {
+ $i=0;
+ foreach($start_entity as $entry)
+ {
+ $link_entity[$i]['link'] =
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
$this->currentapp.'.uientity.edit',
+ 'bypass'
=> true,
+ 'location_code' =>
$ticket['location_code'],
+ 'entity_id'
=> $entry['id'],
+ 'p_num'
=> $ticket['p_num'],
+ 'p_entity_id' =>
$ticket['p_entity_id'],
+ 'p_cat_id'
=> $ticket['p_cat_id'],
+ 'tenant_id'
=> $ticket['tenant_id'],
+ 'origin'
=> 'tts',
+ 'origin_id'
=> $id
+ ));
+ $link_entity[$i]['name'] =
$entry['name'];
+ $i++;
+ }
+ }
+
+//_debug_array($link_entity);
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+ switch(substr($dateformat,0,1))
+ {
+ case 'M':
+ $dateformat_validate=
"javascript:vDateType='1'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'1')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'1')";
+ break;
+ case 'y':
+
$dateformat_validate="javascript:vDateType='2'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'2')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'2')";
+ break;
+ case 'D':
+
$dateformat_validate="javascript:vDateType='3'";
+ $onKeyUp =
"DateFormat(this,this.value,event,false,'3')";
+ $onBlur =
"DateFormat(this,this.value,event,true,'3')";
+ break;
+ }
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+
+ if (isset($ticket['origin']) AND
is_array($ticket['origin']))
+ {
+ for ($i=0;$i<count($ticket['origin']);$i++)
+ {
+
$ticket['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp
. $ticket['origin'][$i]['link']);
+
if(substr($ticket['origin'][$i]['type'],0,6)=='entity')
+ {
+ $type =
explode("_",$ticket['origin'][$i]['type']);
+ $entity_id = $type[1];
+ $cat_id = $type[2];
+
+ if(!is_object($boadmin_entity))
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'.boadmin_entity');
+ }
+ $entity_category =
$boadmin_entity->read_single_category($entity_id,$cat_id);
+ $ticket['origin'][$i]['descr']
= $entity_category['name'];
+ }
+ else
+ {
+ $ticket['origin'][$i]['descr']=
lang($ticket['origin'][$i]['type']);
+ }
+ }
+ }
+
+ $data = array
+ (
+ 'value_origin'
=> $ticket['origin'],
+ 'value_origin_type'
=> $origin,
+ 'value_origin_id'
=> $origin_id,
+
+ 'lang_dateformat'
=> strtolower($dateformat),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
+ 'lang_finnish_date'
=> lang('finnish date'),
+ 'value_finnish_date' =>
$ticket['finnish_date'],
+
+ 'link_entity'
=> $link_entity,
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+
+ 'lang_request'
=> lang('Request'),
+ 'lang_request_statustext' =>
lang('Link to the request originatet from this ticket'),
+ 'link_request'
=> $GLOBALS['phpgw']->link('/index.php',$request_lookup_data),
+ 'value_request_id'
=> $ticket['request_id'],
+
+ 'lang_project'
=> lang('Project'),
+ 'lang_project_statustext' =>
lang('Link to the project originatet from this ticket'),
+ 'link_project'
=> $GLOBALS['phpgw']->link('/index.php',$project_lookup_data),
+ 'value_project_id'
=> $ticket['project_id'],
+
+ 'location_data'
=> $location_data,
+ 'lang_location_code' =>
lang('Location Code'),
+
+ 'lang_ticket'
=> lang('Ticket'),
+ 'table_header_additional_notes' =>
$table_header_additional_notes,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_status'
=> lang('Status'),
+ 'status_name'
=> 'values[status]',
+ 'status_list'
=> $this->bo->get_status_list($ticket['status']),
+ 'lang_status_statustext' =>
lang('Set the status of the ticket'),
+
+ 'lang_no_user'
=> lang('Select user'),
+ 'lang_user_statustext' =>
lang('Select the user the selection belongs to. To do not use a user select NO
USER'),
+ 'select_user_name'
=> 'values[assignedto]',
+ 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$ticket['assignedto'],$this->acl2_location),
+
+ 'lang_group'
=> lang('Group'),
+ 'lang_no_group'
=> lang('No group'),
+ 'group_list'
=>
$this->bocommon->get_group_list('select',$ticket['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
+ 'select_group_name'
=> 'values[group_id]',
+
+ 'lang_priority'
=> lang('Priority'),
+ 'value_priority'
=> $ticket['priority'],
+ 'lang_priority_statustext' =>
lang('Select the priority the selection belongs to.'),
+ 'select_priority_name' =>
'values[priority]',
+ 'priority_list'
=> $this->bo->get_priority_list($ticket['priority']),
+
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
+ 'lang_category'
=> lang('category'),
+ 'value_category_name' =>
$ticket['category_name'],
+
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$form_link),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitts.index'),
+ 'value_subject'
=> $ticket['subject'],
+ 'lang_subject_statustext' =>
lang('update subject'),
+ 'value_id'
=> '[ #'. $id . ' ] - ',
+
+ 'lang_details'
=> lang('Details'),
+ 'value_details'
=> $ticket['details'],
+ 'lang_details_statustext' =>
lang('Add new comments'),
+
+ 'lang_additional_notes' =>
lang('Additional notes'),
+
+ 'lang_new_note'
=> lang('New Note'),
+ 'lang_opendate'
=> lang('Open Date'),
+ 'value_opendate'
=> $ticket['timestampopened'],
+
+ 'lang_assignedfrom'
=> lang('Assigned from'),
+ 'value_assignedfrom' =>
$ticket['user_name'],
+ 'lang_assignedto'
=> lang('Assigned to'),
+ 'value_assignedto'
=> $ticket['assignedto_name'],
+
+ 'lang_no_additional_notes' =>
lang('No additional notes'),
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history for this record'),
+ 'additional_notes'
=> $additional_notes,
+ 'record_history'
=> $record_history,
+ 'request_link'
=> $GLOBALS['phpgw']->link('/index.php',$request_link_data),
+ 'order_link'
=> $GLOBALS['phpgw']->link('/index.php',$order_link_data),
+
+ 'lang_generate_request' =>
lang('Generate Request'),
+ 'lang_generate_request_statustext'
=> lang('Klick this to generate a request with this information'),
+ 'lang_generate_order' =>
lang('Generate order'),
+ 'lang_generate_order_statustext'
=> lang('Klick this to generate an order with this information'),
+
+ 'lang_save'
=> lang('save'),
+ 'lang_name'
=> lang('name'),
+ 'lang_done'
=> lang('done'),
+ 'lang_contact_phone' =>
lang('Contact phone'),
+ 'contact_phone'
=> $ticket['contact_phone'],
+ 'mailnotification'
=> $this->bo->config->config_data['mailnotification'],
+ 'lang_mailnotification' =>
lang('Send e-mail'),
+ 'lang_mailnotification_statustext' =>
lang('Choose to send mailnotification'),
+ 'pref_send_mail'
=>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_user_mailnotification'],
+ );
+
+ $appname
= lang('helpdesk');
+ $function_msg =
lang('view ticket detail');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/class.uiwo_hour.inc.php
diff -u property/inc/class.uiwo_hour.inc.php:1.17
property/inc/class.uiwo_hour.inc.php:1.18
--- property/inc/class.uiwo_hour.inc.php:1.17 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uiwo_hour.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1681 +1,1681 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.uiwo_hour.inc.php,v 1.17 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uiwo_hour
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'tender' => True,
- 'view' => True,
- 'template' => True,
- 'save_template' => True,
- 'prizebook' => True,
- 'add' => True,
- 'edit' => True,
- 'delete' => True,
- 'deviation' => True,
- 'edit_deviation'=> True
- );
-
- function uiwo_hour()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->create_html =
CreateObject('phpgwapi.xslttemplates');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.bowo_hour',True);
- $this->boworkorder =
CreateObject($this->currentapp.'.boworkorder');
- $this->boproject =
CreateObject($this->currentapp.'.boproject');
- $this->bopricebook =
CreateObject($this->currentapp.'.bopricebook');
-
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
- $this->config =
CreateObject('phpgwapi.config');
-
- $this->config->read_repository();
-
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.project';
- $this->acl_read =
$this->acl2->check('.project',1);
- $this->acl_add =
$this->acl2->check('.project',2);
- $this->acl_edit =
$this->acl2->check('.project',4);
- $this->acl_delete =
$this->acl2->check('.project',8);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->chapter_id =
$this->bo->chapter_id;
- $this->allrows =
$this->bo->allrows;
-
- $this->menu->sub ='project';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' =>
$this->filter,
- 'cat_id' =>
$this->cat_id,
- 'chapter_id' => $this->chapter_id,
- 'allrows' =>
$this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
- function deviation()
- {
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
- $hour_id =
get_var('hour_id',array('POST','GET'));
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour'));
- $list =
$this->bo->read_deviation(array('workorder_id'=>$workorder_id,'hour_id'=>$hour_id));
-
- $sum_deviation = 0;
-
- if (isset($list) AND is_array($list))
- {
- $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- foreach($list as $entry)
- {
- $sum_deviation = $sum_deviation +
$entry['amount'];
-
- $entry_date =
(isset($entry['entry_date'])?$GLOBALS['phpgw']->common->show_date($entry['entry_date'],$dateformat):'');
-
- $content[] = array
- (
- 'id'
=> $entry['id'],
- 'amount'
=> $entry['amount'],
- 'descr'
=> $entry['descr'],
- 'entry_date'
=> $entry_date,
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.edit_deviation&workorder_id='
. $workorder_id . '&hour_id=' . $hour_id . '&id=' . $entry['id']),
- 'lang_edit_statustext'
=> lang('edit the deviation'),
- 'text_edit'
=> lang('edit'),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.delete&workorder_id='
. $workorder_id . '&hour_id=' . $hour_id . '&deviation_id=' . $entry['id']),
- 'lang_delete_statustext'
=> lang('delete the deviation'),
- 'text_delete'
=> lang('delete'),
- );
- }
- }
-
-
- $table_header[] = array
- (
- 'lang_id' => lang('ID'),
- 'lang_amount' => lang('amount'),
- 'lang_descr' => lang('Descr'),
- 'lang_date' => lang('date'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete')
- );
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.edit_deviation',
- 'workorder_id' =>$workorder_id,
- 'hour_id'
=>$hour_id
- );
-
-
- $data = array
- (
- 'sum_deviation'
=> $sum_deviation,
- 'table_header_deviation' =>
$table_header,
- 'values_deviation'
=> $content,
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' =>
lang('add a deviation'),
- 'add_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_done'
=> lang('done'),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
- );
-
- $appname =
lang('Workorder');
- $function_msg = lang('list
deviation');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_deviation' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function edit_deviation()
- {
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
- $hour_id =
get_var('hour_id',array('POST','GET'));
- $id =
get_var('id',array('POST','GET'));
- $values =
get_var('values',array('POST','GET'));
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour'));
-
- if ($values['save'])
- {
- $values['workorder_id']=$workorder_id;
- $values['hour_id']=$hour_id;
- if (!$values['amount'])
- {
- $receipt['error'][] =
array('msg'=>lang('amount not entered!'));
- }
-
- if($id)
- {
- $values['id']=$id;
- $action='edit';
- }
-
- if (!$receipt['error'])
- {
- $receipt =
$this->bo->save_deviation($values,$action);
- if(!$id)
- {
- $id=$receipt['id'];
- }
- }
- else
- {
- $receipt['error'][] = array('msg'=>
lang('Status has NOT been saved'));
- }
-
- }
-
- if ($id)
- {
- $values =
$this->bo->read_single_deviation(array('workorder_id'=>$workorder_id,'hour_id'=>$hour_id,'id'=>$id));
- $function_msg = lang('edit deviation');
- $action='edit';
- }
- else
- {
- $function_msg = lang('add deviation');
- $action='add';
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.edit_deviation',
- 'entity_id' => $this->entity_id,
- 'cat_id' => $this->cat_id,
- 'id' => $id
- );
-
- $hour = $this->bo->read_single_hour($hour_id);
-
-//_debug_array($workorder);
-//_debug_array($hour);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $entry_date =
(isset($values['entry_date'])?$GLOBALS['phpgw']->common->show_date($values['entry_date'],$dateformat):'');
-
- $data = array
- (
- 'lang_workorder'
=> lang('Workorder ID'),
- 'lang_hour_id'
=> lang('Post'),
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.deviation&workorder_id='
. $workorder_id . '&hour_id=' . $hour_id),
- 'lang_id'
=> lang('deviation ID'),
- 'lang_descr'
=> lang('Descr'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_date'
=> lang('date'),
- 'value_id'
=> $id,
- 'value_workorder_id' =>
$workorder_id,
- 'value_hour_id'
=> $hour_id,
- 'entry_date'
=> $entry_date,
- 'value_id'
=> $id,
- 'lang_descr_standardtext' =>
lang('Enter a description of the deviation'),
- 'lang_done_standardtext' =>
lang('Back to the list'),
- 'lang_save_standardtext' =>
lang('Save the deviation'),
- 'lang_amount'
=> lang('amount'),
- 'value_amount'
=> $values['amount'],
- 'value_descr'
=> $values['descr']
- );
-
- $appname
= lang('workorder');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_deviation' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function common_data($workorder_id,$view='')
- {
-
- $workorder =
$this->boworkorder->read_single($workorder_id);
-/* if
(!$this->bocommon->check_perms($workorder['grants'],PHPGW_ACL_EDIT))
- {
- $receipt['error'][]=array('msg'=>lang('You have
no edit right for this project'));
-
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view&id='
. $workorder_id);
- }
-*/
- $hour_list = $this->bo->read($workorder_id);
-//_debug_array($hour_list);
- $grouping_descr_old='';
-
- if (isset($hour_list) AND is_array($hour_list))
- {
- foreach($hour_list as $hour)
- {
- $sum_hour = $sum_hour +
$hour['cost'];
- $sum_deviation = $sum_deviation +
$hour['deviation'];
-
-
if($hour['grouping_descr']!=$grouping_descr_old)
- {
- $new_grouping = true;
- }
- else
- {
- $new_grouping = false;
- }
-
- $grouping_descr_old =
$hour['grouping_descr'];
-
- if($hour['activity_num'])
- {
- $code = $hour['activity_num'];
- }
- else
- {
- $code =
str_replace("-",$hour['tolerance'],$hour['ns3420_id']);
- }
-
- if($hour['count_deviation'] || $view)
- {
- $deviation=$hour['deviation'];
- }
- else
- {
- $deviation=lang('edit');
- }
-
- $content[] = array
- (
-
- 'post'
=> sprintf("%02s",$workorder['chapter_id']) . '.' .
sprintf("%02s",$hour['building_part']) . '.' .
sprintf("%02s",$hour['grouping_id']) . '.' . sprintf("%03s",$hour['record']),
- 'hour_id'
=> $hour['hour_id'],
- 'activity_num'
=> $hour['activity_num'],
- 'hours_descr'
=> $hour['hours_descr'],
- 'activity_descr'
=> $hour['activity_descr'],
- 'new_grouping'
=> $new_grouping,
- 'grouping_id'
=> $hour['grouping_id'],
- 'grouping_descr'
=> $hour['grouping_descr'],
- 'ns3420_id'
=> $hour['ns3420_id'],
- 'code'
=> $code,
- 'remark'
=> $hour['remark'],
- 'building_part'
=> $hour['building_part'],
- 'quantity'
=> $hour['quantity'],
- 'cost'
=> $hour['cost'],
- 'unit'
=> $hour['unit'],
- 'billperae'
=> $hour['billperae'],
- 'deviation'
=> $deviation,
- 'result'
=> ($hour['deviation']+$hour['cost']),
- 'wo_hour_category'
=> $hour['wo_hour_category'],
- 'link_deviation'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.deviation&workorder_id='
. $workorder_id . '&hour_id=' . $hour['hour_id']),
- 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.edit&workorder_id='
. $workorder_id . '&hour_id=' . $hour['hour_id']),
- 'lang_edit_statustext'
=> lang('edit/customise this hour'),
- 'lang_delete_statustext'
=> lang('delete this hour'),
- 'text_edit'
=> lang('edit'),
- 'text_delete'
=> lang('delete')
- );
- }
- }
-
-
$this->bo->update_deviation(array('workorder_id'=>$workorder_id,'sum_deviation'=>$sum_deviation));
-
-//_debug_array($content);
-
- $table_header[] = array
- (
- 'lang_post' => lang('Post'),
- 'lang_code' => lang('Code'),
- 'lang_descr' => lang('descr'),
- 'lang_unit' => lang('Unit'),
- 'lang_billperae' => lang('Bill per
unit'),
- 'lang_quantity' => lang('Quantity'),
- 'lang_cost' => lang('cost'),
- 'lang_deviation ' => lang('deviation'),
- 'lang_result' => lang('result'),
- 'lang_view' => lang('view'),
- 'lang_edit' => lang('edit'),
- 'lang_delete' => lang('delete'),
- 'lang_category' => lang('category')
- );
-
- $tax = $this->config->config_data['fm_tax'];
-
- $sum_result = $sum_hour+$sum_deviation;
-
- $addition_percentage = $sum_result *
$workorder['addition_percentage']/100;
- $sum_tax = ($sum_result + $addition_percentage +
$workorder['addition_rs'])*$tax/100;
- $total_sum = $sum_result + $addition_percentage +
$workorder['addition_rs'] + $sum_tax;
-
-
$this->bo->update_calculation(array('workorder_id'=>$workorder_id,'calculation'=>($sum_result+$addition_percentage
+ $workorder['addition_rs'])));
-
- $table_sum[] = array
- (
- 'lang_sum_calculation' =>
lang('Sum calculation'),
- 'value_sum_calculation' =>
number_format($sum_hour, 2, ',', ''),
- 'lang_addition_rs'
=> lang('Rig addition'),
- 'value_addition_rs'
=> number_format($workorder['addition_rs'], 2, ',', ''),
- 'lang_addition_percentage' =>
lang('Percentage addition'),
- 'value_addition_percentage' =>
number_format($addition_percentage, 2, ',', ''),
- 'lang_sum_tax'
=> lang('Sum tax'),
- 'value_sum_tax'
=> number_format($sum_tax, 2, ',', ''),
- 'lang_total_sum'
=> lang('Total sum'),
- 'value_total_sum'
=> number_format($total_sum, 2, ',', ''),
- 'lang_sum_deviation' =>
lang('Sum deviation'),
- 'sum_deviation'
=> number_format($sum_deviation, 2, ',', ''),
- 'sum_result'
=> number_format($sum_result, 2, ',', '')
- );
-
- $workorder_data = array(
- 'link_workorder'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&id='
. $workorder_id),
- 'lang_vendor_name'
=> lang('Vendor'),
- 'vendor_name'
=> $workorder['vendor_name'],
- 'vendor_email'
=> $workorder['vendor_email'],
- 'descr'
=> $workorder['descr'],
-
- 'lang_workorder_id'
=> lang('Workorder ID'),
- 'workorder_id'
=> $workorder['workorder_id'],
- 'lang_project_id'
=> lang('Project ID'),
- 'link_project'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
. $workorder['project_id']),
- 'project_id'
=> $workorder['project_id'],
-
- 'lang_workorder_title' =>
lang('Workorder title'),
- 'workorder_title'
=> $workorder['title']
- );
-
-
-
- $common_data = array(
- 'content' =>
$content,
- 'total_hours_records' => count($content),
- 'table_header' =>
$table_header,
- 'table_sum' => $table_sum,
- 'workorder' => $workorder,
- 'workorder_data' =>
$workorder_data,
- );
-
- return $common_data;
- }
-
- function save_template()
- {
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour',
-
'menu'));
-
- $values =
get_var('values',array('POST'));
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
-
- if($values['name'])
- {
- $receipt =
$this->bo->add_template($values,$workorder_id);
- }
-
- $common_data=$this->common_data($workorder_id);
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.index',
- 'workorder_id' => $workorder_id
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'done_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'add_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.save_template&workorder_id='
. $workorder_id),
-
- 'lang_done_statustext' =>
lang('Back to the workorder list'),
- 'lang_add_statustext' =>
lang('Adds this workorders calculation as a template for later use'),
- 'lang_search_statustext' =>
lang('Adds a new workorder to an existing project'),
-
- 'lang_done'
=> lang('Done'),
- 'lang_add'
=> lang('Add'),
- 'lang_search'
=> lang('Search'),
-
- 'lang_name'
=> lang('name'),
- 'lang_name_statustext' => lang('Enter
the name the template'),
-
- 'lang_descr'
=> lang('Description'),
- 'lang_descr_statustext' => lang('Enter
a short description of this template'),
-
- 'total_hours_records' =>
$common_data['total_hours_records'],
- 'lang_total_records' =>
lang('Total records'),
- 'table_header_hour'
=> $common_data['table_header'],
- 'values_hour'
=> $common_data['content'],
- 'workorder_data'
=> $common_data['workorder_data']
- );
-
- $appname
= lang('Workorder');
- $function_msg =
lang('Add template');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add_template' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour','menu'));
-
- $delete = get_var('delete',array('POST','GET'));
- $hour_id = get_var('hour_id',array('POST','GET'));
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
- $links = $this->menu->links();
-
- if($delete && $hour_id)
- {
- $receipt =
$this->bo->delete($hour_id,$workorder_id);
- }
-
- $common_data=$this->common_data($workorder_id);
-
- $table_add[] = array
- (
- 'lang_add_prizebook'
=> lang('Add from prizebook'),
- 'lang_add_prizebook_statustext' =>
lang('add items from this vendors prizebook'),
- 'add_prizebook_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.prizebook&workorder_id='
. $workorder_id),
-
- 'lang_add_template'
=> lang('Add from template'),
- 'lang_add_template_statustext' =>
lang('add items from a predefined template'),
- 'add_template_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.index&lookup=true&workorder_id='
. $workorder_id),
-
- 'lang_add_custom'
=> lang('Add custom'),
- 'lang_add_custom_statustext' =>
lang('Add single custom line'),
- 'add_custom_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.edit&from=index&workorder_id='
. $workorder_id),
-
- 'lang_save_template'
=> lang('Save as template'),
- 'lang_save_template_statustext' =>
lang('Save this workorder as a template for later use'),
- 'save_template_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.save_template&from=index&workorder_id='
. $workorder_id),
-
- 'lang_print_view'
=> lang('Print view'),
- 'lang_print_view_statustext' =>
lang('View the complete workorder'),
- 'print_view_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.view&from=index&workorder_id='
. $workorder_id),
-
- 'lang_view_tender'
=> lang('View tender'),
- 'lang_view_tender_statustext' =>
lang('View the complete workorder as a tender for bidding'),
- 'view_tender_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.tender&from=index&workorder_id='
. $workorder_id),
-
- 'lang_show_cost'
=> lang('Show calculated cost'),
- 'lang_show_cost_statustext'
=> lang('Show calculated cost on the printview'),
-
- 'lang_show_details'
=> lang('Show details'),
- 'lang_show_details_statustext' =>
lang('Show details'),
-
- 'lang_mark_draft'
=> lang('Mark as DRAFT'),
- 'lang_mark_draft_statustext' =>
lang('Mark the tender as DRAFT')
-
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&delete=true&workorder_id='
. $workorder_id),
- 'function'
=> 'index',
- 'links'
=> $links,
- 'num_records'
=> count($hours_list),
- 'total_hours_records' =>
$common_data['total_hours_records'],
- 'lang_total_records' =>
lang('Total records'),
- 'table_header_hour'
=> $common_data['table_header'],
- 'values_hour'
=> $common_data['content'],
- 'workorder_data'
=> $common_data['workorder_data'],
- 'table_add'
=> $table_add,
- 'table_sum'
=> $common_data['table_sum']
- );
-
-//_debug_array($common_data['content']);
-
- $appname
= lang('Workorder');
- $function_msg =
lang('list hours');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_hour' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour','menu'));
-
- $show_cost =
get_var('show_cost',array('POST','GET'));
- $show_details =
get_var('show_details',array('POST','GET'));
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
- $to_email =
get_var('to_email',array('POST','GET'));
- $update_email =
get_var('update_email',array('POST','GET'));
- $send_order =
get_var('send_order',array('POST','GET'));
- $no_email =
get_var('no_email',array('POST','GET'));
-
- if($update_email)
- {
-
$this->bo->update_email($to_email,$workorder_id);
- }
- $workorder =
$this->boworkorder->read_single($workorder_id);
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
-
- $common_data =
$this->common_data($workorder_id);
- if($show_details)
- {
- $values_hour =
$common_data['content'];
- }
- $project =
$this->boproject->read_single($common_data['workorder']['project_id']);
-
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$project['location_data'],
- 'type_id' =>
count(explode('-',$project['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
$project['location_data']['tenant_id'],
- 'lookup_type' => 'view'
- ));
-
- if($project['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
unset($location_data['location'][$i]['value']);
- }
- }
- }
-
- if(!$show_cost)
- {
- $m = count($values_hour);
- for ($i=0;$i<$m;$i++)
- {
- unset($values_hour[$i]['cost']);
- unset($values_hour[$i]['billperae']);
- }
-
unset($common_data['table_sum'][0]['value_total_sum']);
- }
-
- $table_header[] = array
- (
- 'lang_post' => lang('Post'),
- 'lang_code' => lang('Code'),
- 'lang_descr' => lang('descr'),
- 'lang_unit' => lang('Unit'),
- 'lang_billperae' => lang('Bill per
unit'),
- 'lang_quantity' => lang('Quantity'),
- 'lang_cost' => lang('cost')
- );
-
-
- $table_send[] = array
- (
- 'lang_send_order'
=> lang('Send Order'),
- 'lang_send_order_statustext' => lang('Send
this order by email')
- );
-
- $table_done[] = array
- (
- 'lang_done'
=> lang('Done'),
- 'lang_done_statustext' =>
lang('Back to calculation'),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
- );
-
- $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $date
= $GLOBALS['phpgw']->common->show_date(time(),$dateformat);
-
- $from_name =
$GLOBALS['phpgw_info']['user']['fullname'];
- $from_email =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
-
- $email_data = array
- (
- 'location_data'
=> $location_data,
- 'lang_workorder'
=> lang('Workorder ID'),
- 'workorder_id'
=> $workorder_id,
-
- 'lang_date'
=> lang('Date'),
- 'date'
=> $date,
-
- 'lang_start_date'
=> lang('Start date'),
- 'start_date'
=> $workorder['start_date'],
-
- 'lang_end_date'
=> lang('End date'),
- 'end_date'
=> $workorder['end_date'],
-
- 'lang_from'
=> lang('From'),
- 'from_name'
=> $from_name,
- 'from_email'
=> $from_email,
- 'from_phone'
=>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['cellphone'],
- 'lang_district'
=> lang('District'),
- 'district'
=> $project['location_data']['district_id'],
-
- 'lang_to'
=> lang('To'),
- 'to_name'
=> $workorder['vendor_name'],
-
- 'lang_title'
=> lang('Title'),
- 'title'
=> $workorder['title'],
-
- 'lang_descr'
=> lang('Description'),
- 'descr'
=> $workorder['descr'],
-
- 'lang_budget_account' =>
lang('Budget account'),
- 'budget_account'
=> $workorder['b_account_id'],
-
- 'lang_sum_calculation' =>
lang('Sum of calculation'),
- 'sum_calculation'
=> $common_data['table_sum'][0]['value_total_sum'],
-
- 'lang_contact_phone' =>
lang('Contact phone'),
- 'contact_phone'
=> $project['contact_phone'],
-
-// 'lang_vendor'
=> lang('vendor'),
-
- 'lang_branch'
=> lang('branch'),
- 'branch_list'
=> $this->boproject->select_branch_p_list($project['project_id']),
- 'other_branch'
=> $project['other_branch'],
-
- 'key_responsible_list' =>
$this->boproject->select_branch_list($project['key_responsible']),
- 'lang_key_responsible' =>
lang('key responsible'),
-
- 'key_fetch_list'
=> $this->boproject->select_key_location_list($workorder['key_fetch']),
- 'lang_key_fetch'
=> lang('Where to pick up the key'),
-
- 'key_deliver_list'
=> $this->boproject->select_key_location_list($workorder['key_deliver']),
- 'lang_key_deliver'
=> lang('Where to deliver the key'),
-
- 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
-
- 'lang_cost_tax'
=> lang('Cost (incl tax):'),
- 'lang_materials'
=> lang('Materials:__________'),
- 'lang_work'
=> lang('work:____________'),
-
- 'table_header_view_order' =>
$table_header,
- 'values_view_order'
=> $values_hour
- );
-
-
- if($send_order && !$to_email)
- {
-
$receipt['error'][]=array('msg'=>lang('No mailaddress is selected'));
- }
-
- if($to_email)
- {
-
$this->create_html->add_file(array(PHPGW_SERVER_ROOT . SEP . $this->currentapp
. SEP . 'templates' . SEP . 'default' . SEP . 'wo_hour'));
-
$this->create_html->add_file(array(PHPGW_SERVER_ROOT . SEP . $this->currentapp
. SEP . 'templates' . SEP . 'default' . SEP . 'location_view'));
-
-
$this->create_html->set_var('phpgw',array('email_data' => $email_data));
-
- $this->create_html->xsl_parse();
- $this->create_html->xml_parse();
- $xsltproc = xslt_create();
- $arguments = array('/_xml' =>
$this->create_html->xmldata, '/_xsl' => $this->create_html->xsldata);
- $html =
xslt_process($xsltproc,'arg:/_xml','arg:/_xsl',NULL,$arguments);
- xslt_free($xsltproc);
-
-// print $html;
-
- $headers = "Return-Path: <". $from_email
.">\r\n";
- $headers .= "From: " . $from_name . "<" .
$from_email .">\r\n";
-
if($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['order_email_rcpt']==1)
- {
- $headers .= "Bcc: " . $from_name . "<"
. $from_email .">\r\n";
- $bcc = $from_email;
- }
- $headers .= "Content-type: text/html;
charset=iso-8859-1\r\n";
- $headers .= "MIME-Version: 1.0\r\n";
- $subject = lang('Workorder').": ".$workorder_id;
-
- $mail_method=
$this->config->config_data['fmwrkorder_mail'];
-
- if ($mail_method=='smtp'):
- {
- $send = CreateObject('phpgwapi.send');
- $rcpt = $send->msg('email', $to_email,
$subject, $html, '', $cc, $bcc, $from_email, $from_name, 'html');
- }
- elseif ($mail_method=='sendmail'):
- {
- $rcpt=mail($to_email,$subject,$html,
$headers);
- }
- else:
- {
-
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin
section)'));
- }
- endif;
-
- if ($rcpt)
- {
- $historylog =
CreateObject($this->currentapp.'.historylog','workorder');
-
$historylog->add('M',$workorder_id,$to_email);
-
$receipt['message'][]=array('msg'=>lang('Workorder is sent by email!'));
- }
- else
- {
-
$receipt['error'][]=array('msg'=>lang('The recipient did not get the email:'));
-
$receipt['error'][]=array('msg'=>lang('From') . ' ' . $from_email);
-
$receipt['error'][]=array('msg'=>lang('To') . ' ' . $to_email);
- }
- }
-
- $workorder_history =
$this->boworkorder->read_record_history($workorder_id);
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $email_list =
$this->bo->get_email($to_email,$workorder['vendor_id']);
- if(count($email_list)==1)
- {
- $to_email= $email_list[0]['email'];
- unset($email_list);
- }
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'lang_mail'
=> lang('E-Mail'),
- 'lang_update_email'
=> lang('Update email'),
- 'lang_update_email_statustext' =>
lang('Check to update the email-address for this vendor'),
- 'lang_to_email_address_statustext' =>
lang('The address to which this order will be sendt'),
- 'to_email'
=> $to_email,
- 'email_list'
=> $email_list,
- 'lang_select_email'
=> lang('Select email'),
- 'send_order_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.view&send=true&workorder_id='
. $workorder_id . '&show_details=' . $show_details),
-
- 'lang_no_history'
=> lang('No history'),
- 'lang_history'
=> lang('History'),
- 'workorder_history'
=> $workorder_history,
- 'table_header_history' =>
$table_header_history,
- 'email_data'
=> $email_data,
- 'no_email'
=> $no_email,
- 'table_send'
=> $table_send,
- 'table_done'
=> $table_done
- );
-
-//_debug_array($data);
-
- $appname
= lang('Workorder');
- $function_msg =
lang('Send order');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
-
- $this->save_sessiondata();
- }
-
-
- function tender()
- {
- $GLOBALS['phpgw_info']['flags'][noheader] = True;
- $GLOBALS['phpgw_info']['flags'][nofooter] = True;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
-
- $pdf =
CreateObject($this->currentapp.'.pdf');
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
- $show_cost = get_var('show_cost',array('POST','GET'));
- $mark_draft = get_var('mark_draft',array('POST','GET'));
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
-
- $common_data =
$this->common_data($workorder_id);
- $values_hour = $common_data['content'];
- $project =
$this->boproject->read_single($common_data['workorder']['project_id']);
-
- $grouping_descr_old = '';
-
- if (isSet($values_hour) AND is_array($values_hour))
- {
- foreach($values_hour as $hour)
- {
- $descr= $hour['hours_descr'];
-
- if($hour['remark'])
- {
- $descr .= "\n" .
$hour['remark'];
- }
-
- if(!$show_cost)
- {
- unset($hour['billperae']);
- unset($hour['cost']);
- }
-
-
if($hour['grouping_descr']!=$grouping_descr_old)
- {
- $content[] = array
- (
- lang('post')
=> $hour['grouping_descr'],
- lang('code')
=> '',
- lang('descr')
=> '',
- lang('unit')
=> '',
- lang('quantity')
=> '',
- lang('bill per unit')
=> '',
- lang('cost')
=> ''
- );
- }
-
- $grouping_descr_old =
$hour['grouping_descr'];
-
- $content[] = array
- (
- lang('post')
=> $hour['post'],
- lang('code')
=> $hour['code'],
- lang('descr')
=> $descr,
- lang('unit')
=> $hour['unit'],
- lang('quantity')
=> $hour['quantity'],
- lang('bill per unit')
=> $hour['billperae'],
- lang('cost')
=> $hour['cost']
- );
- }
- }
-
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $date =
$GLOBALS['phpgw']->common->show_date('',$dateformat);
-
- // don't want any warnings turning up in the pdf code
if the server is set to 'anal' mode.
- //error_reporting(7);
- //error_reporting(E_ALL);
- set_time_limit(1800);
- $pdf -> ezSetMargins(50,70,50,50);
- $pdf->selectFont(PHPGW_APP_INC .
'/pdf/fonts/Helvetica.afm');
-
- // put a line top and bottom on all the pages
- $all = $pdf->openObject();
- $pdf->saveState();
- $pdf->setStrokeColor(0,0,0,1);
- $pdf->line(20,40,578,40);
- $pdf->line(20,822,578,822);
- $pdf->addText(50,823,6,lang('Chapter') . ' '
.$common_data['workorder']['chapter_id'] . ' ' .
$common_data['workorder']['chapter'] );
- $pdf->addText(50,34,6,'BBB');
- $pdf->addText(300,34,6,$date);
- if($mark_draft)
- {
- $pdf->setColor(1,0,0);
- // $pdf->setColor(66,66,99);
- $pdf->addText(200,400,40,lang('DRAFT'),-10);
- $pdf->setColor(1,0,0);
- }
- $pdf->restoreState();
- $pdf->closeObject();
- // note that object can be told to appear on just odd
or even pages by changing 'all' to 'odd'
- // or 'even'.
- $pdf->addObject($all,'all');
-
- $pdf->ezSetDy(-100);
-
-
- $pdf->ezStartPageNumbers(500,28,10,'right','{PAGENUM} '
. lang('of') . ' {TOTALPAGENUM}',1);
-
- $pdf->ezText($project['name'],20);
- $pdf->ezText($project['descr'],14);
- $pdf->ezSetDy(-50);
- $pdf->ezText(lang('Order') . ': ' . $workorder_id . ' '
.$common_data['workorder']['title'],14);
- $pdf->ezText(lang('Chapter') . ' '
.$common_data['workorder']['chapter_id'] . ' ' .
$common_data['workorder']['chapter'] ,14);
-
- if(is_array($values_hour))
- {
- $pdf->ezNewPage();
- $pdf->ezTable($content,'',$project['name'],
-
array('xPos'=>70,'xOrientation'=>'right','width'=>500,0,'shaded'=>0,'fontSize'
=> 8,'showLines'=> 2,'titleFontSize' => 12,'outerLineThickness'=>2
- ,'cols'=>array(
- lang('bill per
unit')=>array('justification'=>'right','width'=>50)
-
,lang('quantity')=>array('justification'=>'right','width'=>50)
-
,lang('cost')=>array('justification'=>'right','width'=>50)
-
,lang('unit')=>array('width'=>40)
-
,lang('descr')=>array('width'=>120))
- ));
- }
-
- // $pdf->ezStream();
- $document= $pdf->ezOutput();
- $size=strlen($document);
-
- $browser = CreateObject('phpgwapi.browser');
-
$browser->content_header('tender.pdf','application/pdf',$size);
-
- echo $document;
- }
-
- function prizebook()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $delete = get_var('delete',array('POST','GET'));
- $hour_id = get_var('hour_id',array('POST','GET'));
-
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
- $values = get_var('values',array('POST'));
-//_debug_array($values);
-
- if($delete && $hour_id)
- {
- $receipt =
$this->bo->delete($hour_id,$workorder_id);
- }
-
-
- if($values['add'])
- {
-
$receipt=$this->bo->add_hour($values,$workorder_id);
- }
-
- $links = $this->menu->links();
-
- $common_data=$this->common_data($workorder_id);
-
- $workorder = $common_data['workorder'];
-
- if($workorder['vendor_id'])
- {
- $this->bopricebook->cat_id =
$workorder['vendor_id'];
- $this->bopricebook->start = $this->start;
- $this->bopricebook->query = $this->query;
- $pricebook_list = $this->bopricebook->read();
- }
-
-//_debug_array($pricebook_list);
- $i=0;
- while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
- {
- $content_prizebook[] = array
- (
- 'counter'
=> $i,
- 'activity_id' =>
$pricebook['activity_id'],
- 'num'
=> $pricebook['num'],
- 'branch'
=> $pricebook['branch'],
- 'vendor_id'
=> $pricebook['vendor_id'],
- 'm_cost'
=> $pricebook['m_cost'],
- 'w_cost'
=> $pricebook['w_cost'],
- 'total_cost' =>
$pricebook['total_cost'],
- 'this_index' =>
$pricebook['this_index'],
- 'unit'
=> $pricebook['unit'],
- 'descr'
=> $pricebook['descr'],
- 'base_descr' =>
$pricebook['base_descr']
- );
-
- $i++;
- }
-
- $table_header_prizebook[] = array
- (
- 'sort_num' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'num',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiwo_hour.prizebook',
-
'workorder_id'
=>$workorder_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_num' =>
lang('Activity Num'),
- 'lang_branch' => lang('Branch'),
- 'lang_vendor' => lang('Vendor'),
- 'lang_select' => lang('Select'),
- 'lang_total_cost' => lang('Total Cost'),
- 'lang_descr' => lang('Description'),
- 'lang_base_descr' => lang('Base'),
- 'lang_m_cost' => lang('Material
cost'),
- 'lang_w_cost' => lang('Labour cost'),
- 'lang_unit' => lang('Unit'),
- 'lang_quantity' => lang('Quantity'),
-
- 'lang_view' => lang('view'),
- 'lang_edit' => lang('edit'),
- 'sort_total_cost' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'total_cost',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiwo_hour.prizebook',
-
'workorder_id'
=>$workorder_id,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_category' =>
lang('category'),
- );
-
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Back to list'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.prizebook',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'workorder_id' =>$workorder_id,
- 'allrows'
=>$this->allrows,
- 'query'
=>$this->query
- );
-
- $link_data_nextmatch = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.prizebook',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'workorder_id' =>$workorder_id,
- 'query'
=>$this->query
- );
-
- $link_data_delete = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.prizebook',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'workorder_id' =>$workorder_id,
- 'allrows'
=>$this->allrows,
- 'delete' =>true,
- 'query'
=>$this->query
- );
-
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit =
$this->bopricebook->total_records;
- }
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_add_statustext' =>
lang('Add the selected items'),
- 'lang_add' =>
lang('Add'),
- 'link_delete' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_delete),
- 'function' =>
'prizebook',
- 'links' =>
$links,
- 'allrows' =>
$this->allrows,
- 'allow_allrows' => true,
- 'start_record' =>
$this->start,
- 'record_limit' =>
$record_limit,
- 'num_records' =>
count($pricebook_list),
- 'all_records' =>
$this->bopricebook->total_records,
- 'link_url' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_nextmatch),
- 'img_path' =>
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'select_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_searchfield_statustext' =>
lang('Enter the search string. To show all entries, empty this field and press
the SUBMIT button again'),
- 'lang_searchbutton_statustext' =>
lang('Submit the search string'),
- 'query' =>
$this->query,
- 'lang_search' =>
lang('search'),
- 'workorder_data' =>
$common_data['workorder_data'],
- 'table_header_prizebook' =>
$table_header_prizebook,
- 'values_prizebook' =>
$content_prizebook,
- 'total_hours_records' =>
$common_data['total_hours_records'],
- 'lang_total_records' =>
lang('Total records'),
- 'table_header_hour' =>
$common_data['table_header'],
- 'values_hour' =>
$common_data['content'],
- 'table_sum' =>
$common_data['table_sum'],
- 'table_done' =>
$table_done,
- 'lang_no_wo_hour_cat' =>
lang('no category'),
- 'wo_hour_cat_list' =>
$this->bocommon->select_wo_hours_category_list(),
- );
-//_debug_array($data);
-
- $appname =
lang('pricebook');
- $function_msg =
lang('list pricebook');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('prizebook' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
-
- function template()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $delete = get_var('delete',array('POST','GET'));
- $hour_id = get_var('hour_id',array('POST','GET'));
-
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
- $template_id =
get_var('template_id',array('POST','GET'));
-
- $values = get_var('values',array('POST'));
-//_debug_array($values);
-
- if($delete && $hour_id)
- {
- $receipt =
$this->bo->delete($hour_id,$workorder_id);
- }
-
-
- if($values['add'])
- {
-
$receipt=$this->bo->add_hour_from_template($values,$workorder_id);
- }
-
- $links = $this->menu->links();
-
- $common_data=$this->common_data($workorder_id);
-
- $workorder = $common_data['workorder'];
-
- $botemplate =
CreateObject($this->currentapp.'.botemplate');
- $template_list =
$botemplate->read_template_hour($template_id);
-
- $i=0;
- $grouping_descr_old='';
-
- while (is_array($template_list) && list(,$template) =
each($template_list))
- {
-
-
if($template['grouping_descr']!=$grouping_descr_old)
- {
- $new_grouping = true;
- }
- else
- {
- $new_grouping = false;
- }
-
- $grouping_descr_old =
$template['grouping_descr'];
-
- if($template['activity_num'])
- {
- $code = $template['activity_num'];
- }
- else
- {
- $code =
str_replace("-",$template['tolerance'],$template['ns3420_id']);
- }
-
-
- $content_template_hour[] = array
- (
- 'counter'
=> $i,
- 'chapter_id' =>
$template['chapter_id'],
- 'grouping_descr' =>
$template['grouping_descr'],
- 'building_part' =>
$template['building_part'],
- 'new_grouping' =>
$new_grouping,
- 'code'
=> $code,
- 'activity_id' =>
$template['activity_id'],
- 'activity_num' =>
$template['activity_num'],
- 'hours_descr' =>
$template['hours_descr'],
- 'remark'
=> $template['remark'],
- 'ns3420_id'
=> $template['ns3420_id'],
- 'tolerance'
=> $template['tolerance'],
- 'cost'
=> $template['cost'],
- 'unit'
=> $template['unit'],
- 'billperae'
=> $template['billperae'],
- 'building_part' =>
$template['building_part'],
- 'dim_d'
=> $template['dim_d']
- );
-
- $i++;
- }
-
- $table_header_template_hour[] = array
- (
- 'lang_code' => lang('Code'),
- 'lang_descr' => lang('Description'),
- 'lang_unit' => lang('Unit'),
- 'lang_quantity' => lang('Quantity'),
- 'lang_billperae' => lang('Bill per
unit'),
- 'lang_cost' => lang('Cost'),
-
- 'sort_billperae' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'billperae',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiwo_hour.template',
-
'workorder_id'
=>$workorder_id,
-
'template_id'
=>$template_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_select' => lang('Select'),
- 'sort_building_part' =>
$this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'building_part',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiwo_hour.template',
-
'workorder_id'
=>$workorder_id,
-
'template_id'
=>$template_id,
-
'query'
=>$this->query,
-
'allrows'
=>$this->allrows)
-
)),
- 'lang_building_part' =>
lang('Building part')
- );
-
-
- $table_done[] = array
- (
- 'lang_done' =>
lang('Done'),
- 'lang_done_statustext' => lang('Back to list'),
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
- );
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.template',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'workorder_id' =>$workorder_id,
- 'template_id' =>$template_id,
- 'allrows'
=>$this->allrows,
- 'query'
=>$this->query
- );
-
- $link_data_nextmatch = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.template',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'workorder_id' =>$workorder_id,
- 'template_id' =>$template_id,
- 'query'
=>$this->query
- );
-
- $link_data_delete = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.template',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'workorder_id' =>$workorder_id,
- 'allrows'
=>$this->allrows,
- 'delete' =>true,
- 'query'
=>$this->query
- );
-
-
- if(!$this->allrows)
- {
- $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'lang_select_all'
=> lang('Select All'),
- 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
- 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
-
- 'template_id'
=> $template_id,
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_add_statustext' =>
lang('Add the selected items'),
- 'lang_add'
=> lang('Add'),
- 'link_delete'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_delete),
-
- 'function'
=> 'template',
- 'links'
=> $links,
- 'allrows'
=> $this->allrows,
- 'allow_allrows'
=> true,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $record_limit,
- 'num_records'
=> count($template_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_nextmatch),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'lang_search'
=> lang('search'),
- 'workorder_data'
=> $common_data['workorder_data'],
- 'table_header_template_hour' =>
$table_header_template_hour,
- 'values_template_hour'
=> $content_template_hour,
- 'total_hours_records' =>
$common_data['total_hours_records'],
- 'lang_total_records' =>
lang('Total records'),
- 'table_header_hour'
=> $common_data['table_header'],
- 'values_hour'
=> $common_data['content'],
- 'table_sum'
=> $common_data['table_sum'],
- 'table_done'
=> $table_done
- );
-
-//_debug_array($data);
- $appname
= lang('Template');
- $function_msg =
lang('list template');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_template_hour' =>
$data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit()
- {
- if(!$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
- $from =
get_var('from',array('POST','GET'));
- $template_id =
get_var('template_id',array('POST','GET'));
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
- $activity_id =
get_var('activity_id',array('POST','GET'));
- $hour_id =
get_var('hour_id',array('POST','GET'));
- $values =
get_var('values',array('POST','GET'));
- $values['ns3420_id'] =
get_var('ns3420_id',array('POST','GET'));
- $values['ns3420_descr'] =
get_var('ns3420_descr',array('POST','GET'));
-
-
-//_debug_array($workorder);
-
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour'));
-
- if ($values['save'])
- {
- if($values['copy_hour'])
- {
- unset($hour_id);
- }
-
- $values['hour_id'] = $hour_id;
-
- if(!$receipt['error'])
- {
- $receipt =
$this->bo->save_hour($values,$workorder_id);
-
- $hour_id=$receipt['hour_id'];
- }
- }
-
- if ($hour_id)
- {
- $values = $this->bo->read_single_hour($hour_id);
- $function_msg = lang('Edit hour');
- }
- else
- {
- $function_msg = lang('Add hour');
- }
-
- $workorder =
$this->boworkorder->read_single($workorder_id);
-
-//_debug_array($values);
-
- if($error_id)
- {
- unset($values['hour_id']);
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.edit',
- 'activity_id' => $activity_id,
- 'workorder_id' => $workorder_id,
- 'template_id' => $template_id,
- 'hour_id' => $hour_id,
- 'from' => $from
- );
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.'
. $from . '&workorder_id=' . $workorder_id . '&template_id=' . $template_id),
- 'lang_workorder'
=> lang('Workorder'),
- 'value_workorder_id' =>
$workorder['workorder_id'],
- 'value_workorder_title' =>
$workorder['title'],
-
- 'lang_hour_id'
=> lang('Hour ID'),
- 'value_hour_id'
=> $hour_id,
-
- 'lang_copy_hour' =>
lang('Copy hour ?'),
- 'lang_copy_hour_statustext' => lang('Choose
Copy Hour to copy this hour to a new hour'),
-
- 'lang_activity_num'
=> lang('Activity code'),
- 'value_activity_num' =>
$values['activity_num'],
- 'value_activity_id'
=> $values['activity_id'],
-
- 'lang_unit'
=> lang('Unit'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_descr'
=> lang('description'),
- 'value_descr'
=> $values['hours_descr'],
- 'lang_descr_statustext' =>
lang('Enter the description for this activity'),
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the building'),
-
- 'lang_remark'
=> lang('Remark'),
- 'value_remark'
=> $values['remark'],
- 'lang_remark_statustext' =>
lang('Enter additional remarks to the description - if any'),
-
- 'lang_quantity'
=> lang('quantity'),
- 'value_quantity'
=> $values['quantity'],
- 'lang_quantity_statustext' =>
lang('Enter quantity of unit'),
-
- 'lang_billperae'
=> lang('Cost per unit'),
- 'value_billperae'
=> $values['billperae'],
- 'lang_billperae_statustext' =>
lang('Enter the cost per unit'),
-
- 'lang_total_cost'
=> lang('Total cost'),
- 'value_total_cost'
=> $values['cost'],
- 'lang_total_cost_statustext' => lang('Enter
the total cost of this activity - if not to be calculated from unit-cost'),
-
-
- 'lang_vendor'
=> lang('Vendor'),
- 'value_vendor_id'
=> $workorder['vendor_id'],
- 'value_vendor_name'
=> $workorder['vendor_name'],
-
- 'lang_dim_d'
=> lang('Dim D'),
- 'dim_d_list'
=> $this->bopricebook->get_dim_d_list($values['dim_d']),
- 'select_dim_d'
=> 'values[dim_d]',
- 'lang_no_dim_d'
=> lang('No Dim D'),
- 'lang_dim_d_statustext' =>
lang('Select the Dim D for this activity. To do not use Dim D - select NO DIM
D'),
-
- 'lang_unit'
=> lang('Unit'),
- 'unit_list'
=> $this->bopricebook->get_unit_list($values['unit']),
- 'select_unit'
=> 'values[unit]',
- 'lang_no_unit'
=> lang('Select Unit'),
- 'lang_unit_statustext' =>
lang('Select the unit for this activity.'),
-
- 'lang_chapter'
=> lang('chapter'),
- 'chapter_list'
=> $this->bo->get_chapter_list('select',$workorder['chapter_id']),
- 'select_chapter'
=> 'values[chapter_id]',
- 'lang_no_chapter'
=> lang('Select chapter'),
- 'lang_chapter_statustext' =>
lang('Select the chapter (for tender) for this activity.'),
-
- 'lang_tolerance'
=> lang('tolerance'),
- 'tolerance_list'
=> $this->bo->get_tolerance_list($values['tolerance_id']),
- 'select_tolerance'
=> 'values[tolerance_id]',
- 'lang_no_tolerance'
=> lang('Select tolerance'),
- 'lang_tolerance_statustext' =>
lang('Select the tolerance for this activity.'),
-
- 'lang_grouping'
=> lang('grouping'),
- 'grouping_list'
=> $this->bo->get_grouping_list($values['grouping_id'],$workorder_id),
- 'select_grouping'
=> 'values[grouping_id]',
- 'lang_no_grouping'
=> lang('Select grouping'),
- 'lang_grouping_statustext' =>
lang('Select the grouping for this activity.'),
-
- 'lang_new_grouping'
=> lang('New grouping'),
- 'lang_new_grouping_statustext' =>
lang('Enter a new grouping for this activity if not found in the list'),
-
- 'lang_building_part'
=> lang('building_part'),
- 'building_part_list'
=> $this->bo->get_building_part_list($values['building_part_id']),
- 'select_building_part'
=> 'values[building_part_id]',
- 'lang_no_building_part'
=> lang('Select building part'),
- 'lang_building_part_statustext' =>
lang('Select the building part for this activity.'),
-
-
- 'ns3420_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.ns3420'),
- 'lang_ns3420'
=> lang('NS3420'),
- 'value_ns3420_id'
=> $values['ns3420_id'],
- 'lang_ns3420_statustext' =>
lang('Select a standard-code from the norwegian standard'),
- 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
- 'lang_wo_hour_category' =>
lang('category'),
- 'lang_select_wo_hour_category' =>
lang('no category'),
- 'wo_hour_cat_list' =>
$this->bocommon->select_wo_hours_category_list($values['wo_hour_cat']),
- );
-
- $appname
= lang('Workorder');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_hour' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- if(!$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
- $id =
get_var('id',array('POST','GET'));
- $workorder_id =
get_var('workorder_id',array('POST','GET'));
- $hour_id =
get_var('hour_id',array('POST','GET'));
- $deviation_id =
get_var('deviation_id',array('POST','GET'));
- $confirm =
get_var('confirm',array('POST'));
-
-
- if($deviation_id)
- {
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.deviation',
- 'workorder_id'=>$workorder_id,
- 'hour_id'=>$hour_id
- );
- $delete_link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.delete',
- 'workorder_id'=>$workorder_id,
- 'hour_id'=>$hour_id,
- 'deviation_id'=>$deviation_id
- );
-
- $function_msg
= lang('delete deviation');
- }
- else
- {
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.index'
- );
- $delete_link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiwo_hour.delete',
- 'id'=>$id
- );
- $function_msg
= lang('delete hour');
- }
-
- if (get_var('confirm',array('POST')))
- {
- if($deviation_id)
- {
-
$this->bo->delete_deviation($workorder_id,$hour_id,$deviation_id);
- }
- else
- {
- $this->bo->delete($id);
- }
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php',$delete_link_data),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('workorder');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.uiwo_hour.inc.php,v 1.18 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uiwo_hour
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'tender' => True,
+ 'view' => True,
+ 'template' => True,
+ 'save_template' => True,
+ 'prizebook' => True,
+ 'add' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'deviation' => True,
+ 'edit_deviation'=> True
+ );
+
+ function uiwo_hour()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->create_html =
CreateObject('phpgwapi.xslttemplates');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.bowo_hour',True);
+ $this->boworkorder =
CreateObject($this->currentapp.'.boworkorder');
+ $this->boproject =
CreateObject($this->currentapp.'.boproject');
+ $this->bopricebook =
CreateObject($this->currentapp.'.bopricebook');
+
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+ $this->config =
CreateObject('phpgwapi.config');
+
+ $this->config->read_repository();
+
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.project';
+ $this->acl_read =
$this->acl2->check('.project',1);
+ $this->acl_add =
$this->acl2->check('.project',2);
+ $this->acl_edit =
$this->acl2->check('.project',4);
+ $this->acl_delete =
$this->acl2->check('.project',8);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->chapter_id =
$this->bo->chapter_id;
+ $this->allrows =
$this->bo->allrows;
+
+ $this->menu->sub ='project';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' =>
$this->filter,
+ 'cat_id' =>
$this->cat_id,
+ 'chapter_id' => $this->chapter_id,
+ 'allrows' =>
$this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function deviation()
+ {
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+ $hour_id =
get_var('hour_id',array('POST','GET'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour'));
+ $list =
$this->bo->read_deviation(array('workorder_id'=>$workorder_id,'hour_id'=>$hour_id));
+
+ $sum_deviation = 0;
+
+ if (isset($list) AND is_array($list))
+ {
+ $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ foreach($list as $entry)
+ {
+ $sum_deviation = $sum_deviation +
$entry['amount'];
+
+ $entry_date =
(isset($entry['entry_date'])?$GLOBALS['phpgw']->common->show_date($entry['entry_date'],$dateformat):'');
+
+ $content[] = array
+ (
+ 'id'
=> $entry['id'],
+ 'amount'
=> $entry['amount'],
+ 'descr'
=> $entry['descr'],
+ 'entry_date'
=> $entry_date,
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.edit_deviation&workorder_id='
. $workorder_id . '&hour_id=' . $hour_id . '&id=' . $entry['id']),
+ 'lang_edit_statustext'
=> lang('edit the deviation'),
+ 'text_edit'
=> lang('edit'),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.delete&workorder_id='
. $workorder_id . '&hour_id=' . $hour_id . '&deviation_id=' . $entry['id']),
+ 'lang_delete_statustext'
=> lang('delete the deviation'),
+ 'text_delete'
=> lang('delete'),
+ );
+ }
+ }
+
+
+ $table_header[] = array
+ (
+ 'lang_id' => lang('ID'),
+ 'lang_amount' => lang('amount'),
+ 'lang_descr' => lang('Descr'),
+ 'lang_date' => lang('date'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete')
+ );
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.edit_deviation',
+ 'workorder_id' =>$workorder_id,
+ 'hour_id'
=>$hour_id
+ );
+
+
+ $data = array
+ (
+ 'sum_deviation'
=> $sum_deviation,
+ 'table_header_deviation' =>
$table_header,
+ 'values_deviation'
=> $content,
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' =>
lang('add a deviation'),
+ 'add_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_done'
=> lang('done'),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
+ );
+
+ $appname =
lang('Workorder');
+ $function_msg = lang('list
deviation');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_deviation' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function edit_deviation()
+ {
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+ $hour_id =
get_var('hour_id',array('POST','GET'));
+ $id =
get_var('id',array('POST','GET'));
+ $values =
get_var('values',array('POST','GET'));
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour'));
+
+ if ($values['save'])
+ {
+ $values['workorder_id']=$workorder_id;
+ $values['hour_id']=$hour_id;
+ if (!$values['amount'])
+ {
+ $receipt['error'][] =
array('msg'=>lang('amount not entered!'));
+ }
+
+ if($id)
+ {
+ $values['id']=$id;
+ $action='edit';
+ }
+
+ if (!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_deviation($values,$action);
+ if(!$id)
+ {
+ $id=$receipt['id'];
+ }
+ }
+ else
+ {
+ $receipt['error'][] = array('msg'=>
lang('Status has NOT been saved'));
+ }
+
+ }
+
+ if ($id)
+ {
+ $values =
$this->bo->read_single_deviation(array('workorder_id'=>$workorder_id,'hour_id'=>$hour_id,'id'=>$id));
+ $function_msg = lang('edit deviation');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add deviation');
+ $action='add';
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.edit_deviation',
+ 'entity_id' => $this->entity_id,
+ 'cat_id' => $this->cat_id,
+ 'id' => $id
+ );
+
+ $hour = $this->bo->read_single_hour($hour_id);
+
+//_debug_array($workorder);
+//_debug_array($hour);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $entry_date =
(isset($values['entry_date'])?$GLOBALS['phpgw']->common->show_date($values['entry_date'],$dateformat):'');
+
+ $data = array
+ (
+ 'lang_workorder'
=> lang('Workorder ID'),
+ 'lang_hour_id'
=> lang('Post'),
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.deviation&workorder_id='
. $workorder_id . '&hour_id=' . $hour_id),
+ 'lang_id'
=> lang('deviation ID'),
+ 'lang_descr'
=> lang('Descr'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_date'
=> lang('date'),
+ 'value_id'
=> $id,
+ 'value_workorder_id' =>
$workorder_id,
+ 'value_hour_id'
=> $hour_id,
+ 'entry_date'
=> $entry_date,
+ 'value_id'
=> $id,
+ 'lang_descr_standardtext' =>
lang('Enter a description of the deviation'),
+ 'lang_done_standardtext' =>
lang('Back to the list'),
+ 'lang_save_standardtext' =>
lang('Save the deviation'),
+ 'lang_amount'
=> lang('amount'),
+ 'value_amount'
=> $values['amount'],
+ 'value_descr'
=> $values['descr']
+ );
+
+ $appname
= lang('workorder');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_deviation' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function common_data($workorder_id,$view='')
+ {
+
+ $workorder =
$this->boworkorder->read_single($workorder_id);
+/* if
(!$this->bocommon->check_perms($workorder['grants'],PHPGW_ACL_EDIT))
+ {
+ $receipt['error'][]=array('msg'=>lang('You have
no edit right for this project'));
+
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view&id='
. $workorder_id);
+ }
+*/
+ $hour_list = $this->bo->read($workorder_id);
+//_debug_array($hour_list);
+ $grouping_descr_old='';
+
+ if (isset($hour_list) AND is_array($hour_list))
+ {
+ foreach($hour_list as $hour)
+ {
+ $sum_hour = $sum_hour +
$hour['cost'];
+ $sum_deviation = $sum_deviation +
$hour['deviation'];
+
+
if($hour['grouping_descr']!=$grouping_descr_old)
+ {
+ $new_grouping = true;
+ }
+ else
+ {
+ $new_grouping = false;
+ }
+
+ $grouping_descr_old =
$hour['grouping_descr'];
+
+ if($hour['activity_num'])
+ {
+ $code = $hour['activity_num'];
+ }
+ else
+ {
+ $code =
str_replace("-",$hour['tolerance'],$hour['ns3420_id']);
+ }
+
+ if($hour['count_deviation'] || $view)
+ {
+ $deviation=$hour['deviation'];
+ }
+ else
+ {
+ $deviation=lang('edit');
+ }
+
+ $content[] = array
+ (
+
+ 'post'
=> sprintf("%02s",$workorder['chapter_id']) . '.' .
sprintf("%02s",$hour['building_part']) . '.' .
sprintf("%02s",$hour['grouping_id']) . '.' . sprintf("%03s",$hour['record']),
+ 'hour_id'
=> $hour['hour_id'],
+ 'activity_num'
=> $hour['activity_num'],
+ 'hours_descr'
=> $hour['hours_descr'],
+ 'activity_descr'
=> $hour['activity_descr'],
+ 'new_grouping'
=> $new_grouping,
+ 'grouping_id'
=> $hour['grouping_id'],
+ 'grouping_descr'
=> $hour['grouping_descr'],
+ 'ns3420_id'
=> $hour['ns3420_id'],
+ 'code'
=> $code,
+ 'remark'
=> $hour['remark'],
+ 'building_part'
=> $hour['building_part'],
+ 'quantity'
=> $hour['quantity'],
+ 'cost'
=> $hour['cost'],
+ 'unit'
=> $hour['unit'],
+ 'billperae'
=> $hour['billperae'],
+ 'deviation'
=> $deviation,
+ 'result'
=> ($hour['deviation']+$hour['cost']),
+ 'wo_hour_category'
=> $hour['wo_hour_category'],
+ 'link_deviation'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.deviation&workorder_id='
. $workorder_id . '&hour_id=' . $hour['hour_id']),
+ 'link_edit'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.edit&workorder_id='
. $workorder_id . '&hour_id=' . $hour['hour_id']),
+ 'lang_edit_statustext'
=> lang('edit/customise this hour'),
+ 'lang_delete_statustext'
=> lang('delete this hour'),
+ 'text_edit'
=> lang('edit'),
+ 'text_delete'
=> lang('delete')
+ );
+ }
+ }
+
+
$this->bo->update_deviation(array('workorder_id'=>$workorder_id,'sum_deviation'=>$sum_deviation));
+
+//_debug_array($content);
+
+ $table_header[] = array
+ (
+ 'lang_post' => lang('Post'),
+ 'lang_code' => lang('Code'),
+ 'lang_descr' => lang('descr'),
+ 'lang_unit' => lang('Unit'),
+ 'lang_billperae' => lang('Bill per
unit'),
+ 'lang_quantity' => lang('Quantity'),
+ 'lang_cost' => lang('cost'),
+ 'lang_deviation ' => lang('deviation'),
+ 'lang_result' => lang('result'),
+ 'lang_view' => lang('view'),
+ 'lang_edit' => lang('edit'),
+ 'lang_delete' => lang('delete'),
+ 'lang_category' => lang('category')
+ );
+
+ $tax = $this->config->config_data['fm_tax'];
+
+ $sum_result = $sum_hour+$sum_deviation;
+
+ $addition_percentage = $sum_result *
$workorder['addition_percentage']/100;
+ $sum_tax = ($sum_result + $addition_percentage +
$workorder['addition_rs'])*$tax/100;
+ $total_sum = $sum_result + $addition_percentage +
$workorder['addition_rs'] + $sum_tax;
+
+
$this->bo->update_calculation(array('workorder_id'=>$workorder_id,'calculation'=>($sum_result+$addition_percentage
+ $workorder['addition_rs'])));
+
+ $table_sum[] = array
+ (
+ 'lang_sum_calculation' =>
lang('Sum calculation'),
+ 'value_sum_calculation' =>
number_format($sum_hour, 2, ',', ''),
+ 'lang_addition_rs'
=> lang('Rig addition'),
+ 'value_addition_rs'
=> number_format($workorder['addition_rs'], 2, ',', ''),
+ 'lang_addition_percentage' =>
lang('Percentage addition'),
+ 'value_addition_percentage' =>
number_format($addition_percentage, 2, ',', ''),
+ 'lang_sum_tax'
=> lang('Sum tax'),
+ 'value_sum_tax'
=> number_format($sum_tax, 2, ',', ''),
+ 'lang_total_sum'
=> lang('Total sum'),
+ 'value_total_sum'
=> number_format($total_sum, 2, ',', ''),
+ 'lang_sum_deviation' =>
lang('Sum deviation'),
+ 'sum_deviation'
=> number_format($sum_deviation, 2, ',', ''),
+ 'sum_result'
=> number_format($sum_result, 2, ',', '')
+ );
+
+ $workorder_data = array(
+ 'link_workorder'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&id='
. $workorder_id),
+ 'lang_vendor_name'
=> lang('Vendor'),
+ 'vendor_name'
=> $workorder['vendor_name'],
+ 'vendor_email'
=> $workorder['vendor_email'],
+ 'descr'
=> $workorder['descr'],
+
+ 'lang_workorder_id'
=> lang('Workorder ID'),
+ 'workorder_id'
=> $workorder['workorder_id'],
+ 'lang_project_id'
=> lang('Project ID'),
+ 'link_project'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit&id='
. $workorder['project_id']),
+ 'project_id'
=> $workorder['project_id'],
+
+ 'lang_workorder_title' =>
lang('Workorder title'),
+ 'workorder_title'
=> $workorder['title']
+ );
+
+
+
+ $common_data = array(
+ 'content' =>
$content,
+ 'total_hours_records' => count($content),
+ 'table_header' =>
$table_header,
+ 'table_sum' => $table_sum,
+ 'workorder' => $workorder,
+ 'workorder_data' =>
$workorder_data,
+ );
+
+ return $common_data;
+ }
+
+ function save_template()
+ {
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour',
+
'menu'));
+
+ $values =
get_var('values',array('POST'));
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+
+ if($values['name'])
+ {
+ $receipt =
$this->bo->add_template($values,$workorder_id);
+ }
+
+ $common_data=$this->common_data($workorder_id);
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.index',
+ 'workorder_id' => $workorder_id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'done_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'add_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.save_template&workorder_id='
. $workorder_id),
+
+ 'lang_done_statustext' =>
lang('Back to the workorder list'),
+ 'lang_add_statustext' =>
lang('Adds this workorders calculation as a template for later use'),
+ 'lang_search_statustext' =>
lang('Adds a new workorder to an existing project'),
+
+ 'lang_done'
=> lang('Done'),
+ 'lang_add'
=> lang('Add'),
+ 'lang_search'
=> lang('Search'),
+
+ 'lang_name'
=> lang('name'),
+ 'lang_name_statustext' => lang('Enter
the name the template'),
+
+ 'lang_descr'
=> lang('Description'),
+ 'lang_descr_statustext' => lang('Enter
a short description of this template'),
+
+ 'total_hours_records' =>
$common_data['total_hours_records'],
+ 'lang_total_records' =>
lang('Total records'),
+ 'table_header_hour'
=> $common_data['table_header'],
+ 'values_hour'
=> $common_data['content'],
+ 'workorder_data'
=> $common_data['workorder_data']
+ );
+
+ $appname
= lang('Workorder');
+ $function_msg =
lang('Add template');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add_template' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour','menu'));
+
+ $delete = get_var('delete',array('POST','GET'));
+ $hour_id = get_var('hour_id',array('POST','GET'));
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+ $links = $this->menu->links();
+
+ if($delete && $hour_id)
+ {
+ $receipt =
$this->bo->delete($hour_id,$workorder_id);
+ }
+
+ $common_data=$this->common_data($workorder_id);
+
+ $table_add[] = array
+ (
+ 'lang_add_prizebook'
=> lang('Add from prizebook'),
+ 'lang_add_prizebook_statustext' =>
lang('add items from this vendors prizebook'),
+ 'add_prizebook_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.prizebook&workorder_id='
. $workorder_id),
+
+ 'lang_add_template'
=> lang('Add from template'),
+ 'lang_add_template_statustext' =>
lang('add items from a predefined template'),
+ 'add_template_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitemplate.index&lookup=true&workorder_id='
. $workorder_id),
+
+ 'lang_add_custom'
=> lang('Add custom'),
+ 'lang_add_custom_statustext' =>
lang('Add single custom line'),
+ 'add_custom_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.edit&from=index&workorder_id='
. $workorder_id),
+
+ 'lang_save_template'
=> lang('Save as template'),
+ 'lang_save_template_statustext' =>
lang('Save this workorder as a template for later use'),
+ 'save_template_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.save_template&from=index&workorder_id='
. $workorder_id),
+
+ 'lang_print_view'
=> lang('Print view'),
+ 'lang_print_view_statustext' =>
lang('View the complete workorder'),
+ 'print_view_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.view&from=index&workorder_id='
. $workorder_id),
+
+ 'lang_view_tender'
=> lang('View tender'),
+ 'lang_view_tender_statustext' =>
lang('View the complete workorder as a tender for bidding'),
+ 'view_tender_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.tender&from=index&workorder_id='
. $workorder_id),
+
+ 'lang_show_cost'
=> lang('Show calculated cost'),
+ 'lang_show_cost_statustext'
=> lang('Show calculated cost on the printview'),
+
+ 'lang_show_details'
=> lang('Show details'),
+ 'lang_show_details_statustext' =>
lang('Show details'),
+
+ 'lang_mark_draft'
=> lang('Mark as DRAFT'),
+ 'lang_mark_draft_statustext' =>
lang('Mark the tender as DRAFT')
+
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'link_delete'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&delete=true&workorder_id='
. $workorder_id),
+ 'function'
=> 'index',
+ 'links'
=> $links,
+ 'num_records'
=> count($hours_list),
+ 'total_hours_records' =>
$common_data['total_hours_records'],
+ 'lang_total_records' =>
lang('Total records'),
+ 'table_header_hour'
=> $common_data['table_header'],
+ 'values_hour'
=> $common_data['content'],
+ 'workorder_data'
=> $common_data['workorder_data'],
+ 'table_add'
=> $table_add,
+ 'table_sum'
=> $common_data['table_sum']
+ );
+
+//_debug_array($common_data['content']);
+
+ $appname
= lang('Workorder');
+ $function_msg =
lang('list hours');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_hour' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function view()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour','menu'));
+
+ $show_cost =
get_var('show_cost',array('POST','GET'));
+ $show_details =
get_var('show_details',array('POST','GET'));
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+ $to_email =
get_var('to_email',array('POST','GET'));
+ $update_email =
get_var('update_email',array('POST','GET'));
+ $send_order =
get_var('send_order',array('POST','GET'));
+ $no_email =
get_var('no_email',array('POST','GET'));
+
+ if($update_email)
+ {
+
$this->bo->update_email($to_email,$workorder_id);
+ }
+ $workorder =
$this->boworkorder->read_single($workorder_id);
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+
+ $common_data =
$this->common_data($workorder_id);
+ if($show_details)
+ {
+ $values_hour =
$common_data['content'];
+ }
+ $project =
$this->boproject->read_single($common_data['workorder']['project_id']);
+
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$project['location_data'],
+ 'type_id' =>
count(explode('-',$project['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
$project['location_data']['tenant_id'],
+ 'lookup_type' => 'view'
+ ));
+
+ if($project['contact_phone'])
+ {
+ for
($i=0;$i<count($location_data['location']);$i++)
+ {
+
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+ {
+
unset($location_data['location'][$i]['value']);
+ }
+ }
+ }
+
+ if(!$show_cost)
+ {
+ $m = count($values_hour);
+ for ($i=0;$i<$m;$i++)
+ {
+ unset($values_hour[$i]['cost']);
+ unset($values_hour[$i]['billperae']);
+ }
+
unset($common_data['table_sum'][0]['value_total_sum']);
+ }
+
+ $table_header[] = array
+ (
+ 'lang_post' => lang('Post'),
+ 'lang_code' => lang('Code'),
+ 'lang_descr' => lang('descr'),
+ 'lang_unit' => lang('Unit'),
+ 'lang_billperae' => lang('Bill per
unit'),
+ 'lang_quantity' => lang('Quantity'),
+ 'lang_cost' => lang('cost')
+ );
+
+
+ $table_send[] = array
+ (
+ 'lang_send_order'
=> lang('Send Order'),
+ 'lang_send_order_statustext' => lang('Send
this order by email')
+ );
+
+ $table_done[] = array
+ (
+ 'lang_done'
=> lang('Done'),
+ 'lang_done_statustext' =>
lang('Back to calculation'),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
+ );
+
+ $dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $date
= $GLOBALS['phpgw']->common->show_date(time(),$dateformat);
+
+ $from_name =
$GLOBALS['phpgw_info']['user']['fullname'];
+ $from_email =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
+
+ $email_data = array
+ (
+ 'location_data'
=> $location_data,
+ 'lang_workorder'
=> lang('Workorder ID'),
+ 'workorder_id'
=> $workorder_id,
+
+ 'lang_date'
=> lang('Date'),
+ 'date'
=> $date,
+
+ 'lang_start_date'
=> lang('Start date'),
+ 'start_date'
=> $workorder['start_date'],
+
+ 'lang_end_date'
=> lang('End date'),
+ 'end_date'
=> $workorder['end_date'],
+
+ 'lang_from'
=> lang('From'),
+ 'from_name'
=> $from_name,
+ 'from_email'
=> $from_email,
+ 'from_phone'
=>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['cellphone'],
+ 'lang_district'
=> lang('District'),
+ 'district'
=> $project['location_data']['district_id'],
+
+ 'lang_to'
=> lang('To'),
+ 'to_name'
=> $workorder['vendor_name'],
+
+ 'lang_title'
=> lang('Title'),
+ 'title'
=> $workorder['title'],
+
+ 'lang_descr'
=> lang('Description'),
+ 'descr'
=> $workorder['descr'],
+
+ 'lang_budget_account' =>
lang('Budget account'),
+ 'budget_account'
=> $workorder['b_account_id'],
+
+ 'lang_sum_calculation' =>
lang('Sum of calculation'),
+ 'sum_calculation'
=> $common_data['table_sum'][0]['value_total_sum'],
+
+ 'lang_contact_phone' =>
lang('Contact phone'),
+ 'contact_phone'
=> $project['contact_phone'],
+
+// 'lang_vendor'
=> lang('vendor'),
+
+ 'lang_branch'
=> lang('branch'),
+ 'branch_list'
=> $this->boproject->select_branch_p_list($project['project_id']),
+ 'other_branch'
=> $project['other_branch'],
+
+ 'key_responsible_list' =>
$this->boproject->select_branch_list($project['key_responsible']),
+ 'lang_key_responsible' =>
lang('key responsible'),
+
+ 'key_fetch_list'
=> $this->boproject->select_key_location_list($workorder['key_fetch']),
+ 'lang_key_fetch'
=> lang('Where to pick up the key'),
+
+ 'key_deliver_list'
=> $this->boproject->select_key_location_list($workorder['key_deliver']),
+ 'lang_key_deliver'
=> lang('Where to deliver the key'),
+
+ 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+
+ 'lang_cost_tax'
=> lang('Cost (incl tax):'),
+ 'lang_materials'
=> lang('Materials:__________'),
+ 'lang_work'
=> lang('work:____________'),
+
+ 'table_header_view_order' =>
$table_header,
+ 'values_view_order'
=> $values_hour
+ );
+
+
+ if($send_order && !$to_email)
+ {
+
$receipt['error'][]=array('msg'=>lang('No mailaddress is selected'));
+ }
+
+ if($to_email)
+ {
+
$this->create_html->add_file(array(PHPGW_SERVER_ROOT . SEP . $this->currentapp
. SEP . 'templates' . SEP . 'default' . SEP . 'wo_hour'));
+
$this->create_html->add_file(array(PHPGW_SERVER_ROOT . SEP . $this->currentapp
. SEP . 'templates' . SEP . 'default' . SEP . 'location_view'));
+
+
$this->create_html->set_var('phpgw',array('email_data' => $email_data));
+
+ $this->create_html->xsl_parse();
+ $this->create_html->xml_parse();
+ $xsltproc = xslt_create();
+ $arguments = array('/_xml' =>
$this->create_html->xmldata, '/_xsl' => $this->create_html->xsldata);
+ $html =
xslt_process($xsltproc,'arg:/_xml','arg:/_xsl',NULL,$arguments);
+ xslt_free($xsltproc);
+
+// print $html;
+
+ $headers = "Return-Path: <". $from_email
.">\r\n";
+ $headers .= "From: " . $from_name . "<" .
$from_email .">\r\n";
+
if($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['order_email_rcpt']==1)
+ {
+ $headers .= "Bcc: " . $from_name . "<"
. $from_email .">\r\n";
+ $bcc = $from_email;
+ }
+ $headers .= "Content-type: text/html;
charset=iso-8859-1\r\n";
+ $headers .= "MIME-Version: 1.0\r\n";
+ $subject = lang('Workorder').": ".$workorder_id;
+
+ $mail_method=
$this->config->config_data['fmwrkorder_mail'];
+
+ if ($mail_method=='smtp'):
+ {
+ $send = CreateObject('phpgwapi.send');
+ $rcpt = $send->msg('email', $to_email,
$subject, $html, '', $cc, $bcc, $from_email, $from_name, 'html');
+ }
+ elseif ($mail_method=='sendmail'):
+ {
+ $rcpt=mail($to_email,$subject,$html,
$headers);
+ }
+ else:
+ {
+
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin
section)'));
+ }
+ endif;
+
+ if ($rcpt)
+ {
+ $historylog =
CreateObject($this->currentapp.'.historylog','workorder');
+
$historylog->add('M',$workorder_id,$to_email);
+
$receipt['message'][]=array('msg'=>lang('Workorder is sent by email!'));
+ }
+ else
+ {
+
$receipt['error'][]=array('msg'=>lang('The recipient did not get the email:'));
+
$receipt['error'][]=array('msg'=>lang('From') . ' ' . $from_email);
+
$receipt['error'][]=array('msg'=>lang('To') . ' ' . $to_email);
+ }
+ }
+
+ $workorder_history =
$this->boworkorder->read_record_history($workorder_id);
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $email_list =
$this->bo->get_email($to_email,$workorder['vendor_id']);
+ if(count($email_list)==1)
+ {
+ $to_email= $email_list[0]['email'];
+ unset($email_list);
+ }
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_mail'
=> lang('E-Mail'),
+ 'lang_update_email'
=> lang('Update email'),
+ 'lang_update_email_statustext' =>
lang('Check to update the email-address for this vendor'),
+ 'lang_to_email_address_statustext' =>
lang('The address to which this order will be sendt'),
+ 'to_email'
=> $to_email,
+ 'email_list'
=> $email_list,
+ 'lang_select_email'
=> lang('Select email'),
+ 'send_order_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.view&send=true&workorder_id='
. $workorder_id . '&show_details=' . $show_details),
+
+ 'lang_no_history'
=> lang('No history'),
+ 'lang_history'
=> lang('History'),
+ 'workorder_history'
=> $workorder_history,
+ 'table_header_history' =>
$table_header_history,
+ 'email_data'
=> $email_data,
+ 'no_email'
=> $no_email,
+ 'table_send'
=> $table_send,
+ 'table_done'
=> $table_done
+ );
+
+//_debug_array($data);
+
+ $appname
= lang('Workorder');
+ $function_msg =
lang('Send order');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+
+ $this->save_sessiondata();
+ }
+
+
+ function tender()
+ {
+ $GLOBALS['phpgw_info']['flags'][noheader] = True;
+ $GLOBALS['phpgw_info']['flags'][nofooter] = True;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = False;
+
+ $pdf =
CreateObject($this->currentapp.'.pdf');
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+ $show_cost = get_var('show_cost',array('POST','GET'));
+ $mark_draft = get_var('mark_draft',array('POST','GET'));
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+
+ $common_data =
$this->common_data($workorder_id);
+ $values_hour = $common_data['content'];
+ $project =
$this->boproject->read_single($common_data['workorder']['project_id']);
+
+ $grouping_descr_old = '';
+
+ if (isSet($values_hour) AND is_array($values_hour))
+ {
+ foreach($values_hour as $hour)
+ {
+ $descr= $hour['hours_descr'];
+
+ if($hour['remark'])
+ {
+ $descr .= "\n" .
$hour['remark'];
+ }
+
+ if(!$show_cost)
+ {
+ unset($hour['billperae']);
+ unset($hour['cost']);
+ }
+
+
if($hour['grouping_descr']!=$grouping_descr_old)
+ {
+ $content[] = array
+ (
+ lang('post')
=> $hour['grouping_descr'],
+ lang('code')
=> '',
+ lang('descr')
=> '',
+ lang('unit')
=> '',
+ lang('quantity')
=> '',
+ lang('bill per unit')
=> '',
+ lang('cost')
=> ''
+ );
+ }
+
+ $grouping_descr_old =
$hour['grouping_descr'];
+
+ $content[] = array
+ (
+ lang('post')
=> $hour['post'],
+ lang('code')
=> $hour['code'],
+ lang('descr')
=> $descr,
+ lang('unit')
=> $hour['unit'],
+ lang('quantity')
=> $hour['quantity'],
+ lang('bill per unit')
=> $hour['billperae'],
+ lang('cost')
=> $hour['cost']
+ );
+ }
+ }
+
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $date =
$GLOBALS['phpgw']->common->show_date('',$dateformat);
+
+ // don't want any warnings turning up in the pdf code
if the server is set to 'anal' mode.
+ //error_reporting(7);
+ //error_reporting(E_ALL);
+ set_time_limit(1800);
+ $pdf -> ezSetMargins(50,70,50,50);
+ $pdf->selectFont(PHPGW_APP_INC .
'/pdf/fonts/Helvetica.afm');
+
+ // put a line top and bottom on all the pages
+ $all = $pdf->openObject();
+ $pdf->saveState();
+ $pdf->setStrokeColor(0,0,0,1);
+ $pdf->line(20,40,578,40);
+ $pdf->line(20,822,578,822);
+ $pdf->addText(50,823,6,lang('Chapter') . ' '
.$common_data['workorder']['chapter_id'] . ' ' .
$common_data['workorder']['chapter'] );
+ $pdf->addText(50,34,6,'BBB');
+ $pdf->addText(300,34,6,$date);
+ if($mark_draft)
+ {
+ $pdf->setColor(1,0,0);
+ // $pdf->setColor(66,66,99);
+ $pdf->addText(200,400,40,lang('DRAFT'),-10);
+ $pdf->setColor(1,0,0);
+ }
+ $pdf->restoreState();
+ $pdf->closeObject();
+ // note that object can be told to appear on just odd
or even pages by changing 'all' to 'odd'
+ // or 'even'.
+ $pdf->addObject($all,'all');
+
+ $pdf->ezSetDy(-100);
+
+
+ $pdf->ezStartPageNumbers(500,28,10,'right','{PAGENUM} '
. lang('of') . ' {TOTALPAGENUM}',1);
+
+ $pdf->ezText($project['name'],20);
+ $pdf->ezText($project['descr'],14);
+ $pdf->ezSetDy(-50);
+ $pdf->ezText(lang('Order') . ': ' . $workorder_id . ' '
.$common_data['workorder']['title'],14);
+ $pdf->ezText(lang('Chapter') . ' '
.$common_data['workorder']['chapter_id'] . ' ' .
$common_data['workorder']['chapter'] ,14);
+
+ if(is_array($values_hour))
+ {
+ $pdf->ezNewPage();
+ $pdf->ezTable($content,'',$project['name'],
+
array('xPos'=>70,'xOrientation'=>'right','width'=>500,0,'shaded'=>0,'fontSize'
=> 8,'showLines'=> 2,'titleFontSize' => 12,'outerLineThickness'=>2
+ ,'cols'=>array(
+ lang('bill per
unit')=>array('justification'=>'right','width'=>50)
+
,lang('quantity')=>array('justification'=>'right','width'=>50)
+
,lang('cost')=>array('justification'=>'right','width'=>50)
+
,lang('unit')=>array('width'=>40)
+
,lang('descr')=>array('width'=>120))
+ ));
+ }
+
+ // $pdf->ezStream();
+ $document= $pdf->ezOutput();
+ $size=strlen($document);
+
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header('tender.pdf','application/pdf',$size);
+
+ echo $document;
+ }
+
+ function prizebook()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $delete = get_var('delete',array('POST','GET'));
+ $hour_id = get_var('hour_id',array('POST','GET'));
+
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+//_debug_array($values);
+
+ if($delete && $hour_id)
+ {
+ $receipt =
$this->bo->delete($hour_id,$workorder_id);
+ }
+
+
+ if($values['add'])
+ {
+
$receipt=$this->bo->add_hour($values,$workorder_id);
+ }
+
+ $links = $this->menu->links();
+
+ $common_data=$this->common_data($workorder_id);
+
+ $workorder = $common_data['workorder'];
+
+ if($workorder['vendor_id'])
+ {
+ $this->bopricebook->cat_id =
$workorder['vendor_id'];
+ $this->bopricebook->start = $this->start;
+ $this->bopricebook->query = $this->query;
+ $pricebook_list = $this->bopricebook->read();
+ }
+
+//_debug_array($pricebook_list);
+ $i=0;
+ while (is_array($pricebook_list) && list(,$pricebook) =
each($pricebook_list))
+ {
+ $content_prizebook[] = array
+ (
+ 'counter'
=> $i,
+ 'activity_id' =>
$pricebook['activity_id'],
+ 'num'
=> $pricebook['num'],
+ 'branch'
=> $pricebook['branch'],
+ 'vendor_id'
=> $pricebook['vendor_id'],
+ 'm_cost'
=> $pricebook['m_cost'],
+ 'w_cost'
=> $pricebook['w_cost'],
+ 'total_cost' =>
$pricebook['total_cost'],
+ 'this_index' =>
$pricebook['this_index'],
+ 'unit'
=> $pricebook['unit'],
+ 'descr'
=> $pricebook['descr'],
+ 'base_descr' =>
$pricebook['base_descr']
+ );
+
+ $i++;
+ }
+
+ $table_header_prizebook[] = array
+ (
+ 'sort_num' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'num',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiwo_hour.prizebook',
+
'workorder_id'
=>$workorder_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_num' =>
lang('Activity Num'),
+ 'lang_branch' => lang('Branch'),
+ 'lang_vendor' => lang('Vendor'),
+ 'lang_select' => lang('Select'),
+ 'lang_total_cost' => lang('Total Cost'),
+ 'lang_descr' => lang('Description'),
+ 'lang_base_descr' => lang('Base'),
+ 'lang_m_cost' => lang('Material
cost'),
+ 'lang_w_cost' => lang('Labour cost'),
+ 'lang_unit' => lang('Unit'),
+ 'lang_quantity' => lang('Quantity'),
+
+ 'lang_view' => lang('view'),
+ 'lang_edit' => lang('edit'),
+ 'sort_total_cost' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'total_cost',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiwo_hour.prizebook',
+
'workorder_id'
=>$workorder_id,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_category' =>
lang('category'),
+ );
+
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Back to list'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.prizebook',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'workorder_id' =>$workorder_id,
+ 'allrows'
=>$this->allrows,
+ 'query'
=>$this->query
+ );
+
+ $link_data_nextmatch = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.prizebook',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'workorder_id' =>$workorder_id,
+ 'query'
=>$this->query
+ );
+
+ $link_data_delete = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.prizebook',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'workorder_id' =>$workorder_id,
+ 'allrows'
=>$this->allrows,
+ 'delete' =>true,
+ 'query'
=>$this->query
+ );
+
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit =
$this->bopricebook->total_records;
+ }
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_add_statustext' =>
lang('Add the selected items'),
+ 'lang_add' =>
lang('Add'),
+ 'link_delete' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_delete),
+ 'function' =>
'prizebook',
+ 'links' =>
$links,
+ 'allrows' =>
$this->allrows,
+ 'allow_allrows' => true,
+ 'start_record' =>
$this->start,
+ 'record_limit' =>
$record_limit,
+ 'num_records' =>
count($pricebook_list),
+ 'all_records' =>
$this->bopricebook->total_records,
+ 'link_url' =>
$GLOBALS['phpgw']->link('/index.php',$link_data_nextmatch),
+ 'img_path' =>
$GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'select_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_searchfield_statustext' =>
lang('Enter the search string. To show all entries, empty this field and press
the SUBMIT button again'),
+ 'lang_searchbutton_statustext' =>
lang('Submit the search string'),
+ 'query' =>
$this->query,
+ 'lang_search' =>
lang('search'),
+ 'workorder_data' =>
$common_data['workorder_data'],
+ 'table_header_prizebook' =>
$table_header_prizebook,
+ 'values_prizebook' =>
$content_prizebook,
+ 'total_hours_records' =>
$common_data['total_hours_records'],
+ 'lang_total_records' =>
lang('Total records'),
+ 'table_header_hour' =>
$common_data['table_header'],
+ 'values_hour' =>
$common_data['content'],
+ 'table_sum' =>
$common_data['table_sum'],
+ 'table_done' =>
$table_done,
+ 'lang_no_wo_hour_cat' =>
lang('no category'),
+ 'wo_hour_cat_list' =>
$this->bocommon->select_wo_hours_category_list(),
+ );
+//_debug_array($data);
+
+ $appname =
lang('pricebook');
+ $function_msg =
lang('list pricebook');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('prizebook' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+
+ function template()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $delete = get_var('delete',array('POST','GET'));
+ $hour_id = get_var('hour_id',array('POST','GET'));
+
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+ $template_id =
get_var('template_id',array('POST','GET'));
+
+ $values = get_var('values',array('POST'));
+//_debug_array($values);
+
+ if($delete && $hour_id)
+ {
+ $receipt =
$this->bo->delete($hour_id,$workorder_id);
+ }
+
+
+ if($values['add'])
+ {
+
$receipt=$this->bo->add_hour_from_template($values,$workorder_id);
+ }
+
+ $links = $this->menu->links();
+
+ $common_data=$this->common_data($workorder_id);
+
+ $workorder = $common_data['workorder'];
+
+ $botemplate =
CreateObject($this->currentapp.'.botemplate');
+ $template_list =
$botemplate->read_template_hour($template_id);
+
+ $i=0;
+ $grouping_descr_old='';
+
+ while (is_array($template_list) && list(,$template) =
each($template_list))
+ {
+
+
if($template['grouping_descr']!=$grouping_descr_old)
+ {
+ $new_grouping = true;
+ }
+ else
+ {
+ $new_grouping = false;
+ }
+
+ $grouping_descr_old =
$template['grouping_descr'];
+
+ if($template['activity_num'])
+ {
+ $code = $template['activity_num'];
+ }
+ else
+ {
+ $code =
str_replace("-",$template['tolerance'],$template['ns3420_id']);
+ }
+
+
+ $content_template_hour[] = array
+ (
+ 'counter'
=> $i,
+ 'chapter_id' =>
$template['chapter_id'],
+ 'grouping_descr' =>
$template['grouping_descr'],
+ 'building_part' =>
$template['building_part'],
+ 'new_grouping' =>
$new_grouping,
+ 'code'
=> $code,
+ 'activity_id' =>
$template['activity_id'],
+ 'activity_num' =>
$template['activity_num'],
+ 'hours_descr' =>
$template['hours_descr'],
+ 'remark'
=> $template['remark'],
+ 'ns3420_id'
=> $template['ns3420_id'],
+ 'tolerance'
=> $template['tolerance'],
+ 'cost'
=> $template['cost'],
+ 'unit'
=> $template['unit'],
+ 'billperae'
=> $template['billperae'],
+ 'building_part' =>
$template['building_part'],
+ 'dim_d'
=> $template['dim_d']
+ );
+
+ $i++;
+ }
+
+ $table_header_template_hour[] = array
+ (
+ 'lang_code' => lang('Code'),
+ 'lang_descr' => lang('Description'),
+ 'lang_unit' => lang('Unit'),
+ 'lang_quantity' => lang('Quantity'),
+ 'lang_billperae' => lang('Bill per
unit'),
+ 'lang_cost' => lang('Cost'),
+
+ 'sort_billperae' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'billperae',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiwo_hour.template',
+
'workorder_id'
=>$workorder_id,
+
'template_id'
=>$template_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_select' => lang('Select'),
+ 'sort_building_part' =>
$this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'building_part',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiwo_hour.template',
+
'workorder_id'
=>$workorder_id,
+
'template_id'
=>$template_id,
+
'query'
=>$this->query,
+
'allrows'
=>$this->allrows)
+
)),
+ 'lang_building_part' =>
lang('Building part')
+ );
+
+
+ $table_done[] = array
+ (
+ 'lang_done' =>
lang('Done'),
+ 'lang_done_statustext' => lang('Back to list'),
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_id)
+ );
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.template',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'workorder_id' =>$workorder_id,
+ 'template_id' =>$template_id,
+ 'allrows'
=>$this->allrows,
+ 'query'
=>$this->query
+ );
+
+ $link_data_nextmatch = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.template',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'workorder_id' =>$workorder_id,
+ 'template_id' =>$template_id,
+ 'query'
=>$this->query
+ );
+
+ $link_data_delete = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.template',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'workorder_id' =>$workorder_id,
+ 'allrows'
=>$this->allrows,
+ 'delete' =>true,
+ 'query'
=>$this->query
+ );
+
+
+ if(!$this->allrows)
+ {
+ $record_limit =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_select_all'
=> lang('Select All'),
+ 'img_check'
=>
$GLOBALS['phpgw']->common->get_image_path($this->currentapp).'/check.gif',
+ 'check_source'
=> './'.$this->currentapp.'/inc/check.js',
+
+ 'template_id'
=> $template_id,
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_add_statustext' =>
lang('Add the selected items'),
+ 'lang_add'
=> lang('Add'),
+ 'link_delete'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_delete),
+
+ 'function'
=> 'template',
+ 'links'
=> $links,
+ 'allrows'
=> $this->allrows,
+ 'allow_allrows'
=> true,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $record_limit,
+ 'num_records'
=> count($template_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_nextmatch),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'lang_search'
=> lang('search'),
+ 'workorder_data'
=> $common_data['workorder_data'],
+ 'table_header_template_hour' =>
$table_header_template_hour,
+ 'values_template_hour'
=> $content_template_hour,
+ 'total_hours_records' =>
$common_data['total_hours_records'],
+ 'lang_total_records' =>
lang('Total records'),
+ 'table_header_hour'
=> $common_data['table_header'],
+ 'values_hour'
=> $common_data['content'],
+ 'table_sum'
=> $common_data['table_sum'],
+ 'table_done'
=> $table_done
+ );
+
+//_debug_array($data);
+ $appname
= lang('Template');
+ $function_msg =
lang('list template');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_template_hour' =>
$data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit()
+ {
+ if(!$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+ $from =
get_var('from',array('POST','GET'));
+ $template_id =
get_var('template_id',array('POST','GET'));
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+ $activity_id =
get_var('activity_id',array('POST','GET'));
+ $hour_id =
get_var('hour_id',array('POST','GET'));
+ $values =
get_var('values',array('POST','GET'));
+ $values['ns3420_id'] =
get_var('ns3420_id',array('POST','GET'));
+ $values['ns3420_descr'] =
get_var('ns3420_descr',array('POST','GET'));
+
+
+//_debug_array($workorder);
+
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour'));
+
+ if ($values['save'])
+ {
+ if($values['copy_hour'])
+ {
+ unset($hour_id);
+ }
+
+ $values['hour_id'] = $hour_id;
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_hour($values,$workorder_id);
+
+ $hour_id=$receipt['hour_id'];
+ }
+ }
+
+ if ($hour_id)
+ {
+ $values = $this->bo->read_single_hour($hour_id);
+ $function_msg = lang('Edit hour');
+ }
+ else
+ {
+ $function_msg = lang('Add hour');
+ }
+
+ $workorder =
$this->boworkorder->read_single($workorder_id);
+
+//_debug_array($values);
+
+ if($error_id)
+ {
+ unset($values['hour_id']);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.edit',
+ 'activity_id' => $activity_id,
+ 'workorder_id' => $workorder_id,
+ 'template_id' => $template_id,
+ 'hour_id' => $hour_id,
+ 'from' => $from
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.'
. $from . '&workorder_id=' . $workorder_id . '&template_id=' . $template_id),
+ 'lang_workorder'
=> lang('Workorder'),
+ 'value_workorder_id' =>
$workorder['workorder_id'],
+ 'value_workorder_title' =>
$workorder['title'],
+
+ 'lang_hour_id'
=> lang('Hour ID'),
+ 'value_hour_id'
=> $hour_id,
+
+ 'lang_copy_hour' =>
lang('Copy hour ?'),
+ 'lang_copy_hour_statustext' => lang('Choose
Copy Hour to copy this hour to a new hour'),
+
+ 'lang_activity_num'
=> lang('Activity code'),
+ 'value_activity_num' =>
$values['activity_num'],
+ 'value_activity_id'
=> $values['activity_id'],
+
+ 'lang_unit'
=> lang('Unit'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_descr'
=> lang('description'),
+ 'value_descr'
=> $values['hours_descr'],
+ 'lang_descr_statustext' =>
lang('Enter the description for this activity'),
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the building'),
+
+ 'lang_remark'
=> lang('Remark'),
+ 'value_remark'
=> $values['remark'],
+ 'lang_remark_statustext' =>
lang('Enter additional remarks to the description - if any'),
+
+ 'lang_quantity'
=> lang('quantity'),
+ 'value_quantity'
=> $values['quantity'],
+ 'lang_quantity_statustext' =>
lang('Enter quantity of unit'),
+
+ 'lang_billperae'
=> lang('Cost per unit'),
+ 'value_billperae'
=> $values['billperae'],
+ 'lang_billperae_statustext' =>
lang('Enter the cost per unit'),
+
+ 'lang_total_cost'
=> lang('Total cost'),
+ 'value_total_cost'
=> $values['cost'],
+ 'lang_total_cost_statustext' => lang('Enter
the total cost of this activity - if not to be calculated from unit-cost'),
+
+
+ 'lang_vendor'
=> lang('Vendor'),
+ 'value_vendor_id'
=> $workorder['vendor_id'],
+ 'value_vendor_name'
=> $workorder['vendor_name'],
+
+ 'lang_dim_d'
=> lang('Dim D'),
+ 'dim_d_list'
=> $this->bopricebook->get_dim_d_list($values['dim_d']),
+ 'select_dim_d'
=> 'values[dim_d]',
+ 'lang_no_dim_d'
=> lang('No Dim D'),
+ 'lang_dim_d_statustext' =>
lang('Select the Dim D for this activity. To do not use Dim D - select NO DIM
D'),
+
+ 'lang_unit'
=> lang('Unit'),
+ 'unit_list'
=> $this->bopricebook->get_unit_list($values['unit']),
+ 'select_unit'
=> 'values[unit]',
+ 'lang_no_unit'
=> lang('Select Unit'),
+ 'lang_unit_statustext' =>
lang('Select the unit for this activity.'),
+
+ 'lang_chapter'
=> lang('chapter'),
+ 'chapter_list'
=> $this->bo->get_chapter_list('select',$workorder['chapter_id']),
+ 'select_chapter'
=> 'values[chapter_id]',
+ 'lang_no_chapter'
=> lang('Select chapter'),
+ 'lang_chapter_statustext' =>
lang('Select the chapter (for tender) for this activity.'),
+
+ 'lang_tolerance'
=> lang('tolerance'),
+ 'tolerance_list'
=> $this->bo->get_tolerance_list($values['tolerance_id']),
+ 'select_tolerance'
=> 'values[tolerance_id]',
+ 'lang_no_tolerance'
=> lang('Select tolerance'),
+ 'lang_tolerance_statustext' =>
lang('Select the tolerance for this activity.'),
+
+ 'lang_grouping'
=> lang('grouping'),
+ 'grouping_list'
=> $this->bo->get_grouping_list($values['grouping_id'],$workorder_id),
+ 'select_grouping'
=> 'values[grouping_id]',
+ 'lang_no_grouping'
=> lang('Select grouping'),
+ 'lang_grouping_statustext' =>
lang('Select the grouping for this activity.'),
+
+ 'lang_new_grouping'
=> lang('New grouping'),
+ 'lang_new_grouping_statustext' =>
lang('Enter a new grouping for this activity if not found in the list'),
+
+ 'lang_building_part'
=> lang('building_part'),
+ 'building_part_list'
=> $this->bo->get_building_part_list($values['building_part_id']),
+ 'select_building_part'
=> 'values[building_part_id]',
+ 'lang_no_building_part'
=> lang('Select building part'),
+ 'lang_building_part_statustext' =>
lang('Select the building part for this activity.'),
+
+
+ 'ns3420_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.ns3420'),
+ 'lang_ns3420'
=> lang('NS3420'),
+ 'value_ns3420_id'
=> $values['ns3420_id'],
+ 'lang_ns3420_statustext' =>
lang('Select a standard-code from the norwegian standard'),
+ 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+ 'lang_wo_hour_category' =>
lang('category'),
+ 'lang_select_wo_hour_category' =>
lang('no category'),
+ 'wo_hour_cat_list' =>
$this->bocommon->select_wo_hours_category_list($values['wo_hour_cat']),
+ );
+
+ $appname
= lang('Workorder');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_hour' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ if(!$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+ $id =
get_var('id',array('POST','GET'));
+ $workorder_id =
get_var('workorder_id',array('POST','GET'));
+ $hour_id =
get_var('hour_id',array('POST','GET'));
+ $deviation_id =
get_var('deviation_id',array('POST','GET'));
+ $confirm =
get_var('confirm',array('POST'));
+
+
+ if($deviation_id)
+ {
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.deviation',
+ 'workorder_id'=>$workorder_id,
+ 'hour_id'=>$hour_id
+ );
+ $delete_link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.delete',
+ 'workorder_id'=>$workorder_id,
+ 'hour_id'=>$hour_id,
+ 'deviation_id'=>$deviation_id
+ );
+
+ $function_msg
= lang('delete deviation');
+ }
+ else
+ {
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.index'
+ );
+ $delete_link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiwo_hour.delete',
+ 'id'=>$id
+ );
+ $function_msg
= lang('delete hour');
+ }
+
+ if (get_var('confirm',array('POST')))
+ {
+ if($deviation_id)
+ {
+
$this->bo->delete_deviation($workorder_id,$hour_id,$deviation_id);
+ }
+ else
+ {
+ $this->bo->delete($id);
+ }
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php',$delete_link_data),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('workorder');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ }
+?>
Index: property/inc/class.uiworkorder.inc.php
diff -u property/inc/class.uiworkorder.inc.php:1.17
property/inc/class.uiworkorder.inc.php:1.18
--- property/inc/class.uiworkorder.inc.php:1.17 Fri Jan 27 14:05:43 2006
+++ property/inc/class.uiworkorder.inc.php Fri Feb 3 12:05:49 2006
@@ -1,1128 +1,1128 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 project
- * @version $Id: class.uiworkorder.inc.php,v 1.17 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class uiworkorder
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'excel' => True,
- 'index' => True,
- 'view' => True,
- 'add' => True,
- 'edit' => True,
- 'delete' => True
- );
-
- function uiworkorder()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->bo =
CreateObject($this->currentapp.'.boworkorder',True);
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->menu =
CreateObject($this->currentapp.'.menu');
- $this->acl2 =
CreateObject($this->currentapp.'.acl2');
- $this->acl2_location = '.project';
- $this->acl_read =
$this->acl2->check('.project',1);
- $this->acl_add =
$this->acl2->check('.project',2);
- $this->acl_edit =
$this->acl2->check('.project',4);
- $this->acl_delete =
$this->acl2->check('.project',8);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->status_id =
$this->bo->status_id;
- $this->search_vendor =
$this->bo->search_vendor;
- $this->wo_hour_cat_id =
$this->bo->wo_hour_cat_id;
- $this->start_date =
$this->bo->start_date;
- $this->end_date =
$this->bo->end_date;
-
- $this->menu->sub ='project';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' =>
$this->filter,
- 'cat_id' =>
$this->cat_id,
- 'search_vendor' =>
$this->search_vendor,
- 'status_id' =>
$this->status_id,
- 'wo_hour_cat_id' =>
$this->wo_hour_cat_id,
- 'start_date' =>
$this->start_date,
- 'end_date' =>
$this->end_date
- );
- $this->bo->save_sessiondata($data);
- }
-
- function excel()
- {
- $start_date = urldecode($this->start_date);
- $end_date = urldecode($this->end_date);
- $list =
$this->bo->read($start_date,$end_date,$allrows=True);
- $uicols = $this->bo->uicols;
-
$this->bocommon->excel($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
- }
-
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder','values','table_header',
-
'menu',
-
'nextmatchs'));
-
- $links = $this->menu->links('workorder');
-
- $start_date = urldecode($this->start_date);
- $end_date = urldecode($this->end_date);
- $workorder_list =
$this->bo->read($start_date,$end_date);
-
- $uicols = $this->bo->uicols;
- $count_uicols_name=count($uicols['name']);
-
- $j=0;
- if (isSet($workorder_list) AND
is_array($workorder_list))
- {
- foreach($workorder_list as $workorder_entry)
- {
- for ($k=0;$k<$count_uicols_name;$k++)
- {
-
if($uicols['input_type'][$k]!='hidden')
- {
-
if($workorder_entry['query_location'][$uicols['name'][$k]])
- {
-
$content[$j]['row'][$k]['statustext'] = lang('search');
-
$content[$j]['row'][$k]['text'] =
$workorder_entry[$uicols['name'][$k]];
-
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.index&query='
. $workorder_entry['query_location'][$uicols['name'][$k]] . '&lookup=' .
$lookup . '&filter=' . $this->filter);
- }
- else
- {
-
$content[$j]['row'][$k]['value'] =
$workorder_entry[$uicols['name'][$k]];
-
$content[$j]['row'][$k]['name'] = $uicols['name'][$k];
-
if($uicols['name'][$k]=='vendor_id')
- {
-
$content[$j]['row'][$k]['statustext'] = $workorder_entry['org_name'];
-
$content[$j]['row'][$k]['overlib'] = True;
-
$content[$j]['row'][$k]['text'] =
$workorder_entry[$uicols['name'][$k]];
- }
- }
- }
- if($lookup &&
$k==($count_uicols_name - 2))
-
$content[$j]['row'][$k]['lookup_action'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&workorder_id='
. $workorder_entry['workorder_id']);
- }
- if(!$lookup)
- {
- if ($this->acl_read &&
$this->bocommon->check_perms($workorder_entry['grants'],PHPGW_ACL_READ))
- if($this->acl_read)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('view the
workorder');
-
$content[$j]['row'][$k]['text'] = lang('view');
-
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view&id='
. $workorder_entry['workorder_id']);
- $k++;
- }
- else
- {
-
$content[$j]['row'][$k++]['link']='dummy';
- }
-
- if ($this->acl_edit &&
$this->bocommon->check_perms($workorder_entry['grants'],PHPGW_ACL_EDIT))
- {
-
$content[$j]['row'][$k]['statustext'] = lang('edit the
workorder');
-
$content[$j]['row'][$k]['text'] = lang('edit');
-
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&id='
. $workorder_entry['workorder_id']);
- $k++;
-
-
$content[$j]['row'][$k]['statustext'] = lang('calculate the
workorder');
-
$content[$j]['row'][$k]['text'] =
lang('calculate');
-
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_entry['workorder_id']);
- $k++;
- }
- else
- {
-
$content[$j]['row'][$k++]['link']='dummy';
-
$content[$j]['row'][$k++]['link']='dummy';
- }
-
- if ($this->acl_delete &&
$this->bocommon->check_perms($workorder_entry['grants'],PHPGW_ACL_DELETE))
- {
-
$content[$j]['row'][$k]['statustext'] = lang('delete the
workorder');
-
$content[$j]['row'][$k]['text'] =
lang('delete');
-
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.delete&id='
. $workorder_entry['workorder_id']);
- $k++;
- }
- else
- {
-
$content[$j]['row'][$k++]['link']='dummy';
- }
- }
- $j++;
- }
- }
-
- $count_uicols_descr=count($uicols['descr']);
- for ($i=0;$i<$count_uicols_descr;$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['name'][$i]=='loc1')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'fm_location1.loc1',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiworkorder.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'search_vendor'
=>$this->search_vendor,
-
'cat_id'
=>$this->cat_id,
-
'start_date'=>$start_date,
-
'end_date'=>$end_date,
-
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
-
)
-
));
- }
- if($uicols['name'][$i]=='project_id')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'project_id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiworkorder.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'search_vendor'
=>$this->search_vendor,
-
'cat_id'
=>$this->cat_id,
-
'start_date'=>$start_date,
-
'end_date'=>$end_date,
-
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
-
)
-
));
- }
if($uicols['name'][$i]=='workorder_id')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'workorder_id',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiworkorder.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'search_vendor'
=>$this->search_vendor,
-
'cat_id'
=>$this->cat_id,
-
'start_date'=>$start_date,
-
'end_date'=>$end_date,
-
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
-
)
-
));
- }
- if($uicols['name'][$i]=='address')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'address',
-
'order' => $this->order,
-
'extra' => array('menuaction' =>
$this->currentapp.'.uiworkorder.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'lookup'
=>$lookup,
-
'district_id' =>
$this->district_id,
-
'search_vendor'
=>$this->search_vendor,
-
'cat_id'
=>$this->cat_id,
-
'start_date'=>$start_date,
-
'end_date'=>$end_date,
-
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
-
)
-
));
- }
-
- }
- }
-
- if(!$lookup)
- {
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
-
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('calculate');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
- }
- else
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header'] =
lang('select');
- }
-
-//_debug_array($content);
- if($this->acl_add)
- {
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
workorder'),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.add')
- );
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiworkorder.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'district_id'
=>$this->district_id,
- 'status_id'
=>$this->status_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'search_vendor'
=>$this->search_vendor,
- 'start_date'
=>$start_date,
- 'end_date'
=>$end_date,
- 'wo_hour_cat_id'
=>$this->wo_hour_cat_id
- );
-
- $link_date_search
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
-
- $link_excel = array
- (
- 'menuaction' =>
$this->currentapp.'.uiworkorder.excel',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'district_id'
=>$this->district_id,
- 'status_id'
=>$this->status_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
- 'search_vendor'
=>$this->search_vendor,
- 'start_date'
=>$start_date,
- 'end_date'
=>$end_date,
- 'start'
=>$this->start,
- 'wo_hour_cat_id'
=>$this->wo_hour_cat_id,
- );
-
-
-
if($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'])
- {
- $group_filters = 'select';
-
$GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour_cat_select'));
- }
- else
- {
- $group_filters = 'filter';
-
$GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour_cat_filter'));
- }
-
- $data = array
- (
- 'group_filters' =>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'],
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
-
- 'start_date'
=>$start_date,
- 'end_date'
=>$end_date,
- 'lang_none'
=>lang('None'),
- 'lang_date_search' =>
lang('Date search'),
- 'lang_date_search_help' => lang('Narrow
the search by dates'),
- 'link_date_search' =>
$link_date_search,
- 'overlib_source' =>
'./'.$this->currentapp.'/inc/overlib.js',
-
- 'link_history'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.index'),
- 'lang_history_statustext' =>
lang('search for history at this location'),
- 'links'
=> $links,
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($workorder_list),
- 'all_records'
=> $this->bo->total_records,
- 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the workorder belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=>
$this->bo->select_category_workorder_list($group_filters,$this->cat_id),
- 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-
- 'lang_status_statustext' =>
lang('Select the status the agreement belongs to. To do not use a category
select NO STATUS'),
- 'status_name'
=> 'status_id',
- 'lang_no_status'
=> lang('No status'),
- 'status_list'
=> $this->bo->select_status_list($group_filters,$this->status_id),
-
- 'lang_wo_hour_cat_statustext' =>
lang('Select the workorder hour category'),
- 'lang_no_wo_hour_cat' =>
lang('no hour category'),
- 'wo_hour_cat_list'
=> $this->bocommon->select_wo_hours_category_list($this->wo_hour_cat_id),
-
- 'lang_user_statustext' =>
lang('Select the user the workorder belongs to. To do not use a category select
NO USER'),
- 'select_user_name'
=> 'filter',
- 'lang_no_user'
=> lang('No user'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl2_location,array('all'),$default=$this->account),
-
- 'lang_searchvendor_statustext' => lang('Enter
the vendor name to search for'),
- 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
- 'lang_searchbutton_statustext' => lang('Submit
the search string'),
- 'query'
=> $this->query,
- 'search_vendor'
=> $this->search_vendor,
- 'lang_search'
=> lang('search'),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
-
- $appname
= lang('Workorder');
- $function_msg =
lang('list workorder');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_workorder' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- $this->save_sessiondata();
- }
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
- $boproject =
CreateObject($this->currentapp.'.boproject');
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
- $config =
CreateObject('phpgwapi.config');
- $id =
get_var('id',array('POST','GET'));
- $project_id =
get_var('project_id',array('POST','GET'));
- $values =
get_var('values',array('POST'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder'));
-
- $values['vendor_id'] =
get_var('vendor_id',array('POST'));
- $values['vendor_name'] =
get_var('vendor_name',array('POST'));
- $values['b_account_id'] =
get_var('b_account_id',array('POST'));
- $values['b_account_name'] =
get_var('b_account_name',array('POST'));
-
-
- $values['start_date'] =
get_var('start_date',array('POST'));
- $values['end_date'] =
get_var('end_date',array('POST'));
-
- $config->read_repository();
-
- if ($values['save'])
- {
- if(!$values['title'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a workorder title !'));
- $error_id=true;
- }
- if(!$values['project_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a valid project !'));
- $error_id=true;
- }
-
- if(!$values['status'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
- }
- if(!$values['b_account_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a budget account !'));
- }
-
- if($id)
- {
- $values['workorder_id']=$id;
- $action='edit';
- }
-
- if(!$receipt['error'])
- {
- if(!$id)
- {
-
$values['workorder_id']=$this->bo->next_id();
- $id =
$values['workorder_id'];
- }
- if($values['copy_workorder'])
- {
- $action='add';
- $values['workorder_id'] =
$this->bo->next_id();
- $id =
$values['workorder_id'];
- }
- $receipt =
$this->bo->save($values,$action);
- $id = $values['workorder_id'];
- $function_msg = lang('Edit Workorder');
-
- if ($values['approval'] &&
$values['mail_address'])
- {
-
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
-
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
- $headers = "Return-Path: <".
$coordinator_email .">\r\n";
- $headers .= "From: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
- $headers .= "Bcc: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
- $headers .= "Content-type:
text/plain; charset=iso-8859-1\r\n";
-
- $subject = lang(Approval).": ".
$values['workorder_id'];
- $message = lang('Workorder %1
needs approval',$values['workorder_id']);
-
- $mail_method=
$config->config_data['fmwrkorder_mail'];
- if ($mail_method=='smtp'):
- {
- $bcc =
$coordinator_email;
- $send =
CreateObject('phpgwapi.send');
- $rcpt =
$send->msg('email', $values['mail_address'], $subject, stripslashes($message),
'', $cc, $bcc, $coordinator_email, $coordinator_name, 'plain');
- }
- elseif
($mail_method=='sendmail'):
- {
-
$rcpt=mail($values['mail_address'],$subject,$message, $headers);
- }
- else:
- {
-
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin
section)'));
- }
- endif;
- }
-
- if($rcpt)
- {
-
$receipt['message'][]=array('msg'=>lang('%1 is
notified',$values['mail_address']));
- }
- }
- }
-
- if(!$receipt['error'])
- {
- if($id)
- {
- $values =
$this->bo->read_single($id);
- }
- if($project_id && !$values['project_id'])
- {
- $values['project_id']=$project_id;
- }
- $project =
$boproject->read_single_mini($values['project_id']);
-
- if
(!$this->bocommon->check_perms($project['grants'],PHPGW_ACL_EDIT))
- {
-
$receipt['error'][]=array('msg'=>lang('You have no edit right for this
project'));
-
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view&id='
. $id);
- }
-
- if( $project['key_fetch'] &&
!$values['key_fetch'])
- {
-
$values['key_fetch']=$project['key_fetch'];
- }
-
- if( $project['key_deliver'] &&
!$values['key_deliver'])
- {
-
$values['key_deliver']=$project['key_deliver'];
- }
-
-/* if( $project['charge_tenant'] &&
!$values['workorder_id'])
- {
-
$values['charge_tenant']=$project['charge_tenant'];
- }
-*/
- if( $project['start_date'] &&
!$values['start_date'])
- {
-
$values['start_date']=$project['start_date'];
- }
- if( $project['end_date'] &&
!$values['end_date'])
- {
-
$values['end_date']=$project['end_date'];
- }
- if( $project['name'] && !$values['title'])
- {
- $values['title']=$project['name'];
- }
- if( $project['descr'] && !$values['descr'])
- {
- $values['descr']=$project['descr'];
- }
- if( $project['status'] && !$values['status'])
- {
- $values['status']=$project['status'];
- }
- }
-
- if($id)
- {
- $record_history =
$this->bo->read_record_history($id);
- }
-
-//_debug_array($hour_data);
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- $table_header_workorder_budget[] = array
- (
- 'lang_workorder_id' => lang('Workorder'),
- 'lang_sum' => lang('Sum')
- );
-
- if ($id)
- {
- $function_msg = lang('Edit Workorder');
- }
- else
- {
- $function_msg = lang('Add Workorder');
- }
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$project['location_data'],
- 'type_id' =>
count(explode('-',$project['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
$project['location_data']['tenant_id'],
- 'lookup_type' => 'view'
- ));
-
-
- if($project['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
unset($location_data['location'][$i]['value']);
- }
- }
- }
-
-
-
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
- 'vendor_id' =>
$values['vendor_id'],
- 'vendor_name' =>
$values['vendor_name']));
-
-
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
- 'b_account_id' =>
$values['b_account_id'],
- 'b_account_name' =>
$values['b_account_name']));
-
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiworkorder.edit',
- 'id' => $id
- );
-
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $sep = '/';
- $dlarr[strpos($dateformat,'y')] = 'yyyy';
- $dlarr[strpos($dateformat,'m')] = 'MM';
- $dlarr[strpos($dateformat,'d')] = 'DD';
- ksort($dlarr);
-
- $dateformat= (implode($sep,$dlarr));
-
-
-
$supervisor_id=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['approval_from'];
-
- $need_approval =
$config->config_data['workorder_approval'];
-
- if ($supervisor_id && ($need_approval=='yes'))
- {
- $prefs =
$this->bocommon->create_preferences($this->currentapp,$supervisor_id);
- $supervisor_email = $prefs['email'];
- }
-
-
$project_status=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['project_status'];
- if(!$values['status'])
- {
- $values['status']=$project_status;
- }
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'calculate_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index'),
- 'lang_calculate'
=> lang('Calculate Workorder'),
- 'lang_calculate_statustext' =>
lang('Calculate workorder by adding items from vendors prizebook or adding
general hours'),
-
- 'send_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.view&from=index'),
- 'lang_send'
=> lang('Send Workorder'),
- 'lang_send_statustext' =>
lang('send this workorder to vendor'),
-
- 'project_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit'),
- 'b_account_data'
=> $b_account_data,
- 'table_header_workorder_budget' =>
$table_header_workorder_budget,
- 'lang_no_workorders' =>
lang('No workorder bugdet'),
- 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.w_edit'),
- 'record_history'
=> $record_history,
- 'table_header_history' =>
$table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
- 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
-
- 'lang_start_date_statustext' => lang('Select
the estimated end date for the Project'),
- 'lang_start_date'
=> lang('Workorder start date'),
- 'value_start_date'
=> $values['start_date'],
-
- 'lang_end_date_statustext' =>
lang('Select the estimated end date for the Project'),
- 'lang_end_date'
=> lang('Workorder end date'),
- 'value_end_date'
=> $values['end_date'],
-
- 'lang_copy_workorder' =>
lang('Copy workorder ?'),
- 'lang_copy_workorder_statustext' =>
lang('Choose Copy Workorder to copy this workorder to a new workorder'),
-
- 'lang_contact_phone' =>
lang('Contact phone'),
- 'contact_phone'
=> $project['contact_phone'],
-
- 'lang_charge_tenant' =>
lang('Charge tenant'),
- 'lang_charge_tenant_statustext' => lang('Choose
charge tenant if the tenant i to pay for this project'),
- 'charge_tenant'
=> $values['charge_tenant'],
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'lang_power_meter_statustext' => lang('Enter
the power_meter'),
- 'value_power_meter'
=> $project['power_meter'],
-
- 'lang_addition_rs'
=> lang('Rig addition'),
- 'lang_addition_rs_statustext' => lang('Enter
any round sum addition per order'),
- 'value_addition_rs'
=> $values['addition_rs'],
-
- 'lang_addition_percentage'
=> lang('Percentage addition'),
- 'lang_addition_percentage_statustext' =>
lang('Enter any persentage addition per unit'),
- 'value_addition_percentage'
=> $values['addition_percentage'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $values['budget'],
- 'lang_budget_statustext' =>
lang('Enter the budget'),
-
- 'lang_incl_tax'
=> lang('incl tax'),
- 'lang_calculation'
=> lang('Calculation'),
- 'value_calculation'
=> $values['calculation'],
-
- 'actual_cost'
=> $values['actual_cost'],
- 'lang_actual_cost'
=> lang('Actual cost'),
-
- 'vendor_data'
=> $vendor_data,
- 'location_data'
=> $location_data,
- 'location_type'
=> 'view',
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.index'),
- 'lang_year'
=> lang('Year'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_title'
=> lang('Title'),
- 'value_title'
=> $values['title'],
- 'lang_project_name'
=> lang('Project name'),
- 'value_project_name' =>
$project['name'],
-
- 'lang_project_id'
=> lang('Project ID'),
- 'value_project_id'
=> $values['project_id'],
-
- 'lang_workorder_id'
=> lang('Workorder ID'),
- 'value_workorder_id' =>
$values['workorder_id'],
-
- 'lang_title_statustext' =>
lang('Enter Workorder title'),
-
- 'lang_other_branch'
=> lang('Other branch'),
- 'lang_other_branch_statustext' =>
lang('Enter other branch if not found in the list'),
- 'value_other_branch'
=> $project['other_branch'],
-
- 'lang_descr_statustext' =>
lang('Enter a short description of the workorder'),
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the workorder'),
- 'lang_no_cat'
=> lang('Select category'),
- 'lang_cat_statustext' =>
lang('Select the category the project belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'value_cat_id'
=> $values['cat_id'],
- 'cat_list'
=>
$this->bo->select_category_workorder_list('select',$project['cat_id']),
-
- 'sum_workorder_budget' =>
$values['sum_workorder_budget'],
- 'workorder_budget'
=> $values['workorder_budget'],
-
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_sum'
=> lang('Sum'),
- 'select_user_name'
=> 'values[coordinator]',
- 'user_list'
=>
$this->bocommon->get_user_list('select',$project['coordinator'],$extra=False,$default=False,$start=-1,$sort=False,$order=False,$query='',$offset=-1),
-
- 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
- 'status_name'
=> 'values[status]',
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
- 'lang_status_statustext' =>
lang('What is the current status of this workorder ?'),
-
- 'branch_list'
=> $boproject->select_branch_p_list($project['project_id']),
- 'lang_branch'
=> lang('branch'),
- 'lang_branch_statustext' =>
lang('Select the branches for this project'),
-
- 'key_responsible_list'
=> $boproject->select_branch_list($project['key_responsible']),
- 'lang_key_responsible'
=> lang('key responsible'),
-
- 'key_fetch_list'
=> $this->bo->select_key_location_list($values['key_fetch']),
- 'lang_no_key_fetch'
=> lang('Where to fetch the key'),
- 'lang_key_fetch'
=> lang('key fetch location'),
- 'lang_key_fetch_statustext'
=> lang('Select where to fetch the key'),
-
- 'key_deliver_list'
=> $this->bo->select_key_location_list($values['key_deliver']),
- 'lang_no_key_deliver'
=> lang('Where to deliver the key'),
- 'lang_key_deliver'
=> lang('key deliver location'),
- 'lang_key_deliver_statustext' =>
lang('Select where to deliver the key'),
-
- 'need_approval'
=> $need_approval,
- 'lang_ask_approval'
=> lang('Ask for approval'),
- 'lang_ask_approval_statustext' =>
lang('Check this to send a mail to your supervisor for approval'),
- 'value_approval_mail_address' =>
$supervisor_email,
- 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
- );
-
- $appname
= lang('Workorder');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function add()
- {
- if(!$this->acl_edit)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiworkorder.index'
- );
-
- $GLOBALS['phpgw']->xslttpl->add_file(array('workorder',
-
'menu',
-
'search_field'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit'),
- 'search_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&lookup=true&from=workorder'),
-
- 'lang_done_statustext' =>
lang('Back to the workorder list'),
- 'lang_add_statustext' =>
lang('Adds a new project - then a new workorder'),
- 'lang_search_statustext' =>
lang('Adds a new workorder to an existing project'),
-
- 'lang_done' =>
lang('Done'),
- 'lang_add' =>
lang('Add'),
- 'lang_search' =>
lang('Search')
- );
-
- $appname
= lang('Workorder');
- $function_msg =
lang('Add workorder');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add'
=> $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function delete()
- {
- if(!$this->acl_delete)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
- $id = get_var('id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'menuaction' =>
$this->currentapp.'.uiworkorder.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id);
- Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
- }
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.delete&id='
. $id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('workorder');
- $function_msg =
lang('delete workorder');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $boproject =
CreateObject($this->currentapp.'.boproject');
- $bolocation =
CreateObject($this->currentapp.'.bolocation');
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp);
-
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,'');
-
- $id = get_var('id',array('POST','GET'));
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder','hour_data_view'));
-
- $uiwo_hour =
CreateObject($this->currentapp.'.uiwo_hour');
- $hour_data =
$uiwo_hour->common_data($id,$view=True);
- $values = $this->bo->read_single($id);
- $project =
$boproject->read_single($values['project_id']);
- $record_history = $this->bo->read_record_history($id);
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- $table_header_workorder_budget[] = array
- (
- 'lang_workorder_id' => lang('Workorder'),
- 'lang_sum' => lang('Sum')
- );
-
- $function_msg = lang('View Workorder');
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$project['location_data'],
- 'type_id' =>
count(explode('-',$project['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
$project['location_data']['tenant_id'],
- 'lookup_type' => 'view'
- ));
-
-
- if($project['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
unset($location_data['location'][$i]['value']);
- }
- }
- }
-
-
- $data = array
- (
- 'project_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.view'),
- 'table_header_workorder_budget' =>
$table_header_workorder_budget,
- 'lang_no_workorders' =>
lang('No workorder bugdet'),
- 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
- 'record_history'
=> $record_history,
- 'table_header_history' =>
$table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
- 'lang_project_name'
=> lang('Project name'),
- 'value_project_name' =>
$project['name'],
-
- 'lang_vendor'
=> lang('Vendor'),
- 'value_vendor_id'
=> $values['vendor_id'],
- 'value_vendor_name'
=> $values['vendor_name'],
-
- 'lang_b_account'
=> lang('Budget account'),
- 'value_b_account_id' =>
$values['b_account_id'],
- 'value_b_account_name' =>
$values['b_account_name'],
-
- 'lang_start_date'
=> lang('Project start date'),
- 'value_start_date'
=> $values['start_date'],
-
- 'lang_end_date'
=> lang('Project end date'),
- 'value_end_date'
=> $values['end_date'],
-
- 'lang_charge_tenant' =>
lang('Charge tenant'),
- 'charge_tenant'
=> $values['charge_tenant'],
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'value_power_meter'
=> $project['power_meter'],
-
- 'lang_addition_rs'
=> lang('Rig addition'),
- 'lang_addition_rs_statustext' => lang('Enter
any round sum addition per order'),
- 'value_addition_rs'
=> $values['addition_rs'],
-
- 'lang_addition_percentage'
=> lang('Percentage addition'),
- 'lang_addition_percentage_statustext' =>
lang('Enter any persentage addition per unit'),
- 'value_addition_percentage'
=> $values['addition_percentage'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $values['budget'],
-
- 'actual_cost'
=> $values['actual_cost'],
- 'lang_actual_cost'
=> lang('Actual cost'),
-
- 'location_data'
=> $location_data,
- 'location_type'
=> 'view',
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.index'),
- 'lang_year'
=> lang('Year'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_name'
=> lang('Name'),
-
- 'lang_title'
=> lang('Title'),
- 'value_title'
=> $values['title'],
-
- 'lang_project_id'
=> lang('Project ID'),
- 'value_project_id'
=> $values['project_id'],
- 'value_name'
=> $values['name'],
-
- 'lang_other_branch'
=> lang('Other branch'),
- 'value_other_branch'
=> $project['other_branch'],
-
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'cat_list'
=>
$this->bo->select_category_workorder_list('select',$project['cat_id']),
-
- 'lang_workorder_id'
=> lang('Workorder ID'),
- 'value_workorder_id' =>
$values['workorder_id'],
-
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_sum'
=> lang('Sum'),
- 'user_list'
=>
$this->bocommon->get_user_list('select',$project['coordinator'],$extra=False,$default=False,$start=-1,$sort=False,$order=False,$query='',$offset=-1),
-
- 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
-
- 'branch_list'
=> $this->bo->select_branch_p_list($values['project_id']),
- 'lang_branch'
=> lang('branch'),
-
- 'key_responsible_list' =>
$this->bo->select_branch_list($project['key_responsible']),
- 'lang_key_responsible' =>
lang('key responsible'),
-
- 'key_fetch_list'
=> $this->bo->select_key_location_list($values['key_fetch']),
- 'lang_key_fetch'
=> lang('key fetch location'),
-
- 'key_deliver_list'
=> $this->bo->select_key_location_list($values['key_deliver']),
- 'lang_key_deliver'
=> lang('key deliver location'),
-
- 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&id='
. $id),
- 'lang_edit_statustext' =>
lang('Edit this entry workorder'),
- 'lang_edit'
=> lang('Edit'),
- 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
- 'lang_total_records' =>
lang('Total records'),
- 'total_hours_records' =>
$hour_data['total_hours_records'],
- 'table_header_hour'
=> $hour_data['table_header'],
- 'values_hour'
=> $hour_data['content'],
- 'table_sum'
=> $hour_data['table_sum'],
- 'lang_contact_phone' =>
lang('Contact phone'),
- 'contact_phone'
=> $project['contact_phone']
- );
-
- $appname
= lang('Workorder');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
- // $GLOBALS['phpgw']->xslttpl->pp();
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 project
+ * @version $Id: class.uiworkorder.inc.php,v 1.18 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class uiworkorder
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'excel' => True,
+ 'index' => True,
+ 'view' => True,
+ 'add' => True,
+ 'edit' => True,
+ 'delete' => True
+ );
+
+ function uiworkorder()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ $this->bo =
CreateObject($this->currentapp.'.boworkorder',True);
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->menu =
CreateObject($this->currentapp.'.menu');
+ $this->acl2 =
CreateObject($this->currentapp.'.acl2');
+ $this->acl2_location = '.project';
+ $this->acl_read =
$this->acl2->check('.project',1);
+ $this->acl_add =
$this->acl2->check('.project',2);
+ $this->acl_edit =
$this->acl2->check('.project',4);
+ $this->acl_delete =
$this->acl2->check('.project',8);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->status_id =
$this->bo->status_id;
+ $this->search_vendor =
$this->bo->search_vendor;
+ $this->wo_hour_cat_id =
$this->bo->wo_hour_cat_id;
+ $this->start_date =
$this->bo->start_date;
+ $this->end_date =
$this->bo->end_date;
+
+ $this->menu->sub ='project';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' =>
$this->filter,
+ 'cat_id' =>
$this->cat_id,
+ 'search_vendor' =>
$this->search_vendor,
+ 'status_id' =>
$this->status_id,
+ 'wo_hour_cat_id' =>
$this->wo_hour_cat_id,
+ 'start_date' =>
$this->start_date,
+ 'end_date' =>
$this->end_date
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ function excel()
+ {
+ $start_date = urldecode($this->start_date);
+ $end_date = urldecode($this->end_date);
+ $list =
$this->bo->read($start_date,$end_date,$allrows=True);
+ $uicols = $this->bo->uicols;
+
$this->bocommon->excel($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
+ }
+
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder','values','table_header',
+
'menu',
+
'nextmatchs'));
+
+ $links = $this->menu->links('workorder');
+
+ $start_date = urldecode($this->start_date);
+ $end_date = urldecode($this->end_date);
+ $workorder_list =
$this->bo->read($start_date,$end_date);
+
+ $uicols = $this->bo->uicols;
+ $count_uicols_name=count($uicols['name']);
+
+ $j=0;
+ if (isSet($workorder_list) AND
is_array($workorder_list))
+ {
+ foreach($workorder_list as $workorder_entry)
+ {
+ for ($k=0;$k<$count_uicols_name;$k++)
+ {
+
if($uicols['input_type'][$k]!='hidden')
+ {
+
if($workorder_entry['query_location'][$uicols['name'][$k]])
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('search');
+
$content[$j]['row'][$k]['text'] =
$workorder_entry[$uicols['name'][$k]];
+
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.index&query='
. $workorder_entry['query_location'][$uicols['name'][$k]] . '&lookup=' .
$lookup . '&filter=' . $this->filter);
+ }
+ else
+ {
+
$content[$j]['row'][$k]['value'] =
$workorder_entry[$uicols['name'][$k]];
+
$content[$j]['row'][$k]['name'] = $uicols['name'][$k];
+
if($uicols['name'][$k]=='vendor_id')
+ {
+
$content[$j]['row'][$k]['statustext'] = $workorder_entry['org_name'];
+
$content[$j]['row'][$k]['overlib'] = True;
+
$content[$j]['row'][$k]['text'] =
$workorder_entry[$uicols['name'][$k]];
+ }
+ }
+ }
+ if($lookup &&
$k==($count_uicols_name - 2))
+
$content[$j]['row'][$k]['lookup_action'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&workorder_id='
. $workorder_entry['workorder_id']);
+ }
+ if(!$lookup)
+ {
+ if ($this->acl_read &&
$this->bocommon->check_perms($workorder_entry['grants'],PHPGW_ACL_READ))
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('view the
workorder');
+
$content[$j]['row'][$k]['text'] = lang('view');
+
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view&id='
. $workorder_entry['workorder_id']);
+ $k++;
+ }
+ else
+ {
+
$content[$j]['row'][$k++]['link']='dummy';
+ }
+
+ if ($this->acl_edit &&
$this->bocommon->check_perms($workorder_entry['grants'],PHPGW_ACL_EDIT))
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('edit the
workorder');
+
$content[$j]['row'][$k]['text'] = lang('edit');
+
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&id='
. $workorder_entry['workorder_id']);
+ $k++;
+
+
$content[$j]['row'][$k]['statustext'] = lang('calculate the
workorder');
+
$content[$j]['row'][$k]['text'] =
lang('calculate');
+
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index&workorder_id='
. $workorder_entry['workorder_id']);
+ $k++;
+ }
+ else
+ {
+
$content[$j]['row'][$k++]['link']='dummy';
+
$content[$j]['row'][$k++]['link']='dummy';
+ }
+
+ if ($this->acl_delete &&
$this->bocommon->check_perms($workorder_entry['grants'],PHPGW_ACL_DELETE))
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('delete the
workorder');
+
$content[$j]['row'][$k]['text'] =
lang('delete');
+
$content[$j]['row'][$k]['link'] =
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.delete&id='
. $workorder_entry['workorder_id']);
+ $k++;
+ }
+ else
+ {
+
$content[$j]['row'][$k++]['link']='dummy';
+ }
+ }
+ $j++;
+ }
+ }
+
+ $count_uicols_descr=count($uicols['descr']);
+ for ($i=0;$i<$count_uicols_descr;$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['name'][$i]=='loc1')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'fm_location1.loc1',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiworkorder.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'search_vendor'
=>$this->search_vendor,
+
'cat_id'
=>$this->cat_id,
+
'start_date'=>$start_date,
+
'end_date'=>$end_date,
+
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
+
)
+
));
+ }
+ if($uicols['name'][$i]=='project_id')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'project_id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiworkorder.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'search_vendor'
=>$this->search_vendor,
+
'cat_id'
=>$this->cat_id,
+
'start_date'=>$start_date,
+
'end_date'=>$end_date,
+
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
+
)
+
));
+ }
if($uicols['name'][$i]=='workorder_id')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'workorder_id',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiworkorder.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'search_vendor'
=>$this->search_vendor,
+
'cat_id'
=>$this->cat_id,
+
'start_date'=>$start_date,
+
'end_date'=>$end_date,
+
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
+
)
+
));
+ }
+ if($uicols['name'][$i]=='address')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->nextmatchs->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'address',
+
'order' => $this->order,
+
'extra' => array('menuaction' =>
$this->currentapp.'.uiworkorder.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'lookup'
=>$lookup,
+
'district_id' =>
$this->district_id,
+
'search_vendor'
=>$this->search_vendor,
+
'cat_id'
=>$this->cat_id,
+
'start_date'=>$start_date,
+
'end_date'=>$end_date,
+
'wo_hour_cat_id'
=>$this->wo_hour_cat_id
+
)
+
));
+ }
+
+ }
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('calculate');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+ }
+ else
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header'] =
lang('select');
+ }
+
+//_debug_array($content);
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
workorder'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.add')
+ );
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiworkorder.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'status_id'
=>$this->status_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'search_vendor'
=>$this->search_vendor,
+ 'start_date'
=>$start_date,
+ 'end_date'
=>$end_date,
+ 'wo_hour_cat_id'
=>$this->wo_hour_cat_id
+ );
+
+ $link_date_search
=
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.date_search');
+
+ $link_excel = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiworkorder.excel',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'status_id'
=>$this->status_id,
+ 'filter'
=>$this->filter,
+ 'query'
=>$this->query,
+ 'search_vendor'
=>$this->search_vendor,
+ 'start_date'
=>$start_date,
+ 'end_date'
=>$end_date,
+ 'start'
=>$this->start,
+ 'wo_hour_cat_id'
=>$this->wo_hour_cat_id,
+ );
+
+
+
if($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'])
+ {
+ $group_filters = 'select';
+
$GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour_cat_select'));
+ }
+ else
+ {
+ $group_filters = 'filter';
+
$GLOBALS['phpgw']->xslttpl->add_file(array('wo_hour_cat_filter'));
+ }
+
+ $data = array
+ (
+ 'group_filters' =>
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['group_filters'],
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$GLOBALS['phpgw']->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+
+ 'start_date'
=>$start_date,
+ 'end_date'
=>$end_date,
+ 'lang_none'
=>lang('None'),
+ 'lang_date_search' =>
lang('Date search'),
+ 'lang_date_search_help' => lang('Narrow
the search by dates'),
+ 'link_date_search' =>
$link_date_search,
+ 'overlib_source' =>
'./'.$this->currentapp.'/inc/overlib.js',
+
+ 'link_history'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.index'),
+ 'lang_history_statustext' =>
lang('search for history at this location'),
+ 'links'
=> $links,
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($workorder_list),
+ 'all_records'
=> $this->bo->total_records,
+ 'link_url'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'img_path'
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the workorder belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=>
$this->bo->select_category_workorder_list($group_filters,$this->cat_id),
+ 'select_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+
+ 'lang_status_statustext' =>
lang('Select the status the agreement belongs to. To do not use a category
select NO STATUS'),
+ 'status_name'
=> 'status_id',
+ 'lang_no_status'
=> lang('No status'),
+ 'status_list'
=> $this->bo->select_status_list($group_filters,$this->status_id),
+
+ 'lang_wo_hour_cat_statustext' =>
lang('Select the workorder hour category'),
+ 'lang_no_wo_hour_cat' =>
lang('no hour category'),
+ 'wo_hour_cat_list'
=> $this->bocommon->select_wo_hours_category_list($this->wo_hour_cat_id),
+
+ 'lang_user_statustext' =>
lang('Select the user the workorder belongs to. To do not use a category select
NO USER'),
+ 'select_user_name'
=> 'filter',
+ 'lang_no_user'
=> lang('No user'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl2_location,array('all'),$default=$this->account),
+
+ 'lang_searchvendor_statustext' => lang('Enter
the vendor name to search for'),
+ 'lang_searchfield_statustext' => lang('Enter
the search string. To show all entries, empty this field and press the SUBMIT
button again'),
+ 'lang_searchbutton_statustext' => lang('Submit
the search string'),
+ 'query'
=> $this->query,
+ 'search_vendor'
=> $this->search_vendor,
+ 'lang_search'
=> lang('search'),
+ 'table_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
+
+ $appname
= lang('Workorder');
+ $function_msg =
lang('list workorder');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_workorder' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ $this->save_sessiondata();
+ }
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+ $boproject =
CreateObject($this->currentapp.'.boproject');
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+ $config =
CreateObject('phpgwapi.config');
+ $id =
get_var('id',array('POST','GET'));
+ $project_id =
get_var('project_id',array('POST','GET'));
+ $values =
get_var('values',array('POST'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder'));
+
+ $values['vendor_id'] =
get_var('vendor_id',array('POST'));
+ $values['vendor_name'] =
get_var('vendor_name',array('POST'));
+ $values['b_account_id'] =
get_var('b_account_id',array('POST'));
+ $values['b_account_name'] =
get_var('b_account_name',array('POST'));
+
+
+ $values['start_date'] =
get_var('start_date',array('POST'));
+ $values['end_date'] =
get_var('end_date',array('POST'));
+
+ $config->read_repository();
+
+ if ($values['save'])
+ {
+ if(!$values['title'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a workorder title !'));
+ $error_id=true;
+ }
+ if(!$values['project_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a valid project !'));
+ $error_id=true;
+ }
+
+ if(!$values['status'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
+ }
+ if(!$values['b_account_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a budget account !'));
+ }
+
+ if($id)
+ {
+ $values['workorder_id']=$id;
+ $action='edit';
+ }
+
+ if(!$receipt['error'])
+ {
+ if(!$id)
+ {
+
$values['workorder_id']=$this->bo->next_id();
+ $id =
$values['workorder_id'];
+ }
+ if($values['copy_workorder'])
+ {
+ $action='add';
+ $values['workorder_id'] =
$this->bo->next_id();
+ $id =
$values['workorder_id'];
+ }
+ $receipt =
$this->bo->save($values,$action);
+ $id = $values['workorder_id'];
+ $function_msg = lang('Edit Workorder');
+
+ if ($values['approval'] &&
$values['mail_address'])
+ {
+
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
+
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
+ $headers = "Return-Path: <".
$coordinator_email .">\r\n";
+ $headers .= "From: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
+ $headers .= "Bcc: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
+ $headers .= "Content-type:
text/plain; charset=iso-8859-1\r\n";
+
+ $subject = lang(Approval).": ".
$values['workorder_id'];
+ $message = lang('Workorder %1
needs approval',$values['workorder_id']);
+
+ $mail_method=
$config->config_data['fmwrkorder_mail'];
+ if ($mail_method=='smtp'):
+ {
+ $bcc =
$coordinator_email;
+ $send =
CreateObject('phpgwapi.send');
+ $rcpt =
$send->msg('email', $values['mail_address'], $subject, stripslashes($message),
'', $cc, $bcc, $coordinator_email, $coordinator_name, 'plain');
+ }
+ elseif
($mail_method=='sendmail'):
+ {
+
$rcpt=mail($values['mail_address'],$subject,$message, $headers);
+ }
+ else:
+ {
+
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin
section)'));
+ }
+ endif;
+ }
+
+ if($rcpt)
+ {
+
$receipt['message'][]=array('msg'=>lang('%1 is
notified',$values['mail_address']));
+ }
+ }
+ }
+
+ if(!$receipt['error'])
+ {
+ if($id)
+ {
+ $values =
$this->bo->read_single($id);
+ }
+ if($project_id && !$values['project_id'])
+ {
+ $values['project_id']=$project_id;
+ }
+ $project =
$boproject->read_single_mini($values['project_id']);
+
+ if
(!$this->bocommon->check_perms($project['grants'],PHPGW_ACL_EDIT))
+ {
+
$receipt['error'][]=array('msg'=>lang('You have no edit right for this
project'));
+
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view&id='
. $id);
+ }
+
+ if( $project['key_fetch'] &&
!$values['key_fetch'])
+ {
+
$values['key_fetch']=$project['key_fetch'];
+ }
+
+ if( $project['key_deliver'] &&
!$values['key_deliver'])
+ {
+
$values['key_deliver']=$project['key_deliver'];
+ }
+
+/* if( $project['charge_tenant'] &&
!$values['workorder_id'])
+ {
+
$values['charge_tenant']=$project['charge_tenant'];
+ }
+*/
+ if( $project['start_date'] &&
!$values['start_date'])
+ {
+
$values['start_date']=$project['start_date'];
+ }
+ if( $project['end_date'] &&
!$values['end_date'])
+ {
+
$values['end_date']=$project['end_date'];
+ }
+ if( $project['name'] && !$values['title'])
+ {
+ $values['title']=$project['name'];
+ }
+ if( $project['descr'] && !$values['descr'])
+ {
+ $values['descr']=$project['descr'];
+ }
+ if( $project['status'] && !$values['status'])
+ {
+ $values['status']=$project['status'];
+ }
+ }
+
+ if($id)
+ {
+ $record_history =
$this->bo->read_record_history($id);
+ }
+
+//_debug_array($hour_data);
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ $table_header_workorder_budget[] = array
+ (
+ 'lang_workorder_id' => lang('Workorder'),
+ 'lang_sum' => lang('Sum')
+ );
+
+ if ($id)
+ {
+ $function_msg = lang('Edit Workorder');
+ }
+ else
+ {
+ $function_msg = lang('Add Workorder');
+ }
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$project['location_data'],
+ 'type_id' =>
count(explode('-',$project['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
$project['location_data']['tenant_id'],
+ 'lookup_type' => 'view'
+ ));
+
+
+ if($project['contact_phone'])
+ {
+ for
($i=0;$i<count($location_data['location']);$i++)
+ {
+
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+ {
+
unset($location_data['location'][$i]['value']);
+ }
+ }
+ }
+
+
+
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array(
+ 'vendor_id' =>
$values['vendor_id'],
+ 'vendor_name' =>
$values['vendor_name']));
+
+
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
+ 'b_account_id' =>
$values['b_account_id'],
+ 'b_account_name' =>
$values['b_account_name']));
+
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiworkorder.edit',
+ 'id' => $id
+ );
+
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $sep = '/';
+ $dlarr[strpos($dateformat,'y')] = 'yyyy';
+ $dlarr[strpos($dateformat,'m')] = 'MM';
+ $dlarr[strpos($dateformat,'d')] = 'DD';
+ ksort($dlarr);
+
+ $dateformat= (implode($sep,$dlarr));
+
+
+
$supervisor_id=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['approval_from'];
+
+ $need_approval =
$config->config_data['workorder_approval'];
+
+ if ($supervisor_id && ($need_approval=='yes'))
+ {
+ $prefs =
$this->bocommon->create_preferences($this->currentapp,$supervisor_id);
+ $supervisor_email = $prefs['email'];
+ }
+
+
$project_status=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['project_status'];
+ if(!$values['status'])
+ {
+ $values['status']=$project_status;
+ }
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'calculate_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.index'),
+ 'lang_calculate'
=> lang('Calculate Workorder'),
+ 'lang_calculate_statustext' =>
lang('Calculate workorder by adding items from vendors prizebook or adding
general hours'),
+
+ 'send_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiwo_hour.view&from=index'),
+ 'lang_send'
=> lang('Send Workorder'),
+ 'lang_send_statustext' =>
lang('send this workorder to vendor'),
+
+ 'project_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit'),
+ 'b_account_data'
=> $b_account_data,
+ 'table_header_workorder_budget' =>
$table_header_workorder_budget,
+ 'lang_no_workorders' =>
lang('No workorder bugdet'),
+ 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.w_edit'),
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history'),
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
+ 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
+
+ 'lang_start_date_statustext' => lang('Select
the estimated end date for the Project'),
+ 'lang_start_date'
=> lang('Workorder start date'),
+ 'value_start_date'
=> $values['start_date'],
+
+ 'lang_end_date_statustext' =>
lang('Select the estimated end date for the Project'),
+ 'lang_end_date'
=> lang('Workorder end date'),
+ 'value_end_date'
=> $values['end_date'],
+
+ 'lang_copy_workorder' =>
lang('Copy workorder ?'),
+ 'lang_copy_workorder_statustext' =>
lang('Choose Copy Workorder to copy this workorder to a new workorder'),
+
+ 'lang_contact_phone' =>
lang('Contact phone'),
+ 'contact_phone'
=> $project['contact_phone'],
+
+ 'lang_charge_tenant' =>
lang('Charge tenant'),
+ 'lang_charge_tenant_statustext' => lang('Choose
charge tenant if the tenant i to pay for this project'),
+ 'charge_tenant'
=> $values['charge_tenant'],
+
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'lang_power_meter_statustext' => lang('Enter
the power_meter'),
+ 'value_power_meter'
=> $project['power_meter'],
+
+ 'lang_addition_rs'
=> lang('Rig addition'),
+ 'lang_addition_rs_statustext' => lang('Enter
any round sum addition per order'),
+ 'value_addition_rs'
=> $values['addition_rs'],
+
+ 'lang_addition_percentage'
=> lang('Percentage addition'),
+ 'lang_addition_percentage_statustext' =>
lang('Enter any persentage addition per unit'),
+ 'value_addition_percentage'
=> $values['addition_percentage'],
+
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> $values['budget'],
+ 'lang_budget_statustext' =>
lang('Enter the budget'),
+
+ 'lang_incl_tax'
=> lang('incl tax'),
+ 'lang_calculation'
=> lang('Calculation'),
+ 'value_calculation'
=> $values['calculation'],
+
+ 'actual_cost'
=> $values['actual_cost'],
+ 'lang_actual_cost'
=> lang('Actual cost'),
+
+ 'vendor_data'
=> $vendor_data,
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'view',
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.index'),
+ 'lang_year'
=> lang('Year'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_title'
=> lang('Title'),
+ 'value_title'
=> $values['title'],
+ 'lang_project_name'
=> lang('Project name'),
+ 'value_project_name' =>
$project['name'],
+
+ 'lang_project_id'
=> lang('Project ID'),
+ 'value_project_id'
=> $values['project_id'],
+
+ 'lang_workorder_id'
=> lang('Workorder ID'),
+ 'value_workorder_id' =>
$values['workorder_id'],
+
+ 'lang_title_statustext' =>
lang('Enter Workorder title'),
+
+ 'lang_other_branch'
=> lang('Other branch'),
+ 'lang_other_branch_statustext' =>
lang('Enter other branch if not found in the list'),
+ 'value_other_branch'
=> $project['other_branch'],
+
+ 'lang_descr_statustext' =>
lang('Enter a short description of the workorder'),
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the workorder'),
+ 'lang_no_cat'
=> lang('Select category'),
+ 'lang_cat_statustext' =>
lang('Select the category the project belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'value_cat_id'
=> $values['cat_id'],
+ 'cat_list'
=>
$this->bo->select_category_workorder_list('select',$project['cat_id']),
+
+ 'sum_workorder_budget' =>
$values['sum_workorder_budget'],
+ 'workorder_budget'
=> $values['workorder_budget'],
+
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_sum'
=> lang('Sum'),
+ 'select_user_name'
=> 'values[coordinator]',
+ 'user_list'
=>
$this->bocommon->get_user_list('select',$project['coordinator'],$extra=False,$default=False,$start=-1,$sort=False,$order=False,$query='',$offset=-1),
+
+ 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
+ 'status_name'
=> 'values[status]',
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+ 'lang_status_statustext' =>
lang('What is the current status of this workorder ?'),
+
+ 'branch_list'
=> $boproject->select_branch_p_list($project['project_id']),
+ 'lang_branch'
=> lang('branch'),
+ 'lang_branch_statustext' =>
lang('Select the branches for this project'),
+
+ 'key_responsible_list'
=> $boproject->select_branch_list($project['key_responsible']),
+ 'lang_key_responsible'
=> lang('key responsible'),
+
+ 'key_fetch_list'
=> $this->bo->select_key_location_list($values['key_fetch']),
+ 'lang_no_key_fetch'
=> lang('Where to fetch the key'),
+ 'lang_key_fetch'
=> lang('key fetch location'),
+ 'lang_key_fetch_statustext'
=> lang('Select where to fetch the key'),
+
+ 'key_deliver_list'
=> $this->bo->select_key_location_list($values['key_deliver']),
+ 'lang_no_key_deliver'
=> lang('Where to deliver the key'),
+ 'lang_key_deliver'
=> lang('key deliver location'),
+ 'lang_key_deliver_statustext' =>
lang('Select where to deliver the key'),
+
+ 'need_approval'
=> $need_approval,
+ 'lang_ask_approval'
=> lang('Ask for approval'),
+ 'lang_ask_approval_statustext' =>
lang('Check this to send a mail to your supervisor for approval'),
+ 'value_approval_mail_address' =>
$supervisor_email,
+ 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
+ );
+
+ $appname
= lang('Workorder');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function add()
+ {
+ if(!$this->acl_edit)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiworkorder.index'
+ );
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('workorder',
+
'menu',
+
'search_field'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit'),
+ 'search_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&lookup=true&from=workorder'),
+
+ 'lang_done_statustext' =>
lang('Back to the workorder list'),
+ 'lang_add_statustext' =>
lang('Adds a new project - then a new workorder'),
+ 'lang_search_statustext' =>
lang('Adds a new workorder to an existing project'),
+
+ 'lang_done' =>
lang('Done'),
+ 'lang_add' =>
lang('Add'),
+ 'lang_search' =>
lang('Search')
+ );
+
+ $appname
= lang('Workorder');
+ $function_msg =
lang('Add workorder');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add'
=> $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function delete()
+ {
+ if(!$this->acl_delete)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+ $id = get_var('id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uiworkorder.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id);
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ }
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.delete&id='
. $id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('workorder');
+ $function_msg =
lang('delete workorder');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+
+ function view()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $boproject =
CreateObject($this->currentapp.'.boproject');
+ $bolocation =
CreateObject($this->currentapp.'.bolocation');
+
+ $receipt =
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp);
+
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,'');
+
+ $id = get_var('id',array('POST','GET'));
+
+
$GLOBALS['phpgw']->xslttpl->add_file(array('workorder','hour_data_view'));
+
+ $uiwo_hour =
CreateObject($this->currentapp.'.uiwo_hour');
+ $hour_data =
$uiwo_hour->common_data($id,$view=True);
+ $values = $this->bo->read_single($id);
+ $project =
$boproject->read_single($values['project_id']);
+ $record_history = $this->bo->read_record_history($id);
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ $table_header_workorder_budget[] = array
+ (
+ 'lang_workorder_id' => lang('Workorder'),
+ 'lang_sum' => lang('Sum')
+ );
+
+ $function_msg = lang('View Workorder');
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$project['location_data'],
+ 'type_id' =>
count(explode('-',$project['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
$project['location_data']['tenant_id'],
+ 'lookup_type' => 'view'
+ ));
+
+
+ if($project['contact_phone'])
+ {
+ for
($i=0;$i<count($location_data['location']);$i++)
+ {
+
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+ {
+
unset($location_data['location'][$i]['value']);
+ }
+ }
+ }
+
+
+ $data = array
+ (
+ 'project_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.view'),
+ 'table_header_workorder_budget' =>
$table_header_workorder_budget,
+ 'lang_no_workorders' =>
lang('No workorder bugdet'),
+ 'workorder_link'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.view'),
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history'),
+
+ 'lang_project_name'
=> lang('Project name'),
+ 'value_project_name' =>
$project['name'],
+
+ 'lang_vendor'
=> lang('Vendor'),
+ 'value_vendor_id'
=> $values['vendor_id'],
+ 'value_vendor_name'
=> $values['vendor_name'],
+
+ 'lang_b_account'
=> lang('Budget account'),
+ 'value_b_account_id' =>
$values['b_account_id'],
+ 'value_b_account_name' =>
$values['b_account_name'],
+
+ 'lang_start_date'
=> lang('Project start date'),
+ 'value_start_date'
=> $values['start_date'],
+
+ 'lang_end_date'
=> lang('Project end date'),
+ 'value_end_date'
=> $values['end_date'],
+
+ 'lang_charge_tenant' =>
lang('Charge tenant'),
+ 'charge_tenant'
=> $values['charge_tenant'],
+
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'value_power_meter'
=> $project['power_meter'],
+
+ 'lang_addition_rs'
=> lang('Rig addition'),
+ 'lang_addition_rs_statustext' => lang('Enter
any round sum addition per order'),
+ 'value_addition_rs'
=> $values['addition_rs'],
+
+ 'lang_addition_percentage'
=> lang('Percentage addition'),
+ 'lang_addition_percentage_statustext' =>
lang('Enter any persentage addition per unit'),
+ 'value_addition_percentage'
=> $values['addition_percentage'],
+
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> $values['budget'],
+
+ 'actual_cost'
=> $values['actual_cost'],
+ 'lang_actual_cost'
=> lang('Actual cost'),
+
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'view',
+ 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.index'),
+ 'lang_year'
=> lang('Year'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_name'
=> lang('Name'),
+
+ 'lang_title'
=> lang('Title'),
+ 'value_title'
=> $values['title'],
+
+ 'lang_project_id'
=> lang('Project ID'),
+ 'value_project_id'
=> $values['project_id'],
+ 'value_name'
=> $values['name'],
+
+ 'lang_other_branch'
=> lang('Other branch'),
+ 'value_other_branch'
=> $project['other_branch'],
+
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'cat_list'
=>
$this->bo->select_category_workorder_list('select',$project['cat_id']),
+
+ 'lang_workorder_id'
=> lang('Workorder ID'),
+ 'value_workorder_id' =>
$values['workorder_id'],
+
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_sum'
=> lang('Sum'),
+ 'user_list'
=>
$this->bocommon->get_user_list('select',$project['coordinator'],$extra=False,$default=False,$start=-1,$sort=False,$order=False,$query='',$offset=-1),
+
+ 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+
+ 'branch_list'
=> $this->bo->select_branch_p_list($values['project_id']),
+ 'lang_branch'
=> lang('branch'),
+
+ 'key_responsible_list' =>
$this->bo->select_branch_list($project['key_responsible']),
+ 'lang_key_responsible' =>
lang('key responsible'),
+
+ 'key_fetch_list'
=> $this->bo->select_key_location_list($values['key_fetch']),
+ 'lang_key_fetch'
=> lang('key fetch location'),
+
+ 'key_deliver_list'
=> $this->bo->select_key_location_list($values['key_deliver']),
+ 'lang_key_deliver'
=> lang('key deliver location'),
+
+ 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&id='
. $id),
+ 'lang_edit_statustext' =>
lang('Edit this entry workorder'),
+ 'lang_edit'
=> lang('Edit'),
+ 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+ 'lang_total_records' =>
lang('Total records'),
+ 'total_hours_records' =>
$hour_data['total_hours_records'],
+ 'table_header_hour'
=> $hour_data['table_header'],
+ 'values_hour'
=> $hour_data['content'],
+ 'table_sum'
=> $hour_data['table_sum'],
+ 'lang_contact_phone' =>
lang('Contact phone'),
+ 'contact_phone'
=> $project['contact_phone']
+ );
+
+ $appname
= lang('Workorder');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+ // $GLOBALS['phpgw']->xslttpl->pp();
+ }
+ }
+?>
Index: property/inc/custom/cron.php
diff -u property/inc/custom/cron.php:1.6 property/inc/custom/cron.php:1.7
--- property/inc/custom/cron.php:1.6 Wed Jan 4 08:01:12 2006
+++ property/inc/custom/cron.php Fri Feb 3 12:05:49 2006
@@ -1,49 +1,49 @@
-#!/usr/bin/php -q
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: cron.php,v 1.6 2006/01/04 08:01:12 sigurdne Exp $
- */
-
- /**
- * Description
- * example cron : /usr/local/bin/php -q
/var/www/html/phpgroupware/property/inc/custom/cron.php default
oppdater_namssakstatus_pr_leietaker
- */
-
- $path_to_phpgroupware = dirname(__FILE__) . '/../../..'; // need
to be adapted if this script is moved somewhere else
- $_GET['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] :
'default';
-
-
- if(!$function = $_SERVER['argv'][2])
-
- {
- echo date('Y/m/d H:i:s ') . " Nothing to execute\n";
- return;
- }
-
-// echo $function;
-
- $GLOBALS['phpgw_info']['flags'] = array(
- 'currentapp' => 'login',
- 'noapi' => True // this stops header.inc.php to
include phpgwapi/inc/function.inc.php
- );
- include($path_to_phpgroupware.'/header.inc.php');
- unset($GLOBALS['phpgw_info']['flags']['noapi']);
-
- $db_type = $GLOBALS['phpgw_domain'][$_GET['domain']]['db_type'];
-
- $GLOBALS['phpgw_info']['server']['sessions_type'] = 'db';
-
- include(PHPGW_API_INC.'/functions.inc.php');
-
- $num = ExecMethod('property.custom_functions.index',array('function' =>
$function,'enabled'=>1));
- // echo date('Y/m/d H:i:s ').$_GET['domain'].': '.($num ? "$num job(s)
executed" : 'Nothing to execute')."\n";
-
- $GLOBALS['phpgw']->common->phpgw_exit();
+#!/usr/bin/php -q
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: cron.php,v 1.7 2006/02/03 12:05:49 sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * example cron : /usr/local/bin/php -q
/var/www/html/phpgroupware/property/inc/custom/cron.php default
oppdater_namssakstatus_pr_leietaker
+ */
+
+ $path_to_phpgroupware = dirname(__FILE__) . '/../../..'; // need
to be adapted if this script is moved somewhere else
+ $_GET['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] :
'default';
+
+
+ if(!$function = $_SERVER['argv'][2])
+
+ {
+ echo date('Y/m/d H:i:s ') . " Nothing to execute\n";
+ return;
+ }
+
+// echo $function;
+
+ $GLOBALS['phpgw_info']['flags'] = array(
+ 'currentapp' => 'login',
+ 'noapi' => True // this stops header.inc.php to
include phpgwapi/inc/function.inc.php
+ );
+ include($path_to_phpgroupware.'/header.inc.php');
+ unset($GLOBALS['phpgw_info']['flags']['noapi']);
+
+ $db_type = $GLOBALS['phpgw_domain'][$_GET['domain']]['db_type'];
+
+ $GLOBALS['phpgw_info']['server']['sessions_type'] = 'db';
+
+ include(PHPGW_API_INC.'/functions.inc.php');
+
+ $num = ExecMethod('property.custom_functions.index',array('function' =>
$function,'enabled'=>1));
+ // echo date('Y/m/d H:i:s ').$_GET['domain'].': '.($num ? "$num job(s)
executed" : 'Nothing to execute')."\n";
+
+ $GLOBALS['phpgw']->common->phpgw_exit();
Index: property/inc/export/Agresso
diff -u property/inc/export/Agresso:1.29 property/inc/export/Agresso:1.30
--- property/inc/export/Agresso:1.29 Fri Jan 27 17:03:30 2006
+++ property/inc/export/Agresso Fri Feb 3 12:05:49 2006
@@ -1,1035 +1,1035 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 export
- * @version $Id: Agresso,v 1.29 2006/01/27 17:03:30 sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class export_conv
- {
- //var $fil_katalog='c:/temp'; //On windows use
"//computername/share/filename" or "\\\\computername\share\filename" to check
files on network shares.
-
- var $old_files_deleted;
- var $debug;
-
- function export_conv()
- {
- $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- // $this->db = $GLOBALS['phpgw']->db;
-
- $this->soXport = CreateObject('property.soXport');
- $this->config =
CreateObject('phpgwapi.config','property');
- $this->config->read_repository();
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->db = $this->bocommon->new_db();
- }
-
- function
select_periods_with_invoice_to_transfer($pre_transfer='')
- {
- if($pre_transfer)
- {
- $sql= "SELECT DISTINCT periode from fm_ecobilag
WHERE utbetalingsigndato IS NULL ";
- }
- else
- {
- $sql= "SELECT DISTINCT periode from fm_ecobilag
WHERE budsjettsigndato is not null and (saksigndato is not null or
oppsynsigndato is not null) and utbetalingsigndato is not null ";
- }
-
- $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db->next_record())
- {
- $periode[] = $this->db->f('periode');
- }
- return $periode;
- }
-
- function log_end($batchid)
- {
- $tid=date($this->soXport->datetimeformat);
- $sql= "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','End transfer','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- function log_error($batchid,$error_desr)
- {
- $tid=date($this->datetimeformat);
- $sql= "insert into fm_ecologg
(batchid,ecobilagid,status,melding,tid) values
('$batchid',NULL,0,'$error_desr','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- function increment_batchid()
- {
-
- $this->db->query("update fm_idgenerator set value =
value + 1 where name = 'Ecobatchid'",__LINE__,__FILE__);
- $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'",__LINE__,__FILE__);
- $this->db->next_record();
- $bilagsnr = $this->db->f('value');
- return $bilagsnr;
-
- }
-
- function next_batchid()
- {
-
- $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'",__LINE__,__FILE__);
- $this->db->next_record();
- $batchid = $this->db->f('value')+1;
-
- return $batchid;
- }
-
- //Lagre start melding
- function log_start($batchid)
- {
- $tid=date($this->soXport->datetimeformat);
- $sql= "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','Start transfer','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- function get_vendor_info($vendor_id='')
- {
- $sql = "select org_nr,konto_nr from fm_vendor where
id='$vendor_id'";
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
-
- $vendor_info= array(
- 'org_nr' => $this->db->f('org_nr'),
- 'konto_nr' => $this->db->f('konto_nr')
- );
-
- return $vendor_info;
- }
-
- function get_order_title($order_id='')
- {
- $sql = "select type from fm_orders where
id='$order_id'";
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
-
- switch($this->db->f('type'))
- {
- case 'workorder':
- $sql2 = "select title from fm_workorder
where id='$order_id'";
-
$this->db->query($sql2,__LINE__,__FILE__);
- $this->db->next_record();
- $order_title = $this->db->f('title');
- break;
- case 's_agreement':
- $sql2 = "select descr as title from
fm_s_agreement where id='$order_id'";
-
$this->db->query($sql2,__LINE__,__FILE__);
- $this->db->next_record();
- $order_title = $this->db->f('title');
- break;
- }
-
- return $order_title;
- }
-
-
- function select_invoice_rollback($day,$month,$year,$Filnavn)
- {
-
- switch($GLOBALS['phpgw_info']['server']['db_type'])
- {
- case 'mssql':
- $datepart_year =
"datepart(year,overftid)";
- $datepart_month =
"datepart(month,overftid)";
- $datepart_day =
"datepart(day,overftid)";
- break;
- case 'mysql':
- $datepart_year =
"YEAR(overftid)";
- $datepart_month =
"MONTH(overftid)";
- $datepart_day =
"DAYOFMONTH(overftid)";
- break;
- case 'pgsql':
- $datepart_year =
"date_part('year',overftid)";
- $datepart_month =
"date_part('month',overftid)";
- $datepart_day =
"date_part('day',overftid)";
- break;
- }
-
-
- $sql="select * from fm_ecobilagoverf where
filnavn='$Filnavn' and $datepart_year=$year and $datepart_month=$month and
$datepart_day= $day";
- $this->db->query($sql,__LINE__,__FILE__);
-
- $i = 0;
- while ($this->db->next_record())
- {
- $invoice_roleback[$i]['id'] =
$this->db->f('id');
- $invoice_roleback[$i]['bilagsnr'] =
$this->db->f('bilagsnr');
- $invoice_roleback[$i]['kidnr'] =
$this->db->f('kidnr');
- $invoice_roleback[$i]['typeid'] =
$this->db->f('typeid');
- $invoice_roleback[$i]['kildeid'] =
$this->db->f('kildeid');
- $invoice_roleback[$i]['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
- $invoice_roleback[$i]['belop'] =
$this->db->f('belop');
- $invoice_roleback[$i]['fakturadato'] =
$this->db->f('fakturadato');
- $invoice_roleback[$i]['periode'] =
$this->db->f('periode');
- $invoice_roleback[$i]['forfallsdato'] =
$this->db->f('forfallsdato');
- $invoice_roleback[$i]['fakturanr'] =
$this->db->f('fakturanr');
- $invoice_roleback[$i]['spbudact_code'] =
$this->db->f('spbudact_code');
- $invoice_roleback[$i]['regtid'] =
$this->db->f('regtid');
- $invoice_roleback[$i]['artid'] =
$this->db->f('artid');
- $invoice_roleback[$i]['godkjentbelop'] =
$this->db->f('godkjentbelop');
- $invoice_roleback[$i]['spvend_code'] =
$this->db->f('spvend_code');
- $invoice_roleback[$i]['dima'] =
$this->db->f('dima');
- $invoice_roleback[$i]['loc1'] =
$this->db->f('loc1');
- $invoice_roleback[$i]['dimb'] =
$this->db->f('dimb');
- $invoice_roleback[$i]['mvakode'] =
$this->db->f('mvakode');
- $invoice_roleback[$i]['dimd'] =
$this->db->f('dimd');
- $invoice_roleback[$i]['project_id'] =
$this->db->f('project_id');
- $invoice_roleback[$i]['kostra_id'] =
$this->db->f('kostra_id');
- $invoice_roleback[$i]['item_type'] =
$this->db->f('item_type');
- $invoice_roleback[$i]['item_id'] =
$this->db->f('item_id');
-
- if($this->db->f('oppsynsmannid'))
- {
- $invoice_roleback[$i]['oppsynsmannid']
= $this->db->f('oppsynsmannid');
- }
- if($this->db->f('saksbehandlerid'))
- {
-
$invoice_roleback[$i]['saksbehandlerid'] =
$this->db->f('saksbehandlerid');
- }
-
- $invoice_roleback[$i]['budsjettansvarligid']
= $this->db->f('budsjettansvarligid');
-
- if($this->db->f('oppsynsigndato'))
- {
- $invoice_roleback[$i]['oppsynsigndato']
= $this->db->f('oppsynsigndato');
- }
- if($this->db->f('saksigndato'))
- {
- $invoice_roleback[$i]['saksigndato']
= $this->db->f('saksigndato');
- }
-
- $invoice_roleback[$i]['budsjettsigndato']
= $this->db->f('budsjettsigndato');
- $invoice_roleback[$i]['merknad'] =
$this->db->f('merknad');
- $invoice_roleback[$i]['splitt'] =
$this->db->f('splitt');
- $invoice_roleback[$i]['ordrebelop'] =
$this->db->f('ordrebelop');
- $invoice_roleback[$i]['utbetalingid'] =
$this->db->f('utbetalingid');
- $invoice_roleback[$i]['utbetalingsigndato']
= $this->db->f('utbetalingsigndato');
- $i++;
- }
- return $invoice_roleback;
- }
-
-
- //rollback function
- function bilag_update_overf($BilagOverf)
- {
- $values= array(
- $BilagOverf['project_id'],
- $BilagOverf['kostra_id'],
- $BilagOverf['pmwrkord_code'],
- $BilagOverf['bilagsnr'],
- $BilagOverf['splitt'],
- $BilagOverf['kildeid'],
- $BilagOverf['kidnr'],
- $BilagOverf[typeid],
- $BilagOverf['fakturadato'],
- $BilagOverf['forfallsdato'],
- $BilagOverf['regtid'],
- $BilagOverf['artid'],
- $BilagOverf['spvend_code'],
- $BilagOverf['dimb'],
- $BilagOverf['oppsynsmannid'],
- $BilagOverf['saksbehandlerid'],
- $BilagOverf['budsjettansvarligid'],
- $BilagOverf['fakturanr'],
- $BilagOverf['spbudact_code'],
- $BilagOverf['dima'],
- $BilagOverf['loc1'],
- $BilagOverf['dimd'],
- $BilagOverf['mvakode'],
- $BilagOverf['periode'],
-
$this->db->db_addslashes($BilagOverf['merknad']),
- $BilagOverf['utbetalingid'],
- $BilagOverf['oppsynsigndato'],
- $BilagOverf['saksigndato'],
- $BilagOverf['budsjettsigndato'],
- $BilagOverf['utbetalingsigndato'],
- $BilagOverf['item_type'],
- $BilagOverf['item_id'],
- );
-
- $values = $this->bocommon->validate_db_insert($values);
-
- $sql= "INSERT INTO fm_ecobilag
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
- . "
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
- . "
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
- . "
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,item_type,item_id,belop,godkjentbelop)"
- . " values ($values,"
- . $this->bocommon->moneyformat($BilagOverf['belop']) .
","
- .
$this->bocommon->moneyformat($BilagOverf['godkjentbelop']) . ")";
-
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
-
- //Oppdater beløp på arbeidsordre operator="-" ved tilbakerulling
- function
correct_actual_cost($pmwrkord_code,$Belop,$actual_cost_field,$operator)
- {
- $Belop=$Belop/100;
-
- $sql="update fm_workorder set
$actual_cost_field=$actual_cost_field $operator $Belop where
id='$pmwrkord_code'";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
-
- function
overfor($download,$pre_transfer='',$force_period_year='')
- {
-
-// $download = 'on';
-// $download = False;
- $pre_transfer=True;
-// $this->debug=True;
-
- //Generer batch ID
- $batchid = $this->soXport->next_batchid();
- if ($download=='on')
- {
- $this->increment_batchid();
- //Lagre melding
- $this->log_start($batchid);
- }
-
- //Velg ut alle perioder som har bilag som skal overføres
-
-
- if ($pre_transfer)
- {
- $periode =
$this->select_periods_with_invoice_to_transfer($pre_transfer);
-
- for ($i=0;$i<count($periode);$i++)
- {
-
- $receipt['message'][]= array('msg' =>
$this->OverforPeriode($batchid,$periode[$i],$download,$pre_transfer));
- }
- }
-
-
- $pre_transfer=False;
-
- $periode =
$this->select_periods_with_invoice_to_transfer($pre_transfer);
-
- for ($i=0;$i<count($periode);$i++)
- {
-
- $receipt['message'][]= array('msg' =>
$this->OverforPeriode($batchid,$periode[$i],$download,$pre_transfer,$force_period_year));
- }
-
-
-
- //Lagre melding
- if ($download=='on' || $pre_transfer)
- {
- $this->log_end($batchid); //Lagre melding
- }
-
- return $receipt;
- }
-
- function errorhandler($error_desr)
- {
- $this->db->transaction_abort();
-
- $meld = $error_desr;
-
- //Vis feilmelding
-// echo $meld;
-
- //Lagre feilmelding
- $this->log_error($batchid,$error_desr);
- }
-
- function RullTilbake($Filnavn,$Dato)
- {
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $dateformat = str_replace(".","",$dateformat);
- $dateformat = str_replace("-","",$dateformat);
- $dateformat = str_replace("/","",$dateformat);
- $y=strpos($dateformat,'y');
- $d=strpos($dateformat,'d');
- $m=strpos($dateformat,'m');
-
- $dateparts = explode('/', $Dato);
- $day = $dateparts[$d];
- $month = $dateparts[$m];
- $year = $dateparts[$y];
- /* $date1 = mktime (2,0,0,$month,$day,$year);
- if ($date1)
- {
- $Dato=$date1;
- }
-
- $Dato= date("M d Y",$Dato);
- */
-
-
$BilagOverf=$this->select_invoice_rollback($day,$month,$year,$Filnavn);
- $this->db->transaction_begin();
-
- for ($i=0;$i<count($BilagOverf);$i++)
- {
- $this->bilag_update_overf($BilagOverf[$i]);
-
-
- if($BilagOverf[$i]['pmwrkord_code'])
- {
- if ($BilagOverf[$i]['artid']==1)
- {
- $Belop = sprintf("%01.2f",
$BilagOverf[$i]['ordrebelop'])*100;
- }
- else
- {
- $Belop = sprintf("%01.2f",
-$BilagOverf[$i]['ordrebelop'])*100;
- }
-
- if ($BilagOverf[$i]['dimd'] % 2 == 0)
- {
-
$actual_cost_field='act_mtrl_cost';
- }
- else
- {
-
$actual_cost_field='act_vendor_cost';
- }
-
- $operator='-';
-
-
$this->correct_actual_cost($BilagOverf[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
- }
-
- //Slett fra avviks tabell
- //
$this->soXport->delete_avvik($BilagOverf[$i]['bilagsnr']);
-
- //Slett fra arkiv
-
$this->soXport->delete_invoice($BilagOverf[$i]['bilagsnr']);
-
- $antall = $antall + 1;
- }
-
- if($antall > 0)
- {
- $fil_katalog =
$this->config->config_data['export_path'];
-
- if(unlink ($fil_katalog. SEP . $Filnavn))
- {
- $this->db->transaction_commit();
- $receipt['message'][]= array('msg' =>
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
- $receipt['message'][]= array('msg' =>
lang('File %1 is deleted',$Filnavn));
- }
- else
- {
- $this->db->transaction_abort();
- $receipt['message'][]= array('msg' =>
'Noe gikk galt!');
- }
- }
- else
- {
- $receipt['error'][]= array('msg' => lang('Sorry
- None hits'));
- }
- return $receipt;
- }
-
-
- function LagFilnavn ($batchid,$pre_transfer='')
- {
- if($pre_transfer)
- {
- $fil_katalog =
$this->config->config_data['export_pre_path'];
-
- // Slett gamle filer
-
- if(!$this->old_files_deleted)
- {
- for ($i=0;$i<13;$i++)
- {
- @unlink($fil_katalog . '/FDA_'
. $i. '.TXT');
- }
-
- $this->old_files_deleted= True;
- }
-
-
- $i = 1;
- do
- {
- $Filnavn = $fil_katalog . '/FDA_' . $i.
'.TXT';
-
- //Sjekk om filen eksisterer
- If (!file_exists($Filnavn))
- {
- return $Filnavn;
- }
-
- $i++;
- }
- while ($i < 13);
-
- }
- else
- {
- $fil_katalog =
$this->config->config_data['export_path'];
- $continue = True;
- $i = 1;
- do
- {
- $Filnavn = $fil_katalog . '/FDB' .
date("dmy") . '_' . sprintf("%02s",$i) . '.TXT';
-
- //Sjekk om filen eksisterer
- If (!file_exists($Filnavn))
- {
- return $Filnavn;
- }
-
- $i++;
- }
- while ($continue);
- }
-
-
- //Ingen løpenr er ledige, gi feilmelding
- return False;
- }
-
- function
OverforPeriode($batchid,$periode,$download,$pre_transfer='',$force_period_year='')
- {
- $BilagId = 'NULL';
-
- //Bestem filnavn
-
- $this->db->transaction_begin();
-
- $Filnavn = $this->LagFilnavn($batchid,$pre_transfer);
- if (!$Filnavn)
- {
- $message='LagFilnavn'.lang('Alle løpenr for
filnavn er i bruk!');
- $this->errorhandler($message);
- return $message;
- }
-
- //Test om filen kan opprettes og skrives til
- if (@fopen($Filnavn, "wb"))
- {
- unlink($Filnavn);
- }
- else
- {
- $message='kan ikke lagre til fil: '. $Filnavn
.'<br>';
- return $message;
- }
-
- //Velg ut alle hoved bilag som skal overføres
-
-
$oRsBilag=$this->soXport->hoved_bilag($periode,$pre_transfer);
-
- $bilag_count= count($oRsBilag);
- for ($k=0;$k<$bilag_count;$k++)
- {
- $tranfser_bilag[] = $oRsBilag[$k]['bilagsnr'];
-
- //Bestem belops felt
- if ($oRsBilag[$k]['splitt']==0)
- {
- //Bilaget er ikke splittet
- if ($oRsBilag[$k]['godkjentbelop'] <>
$oRsBilag[$k]['belop'])
- {
- $BelopFelt = 'godkjentbelop';
- //Logg til avviks tabell
- if ($download=='on' &&
!$pre_transfer)
- {
-//
$this->soXport->log_to_deviation_table($oRsBilag[$k]);
- }
- }
- else
- {
- $BelopFelt = 'belop';
- }
- }
-
- //Bilaget er splittet
- if ($oRsBilag[$k]['godkjentbelop'] ==
$oRsBilag[$k]['belop'])
- {
- $BelopFelt = 'godkjentbelop';
- }
- else
- {
- //Ikke lovlig
- $message = lang('Avvik mellom
fakturabeløp og godkjent beløp på splittet faktura!');
- $this->errorhandler($message);
- return $message;
- }
-
- $Belop_motpost =$oRsBilag[$k][$BelopFelt] *100;
-
- //Skriv hovedbilag
-
- $Buntnr =
sprintf("%-12s",basename($Filnavn,".TXT"));// verdi: MMDDFL, type: c12, plass:
1 - 12
- $Forsystem = 'BI';// verdi: BI, type: c2,
plass: 13 - 14
-
- $Transtype = 'GL';// verdi: GL, type: c2,
plass: 17 - 18
- $Firmakode = sprintf("%-2s",'BB');//
verdi: Firmakode, type: c2, plass: 19 - 20
-
- $Valuteringsdato=
date(Ymd,strtotime($oRsBilag[$k]['fakturadato']));// verdi: Dato, type: date,
plass: 251 - 258
- $Bilagsdato =
date(Ymd,strtotime($oRsBilag[$k]['fakturadato'])) ;// verdi: Dato, type: date,
plass: 259 - 266
- $Bilagsnr =
sprintf("%-9s",substr($oRsBilag[$k]['bilagsnr'],-8));// verdi: Bilagsnummer,
type: i4, plass: 267 - 275
- // $Periode =
sprintf("%06s",date(Y,strtotime($oRsBilag[$k]['fakturadato'])) .
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
- $ESL = sprintf("%1s",'');// verdi:
Blank, type: i+C481, plass: 282 - 282
-
- if($pre_transfer)
- {
- if(abs(date(m,time()) - $periode) >1)
- {
- $temp_period = date(m,time())
-1;
-
- if($temp_period == 0)
- {
- $temp_period =1;
- }
-
- $temp_year = date(Y,time());
- }
- else
- {
- $temp_period = $periode;
- $temp_year =
date(Y,strtotime($oRsBilag[$k]['fakturadato']));
- }
-
- $Periode =
sprintf("%06s",$temp_year . sprintf("%02d",$temp_period));// verdi: Periode,
type: i4, plass: 276 - 281
- $Bilagsart =
sprintf("%2s",'FF');// verdi: , type: c2, plass: 15 - 16
- $Forfall = '20991231';// verdi:
Forfallsdato , type: date, plass: 298 - 305
- }
- else
- {
-
- if($force_period_year)
- {
- $Periode =
sprintf("%06s",$force_period_year . sprintf("%02d",$periode));// verdi:
Periode, type: i4, plass: 276 - 281
- }
- else
- {
- $Periode =
sprintf("%06s",date(Y,strtotime($oRsBilag[$k]['fakturadato'])) .
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
- }
-
- $Bilagsart =
sprintf("%2s",'FD');// verdi: , type: c2, plass: 15 - 16
- $Forfall =
date(Ymd,strtotime($oRsBilag[$k]['forfallsdato']));// verdi: Forfallsdato ,
type: date, plass: 298 - 305
- }
-
- $Rab_forf = sprintf("%-8s",'');// verdi:
Blank, type: date, plass: 306 - 313
- $Rabatt = sprintf("%020s",'');// verdi:
Blank, type: money, plass: 314 - 333
- $Avt_Kon = sprintf("%-8s",'');// verdi:
Blank, type: c8, plass: 334 - 341
-
- $Kid =
sprintf("%-27s",$oRsBilag[$k]['kidnr']);// verdi: Kid, type: c27, plass: 351 -
377
- $Bet_overforing = sprintf("%-2s",'');// verdi:
Blank, type: c2, plass: 378 - 379
- $Status = 'N';// verdi: N, type: c1,
plass: 380 - 380
- $Resk_type = 'P';// verdi: Blank, type:
c1, plass: 381 - 381
- $Resk_nr =
sprintf("%-9s",$oRsBilag[$k]['spvend_code']);// verdi: Blank., type: i4, plass:
382 - 390
- $Forskudd = '0';// verdi: 0, type: i1,
plass: 391 - 391
- $Fakturaref = '000000000';// verdi: 0,
type: i4, plass: 392 - 400
- $Fakturaref = '000000000';// verdi: 0,
type: i4, plass: 401 - 409
- $Inkassokode = sprintf("%-6s",'');// verdi:
Blank, type: c6, plass: 410 - 415
- $Bet_mottager = sprintf("%-8s",'');// verdi:
Blank, type: c8, plass: 416 - 423
- $Att_ansvarlig =
sprintf("%-6s",$oRsBilag[$k]['saksbehandler']);// verdi: Blank, type: c6,
plass: 424 - 429
-
- $vendor_info =
$this->get_vendor_info($oRsBilag[$k]['spvend_code']);
-
- if(!$vendor_info['org_nr'])
- {
- $message = 'mangler org_nr for
reskontronr: ' . $oRsBilag[$k]['spvend_code'];
- $this->errorhandler($message);
- return $message;
- }
-
- if(!$vendor_info['konto_nr'])
- {
- $message = 'mangler konto for
reskontronr: ' . $oRsBilag[$k]['spvend_code'];
- $this->errorhandler($message);
- return $message;
- }
-
- $Resk_navn =
sprintf("%-50s",$vendor_info['org_nr']);// verdi: Fødselsnr, type: c50, plass:
430 - 479
- $Postadresse = sprintf("%-160s",'');//
verdi: Blank, type: c160, plass: 480 - 639
- $Stat_Provins = sprintf("%-50s",'');// verdi:
Blank, type: c50, plass: 640 - 689
- $Sted = sprintf("%-50s",'');// verdi:
Blank, type: c50, plass: 690 - 739
- $Bank_Postgiro_kontonr =
sprintf("%-35s",str_replace(" ","",$vendor_info['konto_nr']));// verdi:
konto_nr, type: c35, plass: 740 - 774
- $Betalingsmåte = sprintf("%-2s",'');// verdi:
Blank, type: c2, plass: 775 - 776
- $Mva_reg_nr = sprintf("%-25s",'');// verdi:
Blank, type: c25, plass: 777 - 801
- $Postnummer = sprintf("%-15s",'');// verdi:
Blank, type: c15, plass: 802 - 816
- $Val_dok = sprintf("%-3s",'');// verdi:
Blank, type: c3, plass: 817 - 819
-
-
- //Velg ut alle underbilag
-
$oRsUnderbilag=$this->soXport->select_underbilag($oRsBilag[$k]['bilagsnr']);
-
-
- $underbilag_count= count($oRsUnderbilag);
- $last_record = $underbilag_count - 1;
-
- for ($i=0;$i<$underbilag_count;$i++)
- {
- $BilagId = $oRsUnderbilag[$i]['id'];
-
- $Belop =
$oRsUnderbilag[$i][$BelopFelt]*100;
- $Belop_ = $Belop;
-
- if($Belop < 0)
- {
- $Belop = abs($Belop);
- $Belop =
sprintf("%019s",$Belop);
-
- if ($oRsUnderbilag[$i]['artid']
== 2)
- {
- $Belop = '+' . $Belop;
-
- }
- else
- {
- $Belop = '-' . $Belop;
- }
-
- }
- else
- {
- $Belop =
sprintf("%019s",$Belop);
-
- if ($oRsUnderbilag[$i]['artid']
== 2)
- {
- $Belop = '-' . $Belop;
-
- }
- else
- {
- $Belop = '+' . $Belop;
- }
- }
-
-
- if($oRsUnderbilag[$i]['pmwrkord_code'])
- {
-
- //Oppdater beløp på arbeidsordre
- if ($download=='on' &&
!$pre_transfer)
- {
- if
($oRsUnderbilag[$i]['dimd'] % 2 == 0)
- {
-
$actual_cost_field='act_mtrl_cost';
- }
- else
- {
-
$actual_cost_field='act_vendor_cost';
- }
- $operator='+';
-
- if(!$this->debug)
- {
-
$this->correct_actual_cost($oRsUnderbilag[$i]['pmwrkord_code'],$Belop_,$actual_cost_field,$operator);
- }
- }
- }
-
- //Overfør til fm_ecobilagoverf
-
- $oRsOverfBilag=$oRsUnderbilag[$i];
- $oRsOverfBilag['filnavn']=
basename($Filnavn);
-
$oRsOverfBilag['ordrebelop']=$oRsUnderbilag[$i][$BelopFelt];
-
-
- //dersom det mangler budsjett konto -
kun aktuelt for ikke godkjent - sett konto til 2899999
-
- if(!$oRsOverfBilag['spbudact_code'] &&
$pre_transfer)
- {
- $oRsOverfBilag['spbudact_code']
= 12304361;
- }
-
-
- //dersom ikke gyldig objekt - kun
aktuelt for ikke godkjent - sett objekt til 9999
-
- if(!($oRsOverfBilag['kostra_id']>0) &&
$pre_transfer)
- {
- $oRsOverfBilag['kostra_id'] =
26550;
- $oRsOverfBilag['mvakode'] = 0;
- $oRsOverfBilag['dima'] = 9999;
- }
-
- $Konto =
sprintf("%-8s",$oRsOverfBilag['spbudact_code']);// verdi: Art, type: c8, plass:
21 - 28
- $Dim_1 =
sprintf("%8s",$oRsOverfBilag['district_id']);// verdi: Ansvarssted, type: c8,
plass: 29 - 36
- $Dim_2 =
sprintf("%-8s",$oRsOverfBilag['kostra_id']);// verdi: Tjeneste, type: c8,
plass: 37 - 44
-
- if($pre_transfer)
- {
- $Dim_3 =
sprintf("%-8s",substr($oRsOverfBilag['dima'],0,4));// verdi: Objekt, type: c8,
plass: 45 - 52
- }
- else
- {
- $Dim_3 =
sprintf("%-8s",substr($oRsOverfBilag['dima'],0,6));// verdi: Objekt-bygg, type:
c8, plass: 45 - 52
- }
-
-
- $Dim_4 = sprintf("%-8s",'');//
verdi: Ressurs, type: c8, plass: 53 - 60
- $Dim_5 =
sprintf("%-12s",$oRsOverfBilag['project_id']);// verdi: Prosjekt, type: c12,
plass: 61 - 72
- $Dim_6 =
sprintf("%-4s",$oRsOverfBilag['dimd']);// verdi: Blank, type: c4, plass: 73 - 76
- $Dim_7 = sprintf("%-4s",'');//
verdi: Blank, type: c4, plass: 77 - 80
-
-
$Avgiftskode=sprintf("%-2s",$oRsOverfBilag['mvakode']);// verdi: Avgiftskode,
type: c2, plass: 81 - 82
-
- $Avgiftssystem = sprintf("%2s",'');//
verdi: Blank, type: c2, plass: 83 - 84
- $Valutakode ='NOK';// verdi: NOK,
type: c3, plass: 85 - 87
- $Debet_Kredit = sprintf("%2s",'');//
verdi: Blank, type: i2, plass: 88 - 89
- $Valutabelop = $Belop;// verdi:
Beløp, type: money, plass: 90 - 109
- $Belop_i_firmavaluta=$Belop;// verdi:
Beløp, type: money, plass: 110 - 129
- $Antall = sprintf("%11s",'');//
verdi: Blank, type: i4, plass: 130 - 140
- $Belop2 = sprintf("%20s",'');//
verdi: Blank, type: f8, plass: 141 - 160
- $Belop3 = sprintf("%20s",'');//
verdi: Blank, type: money, plass: 161 - 180
-
- // $Belop4 (også kalt "money3" )blir brukt
for identifisere overføring på tvers av filer.
- $Belop4 =
sprintf("%20s",$batchid);// verdi: Blank, type: money, plass: 181 - 200 -
batch_id høyre justert
-
-
- if($oRsOverfBilag['pmwrkord_code'])
- {
- $Tekst =
sprintf("%-50s",substr($this->get_order_title($oRsOverfBilag['pmwrkord_code']),0,50));//sprintf("%-50s",substr($oRsOverfBilag['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
- }
- else
- {
- $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($oRsOverfBilag['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
- }
-
- $Fakturanr =
sprintf("%-15s",$oRsOverfBilag['fakturanr']);// verdi: Fakturanr, type: c15,
plass: 283 - 297
-
- $Ordrenummer =
sprintf("%-9s",$oRsOverfBilag['pmwrkord_code']);// verdi: Infodoc ordrenr,
type: i4, plass: 342 - 350
-
-
- //Kopier verdier
- if ($download=='on' && !$pre_transfer
&& !$this->debug)
- {
-
$this->soXport->add_OverfBilag($oRsOverfBilag);
- }
-
- //Skriv til fil
-
- $buffer .= $Buntnr . $Forsystem .
$Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 .
$Dim_4 .
- $Dim_5 . $Dim_6 . $Dim_7 . $Avgiftskode
. $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop .
- $Belop_i_firmavaluta . $Antall .
$Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato .
- $Bilagsnr . $Periode . $ESL .
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer .
- $Kid . $Bet_overforing . $Status .
$Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref .
- $Inkassokode . $Bet_mottager .
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted .
- $Bank_Postgiro_kontonr . $Betalingsmåte
. $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
-
- if($i==$last_record)
- {
- $Konto =
sprintf("%-8s",'2327010');// verdi: Art, type: c8, plass: 21 - 28
- $Dim_1 =
sprintf("%-8s",'');// verdi: Ansvarssted, type: c8, plass: 29 - 36
- $Dim_2 =
sprintf("%-8s",'');// verdi: Tjeneste, type: c8, plass: 37 - 44
- $Dim_3 =
sprintf("%-8s",'');// verdi: Objekt, type: c8, plass: 45 - 52
- $Dim_4 =
sprintf("%-8s",'');// verdi: Ressurs, type: c8, plass: 53 - 60
- $Dim_5 =
sprintf("%-12s",'');// verdi: Prosjekt, type: c12, plass: 61 - 72
- $Dim_6 =
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 73 - 76
- $Dim_7 =
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 77 - 80
- $Fakturanr =
sprintf("%-15s",'');// verdi: Fakturanr, type: c15, plass: 283 - 297
- $Ordrenummer =
sprintf("%-9s",'');// verdi: Infodoc ordrenr, type: i4, plass: 342 - 350
- $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($oRsOverfBilag['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
-
- if($Belop_motpost < 0)
- {
- $Belop_motpost =
sprintf("%019s",abs($Belop_motpost));
-
- if
($oRsUnderbilag[$i]['artid'] == 2)
- {
- $Belop_motpost
= '-' . $Belop_motpost;
-
- }
- else
- {
- $Belop_motpost
= '+' . $Belop_motpost;
- }
- }
- else
- {
- $Belop_motpost =
sprintf("%019s",$Belop_motpost);
-
- if
($oRsUnderbilag[$i]['artid'] == 2)
- {
- $Belop_motpost
= '+' . $Belop_motpost;
-
- }
- else
- {
- $Belop_motpost
= '-' . $Belop_motpost;
- }
- }
-
- $Transtype = 'AP';//
verdi: GL, type: c2, plass: 17 - 18
- $Valutabelop =
$Belop_motpost;// verdi: Beløp, type: money, plass: 90 - 109
-
$Belop_i_firmavaluta=$Belop_motpost;// verdi: Beløp, type: money, plass: 110 -
129
-
- $buffer .= $Buntnr . $Forsystem
. $Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 .
$Dim_4 .
- $Dim_5 . $Dim_6 . $Dim_7 .
$Avgiftskode . $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop .
- $Belop_i_firmavaluta . $Antall
. $Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato .
- $Bilagsnr . $Periode . $ESL .
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer .
- $Kid . $Bet_overforing .
$Status . $Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref .
- $Inkassokode . $Bet_mottager .
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted .
- $Bank_Postgiro_kontonr .
$Betalingsmåte . $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
- }
-
- //Slett post i fm_ecobilag
- if ($download=='on' && !$pre_transfer
&& !$this->debug)
- {
-
$this->soXport->delete_from_fm_ecobilag($oRsUnderbilag[$i]['id']);
- //Logg transaksjon
-
$this->soXport->log_transaction($batchid,$BilagId,lang('Invoice tranferred'));
- }
-
- $BilagId = 'NULL';
-
- $antall = $antall + 1;
- }
- }
-
- //Fullfør transaksjon
-
-
- if ($download=='on' && !$pre_transfer && !$this->debug):
- {
- $fp = fopen($Filnavn, "wb");
- fwrite($fp,$buffer);
-
- if(fclose($fp))
- {
- $file_written=True;
- }
-
- if($file_written &&
$this->config->config_data['invoice_export_method']!='ftp'):
- {
- $transfer_ok = True;
- }
- elseif($file_written):
- {
- $transfer_ok =
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
- }
- endif;
-
- if($transfer_ok)
- {
- $this->db->transaction_commit();
- $message = 'Godkjent: periode:
'.$Periode.' antall bilag/underbilag overført:'.$antall . ' , fil: ' . $Filnavn;
- }
- else
- {
- $this->db->transaction_abort();
- $message = 'Noe gikk galt med
overføring av godkjendte fakturaer!';
- }
- }
- elseif($download=='on' && $pre_transfer &&
!$this->debug):
- {
-
- $fp = fopen($Filnavn, "wb");
- fwrite($fp,$buffer);
-
- if(fclose($fp))
- {
- $file_written=True;
- }
-
- if($file_written &&
$this->config->config_data['invoice_export_method']!='ftp'):
- {
- $transfer_ok = True;
- }
- elseif($file_written):
- {
- $transfer_ok =
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
- }
- endif;
-
- if($transfer_ok)
- {
- $this->db->transaction_commit();
- $message = 'Ankomstregistrering:
periode: '.$Periode.' antall bilag/underbilag overført:'.$antall . ' , fil: ' .
$Filnavn;
- }
- else
- {
- $this->db->transaction_abort();
- $message = 'Noe gikk galt med
ankomstregistrering!';
- }
- }
- else:
- {
- $message = $buffer;
- $this->db->transaction_abort();
-
- }
- endif;
-
- return $message;
- }
-
- function transfer($buffer,$Filnavn,$batchid,$tranfser_bilag)
- {
-
-
if($this->config->config_data['invoice_export_method']=='ftp')
- {
- $ftp = $this->phpftp_connect();
-
- $basedir =
$this->config->config_data['invoice_ftp_basedir'];
- if($basedir)
- {
- $newfile = $basedir . '/' .
basename($Filnavn);
- }
- else
- {
- $newfile = basename($Filnavn);
- }
-
- if (ftp_put($ftp,$newfile, $Filnavn,
FTP_BINARY))
- {
- for
($i=0;$i<count($tranfser_bilag);$i++)
- {
-
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Invoice
pre_transferred %1',basename($Filnavn)));
- }
- $transfer_ok = True;
- }
- else
- {
- for
($i=0;$i<count($tranfser_bilag);$i++)
- {
-
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Failed to
pre_transfere %1 to agresso',basename($Filnavn)));
- }
- $transfer_ok = False;
- }
- if(!$transfer_ok)
- {
- unlink($Filnavn);
- }
-
- ftp_quit($ftp);
- }
- return $transfer_ok;
- }
-
- function phpftp_connect()
- {
- $host = $this->config->config_data['invoice_ftp_host'];
- $user = $this->config->config_data['invoice_ftp_user'];
- $pass = $this->config->config_data['invoice_ftp_pw'];
-
-// echo "connecting to $host with $user and $pass\n <br>";
- $ftp = ftp_connect($host);
- if($ftp)
- {
- if (ftp_login($ftp,$user,$pass))
- {
- return $ftp;
- }
- }
- }
- }
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 export
+ * @version $Id: Agresso,v 1.30 2006/02/03 12:05:49 sigurdne Exp $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class export_conv
+ {
+ //var $fil_katalog='c:/temp'; //On windows use
"//computername/share/filename" or "\\\\computername\share\filename" to check
files on network shares.
+
+ var $old_files_deleted;
+ var $debug;
+
+ function export_conv()
+ {
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ // $this->db = $GLOBALS['phpgw']->db;
+
+ $this->soXport = CreateObject('property.soXport');
+ $this->config =
CreateObject('phpgwapi.config','property');
+ $this->config->read_repository();
+ $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->db = $this->bocommon->new_db();
+ }
+
+ function
select_periods_with_invoice_to_transfer($pre_transfer='')
+ {
+ if($pre_transfer)
+ {
+ $sql= "SELECT DISTINCT periode from fm_ecobilag
WHERE utbetalingsigndato IS NULL ";
+ }
+ else
+ {
+ $sql= "SELECT DISTINCT periode from fm_ecobilag
WHERE budsjettsigndato is not null and (saksigndato is not null or
oppsynsigndato is not null) and utbetalingsigndato is not null ";
+ }
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ while ($this->db->next_record())
+ {
+ $periode[] = $this->db->f('periode');
+ }
+ return $periode;
+ }
+
+ function log_end($batchid)
+ {
+ $tid=date($this->soXport->datetimeformat);
+ $sql= "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','End transfer','$tid')";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ function log_error($batchid,$error_desr)
+ {
+ $tid=date($this->datetimeformat);
+ $sql= "insert into fm_ecologg
(batchid,ecobilagid,status,melding,tid) values
('$batchid',NULL,0,'$error_desr','$tid')";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ function increment_batchid()
+ {
+
+ $this->db->query("update fm_idgenerator set value =
value + 1 where name = 'Ecobatchid'",__LINE__,__FILE__);
+ $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'",__LINE__,__FILE__);
+ $this->db->next_record();
+ $bilagsnr = $this->db->f('value');
+ return $bilagsnr;
+
+ }
+
+ function next_batchid()
+ {
+
+ $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'",__LINE__,__FILE__);
+ $this->db->next_record();
+ $batchid = $this->db->f('value')+1;
+
+ return $batchid;
+ }
+
+ //Lagre start melding
+ function log_start($batchid)
+ {
+ $tid=date($this->soXport->datetimeformat);
+ $sql= "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','Start transfer','$tid')";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ function get_vendor_info($vendor_id='')
+ {
+ $sql = "select org_nr,konto_nr from fm_vendor where
id='$vendor_id'";
+ $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->next_record();
+
+ $vendor_info= array(
+ 'org_nr' => $this->db->f('org_nr'),
+ 'konto_nr' => $this->db->f('konto_nr')
+ );
+
+ return $vendor_info;
+ }
+
+ function get_order_title($order_id='')
+ {
+ $sql = "select type from fm_orders where
id='$order_id'";
+ $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->next_record();
+
+ switch($this->db->f('type'))
+ {
+ case 'workorder':
+ $sql2 = "select title from fm_workorder
where id='$order_id'";
+
$this->db->query($sql2,__LINE__,__FILE__);
+ $this->db->next_record();
+ $order_title = $this->db->f('title');
+ break;
+ case 's_agreement':
+ $sql2 = "select descr as title from
fm_s_agreement where id='$order_id'";
+
$this->db->query($sql2,__LINE__,__FILE__);
+ $this->db->next_record();
+ $order_title = $this->db->f('title');
+ break;
+ }
+
+ return $order_title;
+ }
+
+
+ function select_invoice_rollback($day,$month,$year,$Filnavn)
+ {
+
+ switch($GLOBALS['phpgw_info']['server']['db_type'])
+ {
+ case 'mssql':
+ $datepart_year =
"datepart(year,overftid)";
+ $datepart_month =
"datepart(month,overftid)";
+ $datepart_day =
"datepart(day,overftid)";
+ break;
+ case 'mysql':
+ $datepart_year =
"YEAR(overftid)";
+ $datepart_month =
"MONTH(overftid)";
+ $datepart_day =
"DAYOFMONTH(overftid)";
+ break;
+ case 'pgsql':
+ $datepart_year =
"date_part('year',overftid)";
+ $datepart_month =
"date_part('month',overftid)";
+ $datepart_day =
"date_part('day',overftid)";
+ break;
+ }
+
+
+ $sql="select * from fm_ecobilagoverf where
filnavn='$Filnavn' and $datepart_year=$year and $datepart_month=$month and
$datepart_day= $day";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ $i = 0;
+ while ($this->db->next_record())
+ {
+ $invoice_roleback[$i]['id'] =
$this->db->f('id');
+ $invoice_roleback[$i]['bilagsnr'] =
$this->db->f('bilagsnr');
+ $invoice_roleback[$i]['kidnr'] =
$this->db->f('kidnr');
+ $invoice_roleback[$i]['typeid'] =
$this->db->f('typeid');
+ $invoice_roleback[$i]['kildeid'] =
$this->db->f('kildeid');
+ $invoice_roleback[$i]['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
+ $invoice_roleback[$i]['belop'] =
$this->db->f('belop');
+ $invoice_roleback[$i]['fakturadato'] =
$this->db->f('fakturadato');
+ $invoice_roleback[$i]['periode'] =
$this->db->f('periode');
+ $invoice_roleback[$i]['forfallsdato'] =
$this->db->f('forfallsdato');
+ $invoice_roleback[$i]['fakturanr'] =
$this->db->f('fakturanr');
+ $invoice_roleback[$i]['spbudact_code'] =
$this->db->f('spbudact_code');
+ $invoice_roleback[$i]['regtid'] =
$this->db->f('regtid');
+ $invoice_roleback[$i]['artid'] =
$this->db->f('artid');
+ $invoice_roleback[$i]['godkjentbelop'] =
$this->db->f('godkjentbelop');
+ $invoice_roleback[$i]['spvend_code'] =
$this->db->f('spvend_code');
+ $invoice_roleback[$i]['dima'] =
$this->db->f('dima');
+ $invoice_roleback[$i]['loc1'] =
$this->db->f('loc1');
+ $invoice_roleback[$i]['dimb'] =
$this->db->f('dimb');
+ $invoice_roleback[$i]['mvakode'] =
$this->db->f('mvakode');
+ $invoice_roleback[$i]['dimd'] =
$this->db->f('dimd');
+ $invoice_roleback[$i]['project_id'] =
$this->db->f('project_id');
+ $invoice_roleback[$i]['kostra_id'] =
$this->db->f('kostra_id');
+ $invoice_roleback[$i]['item_type'] =
$this->db->f('item_type');
+ $invoice_roleback[$i]['item_id'] =
$this->db->f('item_id');
+
+ if($this->db->f('oppsynsmannid'))
+ {
+ $invoice_roleback[$i]['oppsynsmannid']
= $this->db->f('oppsynsmannid');
+ }
+ if($this->db->f('saksbehandlerid'))
+ {
+
$invoice_roleback[$i]['saksbehandlerid'] =
$this->db->f('saksbehandlerid');
+ }
+
+ $invoice_roleback[$i]['budsjettansvarligid']
= $this->db->f('budsjettansvarligid');
+
+ if($this->db->f('oppsynsigndato'))
+ {
+ $invoice_roleback[$i]['oppsynsigndato']
= $this->db->f('oppsynsigndato');
+ }
+ if($this->db->f('saksigndato'))
+ {
+ $invoice_roleback[$i]['saksigndato']
= $this->db->f('saksigndato');
+ }
+
+ $invoice_roleback[$i]['budsjettsigndato']
= $this->db->f('budsjettsigndato');
+ $invoice_roleback[$i]['merknad'] =
$this->db->f('merknad');
+ $invoice_roleback[$i]['splitt'] =
$this->db->f('splitt');
+ $invoice_roleback[$i]['ordrebelop'] =
$this->db->f('ordrebelop');
+ $invoice_roleback[$i]['utbetalingid'] =
$this->db->f('utbetalingid');
+ $invoice_roleback[$i]['utbetalingsigndato']
= $this->db->f('utbetalingsigndato');
+ $i++;
+ }
+ return $invoice_roleback;
+ }
+
+
+ //rollback function
+ function bilag_update_overf($BilagOverf)
+ {
+ $values= array(
+ $BilagOverf['project_id'],
+ $BilagOverf['kostra_id'],
+ $BilagOverf['pmwrkord_code'],
+ $BilagOverf['bilagsnr'],
+ $BilagOverf['splitt'],
+ $BilagOverf['kildeid'],
+ $BilagOverf['kidnr'],
+ $BilagOverf[typeid],
+ $BilagOverf['fakturadato'],
+ $BilagOverf['forfallsdato'],
+ $BilagOverf['regtid'],
+ $BilagOverf['artid'],
+ $BilagOverf['spvend_code'],
+ $BilagOverf['dimb'],
+ $BilagOverf['oppsynsmannid'],
+ $BilagOverf['saksbehandlerid'],
+ $BilagOverf['budsjettansvarligid'],
+ $BilagOverf['fakturanr'],
+ $BilagOverf['spbudact_code'],
+ $BilagOverf['dima'],
+ $BilagOverf['loc1'],
+ $BilagOverf['dimd'],
+ $BilagOverf['mvakode'],
+ $BilagOverf['periode'],
+
$this->db->db_addslashes($BilagOverf['merknad']),
+ $BilagOverf['utbetalingid'],
+ $BilagOverf['oppsynsigndato'],
+ $BilagOverf['saksigndato'],
+ $BilagOverf['budsjettsigndato'],
+ $BilagOverf['utbetalingsigndato'],
+ $BilagOverf['item_type'],
+ $BilagOverf['item_id'],
+ );
+
+ $values = $this->bocommon->validate_db_insert($values);
+
+ $sql= "INSERT INTO fm_ecobilag
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
+ . "
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
+ . "
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
+ . "
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,item_type,item_id,belop,godkjentbelop)"
+ . " values ($values,"
+ . $this->bocommon->moneyformat($BilagOverf['belop']) .
","
+ .
$this->bocommon->moneyformat($BilagOverf['godkjentbelop']) . ")";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+
+ //Oppdater beløp på arbeidsordre operator="-" ved tilbakerulling
+ function
correct_actual_cost($pmwrkord_code,$Belop,$actual_cost_field,$operator)
+ {
+ $Belop=$Belop/100;
+
+ $sql="update fm_workorder set
$actual_cost_field=$actual_cost_field $operator $Belop where
id='$pmwrkord_code'";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+
+ function
overfor($download,$pre_transfer='',$force_period_year='')
+ {
+
+// $download = 'on';
+// $download = False;
+ $pre_transfer=True;
+// $this->debug=True;
+
+ //Generer batch ID
+ $batchid = $this->soXport->next_batchid();
+ if ($download=='on')
+ {
+ $this->increment_batchid();
+ //Lagre melding
+ $this->log_start($batchid);
+ }
+
+ //Velg ut alle perioder som har bilag som skal overføres
+
+
+ if ($pre_transfer)
+ {
+ $periode =
$this->select_periods_with_invoice_to_transfer($pre_transfer);
+
+ for ($i=0;$i<count($periode);$i++)
+ {
+
+ $receipt['message'][]= array('msg' =>
$this->OverforPeriode($batchid,$periode[$i],$download,$pre_transfer));
+ }
+ }
+
+
+ $pre_transfer=False;
+
+ $periode =
$this->select_periods_with_invoice_to_transfer($pre_transfer);
+
+ for ($i=0;$i<count($periode);$i++)
+ {
+
+ $receipt['message'][]= array('msg' =>
$this->OverforPeriode($batchid,$periode[$i],$download,$pre_transfer,$force_period_year));
+ }
+
+
+
+ //Lagre melding
+ if ($download=='on' || $pre_transfer)
+ {
+ $this->log_end($batchid); //Lagre melding
+ }
+
+ return $receipt;
+ }
+
+ function errorhandler($error_desr)
+ {
+ $this->db->transaction_abort();
+
+ $meld = $error_desr;
+
+ //Vis feilmelding
+// echo $meld;
+
+ //Lagre feilmelding
+ $this->log_error($batchid,$error_desr);
+ }
+
+ function RullTilbake($Filnavn,$Dato)
+ {
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $dateformat = str_replace(".","",$dateformat);
+ $dateformat = str_replace("-","",$dateformat);
+ $dateformat = str_replace("/","",$dateformat);
+ $y=strpos($dateformat,'y');
+ $d=strpos($dateformat,'d');
+ $m=strpos($dateformat,'m');
+
+ $dateparts = explode('/', $Dato);
+ $day = $dateparts[$d];
+ $month = $dateparts[$m];
+ $year = $dateparts[$y];
+ /* $date1 = mktime (2,0,0,$month,$day,$year);
+ if ($date1)
+ {
+ $Dato=$date1;
+ }
+
+ $Dato= date("M d Y",$Dato);
+ */
+
+
$BilagOverf=$this->select_invoice_rollback($day,$month,$year,$Filnavn);
+ $this->db->transaction_begin();
+
+ for ($i=0;$i<count($BilagOverf);$i++)
+ {
+ $this->bilag_update_overf($BilagOverf[$i]);
+
+
+ if($BilagOverf[$i]['pmwrkord_code'])
+ {
+ if ($BilagOverf[$i]['artid']==1)
+ {
+ $Belop = sprintf("%01.2f",
$BilagOverf[$i]['ordrebelop'])*100;
+ }
+ else
+ {
+ $Belop = sprintf("%01.2f",
-$BilagOverf[$i]['ordrebelop'])*100;
+ }
+
+ if ($BilagOverf[$i]['dimd'] % 2 == 0)
+ {
+
$actual_cost_field='act_mtrl_cost';
+ }
+ else
+ {
+
$actual_cost_field='act_vendor_cost';
+ }
+
+ $operator='-';
+
+
$this->correct_actual_cost($BilagOverf[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
+ }
+
+ //Slett fra avviks tabell
+ //
$this->soXport->delete_avvik($BilagOverf[$i]['bilagsnr']);
+
+ //Slett fra arkiv
+
$this->soXport->delete_invoice($BilagOverf[$i]['bilagsnr']);
+
+ $antall = $antall + 1;
+ }
+
+ if($antall > 0)
+ {
+ $fil_katalog =
$this->config->config_data['export_path'];
+
+ if(unlink ($fil_katalog. SEP . $Filnavn))
+ {
+ $this->db->transaction_commit();
+ $receipt['message'][]= array('msg' =>
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
+ $receipt['message'][]= array('msg' =>
lang('File %1 is deleted',$Filnavn));
+ }
+ else
+ {
+ $this->db->transaction_abort();
+ $receipt['message'][]= array('msg' =>
'Noe gikk galt!');
+ }
+ }
+ else
+ {
+ $receipt['error'][]= array('msg' => lang('Sorry
- None hits'));
+ }
+ return $receipt;
+ }
+
+
+ function LagFilnavn ($batchid,$pre_transfer='')
+ {
+ if($pre_transfer)
+ {
+ $fil_katalog =
$this->config->config_data['export_pre_path'];
+
+ // Slett gamle filer
+
+ if(!$this->old_files_deleted)
+ {
+ for ($i=0;$i<13;$i++)
+ {
+ @unlink($fil_katalog . '/FDA_'
. $i. '.TXT');
+ }
+
+ $this->old_files_deleted= True;
+ }
+
+
+ $i = 1;
+ do
+ {
+ $Filnavn = $fil_katalog . '/FDA_' . $i.
'.TXT';
+
+ //Sjekk om filen eksisterer
+ If (!file_exists($Filnavn))
+ {
+ return $Filnavn;
+ }
+
+ $i++;
+ }
+ while ($i < 13);
+
+ }
+ else
+ {
+ $fil_katalog =
$this->config->config_data['export_path'];
+ $continue = True;
+ $i = 1;
+ do
+ {
+ $Filnavn = $fil_katalog . '/FDB' .
date("dmy") . '_' . sprintf("%02s",$i) . '.TXT';
+
+ //Sjekk om filen eksisterer
+ If (!file_exists($Filnavn))
+ {
+ return $Filnavn;
+ }
+
+ $i++;
+ }
+ while ($continue);
+ }
+
+
+ //Ingen løpenr er ledige, gi feilmelding
+ return False;
+ }
+
+ function
OverforPeriode($batchid,$periode,$download,$pre_transfer='',$force_period_year='')
+ {
+ $BilagId = 'NULL';
+
+ //Bestem filnavn
+
+ $this->db->transaction_begin();
+
+ $Filnavn = $this->LagFilnavn($batchid,$pre_transfer);
+ if (!$Filnavn)
+ {
+ $message='LagFilnavn'.lang('Alle løpenr for
filnavn er i bruk!');
+ $this->errorhandler($message);
+ return $message;
+ }
+
+ //Test om filen kan opprettes og skrives til
+ if (@fopen($Filnavn, "wb"))
+ {
+ unlink($Filnavn);
+ }
+ else
+ {
+ $message='kan ikke lagre til fil: '. $Filnavn
.'<br>';
+ return $message;
+ }
+
+ //Velg ut alle hoved bilag som skal overføres
+
+
$oRsBilag=$this->soXport->hoved_bilag($periode,$pre_transfer);
+
+ $bilag_count= count($oRsBilag);
+ for ($k=0;$k<$bilag_count;$k++)
+ {
+ $tranfser_bilag[] = $oRsBilag[$k]['bilagsnr'];
+
+ //Bestem belops felt
+ if ($oRsBilag[$k]['splitt']==0)
+ {
+ //Bilaget er ikke splittet
+ if ($oRsBilag[$k]['godkjentbelop'] <>
$oRsBilag[$k]['belop'])
+ {
+ $BelopFelt = 'godkjentbelop';
+ //Logg til avviks tabell
+ if ($download=='on' &&
!$pre_transfer)
+ {
+//
$this->soXport->log_to_deviation_table($oRsBilag[$k]);
+ }
+ }
+ else
+ {
+ $BelopFelt = 'belop';
+ }
+ }
+
+ //Bilaget er splittet
+ if ($oRsBilag[$k]['godkjentbelop'] ==
$oRsBilag[$k]['belop'])
+ {
+ $BelopFelt = 'godkjentbelop';
+ }
+ else
+ {
+ //Ikke lovlig
+ $message = lang('Avvik mellom
fakturabeløp og godkjent beløp på splittet faktura!');
+ $this->errorhandler($message);
+ return $message;
+ }
+
+ $Belop_motpost =$oRsBilag[$k][$BelopFelt] *100;
+
+ //Skriv hovedbilag
+
+ $Buntnr =
sprintf("%-12s",basename($Filnavn,".TXT"));// verdi: MMDDFL, type: c12, plass:
1 - 12
+ $Forsystem = 'BI';// verdi: BI, type: c2,
plass: 13 - 14
+
+ $Transtype = 'GL';// verdi: GL, type: c2,
plass: 17 - 18
+ $Firmakode = sprintf("%-2s",'BB');//
verdi: Firmakode, type: c2, plass: 19 - 20
+
+ $Valuteringsdato=
date(Ymd,strtotime($oRsBilag[$k]['fakturadato']));// verdi: Dato, type: date,
plass: 251 - 258
+ $Bilagsdato =
date(Ymd,strtotime($oRsBilag[$k]['fakturadato'])) ;// verdi: Dato, type: date,
plass: 259 - 266
+ $Bilagsnr =
sprintf("%-9s",substr($oRsBilag[$k]['bilagsnr'],-8));// verdi: Bilagsnummer,
type: i4, plass: 267 - 275
+ // $Periode =
sprintf("%06s",date(Y,strtotime($oRsBilag[$k]['fakturadato'])) .
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
+ $ESL = sprintf("%1s",'');// verdi:
Blank, type: i+C481, plass: 282 - 282
+
+ if($pre_transfer)
+ {
+ if(abs(date(m,time()) - $periode) >1)
+ {
+ $temp_period = date(m,time())
-1;
+
+ if($temp_period == 0)
+ {
+ $temp_period =1;
+ }
+
+ $temp_year = date(Y,time());
+ }
+ else
+ {
+ $temp_period = $periode;
+ $temp_year =
date(Y,strtotime($oRsBilag[$k]['fakturadato']));
+ }
+
+ $Periode =
sprintf("%06s",$temp_year . sprintf("%02d",$temp_period));// verdi: Periode,
type: i4, plass: 276 - 281
+ $Bilagsart =
sprintf("%2s",'FF');// verdi: , type: c2, plass: 15 - 16
+ $Forfall = '20991231';// verdi:
Forfallsdato , type: date, plass: 298 - 305
+ }
+ else
+ {
+
+ if($force_period_year)
+ {
+ $Periode =
sprintf("%06s",$force_period_year . sprintf("%02d",$periode));// verdi:
Periode, type: i4, plass: 276 - 281
+ }
+ else
+ {
+ $Periode =
sprintf("%06s",date(Y,strtotime($oRsBilag[$k]['fakturadato'])) .
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
+ }
+
+ $Bilagsart =
sprintf("%2s",'FD');// verdi: , type: c2, plass: 15 - 16
+ $Forfall =
date(Ymd,strtotime($oRsBilag[$k]['forfallsdato']));// verdi: Forfallsdato ,
type: date, plass: 298 - 305
+ }
+
+ $Rab_forf = sprintf("%-8s",'');// verdi:
Blank, type: date, plass: 306 - 313
+ $Rabatt = sprintf("%020s",'');// verdi:
Blank, type: money, plass: 314 - 333
+ $Avt_Kon = sprintf("%-8s",'');// verdi:
Blank, type: c8, plass: 334 - 341
+
+ $Kid =
sprintf("%-27s",$oRsBilag[$k]['kidnr']);// verdi: Kid, type: c27, plass: 351 -
377
+ $Bet_overforing = sprintf("%-2s",'');// verdi:
Blank, type: c2, plass: 378 - 379
+ $Status = 'N';// verdi: N, type: c1,
plass: 380 - 380
+ $Resk_type = 'P';// verdi: Blank, type:
c1, plass: 381 - 381
+ $Resk_nr =
sprintf("%-9s",$oRsBilag[$k]['spvend_code']);// verdi: Blank., type: i4, plass:
382 - 390
+ $Forskudd = '0';// verdi: 0, type: i1,
plass: 391 - 391
+ $Fakturaref = '000000000';// verdi: 0,
type: i4, plass: 392 - 400
+ $Fakturaref = '000000000';// verdi: 0,
type: i4, plass: 401 - 409
+ $Inkassokode = sprintf("%-6s",'');// verdi:
Blank, type: c6, plass: 410 - 415
+ $Bet_mottager = sprintf("%-8s",'');// verdi:
Blank, type: c8, plass: 416 - 423
+ $Att_ansvarlig =
sprintf("%-6s",$oRsBilag[$k]['saksbehandler']);// verdi: Blank, type: c6,
plass: 424 - 429
+
+ $vendor_info =
$this->get_vendor_info($oRsBilag[$k]['spvend_code']);
+
+ if(!$vendor_info['org_nr'])
+ {
+ $message = 'mangler org_nr for
reskontronr: ' . $oRsBilag[$k]['spvend_code'];
+ $this->errorhandler($message);
+ return $message;
+ }
+
+ if(!$vendor_info['konto_nr'])
+ {
+ $message = 'mangler konto for
reskontronr: ' . $oRsBilag[$k]['spvend_code'];
+ $this->errorhandler($message);
+ return $message;
+ }
+
+ $Resk_navn =
sprintf("%-50s",$vendor_info['org_nr']);// verdi: Fødselsnr, type: c50, plass:
430 - 479
+ $Postadresse = sprintf("%-160s",'');//
verdi: Blank, type: c160, plass: 480 - 639
+ $Stat_Provins = sprintf("%-50s",'');// verdi:
Blank, type: c50, plass: 640 - 689
+ $Sted = sprintf("%-50s",'');// verdi:
Blank, type: c50, plass: 690 - 739
+ $Bank_Postgiro_kontonr =
sprintf("%-35s",str_replace(" ","",$vendor_info['konto_nr']));// verdi:
konto_nr, type: c35, plass: 740 - 774
+ $Betalingsmåte = sprintf("%-2s",'');// verdi:
Blank, type: c2, plass: 775 - 776
+ $Mva_reg_nr = sprintf("%-25s",'');// verdi:
Blank, type: c25, plass: 777 - 801
+ $Postnummer = sprintf("%-15s",'');// verdi:
Blank, type: c15, plass: 802 - 816
+ $Val_dok = sprintf("%-3s",'');// verdi:
Blank, type: c3, plass: 817 - 819
+
+
+ //Velg ut alle underbilag
+
$oRsUnderbilag=$this->soXport->select_underbilag($oRsBilag[$k]['bilagsnr']);
+
+
+ $underbilag_count= count($oRsUnderbilag);
+ $last_record = $underbilag_count - 1;
+
+ for ($i=0;$i<$underbilag_count;$i++)
+ {
+ $BilagId = $oRsUnderbilag[$i]['id'];
+
+ $Belop =
$oRsUnderbilag[$i][$BelopFelt]*100;
+ $Belop_ = $Belop;
+
+ if($Belop < 0)
+ {
+ $Belop = abs($Belop);
+ $Belop =
sprintf("%019s",$Belop);
+
+ if ($oRsUnderbilag[$i]['artid']
== 2)
+ {
+ $Belop = '+' . $Belop;
+
+ }
+ else
+ {
+ $Belop = '-' . $Belop;
+ }
+
+ }
+ else
+ {
+ $Belop =
sprintf("%019s",$Belop);
+
+ if ($oRsUnderbilag[$i]['artid']
== 2)
+ {
+ $Belop = '-' . $Belop;
+
+ }
+ else
+ {
+ $Belop = '+' . $Belop;
+ }
+ }
+
+
+ if($oRsUnderbilag[$i]['pmwrkord_code'])
+ {
+
+ //Oppdater beløp på arbeidsordre
+ if ($download=='on' &&
!$pre_transfer)
+ {
+ if
($oRsUnderbilag[$i]['dimd'] % 2 == 0)
+ {
+
$actual_cost_field='act_mtrl_cost';
+ }
+ else
+ {
+
$actual_cost_field='act_vendor_cost';
+ }
+ $operator='+';
+
+ if(!$this->debug)
+ {
+
$this->correct_actual_cost($oRsUnderbilag[$i]['pmwrkord_code'],$Belop_,$actual_cost_field,$operator);
+ }
+ }
+ }
+
+ //Overfør til fm_ecobilagoverf
+
+ $oRsOverfBilag=$oRsUnderbilag[$i];
+ $oRsOverfBilag['filnavn']=
basename($Filnavn);
+
$oRsOverfBilag['ordrebelop']=$oRsUnderbilag[$i][$BelopFelt];
+
+
+ //dersom det mangler budsjett konto -
kun aktuelt for ikke godkjent - sett konto til 2899999
+
+ if(!$oRsOverfBilag['spbudact_code'] &&
$pre_transfer)
+ {
+ $oRsOverfBilag['spbudact_code']
= 12304361;
+ }
+
+
+ //dersom ikke gyldig objekt - kun
aktuelt for ikke godkjent - sett objekt til 9999
+
+ if(!($oRsOverfBilag['kostra_id']>0) &&
$pre_transfer)
+ {
+ $oRsOverfBilag['kostra_id'] =
26550;
+ $oRsOverfBilag['mvakode'] = 0;
+ $oRsOverfBilag['dima'] = 9999;
+ }
+
+ $Konto =
sprintf("%-8s",$oRsOverfBilag['spbudact_code']);// verdi: Art, type: c8, plass:
21 - 28
+ $Dim_1 =
sprintf("%8s",$oRsOverfBilag['district_id']);// verdi: Ansvarssted, type: c8,
plass: 29 - 36
+ $Dim_2 =
sprintf("%-8s",$oRsOverfBilag['kostra_id']);// verdi: Tjeneste, type: c8,
plass: 37 - 44
+
+ if($pre_transfer)
+ {
+ $Dim_3 =
sprintf("%-8s",substr($oRsOverfBilag['dima'],0,4));// verdi: Objekt, type: c8,
plass: 45 - 52
+ }
+ else
+ {
+ $Dim_3 =
sprintf("%-8s",substr($oRsOverfBilag['dima'],0,6));// verdi: Objekt-bygg, type:
c8, plass: 45 - 52
+ }
+
+
+ $Dim_4 = sprintf("%-8s",'');//
verdi: Ressurs, type: c8, plass: 53 - 60
+ $Dim_5 =
sprintf("%-12s",$oRsOverfBilag['project_id']);// verdi: Prosjekt, type: c12,
plass: 61 - 72
+ $Dim_6 =
sprintf("%-4s",$oRsOverfBilag['dimd']);// verdi: Blank, type: c4, plass: 73 - 76
+ $Dim_7 = sprintf("%-4s",'');//
verdi: Blank, type: c4, plass: 77 - 80
+
+
$Avgiftskode=sprintf("%-2s",$oRsOverfBilag['mvakode']);// verdi: Avgiftskode,
type: c2, plass: 81 - 82
+
+ $Avgiftssystem = sprintf("%2s",'');//
verdi: Blank, type: c2, plass: 83 - 84
+ $Valutakode ='NOK';// verdi: NOK,
type: c3, plass: 85 - 87
+ $Debet_Kredit = sprintf("%2s",'');//
verdi: Blank, type: i2, plass: 88 - 89
+ $Valutabelop = $Belop;// verdi:
Beløp, type: money, plass: 90 - 109
+ $Belop_i_firmavaluta=$Belop;// verdi:
Beløp, type: money, plass: 110 - 129
+ $Antall = sprintf("%11s",'');//
verdi: Blank, type: i4, plass: 130 - 140
+ $Belop2 = sprintf("%20s",'');//
verdi: Blank, type: f8, plass: 141 - 160
+ $Belop3 = sprintf("%20s",'');//
verdi: Blank, type: money, plass: 161 - 180
+
+ // $Belop4 (også kalt "money3" )blir brukt
for identifisere overføring på tvers av filer.
+ $Belop4 =
sprintf("%20s",$batchid);// verdi: Blank, type: money, plass: 181 - 200 -
batch_id høyre justert
+
+
+ if($oRsOverfBilag['pmwrkord_code'])
+ {
+ $Tekst =
sprintf("%-50s",substr($this->get_order_title($oRsOverfBilag['pmwrkord_code']),0,50));//sprintf("%-50s",substr($oRsOverfBilag['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
+ }
+ else
+ {
+ $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($oRsOverfBilag['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
+ }
+
+ $Fakturanr =
sprintf("%-15s",$oRsOverfBilag['fakturanr']);// verdi: Fakturanr, type: c15,
plass: 283 - 297
+
+ $Ordrenummer =
sprintf("%-9s",$oRsOverfBilag['pmwrkord_code']);// verdi: Infodoc ordrenr,
type: i4, plass: 342 - 350
+
+
+ //Kopier verdier
+ if ($download=='on' && !$pre_transfer
&& !$this->debug)
+ {
+
$this->soXport->add_OverfBilag($oRsOverfBilag);
+ }
+
+ //Skriv til fil
+
+ $buffer .= $Buntnr . $Forsystem .
$Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 .
$Dim_4 .
+ $Dim_5 . $Dim_6 . $Dim_7 . $Avgiftskode
. $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop .
+ $Belop_i_firmavaluta . $Antall .
$Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato .
+ $Bilagsnr . $Periode . $ESL .
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer .
+ $Kid . $Bet_overforing . $Status .
$Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref .
+ $Inkassokode . $Bet_mottager .
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted .
+ $Bank_Postgiro_kontonr . $Betalingsmåte
. $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
+
+ if($i==$last_record)
+ {
+ $Konto =
sprintf("%-8s",'2327010');// verdi: Art, type: c8, plass: 21 - 28
+ $Dim_1 =
sprintf("%-8s",'');// verdi: Ansvarssted, type: c8, plass: 29 - 36
+ $Dim_2 =
sprintf("%-8s",'');// verdi: Tjeneste, type: c8, plass: 37 - 44
+ $Dim_3 =
sprintf("%-8s",'');// verdi: Objekt, type: c8, plass: 45 - 52
+ $Dim_4 =
sprintf("%-8s",'');// verdi: Ressurs, type: c8, plass: 53 - 60
+ $Dim_5 =
sprintf("%-12s",'');// verdi: Prosjekt, type: c12, plass: 61 - 72
+ $Dim_6 =
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 73 - 76
+ $Dim_7 =
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 77 - 80
+ $Fakturanr =
sprintf("%-15s",'');// verdi: Fakturanr, type: c15, plass: 283 - 297
+ $Ordrenummer =
sprintf("%-9s",'');// verdi: Infodoc ordrenr, type: i4, plass: 342 - 350
+ $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($oRsOverfBilag['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
+
+ if($Belop_motpost < 0)
+ {
+ $Belop_motpost =
sprintf("%019s",abs($Belop_motpost));
+
+ if
($oRsUnderbilag[$i]['artid'] == 2)
+ {
+ $Belop_motpost
= '-' . $Belop_motpost;
+
+ }
+ else
+ {
+ $Belop_motpost
= '+' . $Belop_motpost;
+ }
+ }
+ else
+ {
+ $Belop_motpost =
sprintf("%019s",$Belop_motpost);
+
+ if
($oRsUnderbilag[$i]['artid'] == 2)
+ {
+ $Belop_motpost
= '+' . $Belop_motpost;
+
+ }
+ else
+ {
+ $Belop_motpost
= '-' . $Belop_motpost;
+ }
+ }
+
+ $Transtype = 'AP';//
verdi: GL, type: c2, plass: 17 - 18
+ $Valutabelop =
$Belop_motpost;// verdi: Beløp, type: money, plass: 90 - 109
+
$Belop_i_firmavaluta=$Belop_motpost;// verdi: Beløp, type: money, plass: 110 -
129
+
+ $buffer .= $Buntnr . $Forsystem
. $Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 .
$Dim_4 .
+ $Dim_5 . $Dim_6 . $Dim_7 .
$Avgiftskode . $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop .
+ $Belop_i_firmavaluta . $Antall
. $Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato .
+ $Bilagsnr . $Periode . $ESL .
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer .
+ $Kid . $Bet_overforing .
$Status . $Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref .
+ $Inkassokode . $Bet_mottager .
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted .
+ $Bank_Postgiro_kontonr .
$Betalingsmåte . $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
+ }
+
+ //Slett post i fm_ecobilag
+ if ($download=='on' && !$pre_transfer
&& !$this->debug)
+ {
+
$this->soXport->delete_from_fm_ecobilag($oRsUnderbilag[$i]['id']);
+ //Logg transaksjon
+
$this->soXport->log_transaction($batchid,$BilagId,lang('Invoice tranferred'));
+ }
+
+ $BilagId = 'NULL';
+
+ $antall = $antall + 1;
+ }
+ }
+
+ //Fullfør transaksjon
+
+
+ if ($download=='on' && !$pre_transfer && !$this->debug):
+ {
+ $fp = fopen($Filnavn, "wb");
+ fwrite($fp,$buffer);
+
+ if(fclose($fp))
+ {
+ $file_written=True;
+ }
+
+ if($file_written &&
$this->config->config_data['invoice_export_method']!='ftp'):
+ {
+ $transfer_ok = True;
+ }
+ elseif($file_written):
+ {
+ $transfer_ok =
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
+ }
+ endif;
+
+ if($transfer_ok)
+ {
+ $this->db->transaction_commit();
+ $message = 'Godkjent: periode:
'.$Periode.' antall bilag/underbilag overført:'.$antall . ' , fil: ' . $Filnavn;
+ }
+ else
+ {
+ $this->db->transaction_abort();
+ $message = 'Noe gikk galt med
overføring av godkjendte fakturaer!';
+ }
+ }
+ elseif($download=='on' && $pre_transfer &&
!$this->debug):
+ {
+
+ $fp = fopen($Filnavn, "wb");
+ fwrite($fp,$buffer);
+
+ if(fclose($fp))
+ {
+ $file_written=True;
+ }
+
+ if($file_written &&
$this->config->config_data['invoice_export_method']!='ftp'):
+ {
+ $transfer_ok = True;
+ }
+ elseif($file_written):
+ {
+ $transfer_ok =
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
+ }
+ endif;
+
+ if($transfer_ok)
+ {
+ $this->db->transaction_commit();
+ $message = 'Ankomstregistrering:
periode: '.$Periode.' antall bilag/underbilag overført:'.$antall . ' , fil: ' .
$Filnavn;
+ }
+ else
+ {
+ $this->db->transaction_abort();
+ $message = 'Noe gikk galt med
ankomstregistrering!';
+ }
+ }
+ else:
+ {
+ $message = $buffer;
+ $this->db->transaction_abort();
+
+ }
+ endif;
+
+ return $message;
+ }
+
+ function transfer($buffer,$Filnavn,$batchid,$tranfser_bilag)
+ {
+
+
if($this->config->config_data['invoice_export_method']=='ftp')
+ {
+ $ftp = $this->phpftp_connect();
+
+ $basedir =
$this->config->config_data['invoice_ftp_basedir'];
+ if($basedir)
+ {
+ $newfile = $basedir . '/' .
basename($Filnavn);
+ }
+ else
+ {
+ $newfile = basename($Filnavn);
+ }
+
+ if (ftp_put($ftp,$newfile, $Filnavn,
FTP_BINARY))
+ {
+ for
($i=0;$i<count($tranfser_bilag);$i++)
+ {
+
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Invoice
pre_transferred %1',basename($Filnavn)));
+ }
+ $transfer_ok = True;
+ }
+ else
+ {
+ for
($i=0;$i<count($tranfser_bilag);$i++)
+ {
+
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Failed to
pre_transfere %1 to agresso',basename($Filnavn)));
+ }
+ $transfer_ok = False;
+ }
+ if(!$transfer_ok)
+ {
+ unlink($Filnavn);
+ }
+
+ ftp_quit($ftp);
+ }
+ return $transfer_ok;
+ }
+
+ function phpftp_connect()
+ {
+ $host = $this->config->config_data['invoice_ftp_host'];
+ $user = $this->config->config_data['invoice_ftp_user'];
+ $pass = $this->config->config_data['invoice_ftp_pw'];
+
+// echo "connecting to $host with $user and $pass\n <br>";
+ $ftp = ftp_connect($host);
+ if($ftp)
+ {
+ if (ftp_login($ftp,$user,$pass))
+ {
+ return $ftp;
+ }
+ }
+ }
+ }
+?>
Index: property/inc/hook_admin.inc.php
diff -u property/inc/hook_admin.inc.php:1.18
property/inc/hook_admin.inc.php:1.19
--- property/inc/hook_admin.inc.php:1.18 Fri Jan 27 14:05:43 2006
+++ property/inc/hook_admin.inc.php Fri Feb 3 12:05:49 2006
@@ -1,67 +1,67 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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: hook_admin.inc.php,v 1.18 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
- {
- $file = array
- (
- 'Configuration' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname='
. $appname),
- 'Street'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=street'),
- 'District'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=district'),
- 'Part of town'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uip_of_town.index'),
- 'Admin entity'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin_entity.index'),
- 'Admin Location'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin_location.index'),
- 'Update the not active category for
locations'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uilocation.update_cat'),
-// 'Request Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=request'),
- 'Workorder Categories' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=wo'),
- 'Workorder Detail Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=wo_hours'),
- 'Ticket Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=ticket'),
- 'Tenant Claim Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=tenant_claim'),
- 'Tenant Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=tenant'),
- 'Tenant Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.list_attribute&role=tenant'),
- 'Tenant'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.index&role=tenant'),
- 'Owner'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.index&role=owner'),
- 'Owner Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=owner'),
- 'Owner Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.list_attribute&role=owner'),
- 'Vendor'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.index&role=vendor'),
- 'Vendor Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=vendor'),
- 'Vendor Global Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index&appname=fm_vendor&global_cats=True'),
- 'Vendor Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.list_attribute&role=vendor'),
- 'Document Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=document'),
- 'Building Part'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=building_part'),
- 'Tender chapter'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=tender_chapter'),
- 'ID Controle'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.edit_id'),
- 'Permissions'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.list_acl2'),
- 'User contact info'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.contact_info'),
- 'Request status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=request_status'),
- 'Request condition_type'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=r_condition_type'),
- 'Workorders status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=workorder_status'),
- 'Agreement status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=agreement_status'),
- 'Agreement Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiagreement.list_attribute'),
- 'service agreement categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=s_agreement'),
- 'service agreement Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uis_agreement.list_attribute'),
- 'service agreement item Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uis_agreement.list_attribute&role=detail'),
- 'Document Status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=document_status'),
- 'Unit'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=unit'),
- 'Key location'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_3.index&type=key_location'),
- 'Branch'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_3.index&type=branch'),
- 'Accounting'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uib_account.index'),
- 'Accounting extra'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=dim_d'),
- 'Import'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiXport.import'),
- 'Export'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiXport.export'),
- 'Admin Async servises'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uialarm.index'),
- 'Async servises'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiasync.index'),
- );
- display_section($appname,$appname,$file);
-//
$GLOBALS['phpgw']->common->display_mainscreen($appname,$file);
- }
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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: hook_admin.inc.php,v 1.19 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ {
+ $file = array
+ (
+ 'Configuration' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname='
. $appname),
+ 'Street'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=street'),
+ 'District'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=district'),
+ 'Part of town'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uip_of_town.index'),
+ 'Admin entity'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin_entity.index'),
+ 'Admin Location'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin_location.index'),
+ 'Update the not active category for
locations'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uilocation.update_cat'),
+// 'Request Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=request'),
+ 'Workorder Categories' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=wo'),
+ 'Workorder Detail Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=wo_hours'),
+ 'Ticket Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=ticket'),
+ 'Tenant Claim Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=tenant_claim'),
+ 'Tenant Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=tenant'),
+ 'Tenant Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.list_attribute&role=tenant'),
+ 'Tenant'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.index&role=tenant'),
+ 'Owner'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.index&role=owner'),
+ 'Owner Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=owner'),
+ 'Owner Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.list_attribute&role=owner'),
+ 'Vendor'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.index&role=vendor'),
+ 'Vendor Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=vendor'),
+ 'Vendor Global Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index&appname=fm_vendor&global_cats=True'),
+ 'Vendor Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiactor.list_attribute&role=vendor'),
+ 'Document Categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=document'),
+ 'Building Part'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=building_part'),
+ 'Tender chapter'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=tender_chapter'),
+ 'ID Controle'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.edit_id'),
+ 'Permissions'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.list_acl2'),
+ 'User contact info'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.contact_info'),
+ 'Request status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=request_status'),
+ 'Request condition_type'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=r_condition_type'),
+ 'Workorders status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=workorder_status'),
+ 'Agreement status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=agreement_status'),
+ 'Agreement Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiagreement.list_attribute'),
+ 'service agreement categories'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=s_agreement'),
+ 'service agreement Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uis_agreement.list_attribute'),
+ 'service agreement item Attributes'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uis_agreement.list_attribute&role=detail'),
+ 'Document Status'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=document_status'),
+ 'Unit'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_2.index&type=unit'),
+ 'Key location'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_3.index&type=key_location'),
+ 'Branch'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uistandard_3.index&type=branch'),
+ 'Accounting'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uib_account.index'),
+ 'Accounting extra'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uicategory.index&type=dim_d'),
+ 'Import'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiXport.import'),
+ 'Export'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiXport.export'),
+ 'Admin Async servises'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uialarm.index'),
+ 'Async servises'=>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiasync.index'),
+ );
+ display_section($appname,$appname,$file);
+//
$GLOBALS['phpgw']->common->display_mainscreen($appname,$file);
+ }
?>
\ No newline at end of file
Index: property/inc/hook_help.inc.php
diff -u property/inc/hook_help.inc.php:1.6 property/inc/hook_help.inc.php:1.7
--- property/inc/hook_help.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/hook_help.inc.php Fri Feb 3 12:05:49 2006
@@ -1,47 +1,47 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 manual
- * @version $Id: hook_help.inc.php,v 1.6 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
-
- /**
- * Description
- */
-
- include(PHPGW_SERVER_ROOT.'/'.'property'.'/setup/setup.inc.php');
-
- $GLOBALS['phpgw']->help->set_params(array('app_name' =>
'property',
-
'title' => lang('property'),
-
'app_version' => $setup_info['property']['version']));
- $GLOBALS['phpgw']->help->data[] = array
- (
- 'text' => lang('overview'),
- 'link' =>
$GLOBALS['phpgw']->help->check_help_file('overview.php'),
- 'lang_link_statustext' => lang('overview')
- );
-
-
- $GLOBALS['phpgw']->help->data[] = array
- (
- 'text' => lang('property'),
- 'link' =>
$GLOBALS['phpgw']->help->check_help_file('property.php'),
- 'lang_link_statustext' => lang('property')
- );
-
- $GLOBALS['phpgw']->help->data[] = array
- (
- 'text' => lang('project'),
- 'link' =>
$GLOBALS['phpgw']->help->check_help_file('project.php'),
- 'lang_link_statustext' => lang('project')
- );
-
- $GLOBALS['phpgw']->help->draw();
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 manual
+ * @version $Id: hook_help.inc.php,v 1.7 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+
+ /**
+ * Description
+ */
+
+ include(PHPGW_SERVER_ROOT.'/'.'property'.'/setup/setup.inc.php');
+
+ $GLOBALS['phpgw']->help->set_params(array('app_name' =>
'property',
+
'title' => lang('property'),
+
'app_version' => $setup_info['property']['version']));
+ $GLOBALS['phpgw']->help->data[] = array
+ (
+ 'text' => lang('overview'),
+ 'link' =>
$GLOBALS['phpgw']->help->check_help_file('overview.php'),
+ 'lang_link_statustext' => lang('overview')
+ );
+
+
+ $GLOBALS['phpgw']->help->data[] = array
+ (
+ 'text' => lang('property'),
+ 'link' =>
$GLOBALS['phpgw']->help->check_help_file('property.php'),
+ 'lang_link_statustext' => lang('property')
+ );
+
+ $GLOBALS['phpgw']->help->data[] = array
+ (
+ 'text' => lang('project'),
+ 'link' =>
$GLOBALS['phpgw']->help->check_help_file('project.php'),
+ 'lang_link_statustext' => lang('project')
+ );
+
+ $GLOBALS['phpgw']->help->draw();
+?>
Index: property/inc/hook_home.inc.php
diff -u property/inc/hook_home.inc.php:1.6 property/inc/hook_home.inc.php:1.7
--- property/inc/hook_home.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/hook_home.inc.php Fri Feb 3 12:05:49 2006
@@ -1,55 +1,55 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 core
- * @version $Id: hook_home.inc.php,v 1.6 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
- if
($GLOBALS['phpgw_info']['user']['preferences']['property']['mainscreen_show_new_updated'])
- {
- $save_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
- $GLOBALS['phpgw_info']['flags']['currentapp'] = 'property';
-
- $GLOBALS['phpgw']->translation->add_app('property');
-
- $app_id = $GLOBALS['phpgw']->applications->name2id('property');
- $GLOBALS['portal_order'][] = $app_id;
-
- $GLOBALS['phpgw']->portalbox->set_params(array('app_id' =>
$app_id,
-
'title' => lang('property')));
-
- $GLOBALS['HTTP_POST_VARS']['filter'] = $GLOBALS['filter'] =
'open';
- $property = CreateObject('property.uitts');
-
- $GLOBALS['phpgw']->portalbox->draw($property->index());
-
- unset($property);
- $GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app;
- }
-
-
-/*
-
if($GLOBALS['phpgw_info']['user']['preferences']['property']['mainscreen_show_new_updated'])
- {
- $property = CreateObject('property.uitts');
- $property->bo->start = 0;
- $property->bo->limit = 5;
- $property->start = 0;
- $property->limit = 5;
- $extra_data = '<td>'."\n".$property->index(False).'</td>'."\n";
-
- $app_id = $GLOBALS['phpgw']->applications->name2id('property');
- $GLOBALS['portal_order'][] = $app_id;
-
- $GLOBALS['phpgw']->portalbox->set_params(array('app_id' =>
$app_id,
-
'title' => lang('property')));
- $GLOBALS['phpgw']->portalbox->draw($extra_data);
- }
-*/
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 core
+ * @version $Id: hook_home.inc.php,v 1.7 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ if
($GLOBALS['phpgw_info']['user']['preferences']['property']['mainscreen_show_new_updated'])
+ {
+ $save_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
+ $GLOBALS['phpgw_info']['flags']['currentapp'] = 'property';
+
+ $GLOBALS['phpgw']->translation->add_app('property');
+
+ $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+ $GLOBALS['portal_order'][] = $app_id;
+
+ $GLOBALS['phpgw']->portalbox->set_params(array('app_id' =>
$app_id,
+
'title' => lang('property')));
+
+ $GLOBALS['HTTP_POST_VARS']['filter'] = $GLOBALS['filter'] =
'open';
+ $property = CreateObject('property.uitts');
+
+ $GLOBALS['phpgw']->portalbox->draw($property->index());
+
+ unset($property);
+ $GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app;
+ }
+
+
+/*
+
if($GLOBALS['phpgw_info']['user']['preferences']['property']['mainscreen_show_new_updated'])
+ {
+ $property = CreateObject('property.uitts');
+ $property->bo->start = 0;
+ $property->bo->limit = 5;
+ $property->start = 0;
+ $property->limit = 5;
+ $extra_data = '<td>'."\n".$property->index(False).'</td>'."\n";
+
+ $app_id = $GLOBALS['phpgw']->applications->name2id('property');
+ $GLOBALS['portal_order'][] = $app_id;
+
+ $GLOBALS['phpgw']->portalbox->set_params(array('app_id' =>
$app_id,
+
'title' => lang('property')));
+ $GLOBALS['phpgw']->portalbox->draw($extra_data);
+ }
+*/
+?>
Index: property/inc/hook_manual.inc.php
diff -u property/inc/hook_manual.inc.php:1.7
property/inc/hook_manual.inc.php:1.8
--- property/inc/hook_manual.inc.php:1.7 Fri Jan 27 14:05:43 2006
+++ property/inc/hook_manual.inc.php Fri Feb 3 12:05:49 2006
@@ -1,27 +1,27 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 core
- * @version $Id: hook_manual.inc.php,v 1.7 2006/01/27 14:05:43 sigurdne
Exp $
- */
-
- // Only Modify the $file variable.....
- $file = Array(
- 'Location'
=> 'location.php',
- 'Entities'
=> 'entities.php',
- 'Project management' =>
'project.php',
- 'Deviation / requirement' =>
'requirement.php',
- 'Electronic invoice handling ' => 'invoice.php',
- 'Vendor agreements' =>
'agreements.php',
- 'Document register/Drawing register' => 'document.php',
- 'Helpdesk'
=> 'helpdesk.php'
- );
-//Do not modify below this line
- display_manual_section($appname,$file);
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 core
+ * @version $Id: hook_manual.inc.php,v 1.8 2006/02/03 12:05:49 sigurdne
Exp $
+ */
+
+ // Only Modify the $file variable.....
+ $file = Array(
+ 'Location'
=> 'location.php',
+ 'Entities'
=> 'entities.php',
+ 'Project management' =>
'project.php',
+ 'Deviation / requirement' =>
'requirement.php',
+ 'Electronic invoice handling ' => 'invoice.php',
+ 'Vendor agreements' =>
'agreements.php',
+ 'Document register/Drawing register' => 'document.php',
+ 'Helpdesk'
=> 'helpdesk.php'
+ );
+//Do not modify below this line
+ display_manual_section($appname,$file);
+?>
Index: property/inc/hook_preferences.inc.php
diff -u property/inc/hook_preferences.inc.php:1.6
property/inc/hook_preferences.inc.php:1.7
--- property/inc/hook_preferences.inc.php:1.6 Fri Jan 27 14:05:43 2006
+++ property/inc/hook_preferences.inc.php Fri Feb 3 12:05:49 2006
@@ -1,22 +1,22 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 core
- * @version $Id: hook_preferences.inc.php,v 1.6 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- $title = $appname;
- $file = Array(
- 'Preferences' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname .
'&type=user'),
- 'Grant Access' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.aclprefs&acl_app='.$appname)
- );
- display_section($appname,$file);
-
-
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 core
+ * @version $Id: hook_preferences.inc.php,v 1.7 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ $title = $appname;
+ $file = Array(
+ 'Preferences' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname .
'&type=user'),
+ 'Grant Access' =>
$GLOBALS['phpgw']->link('/index.php','menuaction='.$appname.'.uiadmin.aclprefs&acl_app='.$appname)
+ );
+ display_section($appname,$file);
+
+
+?>
Index: property/inc/hook_settings.inc.php
diff -u property/inc/hook_settings.inc.php:1.12
property/inc/hook_settings.inc.php:1.13
--- property/inc/hook_settings.inc.php:1.12 Fri Jan 27 14:05:43 2006
+++ property/inc/hook_settings.inc.php Fri Feb 3 12:05:49 2006
@@ -1,170 +1,170 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 core
- * @version $Id: hook_settings.inc.php,v 1.12 2006/01/27 14:05:43
sigurdne Exp $
- */
-
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
-
- $yes_and_no = array(
- 'True' => 'Yes',
- '' => 'No'
- );
- create_select_box('show new/updated tickets on main
screen','mainscreen_show_new_updated',$yes_and_no,'Dont think this is working -
yet');
-
- create_select_box('Group filters in single
query','group_filters',$yes_and_no,'Group filters - means that one has to hit
the search button to apply the filter');
-
- $tts_status = array(
- '' => lang('Open'),
- 'closed' => lang('Closed'),
- 'all' => lang('All')
- );
-
- create_select_box('Default ticket status','tts_status',$tts_status,'The
default status when entering the helpdesk');
-
- $acc = CreateObject('phpgwapi.accounts');
- $group_list = $acc->get_list('groups');
- while (list($key,$entry) = each($group_list))
- {
- $_groups[$entry['account_id']] = $entry['account_lid'];
- }
- create_select_box('Default group TTS','groupdefault',$_groups,'The
default group to assign a ticket in Helpdesk-submodule');
-
- $account_list = $acc->get_list('accounts');
- while (list($key,$entry) = each($account_list))
- {
- $_accounts[$entry['account_id']] = $entry['account_lid'];
- }
- create_select_box('Default assign to
TTS','assigntodefault',$_accounts,'The default user to assign a ticket in
Helpdesk-submodule');
-
- // Choose the correct priority to display
- $priority_comment[1] = ' - ' . lang('Lowest');
- $priority_comment[5] = ' - ' . lang('Medium');
- $priority_comment[10] = ' - ' . lang('Highest');
- for ($i=1; $i<=10; $i++)
- {
- $priority[$i] = $i . $priority_comment[$i];
- }
-
-
- // Choose the correct degree to display
- $degree_comment[0]=' - '.lang('None');
- $degree_comment[1]=' - '.lang('Minor');
- $degree_comment[2]=' - '.lang('Medium');
- $degree_comment[3]=' - '.lang('Serious');
- for ($i=0; $i<=3; $i++)
- {
- $degree[$i] = $i . $degree_comment[$i];
- }
- create_select_box('Default Priority
TTS','prioritydefault',$priority,'The default priority for tickets in the
Helpdesk-submodule');
-
-
- $sotts= CreateObject($this->currentapp.'.sotts');
- $category_tts= $sotts->select_category_list();
- if ($category_tts)
- {
- while (list($key,$entry) = each($category_tts))
- {
- $_categories_tts[$entry['id']] = $entry['name'];
- }
- }
-
- unset($sotts);
- create_select_box('Default TTS
categories','tts_category',$_categories_tts,'The default category for TTS');
-
- $yes_and_no = array(
- '1' => 'Yes',
- '2' => 'No'
- );
-
- create_select_box('Send e-mail from
TTS','tts_user_mailnotification',$yes_and_no,'Send e-mail from TTS as default');
- create_input_box('Refresh TTS every (seconds)','refreshinterval','The
intervall for Helpdesk refresh - cheking for new tickets');
-
- create_select_box('Default Degree Request
safety','default_safety',$degree,'The degree of seriousness');
- create_select_box('Default Degree Request
aesthetics','default_aesthetics',$degree);
- create_select_box('Default Degree Request indoor
climate','default_climate',$degree);
- create_select_box('Default Degree Request consequential
damage','default_consequential_damage',$degree);
- create_select_box('Default Degree Request user
gratification','default_gratification',$degree);
- create_select_box('Default Degree Request residential
environment','default_environment',$degree);
-
- create_select_box('Send order receipt as email
','order_email_rcpt',$yes_and_no,'Send the order as BCC to the user');
-
- $default_start_page = array(
- 'location' => lang('Location'),
- 'project' => lang('Project'),
- 'tts' => lang('Ticket'),
- 'invoice' => lang('Invoice'),
- 'document'=> lang(Document)
- );
- create_select_box('Default start
page','default_start_page',$default_start_page,'Select your start-submodule');
-
- $soworkorder= CreateObject($this->currentapp.'.soworkorder');
- $socommon= CreateObject($this->currentapp.'.socommon');
-
- $status_list= $soworkorder->select_status_list();
- $category_list= $soworkorder->select_category_workorder_list();
- $district_list= $socommon->select_district_list();
-
- if ($status_list)
- {
- while (list($key,$entry) = each($status_list))
- {
- $_status[$entry['id']] = $entry['name'];
- }
- }
- if ($category_list)
- {
- while (list($key,$entry) = each($category_list))
- {
- $_categories[$entry['id']] = $entry['name'];
- }
- }
- if ($district_list)
- {
- while (list($key,$entry) = each($district_list))
- {
- $_districts[$entry['id']] = $entry['name'];
- }
- }
-
- unset($soworkorder);
- unset($socommon);
- create_select_box('Default project
status','project_status',$_status,'The default status for your projects and
workorders');
- create_select_box('Default project
categories','project_category',$_categories,'The default category for your
projects and workorders');
- create_select_box('Default
district-filter','default_district',$_districts,'Your default district-filter
');
-
- create_input_box('Your Cellphone','cellphone');
-
- create_select_box('Workorder Approval
From','approval_from',$_accounts,'If you need approval from your supervisor for
projects/workorders');
-
- if(!$email_org)
- {
- create_input_box('Your Email','email','Insert your email
address');
- }
-
-
$email_property=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
- $GLOBALS['phpgw']->preferences->add("email","address",$email_property);
- $GLOBALS['phpgw']->preferences->save_repository();
-
- $cats = CreateObject('phpgwapi.categories');
- $cats->app_name = 'fm_vendor';
- $cat_data = $cats->formatted_xslt_list(array('globals' => True,
'link_data' =>array()));
- $cat_list = $cat_data['cat_list'];
-
- if (is_array($cat_list))
- {
- while (list($key,$entry) = each($cat_list))
- {
- $_categories_vendor[$entry['cat_id']] = $entry['name'];
- }
- }
-
- create_select_box('Default vendor
type','default_vendor_category',$_categories_vendor,'which agreement');
-
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 core
+ * @version $Id: hook_settings.inc.php,v 1.13 2006/02/03 12:05:49
sigurdne Exp $
+ */
+
+ $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+
+ $yes_and_no = array(
+ 'True' => 'Yes',
+ '' => 'No'
+ );
+ create_select_box('show new/updated tickets on main
screen','mainscreen_show_new_updated',$yes_and_no,'Dont think this is working -
yet');
+
+ create_select_box('Group filters in single
query','group_filters',$yes_and_no,'Group filters - means that one has to hit
the search button to apply the filter');
+
+ $tts_status = array(
+ '' => lang('Open'),
+ 'closed' => lang('Closed'),
+ 'all' => lang('All')
+ );
+
+ create_select_box('Default ticket status','tts_status',$tts_status,'The
default status when entering the helpdesk');
+
+ $acc = CreateObject('phpgwapi.accounts');
+ $group_list = $acc->get_list('groups');
+ while (list($key,$entry) = each($group_list))
+ {
+ $_groups[$entry['account_id']] = $entry['account_lid'];
+ }
+ create_select_box('Default group TTS','groupdefault',$_groups,'The
default group to assign a ticket in Helpdesk-submodule');
+
+ $account_list = $acc->get_list('accounts');
+ while (list($key,$entry) = each($account_list))
+ {
+ $_accounts[$entry['account_id']] = $entry['account_lid'];
+ }
+ create_select_box('Default assign to
TTS','assigntodefault',$_accounts,'The default user to assign a ticket in
Helpdesk-submodule');
+
+ // Choose the correct priority to display
+ $priority_comment[1] = ' - ' . lang('Lowest');
+ $priority_comment[5] = ' - ' . lang('Medium');
+ $priority_comment[10] = ' - ' . lang('Highest');
+ for ($i=1; $i<=10; $i++)
+ {
+ $priority[$i] = $i . $priority_comment[$i];
+ }
+
+
+ // Choose the correct degree to display
+ $degree_comment[0]=' - '.lang('None');
+ $degree_comment[1]=' - '.lang('Minor');
+ $degree_comment[2]=' - '.lang('Medium');
+ $degree_comment[3]=' - '.lang('Serious');
+ for ($i=0; $i<=3; $i++)
+ {
+ $degree[$i] = $i . $degree_comment[$i];
+ }
+ create_select_box('Default Priority
TTS','prioritydefault',$priority,'The default priority for tickets in the
Helpdesk-submodule');
+
+
+ $sotts= CreateObject($this->currentapp.'.sotts');
+ $category_tts= $sotts->select_category_list();
+ if ($category_tts)
+ {
+ while (list($key,$entry) = each($category_tts))
+ {
+ $_categories_tts[$entry['id']] = $entry['name'];
+ }
+ }
+
+ unset($sotts);
+ create_select_box('Default TTS
categories','tts_category',$_categories_tts,'The default category for TTS');
+
+ $yes_and_no = array(
+ '1' => 'Yes',
+ '2' => 'No'
+ );
+
+ create_select_box('Send e-mail from
TTS','tts_user_mailnotification',$yes_and_no,'Send e-mail from TTS as default');
+ create_input_box('Refresh TTS every (seconds)','refreshinterval','The
intervall for Helpdesk refresh - cheking for new tickets');
+
+ create_select_box('Default Degree Request
safety','default_safety',$degree,'The degree of seriousness');
+ create_select_box('Default Degree Request
aesthetics','default_aesthetics',$degree);
+ create_select_box('Default Degree Request indoor
climate','default_climate',$degree);
+ create_select_box('Default Degree Request consequential
damage','default_consequential_damage',$degree);
+ create_select_box('Default Degree Request user
gratification','default_gratification',$degree);
+ create_select_box('Default Degree Request residential
environment','default_environment',$degree);
+
+ create_select_box('Send order receipt as email
','order_email_rcpt',$yes_and_no,'Send the order as BCC to the user');
+
+ $default_start_page = array(
+ 'location' => lang('Location'),
+ 'project' => lang('Project'),
+ 'tts' => lang('Ticket'),
+ 'invoice' => lang('Invoice'),
+ 'document'=> lang(Document)
+ );
+ create_select_box('Default start
page','default_start_page',$default_start_page,'Select your start-submodule');
+
+ $soworkorder= CreateObject($this->currentapp.'.soworkorder');
+ $socommon= CreateObject($this->currentapp.'.socommon');
+
+ $status_list= $soworkorder->select_status_list();
+ $category_list= $soworkorder->select_category_workorder_list();
+ $district_list= $socommon->select_district_list();
+
+ if ($status_list)
+ {
+ while (list($key,$entry) = each($status_list))
+ {
+ $_status[$entry['id']] = $entry['name'];
+ }
+ }
+ if ($category_list)
+ {
+ while (list($key,$entry) = each($category_list))
+ {
+ $_categories[$entry['id']] = $entry['name'];
+ }
+ }
+ if ($district_list)
+ {
+ while (list($key,$entry) = each($district_list))
+ {
+ $_districts[$entry['id']] = $entry['name'];
+ }
+ }
+
+ unset($soworkorder);
+ unset($socommon);
+ create_select_box('Default project
status','project_status',$_status,'The default status for your projects and
workorders');
+ create_select_box('Default project
categories','project_category',$_categories,'The default category for your
projects and workorders');
+ create_select_box('Default
district-filter','default_district',$_districts,'Your default district-filter
');
+
+ create_input_box('Your Cellphone','cellphone');
+
+ create_select_box('Workorder Approval
From','approval_from',$_accounts,'If you need approval from your supervisor for
projects/workorders');
+
+ if(!$email_org)
+ {
+ create_input_box('Your Email','email','Insert your email
address');
+ }
+
+
$email_property=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
+ $GLOBALS['phpgw']->preferences->add("email","address",$email_property);
+ $GLOBALS['phpgw']->preferences->save_repository();
+
+ $cats = CreateObject('phpgwapi.categories');
+ $cats->app_name = 'fm_vendor';
+ $cat_data = $cats->formatted_xslt_list(array('globals' => True,
'link_data' =>array()));
+ $cat_list = $cat_data['cat_list'];
+
+ if (is_array($cat_list))
+ {
+ while (list($key,$entry) = each($cat_list))
+ {
+ $_categories_vendor[$entry['cat_id']] = $entry['name'];
+ }
+ }
+
+ create_select_box('Default vendor
type','default_vendor_category',$_categories_vendor,'which agreement');
+
Index: property/setup/setup.inc.php
diff -u property/setup/setup.inc.php:1.25 property/setup/setup.inc.php:1.26
--- property/setup/setup.inc.php:1.25 Wed Jan 25 18:19:12 2006
+++ property/setup/setup.inc.php Fri Feb 3 12:05:49 2006
@@ -1,221 +1,221 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @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 setup
- * @version $Id: setup.inc.php,v 1.25 2006/01/25 18:19:12 sigurdne Exp $
- */
-
- $setup_info['property']['name'] = 'property';
- $setup_info['property']['title'] = 'Property';
- $setup_info['property']['version'] = '0.9.17.511';
- $setup_info['property']['app_order'] = 8;
- $setup_info['property']['enable'] = 1;
-
- $setup_info['property']['author'][] = array
- (
- 'name' => 'Sigurd Nes',
- 'email' => 'address@hidden'
- );
-
- $setup_info['property']['maintainer'] = array
- (
- 'name' => 'Sigurd Nes',
- 'email' => 'address@hidden'
- );
-
- $setup_info['property']['license'] = 'GPL';
- $setup_info['property']['description'] =
- '<div align="left">
-
- <b>FM</b> (Facilities-management) providing:
- <ol>
- <li>Helpdesk</li>
- <li>Property register - with drawing and
document-archive(vfs)</li>
- <li>Equipment register</li>
- <li>Vendor register (using Addressbook)</li>
- <li>Tenant register</li>
- <li>Project/workorder by email/pdf with ability to save
workorders as templates for later use</li>
- <ol>
- <li>From vendors prizebook - or</li>
- <li>from templates - or</li>
- <li> by custom definition as (optional) tender for
bidding based on (for the moment) norwegian building standards.</li>
- </ol>
- <li>Service agreements with prizebook with historical prizing
per vendor</li>
- <li>Invoice handling</li>
- <ol>
- <li>Import from file (currently Three different
formats)</li>
- <li>Approval per Role</li>
- <ol>
- <li>Janitor</li>
- <li>Supervisor</li>
- <li>Budget responsible</li>
- </ol>
- <li>Eksport to payment system / accounting system</li>
- </ol>
- </ol>
-
-
- <b>Property</b> is organized as a set of submodules - each with theis
own set of user permission-settings.
- <br>
- <b>Workorder</b> can be used as a general tool for producing tender for
bidding - the document is presented as a pdf-document.
- </div>';
-
- $setup_info['property']['note'] =
- 'I am also planning to add maintenance planning as events in
the calendar app.';
-
-
- $setup_info['property']['tables'] = array(
- 'fm_part_of_town',
- 'fm_gab_location',
- 'fm_streetaddress',
- 'fm_tenant',
- 'fm_tenant_category',
- 'fm_tenant_attribute',
- 'fm_tenant_choice',
- 'fm_vendor',
- 'fm_vendor_category',
- 'fm_vendor_attribute',
- 'fm_vendor_choice',
- 'fm_district',
- 'fm_location1',
- 'fm_location1_category',
- 'fm_location1_history',
- 'fm_location2',
- 'fm_location2_category',
- 'fm_location2_history',
- 'fm_location3',
- 'fm_location3_category',
- 'fm_location3_history',
- 'fm_location4',
- 'fm_location4_category',
- 'fm_location4_history',
- 'fm_location_type',
- 'fm_location_attrib',
- 'fm_location_choice',
- 'fm_location_config',
- 'fm_building_part',
- 'fm_b_account',
- 'fm_dim_d',
- 'fm_workorder',
- 'fm_workorder_category',
- 'fm_workorder_history',
- 'fm_workorder_status',
- 'fm_activities',
- 'fm_agreement_group',
- 'fm_agreement',
- 'fm_agreement_status',
- 'fm_agreement_attribute',
- 'fm_agreement_choice',
- 'fm_activity_price_index',
- 'fm_branch',
- 'fm_wo_hours',
- 'fm_wo_hours_category',
- 'fm_wo_h_deviation',
- 'fm_key_loc',
- 'fm_request',
- 'fm_request_condition_type',
- 'fm_request_condition',
- 'fm_request_status',
- 'fm_request_category',
- 'fm_request_history',
- 'fm_template',
- 'fm_template_hours',
- 'fm_chapter',
- 'fm_ns3420',
- 'fm_project',
- 'fm_projectbranch',
- 'fm_project_history',
- 'fm_tts_tickets',
- 'fm_tts_category',
- 'fm_tts_history',
- 'fm_tts_views',
- 'fm_ecoart',
- 'fm_ecoavvik',
- 'fm_ecobilag',
- 'fm_ecobilagkilde',
- 'fm_ecobilagoverf',
- 'fm_ecobilagtype',
- 'fm_ecodimb',
- 'fm_ecodimd',
- 'fm_ecologg',
- 'fm_ecomva',
- 'fm_ecouser',
- 'fm_acl2',
- 'fm_investment',
- 'fm_investment_value',
- 'fm_event_receipt',
- 'fm_idgenerator',
- 'fm_document',
- 'fm_document_category',
- 'fm_document_history',
- 'fm_document_status',
- 'fm_acl_location',
- 'fm_standard_unit',
- 'fm_owner',
- 'fm_owner_category',
- 'fm_owner_attribute',
- 'fm_owner_choice',
- 'fm_cache',
- 'fm_entity',
- 'fm_entity_attribute',
- 'fm_entity_category',
- 'fm_entity_choice',
- 'fm_entity_lookup',
- 'fm_entity_1_1',
- 'fm_entity_1_2',
- 'fm_entity_1_3',
- 'fm_entity_2_1',
- 'fm_entity_2_2',
- 'fm_custom_function',
- 'fm_custom',
- 'fm_custom_cols',
- 'fm_orders',
- 'fm_s_agreement',
- 'fm_s_agreement_attribute',
- 'fm_s_agreement_category',
- 'fm_s_agreement_choice',
- 'fm_s_agreement_detail',
- 'fm_s_agreement_pricing',
- 'fm_async_method',
- 'fm_cron_log',
- 'fm_origin',
- 'fm_tenant_claim',
- 'fm_tenant_claim_category'
- );
-
- /* The hooks this app includes, needed for hooks registration */
- $setup_info['property']['hooks'] = array
- (
-// 'home',
- 'add_def_pref',
- 'deleteaccount',
- 'manual',
- 'settings',
- 'preferences',
- 'admin',
- 'help'
- );
-
- /* Dependencies for this app to work */
- $setup_info['property']['depends'][] = array
- (
- 'appname' => 'phpgwapi',
- 'versions' => Array('0.9.15', '0.9.16', '0.9.17', '0.9.18')
- );
-
- $setup_info['property']['depends'][] = array(
- 'appname' => 'admin',
- 'versions' => Array('0.9.13', '0.9.14', '0.9.15', '0.9.16',
'0.9.17', '0.9.18')
- );
-
- $setup_info['property']['depends'][] = array(
- 'appname' => 'preferences',
- 'versions' => Array('0.9.13', '0.9.14', '0.9.15', '0.9.16',
'0.9.17', '0.9.18')
- );
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @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 setup
+ * @version $Id: setup.inc.php,v 1.26 2006/02/03 12:05:49 sigurdne Exp $
+ */
+
+ $setup_info['property']['name'] = 'property';
+ $setup_info['property']['title'] = 'Property';
+ $setup_info['property']['version'] = '0.9.17.511';
+ $setup_info['property']['app_order'] = 8;
+ $setup_info['property']['enable'] = 1;
+
+ $setup_info['property']['author'][] = array
+ (
+ 'name' => 'Sigurd Nes',
+ 'email' => 'address@hidden'
+ );
+
+ $setup_info['property']['maintainer'] = array
+ (
+ 'name' => 'Sigurd Nes',
+ 'email' => 'address@hidden'
+ );
+
+ $setup_info['property']['license'] = 'GPL';
+ $setup_info['property']['description'] =
+ '<div align="left">
+
+ <b>FM</b> (Facilities-management) providing:
+ <ol>
+ <li>Helpdesk</li>
+ <li>Property register - with drawing and
document-archive(vfs)</li>
+ <li>Equipment register</li>
+ <li>Vendor register (using Addressbook)</li>
+ <li>Tenant register</li>
+ <li>Project/workorder by email/pdf with ability to save
workorders as templates for later use</li>
+ <ol>
+ <li>From vendors prizebook - or</li>
+ <li>from templates - or</li>
+ <li> by custom definition as (optional) tender for
bidding based on (for the moment) norwegian building standards.</li>
+ </ol>
+ <li>Service agreements with prizebook with historical prizing
per vendor</li>
+ <li>Invoice handling</li>
+ <ol>
+ <li>Import from file (currently Three different
formats)</li>
+ <li>Approval per Role</li>
+ <ol>
+ <li>Janitor</li>
+ <li>Supervisor</li>
+ <li>Budget responsible</li>
+ </ol>
+ <li>Eksport to payment system / accounting system</li>
+ </ol>
+ </ol>
+
+
+ <b>Property</b> is organized as a set of submodules - each with theis
own set of user permission-settings.
+ <br>
+ <b>Workorder</b> can be used as a general tool for producing tender for
bidding - the document is presented as a pdf-document.
+ </div>';
+
+ $setup_info['property']['note'] =
+ 'I am also planning to add maintenance planning as events in
the calendar app.';
+
+
+ $setup_info['property']['tables'] = array(
+ 'fm_part_of_town',
+ 'fm_gab_location',
+ 'fm_streetaddress',
+ 'fm_tenant',
+ 'fm_tenant_category',
+ 'fm_tenant_attribute',
+ 'fm_tenant_choice',
+ 'fm_vendor',
+ 'fm_vendor_category',
+ 'fm_vendor_attribute',
+ 'fm_vendor_choice',
+ 'fm_district',
+ 'fm_location1',
+ 'fm_location1_category',
+ 'fm_location1_history',
+ 'fm_location2',
+ 'fm_location2_category',
+ 'fm_location2_history',
+ 'fm_location3',
+ 'fm_location3_category',
+ 'fm_location3_history',
+ 'fm_location4',
+ 'fm_location4_category',
+ 'fm_location4_history',
+ 'fm_location_type',
+ 'fm_location_attrib',
+ 'fm_location_choice',
+ 'fm_location_config',
+ 'fm_building_part',
+ 'fm_b_account',
+ 'fm_dim_d',
+ 'fm_workorder',
+ 'fm_workorder_category',
+ 'fm_workorder_history',
+ 'fm_workorder_status',
+ 'fm_activities',
+ 'fm_agreement_group',
+ 'fm_agreement',
+ 'fm_agreement_status',
+ 'fm_agreement_attribute',
+ 'fm_agreement_choice',
+ 'fm_activity_price_index',
+ 'fm_branch',
+ 'fm_wo_hours',
+ 'fm_wo_hours_category',
+ 'fm_wo_h_deviation',
+ 'fm_key_loc',
+ 'fm_request',
+ 'fm_request_condition_type',
+ 'fm_request_condition',
+ 'fm_request_status',
+ 'fm_request_category',
+ 'fm_request_history',
+ 'fm_template',
+ 'fm_template_hours',
+ 'fm_chapter',
+ 'fm_ns3420',
+ 'fm_project',
+ 'fm_projectbranch',
+ 'fm_project_history',
+ 'fm_tts_tickets',
+ 'fm_tts_category',
+ 'fm_tts_history',
+ 'fm_tts_views',
+ 'fm_ecoart',
+ 'fm_ecoavvik',
+ 'fm_ecobilag',
+ 'fm_ecobilagkilde',
+ 'fm_ecobilagoverf',
+ 'fm_ecobilagtype',
+ 'fm_ecodimb',
+ 'fm_ecodimd',
+ 'fm_ecologg',
+ 'fm_ecomva',
+ 'fm_ecouser',
+ 'fm_acl2',
+ 'fm_investment',
+ 'fm_investment_value',
+ 'fm_event_receipt',
+ 'fm_idgenerator',
+ 'fm_document',
+ 'fm_document_category',
+ 'fm_document_history',
+ 'fm_document_status',
+ 'fm_acl_location',
+ 'fm_standard_unit',
+ 'fm_owner',
+ 'fm_owner_category',
+ 'fm_owner_attribute',
+ 'fm_owner_choice',
+ 'fm_cache',
+ 'fm_entity',
+ 'fm_entity_attribute',
+ 'fm_entity_category',
+ 'fm_entity_choice',
+ 'fm_entity_lookup',
+ 'fm_entity_1_1',
+ 'fm_entity_1_2',
+ 'fm_entity_1_3',
+ 'fm_entity_2_1',
+ 'fm_entity_2_2',
+ 'fm_custom_function',
+ 'fm_custom',
+ 'fm_custom_cols',
+ 'fm_orders',
+ 'fm_s_agreement',
+ 'fm_s_agreement_attribute',
+ 'fm_s_agreement_category',
+ 'fm_s_agreement_choice',
+ 'fm_s_agreement_detail',
+ 'fm_s_agreement_pricing',
+ 'fm_async_method',
+ 'fm_cron_log',
+ 'fm_origin',
+ 'fm_tenant_claim',
+ 'fm_tenant_claim_category'
+ );
+
+ /* The hooks this app includes, needed for hooks registration */
+ $setup_info['property']['hooks'] = array
+ (
+// 'home',
+ 'add_def_pref',
+ 'deleteaccount',
+ 'manual',
+ 'settings',
+ 'preferences',
+ 'admin',
+ 'help'
+ );
+
+ /* Dependencies for this app to work */
+ $setup_info['property']['depends'][] = array
+ (
+ 'appname' => 'phpgwapi',
+ 'versions' => Array('0.9.15', '0.9.16', '0.9.17', '0.9.18')
+ );
+
+ $setup_info['property']['depends'][] = array(
+ 'appname' => 'admin',
+ 'versions' => Array('0.9.13', '0.9.14', '0.9.15', '0.9.16',
'0.9.17', '0.9.18')
+ );
+
+ $setup_info['property']['depends'][] = array(
+ 'appname' => 'preferences',
+ 'versions' => Array('0.9.13', '0.9.14', '0.9.15', '0.9.16',
'0.9.17', '0.9.18')
+ );
+?>
Index: property/templates/base/admin_entity.xsl
diff -u property/templates/base/admin_entity.xsl:1.3
property/templates/base/admin_entity.xsl:1.4
--- property/templates/base/admin_entity.xsl:1.3 Mon Oct 24 10:45:29 2005
+++ property/templates/base/admin_entity.xsl Fri Feb 3 12:05:49 2006
@@ -1,1835 +1,1835 @@
-<!-- $Id: admin_entity.xsl,v 1.3 2005/10/24 10:45:29 sigurdne Exp $ -->
-
- <xsl:template name="app_data">
- <xsl:choose>
- <xsl:when test="edit">
- <xsl:apply-templates select="edit"/>
- </xsl:when>
- <xsl:when test="edit_status">
- <xsl:apply-templates select="edit_status"/>
- </xsl:when>
- <xsl:when test="list_attribute">
- <xsl:apply-templates select="list_attribute"/>
- </xsl:when>
- <xsl:when test="list_status">
- <xsl:apply-templates select="list_status"/>
- </xsl:when>
- <xsl:when test="edit_attrib">
- <xsl:apply-templates select="edit_attrib"/>
- </xsl:when>
- <xsl:when test="list_config">
- <xsl:apply-templates select="list_config"/>
- </xsl:when>
- <xsl:when test="edit_config">
- <xsl:apply-templates select="edit_config"/>
- </xsl:when>
- <xsl:when test="list_category">
- <xsl:apply-templates select="list_category"/>
- </xsl:when>
- <xsl:when test="list_custom_function">
- <xsl:apply-templates
select="list_custom_function"/>
- </xsl:when>
- <xsl:when test="edit_custom_function">
- <xsl:apply-templates
select="edit_custom_function"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="list"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <xsl:template match="list">
- <xsl:call-template name="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates select="table_header"/>
- <xsl:apply-templates select="values"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
-
- <xsl:template match="table_header">
- <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="10%" align="right">
- <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
- </td>
- <td class="th_text" width="10%" align="center">
- <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
- </td>
- <td class="th_text" width="20%" align="center">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_categories"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_delete"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values">
- <xsl:variable name="lang_attribute_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
- <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
- <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <xsl:value-of select="id"/>
- </td>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="left">
- <xsl:value-of select="descr"/>
- </td>
- <td align="center">
- <xsl:variable
name="link_categories"><xsl:value-of select="link_categories"/></xsl:variable>
- <a href="{$link_categories}"
onMouseover="window.status='{lang_category_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_categories"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="list_status">
- <xsl:call-template name="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_status"/>
- <xsl:apply-templates select="values_status"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
-
- <xsl:template match="table_header_status">
- <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="10%" align="right">
- <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
- </td>
- <td class="th_text" width="20%" align="center">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_delete"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_status">
- <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
- <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <xsl:value-of select="id"/>
- </td>
- <td align="left">
- <xsl:value-of select="descr"/>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="list_category">
- <xsl:call-template name="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_category"/>
- <xsl:apply-templates select="values_category"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
-
- <xsl:template match="table_header_category">
- <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="5%" align="right">
- <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
- </td>
- <td class="th_text" width="10%" align="center">
- <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
- </td>
- <td class="th_text" width="20%" align="center">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_prefix"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_attribute"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_custom_function"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_delete"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_category">
- <xsl:variable name="lang_attribute_standardtext"><xsl:value-of
select="lang_attribute_standardtext"/></xsl:variable>
- <xsl:variable
name="lang_custom_function_standardtext"><xsl:value-of
select="lang_custom_function_standardtext"/></xsl:variable>
- <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
- <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <xsl:value-of select="id"/>
- </td>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="left">
- <xsl:value-of select="descr"/>
- </td>
- <td align="left">
- <xsl:value-of select="prefix"/>
- </td>
- <td align="center">
- <xsl:variable
name="link_attribute"><xsl:value-of select="link_attribute"/></xsl:variable>
- <a href="{$link_attribute}"
onMouseover="window.status='{$lang_attribute_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_attribute"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_custom_function"><xsl:value-of
select="link_custom_function"/></xsl:variable>
- <a href="{$link_custom_function}"
onMouseover="window.status='{$lang_custom_function_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_custom_function"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </tr>
- </xsl:template>
-
-
- <xsl:template match="list_config">
- <xsl:call-template name="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template
name="search_field"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template
name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_list_config"/>
- <xsl:apply-templates
select="values_list_config"/>
- </table>
- </xsl:template>
-
- <xsl:template match="table_header_list_config">
- <xsl:variable name="sort_column_name"><xsl:value-of
select="sort_column_name"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="10%" align="center">
- <a
href="{$sort_column_name}"><xsl:value-of select="lang_column_name"/></a>
- </td>
- <td class="th_text" width="10%" align="center">
- <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_list_config">
- <xsl:variable
name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="left">
- <xsl:value-of
select="column_name"/>
- </td>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- </tr>
- </xsl:template>
-
-
- <xsl:template match="table_add">
- <tr>
- <td height="50">
- <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
- <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
- <form method="post"
action="{$add_action}">
- <input type="submit" name="add"
value="{$lang_add}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_standardtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- <td height="50">
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit" name="add"
value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_standardtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </xsl:template>
-
-<!-- add / edit -->
- <xsl:template match="edit">
- <div align="left">
-
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" action="{$form_action}">
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="value_id != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_id"/>
- </td>
- <td>
- <xsl:value-of
select="value_id"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_name"/>
- </td>
- <td>
- <input type="text" name="values[name]"
value="{value_name}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_name_standardtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td>
- <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_descr_standardtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of
select="value_descr"/>
- </textarea>
-
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="lang_location_form != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_location_form"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_location_form = 1">
-
<input type="checkbox" name="values[location_form]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_location_form_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[location_form]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_location_form_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="lang_documentation != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_documentation"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_documentation = 1">
-
<input type="checkbox" name="values[documentation]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_documentation_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[documentation]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_documentation_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="value_location_form = 1">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_include_in_location_form"/>
- </td>
- <td>
- <xsl:call-template
name="include_list"/>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_include_this_entity"/>
- </td>
- <td>
- <xsl:call-template
name="include_list_2"/>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_start_this_entity"/>
- </td>
- <td>
- <xsl:call-template
name="include_list_3"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
-
- <xsl:choose>
- <xsl:when test="lang_prefix != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_prefix"/>
- </td>
- <td>
- <input type="text"
name="values[prefix]" value="{value_prefix}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_prefix_standardtext"/>
-
<xsl:text>'; return true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="lang_lookup_tenant != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_lookup_tenant"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_lookup_tenant = 1">
-
<input type="checkbox" name="values[lookup_tenant]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_lookup_tenant_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[lookup_tenant]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_lookup_tenant_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="lang_tracking != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_tracking"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_tracking = 1">
-
<input type="checkbox" name="values[tracking]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_tracking_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[tracking]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_tracking_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="lang_fileupload != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_fileupload"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_fileupload = 1">
-
<input type="checkbox" name="values[fileupload]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_fileupload_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[fileupload]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_fileupload_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="lang_loc_link != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_loc_link"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_loc_link = 1">
-
<input type="checkbox" name="values[loc_link]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_loc_link_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[loc_link]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_loc_link_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="lang_start_project != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_start_project"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_start_project = 1">
-
<input type="checkbox" name="values[start_project]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_start_project_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[start_project]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_start_project_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="lang_location_level != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_location_level"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_location_level_statustext"><xsl:value-of
select="lang_location_level_statustext"/></xsl:variable>
- <select
name="values[location_level]" class="forms"
onMouseover="window.status='{$lang_location_level_statustext}'; return true;"
onMouseout="window.status='';return true;">
- <option
value=""><xsl:value-of select="lang_no_location_level"/></option>
-
<xsl:apply-templates select="location_level_list"/>
- </select>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_standardtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_done_standardtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-<!-- add_status / edit_status -->
- <xsl:template match="edit_status">
- <div align="left">
-
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" action="{$form_action}">
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_id"/>
- </td>
- <xsl:choose>
- <xsl:when test="value_id != ''">
- <td>
- <xsl:value-of
select="value_id"/>
- <input type="hidden"
name="values[id]" value="{value_id}"></input>
- </td>
- </xsl:when>
- <xsl:otherwise>
- <td>
- <input type="text"
name="values[id]" value="{value_id}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_id_standardtext"/>
-
<xsl:text>'; return true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </xsl:otherwise>
- </xsl:choose>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td>
- <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_descr_standardtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of
select="value_descr"/>
- </textarea>
-
- </td>
- </tr>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_standardtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_done_standardtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-<!-- list attribute -->
-
- <xsl:template match="list_attribute">
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_attrib"/>
- <xsl:apply-templates select="values_attrib"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
- <xsl:template match="table_header_attrib">
- <xsl:variable name="sort_sorting"><xsl:value-of
select="sort_sorting"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="10%" align="left">
- <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
- </td>
- <td class="th_text" width="20%" align="left">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td class="th_text" width="1%" align="left">
- <xsl:value-of select="lang_datatype"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <a href="{$sort_sorting}"><xsl:value-of
select="lang_sorting"/></a>
- </td>
- <td class="th_text" width="1%" align="center">
- <xsl:value-of select="lang_search"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_delete"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_attrib">
- <xsl:variable name="lang_up_text"><xsl:value-of
select="lang_up_text"/></xsl:variable>
- <xsl:variable name="lang_down_text"><xsl:value-of
select="lang_down_text"/></xsl:variable>
- <xsl:variable name="lang_edit_text"><xsl:value-of
select="lang_edit_text"/></xsl:variable>
- <xsl:variable name="lang_delete_text"><xsl:value-of
select="lang_delete_text"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="column_name"/>
- </td>
- <td>
- <xsl:value-of select="input_text"/>
- </td>
- <td>
- <xsl:value-of select="datatype"/>
- </td>
- <td>
- <table align="left">
- <tr>
- <td>
- <xsl:value-of
select="sorting"/>
- </td>
-
- <td align="left">
- <xsl:variable
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
- <a
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
- <xsl:text> |
</xsl:text>
- <xsl:variable
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
- <a
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return
true;" onMouseout="window.status='';return true;"><xsl:value-of
select="text_down"/></a>
- </td>
-
- </tr>
- </table>
- </td>
- <td align="center">
- <xsl:value-of select="search"/>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </tr>
- </xsl:template>
-
-
-<!-- add attribute / edit attribute -->
-
- <xsl:template match="edit_attrib">
- <div align="left">
-
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" action="{$form_action}">
-
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="value_id != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_id"/>
- </td>
- <td>
- <xsl:value-of
select="value_id"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_column_name"/>
- </td>
- <td>
- <input type="text"
name="values[column_name]" value="{value_column_name}" maxlength="20"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_column_name_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_input_text"/>
- </td>
- <td>
- <input type="text"
name="values[input_text]" value="{value_input_text}" maxlength="20"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_input_text_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_statustext"/>
- </td>
- <td>
- <textarea cols="60" rows="10"
name="values[statustext]" wrap="virtual" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_statustext_attribtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of
select="value_statustext"/>
- </textarea>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_datatype"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_datatype_statustext"><xsl:value-of
select="lang_datatype_statustext"/></xsl:variable>
- <select
name="values[column_info][type]" class="forms"
onMouseover="window.status='{$lang_datatype_statustext}'; return true;"
onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_datatype"/></option>
- <xsl:apply-templates
select="datatype_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_precision"/>
- </td>
- <td>
- <input type="text"
name="values[column_info][precision]" value="{value_precision}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_precision_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_scale"/>
- </td>
- <td>
- <input type="text"
name="values[column_info][scale]" value="{value_scale}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_scale_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_default"/>
- </td>
- <td>
- <input type="text"
name="values[column_info][default]" value="{value_default}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_default_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_nullable"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_nullable_statustext"><xsl:value-of
select="lang_nullable_statustext"/></xsl:variable>
- <select
name="values[column_info][nullable]" class="forms"
onMouseover="window.status='{$lang_nullable_statustext}'; return true;"
onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_nullable"/></option>
- <xsl:apply-templates
select="nullable_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td>
- <xsl:value-of select="lang_list"/>
- </td>
- <td>
- <xsl:choose>
- <xsl:when
test="value_list = 1">
- <input
type="checkbox" name="values[list]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_list_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[list]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_list_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <tr>
- <td>
- <xsl:value-of
select="lang_include_search"/>
- </td>
- <td>
- <xsl:choose>
- <xsl:when
test="value_search = 1">
- <input
type="checkbox" name="values[search]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_include_search_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[search]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_include_search_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="multiple_choice != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_choice"/>
- </td>
- <td align="right">
- <xsl:call-template
name="choice"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_attribtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-
- </form>
- <tr>
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_done_attribtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-
-
-<!-- list custom_function -->
-
- <xsl:template match="list_custom_function">
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_custom_function"/>
- <xsl:choose>
- <xsl:when test="values_custom_function != ''">
- <xsl:apply-templates
select="values_custom_function"/>
- </xsl:when>
- </xsl:choose>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
- <xsl:template match="table_header_custom_function">
- <xsl:variable name="sort_sorting"><xsl:value-of
select="sort_sorting"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="10%" align="left">
- <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
- </td>
- <td class="th_text" width="20%" align="left">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_active"/>
- </td>
- <td class="th_text" width="10%" align="center">
- <a href="{$sort_sorting}"><xsl:value-of
select="lang_sorting"/></a>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_delete"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_custom_function">
- <xsl:variable name="lang_up_text"><xsl:value-of
select="lang_up_text"/></xsl:variable>
- <xsl:variable name="lang_down_text"><xsl:value-of
select="lang_down_text"/></xsl:variable>
- <xsl:variable name="lang_edit_text"><xsl:value-of
select="lang_edit_text"/></xsl:variable>
- <xsl:variable name="lang_delete_text"><xsl:value-of
select="lang_delete_text"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="file_name"/>
- </td>
- <td>
- <xsl:value-of select="descr"/>
- </td>
- <td align = 'center'>
- <xsl:value-of select="active"/>
- </td>
- <td>
- <table align="left">
- <tr>
- <td>
- <xsl:value-of
select="sorting"/>
- </td>
-
- <td align="left">
- <xsl:variable
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
- <a
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
- <xsl:text> |
</xsl:text>
- <xsl:variable
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
- <a
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return
true;" onMouseout="window.status='';return true;"><xsl:value-of
select="text_down"/></a>
- </td>
-
- </tr>
- </table>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </tr>
- </xsl:template>
-
-
-<!-- add custom_function / edit custom_function -->
-
- <xsl:template match="edit_custom_function">
- <div align="left">
-
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" action="{$form_action}">
-
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="value_id != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_id"/>
- </td>
- <td>
- <xsl:value-of
select="value_id"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td>
- <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_descr_custom_functiontext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of
select="value_descr"/>
- </textarea>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_custom_function"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_custom_function_statustext"><xsl:value-of
select="lang_custom_function_statustext"/></xsl:variable>
- <select
name="values[custom_function_file]" class="forms"
onMouseover="window.status='{$lang_custom_function_statustext}'; return true;"
onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_custom_function"/></option>
- <xsl:apply-templates
select="custom_function_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td>
- <xsl:value-of select="lang_active"/>
- </td>
- <td>
- <xsl:choose>
- <xsl:when
test="value_active = 1">
- <input
type="checkbox" name="values[active]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_active_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[active]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_active_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_custom_functiontext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-
- </form>
- <tr>
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_done_custom_functiontext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-
-
-<!-- location_level_list -->
-
- <xsl:template match="location_level_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- datatype_list -->
-
- <xsl:template match="datatype_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- custom_function_list -->
-
- <xsl:template match="custom_function_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected='selected'">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- nullable_list -->
-
- <xsl:template match="nullable_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="choice">
- <table cellpadding="2" cellspacing="2" width="80%"
align="left">
- <xsl:choose>
- <xsl:when test="value_choice!=''">
- <tr class="th">
- <td class="th_text" width="85%"
align="left">
- <xsl:value-of
select="lang_value"/>
- </td>
- <td class="th_text" width="15%"
align="center">
- <xsl:value-of
select="lang_delete_value"/>
- </td>
- </tr>
- <xsl:for-each select="value_choice" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when
test="@class">
-
<xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="value"/>
- <xsl:text> </xsl:text>
- </td>
- <td align="center">
- <input type="checkbox"
name="values[delete_choice][]" value="{id}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_delete_choice_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </xsl:for-each>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_new_value"/>
- </td>
- <td>
- <input type="text"
name="values[new_choice]" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_new_value_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <xsl:template name="include_list">
- <table cellpadding="2" cellspacing="2" width="80%"
align="left">
- <tr class="th">
- <td class="th_text" width="85%"
align="left">
- <xsl:value-of
select="lang_name"/>
- </td>
- <td class="th_text" width="15%"
align="center">
- <xsl:value-of
select="lang_select"/>
- </td>
- </tr>
- <xsl:for-each select="include_list" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when
test="@class">
-
<xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="center">
- <xsl:choose>
- <xsl:when
test="selected='selected'">
- <input
type="checkbox" name="values[lookup_entity][]" value="{id}" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_include_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[lookup_entity][]" value="{id}"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_include_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
-
- <xsl:template name="include_list_2">
- <table cellpadding="2" cellspacing="2" width="80%"
align="left">
- <tr class="th">
- <td class="th_text" width="85%"
align="left">
- <xsl:value-of
select="lang_name"/>
- </td>
- <td class="th_text" width="15%"
align="center">
- <xsl:value-of
select="lang_select"/>
- </td>
- </tr>
- <xsl:for-each select="include_list_2" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when
test="@class">
-
<xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="center">
- <xsl:choose>
- <xsl:when
test="selected='selected'">
- <input
type="checkbox" name="values[include_entity_for][]" value="{id}"
checked="checked" onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_include_2_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[include_entity_for][]" value="{id}"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_include_2_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
- <xsl:template name="include_list_3">
- <table cellpadding="2" cellspacing="2" width="80%"
align="left">
- <tr class="th">
- <td class="th_text" width="85%"
align="left">
- <xsl:value-of
select="lang_name"/>
- </td>
- <td class="th_text" width="15%"
align="center">
- <xsl:value-of
select="lang_select"/>
- </td>
- </tr>
- <xsl:for-each select="include_list_3" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when
test="@class">
-
<xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="center">
- <xsl:choose>
- <xsl:when
test="selected='selected'">
- <input
type="checkbox" name="values[start_entity_from][]" value="{id}"
checked="checked" onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[start_entity_from][]" value="{id}"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_include_3_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
-
+<!-- $Id: admin_entity.xsl,v 1.4 2006/02/03 12:05:49 sigurdne Exp $ -->
+
+ <xsl:template name="app_data">
+ <xsl:choose>
+ <xsl:when test="edit">
+ <xsl:apply-templates select="edit"/>
+ </xsl:when>
+ <xsl:when test="edit_status">
+ <xsl:apply-templates select="edit_status"/>
+ </xsl:when>
+ <xsl:when test="list_attribute">
+ <xsl:apply-templates select="list_attribute"/>
+ </xsl:when>
+ <xsl:when test="list_status">
+ <xsl:apply-templates select="list_status"/>
+ </xsl:when>
+ <xsl:when test="edit_attrib">
+ <xsl:apply-templates select="edit_attrib"/>
+ </xsl:when>
+ <xsl:when test="list_config">
+ <xsl:apply-templates select="list_config"/>
+ </xsl:when>
+ <xsl:when test="edit_config">
+ <xsl:apply-templates select="edit_config"/>
+ </xsl:when>
+ <xsl:when test="list_category">
+ <xsl:apply-templates select="list_category"/>
+ </xsl:when>
+ <xsl:when test="list_custom_function">
+ <xsl:apply-templates
select="list_custom_function"/>
+ </xsl:when>
+ <xsl:when test="edit_custom_function">
+ <xsl:apply-templates
select="edit_custom_function"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="list"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template match="list">
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates select="table_header"/>
+ <xsl:apply-templates select="values"/>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="table_header">
+ <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="10%" align="right">
+ <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
+ </td>
+ <td class="th_text" width="10%" align="center">
+ <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
+ </td>
+ <td class="th_text" width="20%" align="center">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_categories"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values">
+ <xsl:variable name="lang_attribute_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
+ <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
+ <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <xsl:value-of select="id"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="descr"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_categories"><xsl:value-of select="link_categories"/></xsl:variable>
+ <a href="{$link_categories}"
onMouseover="window.status='{lang_category_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_categories"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="list_status">
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_status"/>
+ <xsl:apply-templates select="values_status"/>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="table_header_status">
+ <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="10%" align="right">
+ <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
+ </td>
+ <td class="th_text" width="20%" align="center">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_status">
+ <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
+ <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <xsl:value-of select="id"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="descr"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="list_category">
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_category"/>
+ <xsl:apply-templates select="values_category"/>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="table_header_category">
+ <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="5%" align="right">
+ <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
+ </td>
+ <td class="th_text" width="10%" align="center">
+ <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
+ </td>
+ <td class="th_text" width="20%" align="center">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_prefix"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_attribute"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_custom_function"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_category">
+ <xsl:variable name="lang_attribute_standardtext"><xsl:value-of
select="lang_attribute_standardtext"/></xsl:variable>
+ <xsl:variable
name="lang_custom_function_standardtext"><xsl:value-of
select="lang_custom_function_standardtext"/></xsl:variable>
+ <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
+ <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <xsl:value-of select="id"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="descr"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="prefix"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_attribute"><xsl:value-of select="link_attribute"/></xsl:variable>
+ <a href="{$link_attribute}"
onMouseover="window.status='{$lang_attribute_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_attribute"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_custom_function"><xsl:value-of
select="link_custom_function"/></xsl:variable>
+ <a href="{$link_custom_function}"
onMouseover="window.status='{$lang_custom_function_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_custom_function"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+ <xsl:template match="list_config">
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template
name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template
name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_list_config"/>
+ <xsl:apply-templates
select="values_list_config"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="table_header_list_config">
+ <xsl:variable name="sort_column_name"><xsl:value-of
select="sort_column_name"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="10%" align="center">
+ <a
href="{$sort_column_name}"><xsl:value-of select="lang_column_name"/></a>
+ </td>
+ <td class="th_text" width="10%" align="center">
+ <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_list_config">
+ <xsl:variable
name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when
test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="left">
+ <xsl:value-of
select="column_name"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+ <xsl:template match="table_add">
+ <tr>
+ <td height="50">
+ <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
+ <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
+ <form method="post"
action="{$add_action}">
+ <input type="submit" name="add"
value="{$lang_add}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_add_standardtext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ <td height="50">
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit" name="add"
value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_add_standardtext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </xsl:template>
+
+<!-- add / edit -->
+ <xsl:template match="edit">
+ <div align="left">
+
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="value_id != ''">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_id"/>
+ </td>
+ <td>
+ <xsl:value-of
select="value_id"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_name"/>
+ </td>
+ <td>
+ <input type="text" name="values[name]"
value="{value_name}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_name_standardtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_descr_standardtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of
select="value_descr"/>
+ </textarea>
+
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="lang_location_form != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_location_form"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_location_form = 1">
+
<input type="checkbox" name="values[location_form]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_location_form_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[location_form]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_location_form_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="lang_documentation != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_documentation"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_documentation = 1">
+
<input type="checkbox" name="values[documentation]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_documentation_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[documentation]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_documentation_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="value_location_form = 1">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_include_in_location_form"/>
+ </td>
+ <td>
+ <xsl:call-template
name="include_list"/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_include_this_entity"/>
+ </td>
+ <td>
+ <xsl:call-template
name="include_list_2"/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_start_this_entity"/>
+ </td>
+ <td>
+ <xsl:call-template
name="include_list_3"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+
+ <xsl:choose>
+ <xsl:when test="lang_prefix != ''">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_prefix"/>
+ </td>
+ <td>
+ <input type="text"
name="values[prefix]" value="{value_prefix}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_prefix_standardtext"/>
+
<xsl:text>'; return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="lang_lookup_tenant != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_lookup_tenant"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_lookup_tenant = 1">
+
<input type="checkbox" name="values[lookup_tenant]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_lookup_tenant_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[lookup_tenant]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_lookup_tenant_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="lang_tracking != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_tracking"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_tracking = 1">
+
<input type="checkbox" name="values[tracking]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_tracking_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[tracking]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_tracking_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="lang_fileupload != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_fileupload"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_fileupload = 1">
+
<input type="checkbox" name="values[fileupload]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_fileupload_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[fileupload]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_fileupload_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="lang_loc_link != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_loc_link"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_loc_link = 1">
+
<input type="checkbox" name="values[loc_link]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_loc_link_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[loc_link]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_loc_link_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="lang_start_project != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_start_project"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_start_project = 1">
+
<input type="checkbox" name="values[start_project]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_start_project_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[start_project]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_start_project_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="lang_location_level != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_location_level"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_location_level_statustext"><xsl:value-of
select="lang_location_level_statustext"/></xsl:variable>
+ <select
name="values[location_level]" class="forms"
onMouseover="window.status='{$lang_location_level_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <option
value=""><xsl:value-of select="lang_no_location_level"/></option>
+
<xsl:apply-templates select="location_level_list"/>
+ </select>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_save_standardtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_done_standardtext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+<!-- add_status / edit_status -->
+ <xsl:template match="edit_status">
+ <div align="left">
+
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_id"/>
+ </td>
+ <xsl:choose>
+ <xsl:when test="value_id != ''">
+ <td>
+ <xsl:value-of
select="value_id"/>
+ <input type="hidden"
name="values[id]" value="{value_id}"></input>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td>
+ <input type="text"
name="values[id]" value="{value_id}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_id_standardtext"/>
+
<xsl:text>'; return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_descr_standardtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of
select="value_descr"/>
+ </textarea>
+
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_save_standardtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_done_standardtext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+<!-- list attribute -->
+
+ <xsl:template match="list_attribute">
+
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_attrib"/>
+ <xsl:apply-templates select="values_attrib"/>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+ <xsl:template match="table_header_attrib">
+ <xsl:variable name="sort_sorting"><xsl:value-of
select="sort_sorting"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="10%" align="left">
+ <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
+ </td>
+ <td class="th_text" width="20%" align="left">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td class="th_text" width="1%" align="left">
+ <xsl:value-of select="lang_datatype"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <a href="{$sort_sorting}"><xsl:value-of
select="lang_sorting"/></a>
+ </td>
+ <td class="th_text" width="1%" align="center">
+ <xsl:value-of select="lang_search"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_attrib">
+ <xsl:variable name="lang_up_text"><xsl:value-of
select="lang_up_text"/></xsl:variable>
+ <xsl:variable name="lang_down_text"><xsl:value-of
select="lang_down_text"/></xsl:variable>
+ <xsl:variable name="lang_edit_text"><xsl:value-of
select="lang_edit_text"/></xsl:variable>
+ <xsl:variable name="lang_delete_text"><xsl:value-of
select="lang_delete_text"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="column_name"/>
+ </td>
+ <td>
+ <xsl:value-of select="input_text"/>
+ </td>
+ <td>
+ <xsl:value-of select="datatype"/>
+ </td>
+ <td>
+ <table align="left">
+ <tr>
+ <td>
+ <xsl:value-of
select="sorting"/>
+ </td>
+
+ <td align="left">
+ <xsl:variable
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
+ <a
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
+ <xsl:text> |
</xsl:text>
+ <xsl:variable
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
+ <a
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return
true;" onMouseout="window.status='';return true;"><xsl:value-of
select="text_down"/></a>
+ </td>
+
+ </tr>
+ </table>
+ </td>
+ <td align="center">
+ <xsl:value-of select="search"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+<!-- add attribute / edit attribute -->
+
+ <xsl:template match="edit_attrib">
+ <div align="left">
+
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="value_id != ''">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_id"/>
+ </td>
+ <td>
+ <xsl:value-of
select="value_id"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_column_name"/>
+ </td>
+ <td>
+ <input type="text"
name="values[column_name]" value="{value_column_name}" maxlength="20"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_column_name_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_input_text"/>
+ </td>
+ <td>
+ <input type="text"
name="values[input_text]" value="{value_input_text}" maxlength="20"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_input_text_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_statustext"/>
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="values[statustext]" wrap="virtual" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_statustext_attribtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of
select="value_statustext"/>
+ </textarea>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_datatype"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_datatype_statustext"><xsl:value-of
select="lang_datatype_statustext"/></xsl:variable>
+ <select
name="values[column_info][type]" class="forms"
onMouseover="window.status='{$lang_datatype_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_datatype"/></option>
+ <xsl:apply-templates
select="datatype_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_precision"/>
+ </td>
+ <td>
+ <input type="text"
name="values[column_info][precision]" value="{value_precision}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_precision_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_scale"/>
+ </td>
+ <td>
+ <input type="text"
name="values[column_info][scale]" value="{value_scale}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_scale_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_default"/>
+ </td>
+ <td>
+ <input type="text"
name="values[column_info][default]" value="{value_default}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_default_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_nullable"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_nullable_statustext"><xsl:value-of
select="lang_nullable_statustext"/></xsl:variable>
+ <select
name="values[column_info][nullable]" class="forms"
onMouseover="window.status='{$lang_nullable_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_nullable"/></option>
+ <xsl:apply-templates
select="nullable_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of select="lang_list"/>
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when
test="value_list = 1">
+ <input
type="checkbox" name="values[list]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_list_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[list]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_list_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_include_search"/>
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when
test="value_search = 1">
+ <input
type="checkbox" name="values[search]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_include_search_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[search]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_include_search_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="multiple_choice != ''">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_choice"/>
+ </td>
+ <td align="right">
+ <xsl:call-template
name="choice"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_save_attribtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_done_attribtext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+
+
+<!-- list custom_function -->
+
+ <xsl:template match="list_custom_function">
+
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_custom_function"/>
+ <xsl:choose>
+ <xsl:when test="values_custom_function != ''">
+ <xsl:apply-templates
select="values_custom_function"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+ <xsl:template match="table_header_custom_function">
+ <xsl:variable name="sort_sorting"><xsl:value-of
select="sort_sorting"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="10%" align="left">
+ <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
+ </td>
+ <td class="th_text" width="20%" align="left">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_active"/>
+ </td>
+ <td class="th_text" width="10%" align="center">
+ <a href="{$sort_sorting}"><xsl:value-of
select="lang_sorting"/></a>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_custom_function">
+ <xsl:variable name="lang_up_text"><xsl:value-of
select="lang_up_text"/></xsl:variable>
+ <xsl:variable name="lang_down_text"><xsl:value-of
select="lang_down_text"/></xsl:variable>
+ <xsl:variable name="lang_edit_text"><xsl:value-of
select="lang_edit_text"/></xsl:variable>
+ <xsl:variable name="lang_delete_text"><xsl:value-of
select="lang_delete_text"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="file_name"/>
+ </td>
+ <td>
+ <xsl:value-of select="descr"/>
+ </td>
+ <td align = 'center'>
+ <xsl:value-of select="active"/>
+ </td>
+ <td>
+ <table align="left">
+ <tr>
+ <td>
+ <xsl:value-of
select="sorting"/>
+ </td>
+
+ <td align="left">
+ <xsl:variable
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
+ <a
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
+ <xsl:text> |
</xsl:text>
+ <xsl:variable
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
+ <a
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return
true;" onMouseout="window.status='';return true;"><xsl:value-of
select="text_down"/></a>
+ </td>
+
+ </tr>
+ </table>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+<!-- add custom_function / edit custom_function -->
+
+ <xsl:template match="edit_custom_function">
+ <div align="left">
+
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="value_id != ''">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_id"/>
+ </td>
+ <td>
+ <xsl:value-of
select="value_id"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_descr_custom_functiontext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of
select="value_descr"/>
+ </textarea>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_custom_function"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_custom_function_statustext"><xsl:value-of
select="lang_custom_function_statustext"/></xsl:variable>
+ <select
name="values[custom_function_file]" class="forms"
onMouseover="window.status='{$lang_custom_function_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_custom_function"/></option>
+ <xsl:apply-templates
select="custom_function_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of select="lang_active"/>
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when
test="value_active = 1">
+ <input
type="checkbox" name="values[active]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_active_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[active]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_active_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_save_custom_functiontext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_done_custom_functiontext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+
+
+<!-- location_level_list -->
+
+ <xsl:template match="location_level_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- datatype_list -->
+
+ <xsl:template match="datatype_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- custom_function_list -->
+
+ <xsl:template match="custom_function_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected='selected'">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- nullable_list -->
+
+ <xsl:template match="nullable_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="choice">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="left">
+ <xsl:choose>
+ <xsl:when test="value_choice!=''">
+ <tr class="th">
+ <td class="th_text" width="85%"
align="left">
+ <xsl:value-of
select="lang_value"/>
+ </td>
+ <td class="th_text" width="15%"
align="center">
+ <xsl:value-of
select="lang_delete_value"/>
+ </td>
+ </tr>
+ <xsl:for-each select="value_choice" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when
test="@class">
+
<xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when
test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="value"/>
+ <xsl:text> </xsl:text>
+ </td>
+ <td align="center">
+ <input type="checkbox"
name="values[delete_choice][]" value="{id}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_delete_choice_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_new_value"/>
+ </td>
+ <td>
+ <input type="text"
name="values[new_choice]" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_new_value_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template name="include_list">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="left">
+ <tr class="th">
+ <td class="th_text" width="85%"
align="left">
+ <xsl:value-of
select="lang_name"/>
+ </td>
+ <td class="th_text" width="15%"
align="center">
+ <xsl:value-of
select="lang_select"/>
+ </td>
+ </tr>
+ <xsl:for-each select="include_list" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when
test="@class">
+
<xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when
test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="center">
+ <xsl:choose>
+ <xsl:when
test="selected='selected'">
+ <input
type="checkbox" name="values[lookup_entity][]" value="{id}" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_include_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[lookup_entity][]" value="{id}"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_include_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:template>
+
+ <xsl:template name="include_list_2">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="left">
+ <tr class="th">
+ <td class="th_text" width="85%"
align="left">
+ <xsl:value-of
select="lang_name"/>
+ </td>
+ <td class="th_text" width="15%"
align="center">
+ <xsl:value-of
select="lang_select"/>
+ </td>
+ </tr>
+ <xsl:for-each select="include_list_2" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when
test="@class">
+
<xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when
test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="center">
+ <xsl:choose>
+ <xsl:when
test="selected='selected'">
+ <input
type="checkbox" name="values[include_entity_for][]" value="{id}"
checked="checked" onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_include_2_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[include_entity_for][]" value="{id}"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_include_2_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:template>
+ <xsl:template name="include_list_3">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="left">
+ <tr class="th">
+ <td class="th_text" width="85%"
align="left">
+ <xsl:value-of
select="lang_name"/>
+ </td>
+ <td class="th_text" width="15%"
align="center">
+ <xsl:value-of
select="lang_select"/>
+ </td>
+ </tr>
+ <xsl:for-each select="include_list_3" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when
test="@class">
+
<xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when
test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="center">
+ <xsl:choose>
+ <xsl:when
test="selected='selected'">
+ <input
type="checkbox" name="values[start_entity_from][]" value="{id}"
checked="checked" onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[start_entity_from][]" value="{id}"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_include_3_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:template>
+
Index: property/templates/base/invoice.xsl
diff -u property/templates/base/invoice.xsl:1.6
property/templates/base/invoice.xsl:1.7
--- property/templates/base/invoice.xsl:1.6 Fri Jan 27 14:05:59 2006
+++ property/templates/base/invoice.xsl Fri Feb 3 12:05:49 2006
@@ -1,2542 +1,2542 @@
-<!-- $Id: invoice.xsl,v 1.6 2006/01/27 14:05:59 sigurdne Exp $ -->
-
- <xsl:template name="app_data">
- <xsl:choose>
- <xsl:when test="add">
- <xsl:apply-templates select="add"/>
- </xsl:when>
- <xsl:when test="edit">
- <xsl:apply-templates select="edit"/>
- </xsl:when>
- <xsl:when test="import">
- <xsl:apply-templates select="import"/>
- </xsl:when>
- <xsl:when test="export">
- <xsl:apply-templates select="export"/>
- </xsl:when>
- <xsl:when test="rollback">
- <xsl:apply-templates select="rollback"/>
- </xsl:when>
- <xsl:when test="debug">
- <xsl:apply-templates select="debug"/>
- </xsl:when>
- <xsl:when test="edit_period">
- <xsl:apply-templates select="edit_period"/>
- </xsl:when>
- <xsl:when test="list_voucher">
- <xsl:apply-templates select="list_voucher"/>
- </xsl:when>
- <xsl:when test="list_voucher_paid">
- <xsl:apply-templates
select="list_voucher_paid"/>
- </xsl:when>
- <xsl:when test="consume">
- <xsl:apply-templates select="consume"/>
- </xsl:when>
- <xsl:when test="remark">
- <xsl:apply-templates select="remark"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="list_invoice_sub"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="edit_period">
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" action="{$form_action}">
- <div align="center">
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td>
- <xsl:variable name="select_name"><xsl:value-of
select="select_name"/></xsl:variable>
- <select name="{$select_name}" class="forms" >
- <xsl:apply-templates
select="period_list"/>
- </select>
- </td>
- </tr>
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit" name="submit"
value="{$lang_save}" >
- </input>
- </td>
- </tr>
- </table>
- </div>
- </form>
- </xsl:template>
-
- <xsl:template match="period_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <xsl:template match="remark">
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td colspan="2" align="center">
- <xsl:value-of select="message"/>
- </td>
- </tr>
- <tr>
- <td align="center">
- <textarea cols="60" rows="15"
name="remark" readonly="readonly" wrap="virtual"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_content_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of select="remark"/>
- </textarea>
- </td>
- </tr>
-
- </table>
- </xsl:template>
-
- <xsl:template name="excel">
- <xsl:variable name="link_excel"><xsl:value-of
select="link_excel"/></xsl:variable>
- <xsl:variable name="lang_excel_help"><xsl:value-of
select="lang_excel_help"/></xsl:variable>
- <xsl:variable name="lang_excel"><xsl:value-of
select="lang_excel"/></xsl:variable>
- <a href="javascript:var
w=window.open('{$link_excel}','','')"
- onMouseOver="overlib('{$lang_excel_help}',
CAPTION, '{$lang_excel}')"
- onMouseOut="nd()">
- <xsl:value-of select="lang_excel"/></a>
- </xsl:template>
-
-
-<!-- list_voucher -->
-
- <xsl:template match="list_voucher">
- <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
- <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
- <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
- <xsl:variable name="check_source"><xsl:value-of
select="check_source"/></xsl:variable>
- <SCRIPT LANGUAGE="JavaScript" SRC="{$check_source}"></SCRIPT>
- <xsl:call-template name="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <tr>
- <td>
- <xsl:call-template name="cat_filter"/>
- </td>
- <td align="center">
- <xsl:call-template
name="user_lid_filter"/>
- </td>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- <td colspan="3" width="100%" class="small_text"
valign="top" align="left">
- <xsl:call-template name="excel"/>
- </td>
- </tr>
- </table>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" name="form" action="{$form_action}">
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_list_voucher"/>
-
- <xsl:choose>
- <xsl:when
test="values_list_voucher[voucher_id]">
- <xsl:apply-templates
select="values_list_voucher"/>
-
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="img_check"><xsl:value-of
select="img_check"/></xsl:variable>
- <tr>
- <td></td>
- <td></td>
- <td></td>
- <td class="small_text" align="right">
- <xsl:value-of select="sum"/>
- </td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td align="center">
- <a
href="javascript:check_all_radio('sign_none')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
- </td>
- <td align="center">
- <a
href="javascript:check_all_radio('sign_janitor')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
- </td>
- <td align="center">
- <a
href="javascript:check_all_radio('sign_supervisor')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
- </td>
- <td align="center">
- <a
href="javascript:check_all_radio('sign_budget_responsible')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
- </td>
- <td align="right">
- <a
href="javascript:check_all_checkbox('values[transfer]')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
- </td>
- </tr>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-
- </table>
- </form>
- <xsl:choose>
- <xsl:when test="table_add_invoice !=''">
- <xsl:apply-templates
select="table_add_invoice"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="table_add_invoice">
- <table align = "left">
- <tr>
- <td height="50" align="left" valign="top">
- <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
- <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
- <form method="post"
action="{$add_action}">
- <input type="submit" name=""
value="{$lang_add}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </xsl:template>
-
-
- <xsl:template match="table_header_list_voucher">
- <xsl:variable name="sort_voucher"><xsl:value-of
select="sort_voucher"/></xsl:variable>
- <xsl:variable name="sort_voucher_date"><xsl:value-of
select="sort_voucher_date"/></xsl:variable>
- <xsl:variable name="sort_vendor_id"><xsl:value-of
select="sort_vendor_id"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="5%" align="right">
- <a href="{$sort_voucher}"><xsl:value-of
select="lang_voucher"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <a
href="{$sort_voucher_date}"><xsl:value-of select="lang_voucher_date"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_days"/>
- </td>
- <td class="th_text" width="8%" align="right">
- <xsl:value-of select="lang_sum"/>
- </td>
- <td class="th_text" width="4%" align="right">
- <a
href="{$sort_vendor_id}"><xsl:value-of select="lang_vendor_id"/></a>
- </td>
- <td class="th_text" width="3%" align="right">
- <xsl:value-of
select="lang_num_sub_invoice"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_type"/>
- </td>
- <td class="th_text" width="3%" align="right">
- <xsl:value-of select="lang_period"/>
- </td>
- <td class="th_text" width="3%" align="right">
- <xsl:value-of select="lang_kredit"/>
- </td>
- <td class="th_text" width="3%" align="right">
- <xsl:value-of select="lang_none"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_janitor"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_supervisor"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of
select="lang_budget_responsible"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_transfer"/>
- </td>
- <xsl:choose>
- <xsl:when test="//acl_delete!=''">
- <td class="th_text" width="5%"
align="center">
- <xsl:value-of
select="lang_delete"/>
- </td>
- </xsl:when>
- </xsl:choose>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_list_voucher">
-
- <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
- <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td class="small_text" align="right">
- <input type="hidden"
name="values[counter][{$counter}]" value="{counter}">
- </input>
- <input type="hidden"
name="values[voucher_id][{$counter}]" value="{voucher_id}">
- </input>
- <xsl:variable
name="link_sub"><xsl:value-of select="link_sub"/>&voucher_id=<xsl:value-of
select="voucher_id"/></xsl:variable>
- <xsl:variable
name="lang_sub_help"><xsl:value-of select="lang_sub_help"/></xsl:variable>
- <xsl:variable
name="lang_sub"><xsl:value-of select="lang_sub"/></xsl:variable>
- <a href="{$link_sub}"
-
onMouseOver="overlib('{$lang_sub_help}', CAPTION, '{$lang_sub}')"
- onMouseOut="nd()">
- <xsl:value-of select="voucher_id"/></a>
- </td>
- <td class="small_text" align="right">
- <xsl:variable
name="lang_payment_date"><xsl:value-of
select="lang_payment_date"/></xsl:variable>
- <xsl:variable
name="payment_date"><xsl:value-of select="payment_date"/></xsl:variable>
- <a href="javascript:void()"
- onMouseOver="overlib('{$payment_date}',
CAPTION, '{$lang_payment_date}')"
- onMouseOut="nd()">
- <xsl:value-of
select="voucher_date"/></a>
- </td>
- <td class="small_text" align="right">
- <input type="hidden"
name="values[sign_orig][{$counter}]" value="{sign_orig}">
- </input>
- <input type="hidden"
name="values[num_days_orig][{$counter}]" value="{num_days}">
- </input>
- <input type="hidden"
name="values[timestamp_voucher_date][{$counter}]"
value="{timestamp_voucher_date}">
- </input>
- <input type="text" size="2"
name="values[num_days][{$counter}]" value="{num_days}">
- </input>
- </td>
- <td class="small_text" align="right">
- <xsl:value-of select="amount"/>
- </td>
- <td class="small_text" align="right">
- <xsl:variable
name="vendor"><xsl:value-of select="vendor"/></xsl:variable>
- <xsl:variable
name="vendor_id"><xsl:value-of select="vendor_id"/></xsl:variable>
- <a href="javascript:void()"
- onMouseOver="overlib('{$vendor}',
CAPTION, '{$vendor_id}')"
- onMouseOut="nd()">
- <xsl:value-of select="vendor_id"/></a>
-
- </td>
- <td class="small_text" align="right">
- <input type="hidden"
name="values[invoice_count][{$counter}]" value="{invoice_count}">
- </input>
- <xsl:value-of select="invoice_count"/>
- </td>
- <td class="small_text" align="center">
- <xsl:value-of select="type"/>
- </td>
- <td class="small_text" align="right">
- <xsl:variable
name="link_period"><xsl:value-of
select="link_period"/>&voucher_id=<xsl:value-of
select="voucher_id"/>&period=<xsl:value-of select="period"/></xsl:variable>
- <xsl:variable
name="lang_period_help"><xsl:value-of select="lang_period_help"/></xsl:variable>
- <xsl:variable
name="lang_period"><xsl:value-of select="lang_period"/></xsl:variable>
- <a href="javascript:var
w=window.open('{$link_period}','','width=150,height=150')"
-
onMouseOver="overlib('{$lang_period_help}', CAPTION, '{$lang_period}')"
- onMouseOut="nd()">
- <xsl:value-of select="period"/></a>
- </td>
- <td align="center">
- <xsl:choose>
- <xsl:when test="kreditnota='1'">
- <input type="checkbox"
name="values[kreditnota][{$counter}]" value="true" checked="checked"
onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input type="checkbox"
name="values[kreditnota][{$counter}]" value="true"
onMouseout="window.status='';return true;">
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when test="is_janitor">
- <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:when test="is_supervisor">
- <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:when
test="is_budget_responsible">
- <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:otherwise>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="right">
-
- <xsl:choose>
- <xsl:when
test="is_janitor='32'">
- <xsl:choose>
- <xsl:when
test="jan_date=''">
- <input
type="radio" name="values[sign][{$counter}]" value="sign_janitor"
onMouseout="window.status='';return true;">
-
</input>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:choose>
-
<xsl:when test="janitor = $current_user">
-
<input type="radio" name="values[sign][{$counter}]"
value="sign_janitor" checked="checked" onMouseout="window.status='';return
true;">
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
-
</xsl:otherwise>
-
</xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when
test="jan_date=''">
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:value-of select="janitor"/>
- </td>
- <td class="small_text" align="right">
-
- <xsl:choose>
- <xsl:when
test="is_supervisor='64'"><xsl:value-of select="super_date"/>
- <xsl:choose>
- <xsl:when
test="super_date=''">
- <input
type="radio" name="values[sign][{$counter}]" value="sign_supervisor"
onMouseout="window.status='';return true;">
-
</input>
- </xsl:when>
- <xsl:when
test="super_date!=''">
-
<xsl:choose>
-
<xsl:when test="supervisor = $current_user">
-
<input type="radio" name="values[sign][{$counter}]"
value="sign_supervisor" checked="checked" onMouseout="window.status='';return
true;">
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
-
</xsl:otherwise>
-
</xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when
test="super_date=''">
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:value-of select="supervisor"/>
- </td>
- <td class="small_text" align="right">
- <xsl:choose>
- <xsl:when
test="is_budget_responsible='128'">
- <xsl:choose>
- <xsl:when
test="budget_date=''">
- <input
type="radio" name="values[sign][{$counter}]" value="sign_budget_responsible"
onMouseout="window.status='';return true;">
-
</input>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:choose>
-
<xsl:when test="budget_responsible = $current_user">
-
<input type="radio" name="values[sign][{$counter}]"
value="sign_budget_responsible" checked="checked"
onMouseout="window.status='';return true;">
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
-
</xsl:otherwise>
-
</xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when
test="budget_date=''">
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of
select="budget_responsible"/>
- </td>
- <td class="small_text" align="right">
- <xsl:choose>
- <xsl:when
test="is_transfer='16'">
- <xsl:choose>
- <xsl:when
test="transfer_date=''">
- <input
type="checkbox" name="values[transfer][{$counter}]" value="true"
onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[transfer][{$counter}]" value="true"
checked="checked" onMouseout="window.status='';return true;">
-
</input>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when
test="transfer_id!=''">
- <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
- </xsl:when>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="transfer_id"/>
- </td>
- <xsl:choose>
- <xsl:when test="//acl_delete!=''">
- <xsl:variable
name="lang_delete_statustext"><xsl:value-of
select="lang_delete_statustext"/></xsl:variable>
- <td class="small_text"
align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_statustext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </xsl:when>
- </xsl:choose>
- </tr>
- </xsl:template>
-
-
-
-<!-- list_voucher_paid -->
-
- <xsl:template match="list_voucher_paid">
- <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
- <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
- <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
-
- <script language="JavaScript">
- self.name="first_Window";
- function abook()
- {
- Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- function property_lookup()
- {
- Window1=window.open('<xsl:value-of
select="property_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- </script>
-
- <xsl:call-template name="menu"/>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <div align="left">
- <form method="post" name="form" action="{$form_action}">
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <tr>
- <td>
- <input type="text" id="start_date"
name="start_date" size="10" value="{start_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_start_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_start"/>
- </script>
- </td>
- <td>
- <input type="text" id="end_date"
name="end_date" size="10" value="{end_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_end_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_end"/>
- </script>
- </td>
- <td>
- <input type="text" size="8"
name="workorder_id" value="{workorder_id}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_workorder_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:void()"
-
onMouseOver="overlib('{lang_workorder_statustext}', CAPTION,
'{lang_workorder}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_workorder"/></a>
- </td>
-
- <td align="left">
- <input type="text" name="vendor_id"
value="{vendor_id}" size="4" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:abook()"
-
onMouseOver="overlib('{lang_select_vendor_statustext}', CAPTION,
'{lang_vendor}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_vendor"/></a>
-
- <input type="hidden"
name="vendor_name"></input>
- </td>
- </tr>
-
- <tr>
- <td>
- <xsl:call-template name="cat_select"/>
- </td>
- <td align="left">
- <xsl:call-template
name="user_lid_select"/>
- </td>
- <td align="left">
- <input type="text" name="loc1"
value="{loc1}" size="4" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_property_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:property_lookup()"
-
onMouseOver="overlib('{lang_select_property_statustext}', CAPTION,
'{lang_property}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_property"/></a>
-
- <input type="hidden"
name="loc1_name"></input>
- </td>
-
- <td align="left">
- <input type="text" name="voucher_id"
value="{voucher_id}" size="8" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_voucher_id_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <xsl:text> </xsl:text>
- <xsl:value-of select="lang_voucher_id"/>
- </td>
-
- <td align="left">
- <xsl:variable
name="lang_search"><xsl:value-of select="lang_search"/></xsl:variable>
- <input type="submit"
name="submit_search" value="{$lang_search}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_search_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td colspan="11" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_list_voucher_paid"/>
-
- <xsl:choose>
- <xsl:when
test="values_list_voucher_paid[voucher_id]">
- <xsl:apply-templates
select="values_list_voucher_paid"/>
- <tr>
- <td></td>
- <td></td>
- <td></td>
- <td class="th_text"
align="right">
- <xsl:value-of
select="sum"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="img_check"><xsl:value-of
select="img_check"/></xsl:variable>
- </table>
- </xsl:template>
-
-
- <xsl:template match="table_header_list_voucher_paid">
- <xsl:variable name="sort_voucher"><xsl:value-of
select="sort_voucher"/></xsl:variable>
- <xsl:variable name="sort_voucher_date"><xsl:value-of
select="sort_voucher_date"/></xsl:variable>
- <xsl:variable name="sort_vendor_id"><xsl:value-of
select="sort_vendor_id"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="5%" align="right">
- <a href="{$sort_voucher}"><xsl:value-of
select="lang_voucher"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <a
href="{$sort_voucher_date}"><xsl:value-of select="lang_voucher_date"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_days"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_sum"/>
- </td>
- <td class="th_text" width="4%" align="right">
- <a
href="{$sort_vendor_id}"><xsl:value-of select="lang_vendor_id"/></a>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of
select="lang_num_sub_invoice"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_type"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_janitor"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_supervisor"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of
select="lang_budget_responsible"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_transfer"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_list_voucher_paid">
-
- <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
- <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <xsl:variable
name="link_sub"><xsl:value-of select="link_sub"/>&voucher_id=<xsl:value-of
select="voucher_id"/>&paid=true</xsl:variable>
- <xsl:variable
name="lang_sub_help"><xsl:value-of select="lang_sub_help"/></xsl:variable>
- <xsl:variable
name="lang_sub"><xsl:value-of select="lang_sub"/></xsl:variable>
- <a href="{$link_sub}"
-
onMouseOver="overlib('{$lang_sub_help}', CAPTION, '{$lang_sub}')"
- onMouseOut="nd()">
- <xsl:value-of select="voucher_id"/></a>
- </td>
- <td align="right">
- <xsl:variable
name="lang_payment_date"><xsl:value-of
select="lang_payment_date"/></xsl:variable>
- <xsl:variable
name="payment_date"><xsl:value-of select="payment_date"/></xsl:variable>
- <a href="javascript:void()"
- onMouseOver="overlib('{$payment_date}',
CAPTION, '{$lang_payment_date}')"
- onMouseOut="nd()">
- <xsl:value-of
select="voucher_date"/></a>
- </td>
- <td align="right">
- <xsl:value-of select="num_days"/>
- </td>
- <td align="right">
- <xsl:value-of select="amount"/>
- </td>
- <td align="right">
- <xsl:variable
name="vendor"><xsl:value-of select="vendor"/></xsl:variable>
- <xsl:variable
name="vendor_id"><xsl:value-of select="vendor_id"/></xsl:variable>
- <a href="javascript:void()"
- onMouseOver="overlib('{$vendor}',
CAPTION, '{$vendor_id}')"
- onMouseOut="nd()">
- <xsl:value-of select="vendor_id"/></a>
-
- </td>
- <td align="right">
- <xsl:value-of select="invoice_count"/>
- </td>
- <td align="center">
- <xsl:value-of select="type"/>
- </td>
- <td align="center">
- <xsl:value-of select="jan_date"/> -
<xsl:value-of select="janitor"/>
- </td>
- <td align="center">
- <xsl:value-of select="super_date"/> -
<xsl:value-of select="supervisor"/>
- </td>
- <td align="center">
- <xsl:value-of select="budget_date"/> -
<xsl:value-of select="budget_responsible"/>
- </td>
- <td align="center">
- <xsl:value-of select="transfer_date"/>
- <xsl:value-of select="transfer_id"/>
- </td>
- </tr>
- </xsl:template>
-
-
-<!-- consume -->
-
- <xsl:template match="consume">
- <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
- <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
- <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
-
- <script language="JavaScript">
- self.name="first_Window";
- function abook()
- {
- Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- function property_lookup()
- {
- Window1=window.open('<xsl:value-of
select="property_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- </script>
-
- <xsl:call-template name="menu"/>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <div align="left">
- <form method="post" name="form" action="{$form_action}">
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td>
- <input type="text" id="start_date"
name="start_date" size="10" value="{start_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_start_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_start"/>
- </script>
- </td>
- <td>
- <input type="text" id="end_date"
name="end_date" size="10" value="{end_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_end_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_end"/>
- </script>
- </td>
- <td>
- <input type="text" size="8"
name="workorder_id" value="{workorder_id}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_workorder_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:void()"
-
onMouseOver="overlib('{lang_workorder_statustext}', CAPTION,
'{lang_workorder}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_workorder"/></a>
- </td>
-
- <td align="left">
- <input type="text" name="vendor_id"
onClick="abook()" value="{vendor_id}" size="4"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:abook()"
-
onMouseOver="overlib('{lang_select_vendor_statustext}', CAPTION,
'{lang_vendor}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_vendor"/></a>
-
- <input type="hidden" name="vendor_name"
value="{vendor_name}"></input>
- </td>
- </tr>
-
- <tr>
- <td>
- <xsl:call-template name="cat_select"/>
- </td>
- <td align="left">
- <xsl:call-template
name="select_district"/>
- </td>
- <td align="left">
- <xsl:variable
name="lang_account_class_statustext"><xsl:value-of
select="lang_account_class_statustext"/></xsl:variable>
- <xsl:variable
name="select_account_class_name"><xsl:value-of
select="select_account_class_name"/></xsl:variable>
- <select
name="{$select_account_class_name}" class="forms"
onMouseover="window.status='{$lang_account_class_statustext}'; return true;"
onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_account_class_"/></option>
- <xsl:apply-templates
select="account_class_list"/>
- </select>
-
- </td>
-
- <td align="left">
- <input type="text" name="loc1"
onClick="property_lookup()" value="{loc1}" size="4"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_property_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:property_lookup()"
-
onMouseOver="overlib('{lang_select_property_statustext}', CAPTION,
'{lang_property}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_property"/></a>
-
- <input type="hidden"
name="loc1_name"></input>
- </td>
- <td align="left">
- <xsl:variable
name="lang_search"><xsl:value-of select="lang_search"/></xsl:variable>
- <input type="submit"
name="submit_search" value="{$lang_search}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_search_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </table>
- </form>
- </div>
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="vendor_name!=''">
- <tr>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="lang_vendor"/>
- </td>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="vendor_name"/>
- </td>
- <td width="50%">
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="loc1!=''">
- <tr>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="lang_property"/>
- </td>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="loc1"/>
- </td>
- <td width="50%">
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="workorder_id!=''">
- <tr>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="lang_workorder"/>
- </td>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="workorder_id"/>
- </td>
- <td width="50%">
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- </table>
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates select="table_header_consume"/>
-
- <xsl:choose>
- <xsl:when test="values_consume[consume]">
- <xsl:apply-templates
select="values_consume"/>
-
- </xsl:when>
- </xsl:choose>
- <tr>
- <td>
- </td>
- <td>
- </td>
- <td class="th_text" align="right">
- <xsl:value-of select="lang_sum"/>
- </td>
- <td class="th_text" align="right">
- <xsl:value-of select="sum"/>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <xsl:template match="account_class_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="table_header_consume">
- <tr class="th">
- <td class="th_text" width="10%" align="right">
- <xsl:value-of select="lang_district"/>
- </td>
- <td class="th_text" width="10%" align="right">
- <xsl:value-of select="lang_period"/>
- </td>
- <td class="th_text" width="25%" align="right">
- <xsl:value-of
select="lang_budget_account"/>
- </td>
- <td class="th_text" width="55%" align="right">
- <xsl:value-of select="lang_consume"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_consume">
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <xsl:value-of select="district_id"/>
- </td>
- <td align="center">
- <xsl:value-of select="period"/>
- </td>
- <td align="center">
- <xsl:value-of select="account_class"/>
- </td>
- <td align="right">
- <xsl:value-of select="consume"/>
- </td>
- </tr>
- </xsl:template>
-
-<!-- debug-->
-
- <xsl:template match="debug">
- <div align="left">
- <table width="50%" cellpadding="2" cellspacing="2"
align="center">
-
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_bilagsnr"/>
- </td>
- <td>
- <xsl:value-of select="bilagsnr"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_type"/>
- </td>
- <td>
- <xsl:value-of select="artid"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_vendor"/>
- </td>
- <td>
- <xsl:value-of select="spvend_code"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="vendor_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of
select="lang_fakturadato"/>
- </td>
- <td>
- <xsl:value-of select="fakturadato"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of
select="lang_forfallsdato"/>
- </td>
- <td>
- <xsl:value-of select="forfallsdato"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_janitor"/>
- </td>
- <td>
- <xsl:value-of select="oppsynsmannid"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_supervisor"/>
- </td>
- <td>
- <xsl:value-of select="saksbehandlerid"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of
select="lang_budget_responsible"/>
- </td>
- <td>
- <xsl:value-of
select="budsjettansvarligid"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_project_id"/>
- </td>
- <td>
- <xsl:value-of select="project_id"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_sum"/>
- </td>
- <td>
- <xsl:value-of select="sum"/>
- </td>
- </tr>
- </table>
- </div>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr class="th">
- <xsl:call-template name="table_header"/>
- </tr>
- <xsl:call-template name="values_debug"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
-
- <xsl:template name="values_debug">
- <xsl:for-each select="values" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod 2 = 0">
- <xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:for-each select="row" >
- <td align="{align}">
- <xsl:value-of select="value"/>
- </td>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="table_add">
- <tr>
- <td height="50">
- <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
- <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
- <form method="post"
action="{$add_action}">
- <input type="submit" name="add"
value="{$lang_add}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- <td height="50">
- <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <form method="post"
action="{$cancel_action}">
- <input type="submit"
name="cancel" value="{$lang_cancel}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_cancel_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </xsl:template>
-
-<!-- add / edit -->
- <xsl:template match="add">
-
- <script language="JavaScript">
- self.name="first_Window";
- function abook()
- {
- Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- </script>
-
- <xsl:call-template name="menu"/>
- <div align="left">
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <tr>
- <td colspan="2" align="center">
- <xsl:value-of select="message"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" name="form" action="{$form_action}">
-
- <tr>
- <td>
- <xsl:value-of select="lang_auto_tax"/>
- </td>
- <td>
- <input type="checkbox" name="auto_tax"
value="True" checked="checked" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_auto_tax_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <xsl:call-template name="location_form"/>
- <xsl:call-template name="b_account_form"/>
- <tr>
- <td valign="top">
- <xsl:variable
name="lang_vendor"><xsl:value-of select="lang_vendor"/></xsl:variable>
- <input type="button" name="convert"
value="{$lang_vendor}" onClick="abook();" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_select_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- <td>
- <input type="text" name="vendor_id"
value="{value_vendor_id}" size="4" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <input type="text" name="vendor_name"
value="{value_vendor_name}" size="20" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_name_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_janitor"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_janitor_statustext"><xsl:value-of
select="lang_janitor_statustext"/></xsl:variable>
- <xsl:variable
name="select_janitor"><xsl:value-of select="select_janitor"/></xsl:variable>
- <select name="{$select_janitor}"
class="forms" onMouseover="window.status='{$lang_janitor_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_janitor"/></option>
- <xsl:apply-templates
select="janitor_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_supervisor"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_supervisor_statustext"><xsl:value-of
select="lang_supervisor_statustext"/></xsl:variable>
- <xsl:variable
name="select_supervisor"><xsl:value-of
select="select_supervisor"/></xsl:variable>
- <select name="{$select_supervisor}"
class="forms" onMouseover="window.status='{$lang_supervisor_statustext}';
return true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_supervisor"/></option>
- <xsl:apply-templates
select="supervisor_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_budget_responsible"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_budget_responsible_statustext"><xsl:value-of
select="lang_budget_responsible_statustext"/></xsl:variable>
- <xsl:variable
name="select_budget_responsible"><xsl:value-of
select="select_budget_responsible"/></xsl:variable>
- <select
name="{$select_budget_responsible}" class="forms"
onMouseover="window.status='{$lang_budget_responsible_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_budget_responsible"/></option>
- <xsl:apply-templates
select="budget_responsible_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_order"/>
- </td>
- <td>
- <input type="text" name="order"
value="{value_order}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_order_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_art"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_art_statustext"><xsl:value-of
select="lang_art_statustext"/></xsl:variable>
- <xsl:variable
name="select_art"><xsl:value-of select="select_art"/></xsl:variable>
- <select name="{$select_art}"
class="forms" onMouseover="window.status='{$lang_art_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_art"/></option>
- <xsl:apply-templates
select="art_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_type"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_type_statustext"><xsl:value-of
select="lang_type_statustext"/></xsl:variable>
- <xsl:variable
name="select_type"><xsl:value-of select="select_type"/></xsl:variable>
- <select name="{$select_type}"
class="forms" onMouseover="window.status='{$lang_type_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_type"/></option>
- <xsl:apply-templates
select="type_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_dimb"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_dimb_statustext"><xsl:value-of
select="lang_dimb_statustext"/></xsl:variable>
- <xsl:variable
name="select_dimb"><xsl:value-of select="select_dimb"/></xsl:variable>
- <select name="{$select_dimb}"
class="forms" onMouseover="window.status='{$lang_dimb_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_dimb"/></option>
- <xsl:apply-templates
select="dimb_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_invoice_number"/>
- </td>
- <td>
- <input type="text" name="invoice_num"
value="{value_invoice_num}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_invoice_num_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_kidnr"/>
- </td>
- <td>
- <input type="text" name="kid_nr"
value="{value_kid_nr}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_kid_nr_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_amount"/>
- </td>
- <td>
- <input type="text" name="amount"
value="{value_amount}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_amount_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_invoice_date"/>
- </td>
- <td>
- <input type="text" id="invoice_date"
name="invoice_date" size="10" value="{value_invoice_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_invoice_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="invoice_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_invoice"/>
- </script>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_no_of_days"/>
- </td>
- <td>
- <input type="text" name="num_days"
value="{value_num_days}" size="4" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_num_days_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
-
- <tr>
-
- <td valign="top">
- <xsl:value-of
select="lang_payment_date"/>
- </td>
- <td>
- <input type="text" id="payment_date"
name="payment_date" size="10" value="{value_payment_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_payment_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="payment_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_payment"/>
- </script>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_merknad"/>
- </td>
- <td>
- <textarea cols="60" rows="10"
name="merknad" wrap="virtual" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_merknad_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of
select="value_merknad"/>
- </textarea>
-
- </td>
- </tr>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
- <input type="submit" name="add_invoice"
value="{$lang_add}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_add_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <form method="post"
action="{$cancel_action}">
- <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_cancel_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-<!-- import -->
-
- <xsl:template match="import">
-
- <script language="JavaScript">
- self.name="first_Window";
- function abook()
- {
- Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- </script>
-
- <xsl:call-template name="menu"/>
- <div align="left">
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <tr>
- <td colspan="2" align="center">
- <xsl:value-of select="message"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form ENCTYPE="multipart/form-data" method="post"
name="form" action="{$form_action}">
-
- <tr>
- <td>
- <xsl:value-of select="lang_auto_tax"/>
- </td>
- <td>
- <input type="checkbox" name="auto_tax"
value="True" checked="checked" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_auto_tax_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_art"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_art_statustext"><xsl:value-of
select="lang_art_statustext"/></xsl:variable>
- <xsl:variable
name="select_art"><xsl:value-of select="select_art"/></xsl:variable>
- <select name="{$select_art}"
class="forms" onMouseover="window.status='{$lang_art_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_art"/></option>
- <xsl:apply-templates
select="art_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_type"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_type_statustext"><xsl:value-of
select="lang_type_statustext"/></xsl:variable>
- <xsl:variable
name="select_type"><xsl:value-of select="select_type"/></xsl:variable>
- <select name="{$select_type}"
class="forms" onMouseover="window.status='{$lang_type_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_type"/></option>
- <xsl:apply-templates
select="type_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_dimb"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_dimb_statustext"><xsl:value-of
select="lang_dimb_statustext"/></xsl:variable>
- <xsl:variable
name="select_dimb"><xsl:value-of select="select_dimb"/></xsl:variable>
- <select name="{$select_dimb}"
class="forms" onMouseover="window.status='{$lang_dimb_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_dimb"/></option>
- <xsl:apply-templates
select="dimb_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_invoice_number"/>
- </td>
- <td>
- <input type="text" name="invoice_num"
value="{value_invoice_num}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_invoice_num_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_kidnr"/>
- </td>
- <td>
- <input type="text" name="kid_nr"
value="{value_kid_nr}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_kid_nr_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:variable
name="lang_vendor"><xsl:value-of select="lang_vendor"/></xsl:variable>
- <input type="button" name="convert"
value="{$lang_vendor}" onClick="abook();" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_select_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- <td>
- <input type="text" name="vendor_id"
value="{value_vendor_id}" size="6" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <input type="text" name="vendor_name"
value="{value_vendor_name}" size="20" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_name_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_janitor"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_janitor_statustext"><xsl:value-of
select="lang_janitor_statustext"/></xsl:variable>
- <xsl:variable
name="select_janitor"><xsl:value-of select="select_janitor"/></xsl:variable>
- <select name="{$select_janitor}"
class="forms" onMouseover="window.status='{$lang_janitor_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_janitor"/></option>
- <xsl:apply-templates
select="janitor_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_supervisor"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_supervisor_statustext"><xsl:value-of
select="lang_supervisor_statustext"/></xsl:variable>
- <xsl:variable
name="select_supervisor"><xsl:value-of
select="select_supervisor"/></xsl:variable>
- <select name="{$select_supervisor}"
class="forms" onMouseover="window.status='{$lang_supervisor_statustext}';
return true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_supervisor"/></option>
- <xsl:apply-templates
select="supervisor_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_budget_responsible"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_budget_responsible_statustext"><xsl:value-of
select="lang_budget_responsible_statustext"/></xsl:variable>
- <xsl:variable
name="select_budget_responsible"><xsl:value-of
select="select_budget_responsible"/></xsl:variable>
- <select
name="{$select_budget_responsible}" class="forms"
onMouseover="window.status='{$lang_budget_responsible_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_budget_responsible"/></option>
- <xsl:apply-templates
select="budget_responsible_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_invoice_date"/>
- </td>
- <td>
- <input type="text" id="invoice_date"
name="invoice_date" size="10" value="{value_invoice_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_invoice_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="invoice_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_invoice"/>
- </script>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_no_of_days"/>
- </td>
- <td>
- <input type="text" name="num_days"
value="{value_num_days}" size="4" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_num_days_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
-
- <tr>
-
- <td valign="top">
- <xsl:value-of
select="lang_payment_date"/>
- </td>
- <td>
- <input type="text" id="payment_date"
name="payment_date" size="10" value="{value_payment_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_payment_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="payment_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_payment"/>
- </script>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_file"/>
- </td>
- <td>
- <input type="file" name="tsvfile"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_file_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_conv"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
- <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
- <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_conversion"/></option>
- <xsl:apply-templates
select="conv_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td>
- <xsl:value-of select="lang_debug"/>
- </td>
- <td>
- <input type="checkbox" name="download"
value="True" checked="checked" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_debug_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr height="50">
- <td>
- <xsl:variable
name="lang_import"><xsl:value-of select="lang_import"/></xsl:variable>
- <input type="submit" name="convert"
value="{$lang_import}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_import_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <form method="post"
action="{$cancel_action}">
- <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_cancel_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-<!-- art_list -->
-
- <xsl:template match="art_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- type_list -->
-
- <xsl:template match="type_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- dimb_list -->
-
- <xsl:template match="dimb_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
-<!-- janitor_list -->
-
- <xsl:template match="janitor_list">
- <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- supervisor_list -->
-
- <xsl:template match="supervisor_list">
- <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- budget_responsible_list -->
-
- <xsl:template match="budget_responsible_list">
- <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
-<!-- conv_list -->
-
- <xsl:template match="conv_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- rollback_file_list -->
-
- <xsl:template match="rollback_file_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- tax_code_list -->
-
- <xsl:template match="tax_code_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- export -->
-
- <xsl:template match="export">
- <xsl:call-template name="menu"/>
- <div align="left">
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" name="form" action="{$form_action}">
-
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_select_conv"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
- <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
- <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_conv"/></option>
- <xsl:apply-templates
select="conv_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_force_period_year"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_force_period_year_statustext"><xsl:value-of
select="lang_force_period_year_statustext"/></xsl:variable>
- <select
name="values[force_period_year]" class="forms"
onMouseover="window.status='{$lang_force_period_year_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_year"/></option>
- <xsl:apply-templates
select="force_period_year"/>
- </select>
- </td>
- </tr>
- <tr>
- <td>
- <xsl:value-of
select="lang_export_to_file"/>
- </td>
- <td>
- <input type="checkbox"
name="values[download]" value="on" checked="checked"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_debug_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-
- <tr>
- <td>
- </td>
- <td>
- <xsl:variable
name="link_rollback_file"><xsl:value-of
select="link_rollback_file"/></xsl:variable>
- <a
href="{$link_rollback_file}"><xsl:value-of select="lang_rollback_file"/></a>
- </td>
- </tr>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_submit"><xsl:value-of select="lang_submit"/></xsl:variable>
- <input type="submit"
name="values[submit]" value="{$lang_submit}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_import_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <form method="post"
action="{$cancel_action}">
- <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_cancel_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-
-<!-- rollback -->
-
- <xsl:template match="rollback">
- <xsl:call-template name="menu"/>
- <div align="left">
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" name="form" action="{$form_action}">
-
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_select_conv"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
- <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
- <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_conv"/></option>
- <xsl:apply-templates
select="conv_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_select_file"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_file_statustext"><xsl:value-of
select="lang_file_statustext"/></xsl:variable>
- <xsl:variable
name="select_file"><xsl:value-of select="select_file"/></xsl:variable>
- <select name="{$select_file}"
class="forms" onMouseover="window.status='{$lang_file_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_file"/></option>
- <xsl:apply-templates
select="rollback_file_list"/>
- </select>
- </td>
- </tr>
-
-
- <tr>
-
- <td valign="top">
- <xsl:value-of select="lang_date"/>
- </td>
- <td>
- <input type="text" id="date"
name="date" size="10" value="{value_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of select="calendar_setup"/>
- </script>
- </td>
- </tr>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_submit"><xsl:value-of select="lang_submit"/></xsl:variable>
- <input type="submit"
name="values[submit]" value="{$lang_submit}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_import_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <form method="post"
action="{$cancel_action}">
- <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_cancel_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-
-<!--list_invoice_sub-->
-
- <xsl:template match="list_invoice_sub">
- <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
- <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
- <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
- <SCRIPT LANGUAGE="JavaScript" SRC="{check_source}"></SCRIPT>
-
- <xsl:call-template name="menu"/>
- <table width="80%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="vendor!=''">
- <tr>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="lang_vendor"/>
- </td>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="vendor"/>
- </td>
- <td width="50%">
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="voucher_id!=''">
- <tr>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="lang_voucher_id"/>
- </td>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="voucher_id"/>
- </td>
- <td width="50%">
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" name="form" action="{$form_action}">
- <xsl:apply-templates
select="table_header_list_invoice_sub"/>
-
- <xsl:choose>
- <xsl:when test="values_list_invoice_sub[id]">
- <xsl:apply-templates
select="values_list_invoice_sub"/>
- <xsl:variable
name="img_check"><xsl:value-of select="img_check"/></xsl:variable>
- <tr>
- <td></td>
- <td align="center">
- <a
href="javascript:check_all_checkbox('values[close_order]')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
- </td>
- <td></td>
- <td></td>
- <td></td>
- <td class="small_text"
align="right">
- <xsl:value-of
select="sum"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr height="50">
- <td>
- <xsl:choose>
- <xsl:when test="paid=''">
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_save_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
- </xsl:attribute>
- </input>
- </xsl:when>
- </xsl:choose>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_done_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
-
- </table>
- </xsl:template>
-
- <xsl:template match="table_header_list_invoice_sub">
- <xsl:variable name="sort_workorder"><xsl:value-of
select="sort_workorder"/></xsl:variable>
- <xsl:variable name="sort_budget_account"><xsl:value-of
select="sort_budget_account"/></xsl:variable>
- <xsl:variable name="sort_sum"><xsl:value-of
select="sort_sum"/></xsl:variable>
- <xsl:variable name="sort_dima"><xsl:value-of
select="sort_dima"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="5%" align="right">
- <a
href="{$sort_workorder}"><xsl:value-of select="lang_workorder"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of
select="lang_close_order"/>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of
select="lang_charge_tenant"/>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_invoice_id"/>
- </td>
- <td class="th_text" width="2%" align="right">
- <a
href="{$sort_budget_account}"><xsl:value-of select="lang_budget_account"/></a>
- </td>
- <td class="th_text" width="5%" align="right">
- <a href="{$sort_sum}"><xsl:value-of
select="lang_sum"/></a>
- </td>
- <td class="th_text" width="5%" align="right">
- <a href="{$sort_dima}"><xsl:value-of
select="lang_dima"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_dimb"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_dimd"/>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_tax_code"/>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_remark"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_list_invoice_sub">
-
- <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
- <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <input type="hidden"
name="values[counter][{$counter}]" value="{counter}">
- </input>
- <input type="hidden"
name="values[id][{$counter}]" value="{id}">
- </input>
- <input type="hidden"
name="values[workorder_id][{$counter}]" value="{workorder_id}">
- </input>
- <xsl:variable
name="link_order"><xsl:value-of
select="link_order"/>&order_id=<xsl:value-of
select="workorder_id"/></xsl:variable>
- <a href="{$link_order}"
target="_blank"><xsl:value-of select="workorder_id"/></a>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when
test="workorder_id=''">
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when
test="paid=''">
- <input
type="hidden" name="values[close_order_orig][{$counter}]" value="{closed}">
- </input>
-
<xsl:choose>
-
<xsl:when test="closed='1'">
-
<input type="checkbox" name="values[close_order][{$counter}]"
value="true" checked="checked" onMouseout="window.status='';return true;">
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[close_order][{$counter}]"
value="true" onMouseout="window.status='';return true;">
-
</input>
-
</xsl:otherwise>
-
</xsl:choose>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:choose>
-
<xsl:when test="closed='1'">
-
<b>x</b>
-
</xsl:when>
-
</xsl:choose>
-
</xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when
test="charge_tenant='1'">
- <xsl:choose>
- <xsl:when
test="claim_issued=''">
-
<xsl:variable name="link_claim"><xsl:value-of
select="link_claim"/>&project_id=<xsl:value-of
select="project_id"/></xsl:variable>
- <a
href="{$link_claim}" target="_blank"><xsl:value-of select="//lang_claim"/></a>
- </xsl:when>
- </xsl:choose>
- <b>x</b>
- </xsl:when>
- </xsl:choose>
- </td>
- <td class="small_text" align="right">
- <xsl:value-of select="invoice_id"/>
- </td>
- <td class="small_text" align="right">
- <xsl:choose>
- <xsl:when test="paid='true'">
- <xsl:value-of
select="budget_account"/>
- </xsl:when>
- <xsl:otherwise>
- <input type="text"
size="7" name="values[budget_account][{$counter}]" value="{budget_account}">
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="right">
- <xsl:value-of select="amount"/>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when test="paid='true'">
- <xsl:value-of
select="dima"/>
- </xsl:when>
- <xsl:otherwise>
- <input type="text"
size="7" name="values[dima][{$counter}]" value="{dima}">
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="right">
- <xsl:value-of select="dimb"/>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when test="paid='true'">
- <xsl:value-of
select="dimd"/>
- </xsl:when>
- <xsl:otherwise>
- <input type="text"
size="4" name="values[dimd][{$counter}]" value="{dimd}">
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when test="paid='true'">
- <xsl:value-of
select="tax_code"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable
name="lang_tax_code_statustext"><xsl:value-of
select="lang_tax_code_statustext"/></xsl:variable>
- <select
name="values[tax_code][{$counter}]" class="forms"
onMouseover="window.status='{$lang_tax_code_statustext}'; return true;"
onMouseout="window.status='';return true;">
-
<xsl:apply-templates select="tax_code_list"/>
- </select>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="right">
- <xsl:choose>
- <xsl:when test="remark='1'">
- <xsl:variable
name="link_remark"><xsl:value-of select="link_remark"/>&id=<xsl:value-of
select="id"/>&paid=<xsl:value-of select="paid"/></xsl:variable>
- <xsl:variable
name="lang_remark_help"><xsl:value-of select="lang_remark_help"/></xsl:variable>
- <xsl:variable
name="lang_remark"><xsl:value-of select="lang_remark"/></xsl:variable>
- <a href="javascript:var
w=window.open('{$link_remark}','','width=550,height=400,scrollbars')"
-
onMouseOver="overlib('{$lang_remark_help}', CAPTION, '{$lang_remark}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_remark"/></a>
- </xsl:when>
- </xsl:choose>
- </td>
-
- </tr>
- </xsl:template>
-
- <xsl:template match="force_period_year">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected='selected'">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+<!-- $Id: invoice.xsl,v 1.7 2006/02/03 12:05:49 sigurdne Exp $ -->
+
+ <xsl:template name="app_data">
+ <xsl:choose>
+ <xsl:when test="add">
+ <xsl:apply-templates select="add"/>
+ </xsl:when>
+ <xsl:when test="edit">
+ <xsl:apply-templates select="edit"/>
+ </xsl:when>
+ <xsl:when test="import">
+ <xsl:apply-templates select="import"/>
+ </xsl:when>
+ <xsl:when test="export">
+ <xsl:apply-templates select="export"/>
+ </xsl:when>
+ <xsl:when test="rollback">
+ <xsl:apply-templates select="rollback"/>
+ </xsl:when>
+ <xsl:when test="debug">
+ <xsl:apply-templates select="debug"/>
+ </xsl:when>
+ <xsl:when test="edit_period">
+ <xsl:apply-templates select="edit_period"/>
+ </xsl:when>
+ <xsl:when test="list_voucher">
+ <xsl:apply-templates select="list_voucher"/>
+ </xsl:when>
+ <xsl:when test="list_voucher_paid">
+ <xsl:apply-templates
select="list_voucher_paid"/>
+ </xsl:when>
+ <xsl:when test="consume">
+ <xsl:apply-templates select="consume"/>
+ </xsl:when>
+ <xsl:when test="remark">
+ <xsl:apply-templates select="remark"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="list_invoice_sub"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="edit_period">
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+ <div align="center">
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td>
+ <xsl:variable name="select_name"><xsl:value-of
select="select_name"/></xsl:variable>
+ <select name="{$select_name}" class="forms" >
+ <xsl:apply-templates
select="period_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit" name="submit"
value="{$lang_save}" >
+ </input>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </form>
+ </xsl:template>
+
+ <xsl:template match="period_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template match="remark">
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td colspan="2" align="center">
+ <xsl:value-of select="message"/>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">
+ <textarea cols="60" rows="15"
name="remark" readonly="readonly" wrap="virtual"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_content_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="remark"/>
+ </textarea>
+ </td>
+ </tr>
+
+ </table>
+ </xsl:template>
+
+ <xsl:template name="excel">
+ <xsl:variable name="link_excel"><xsl:value-of
select="link_excel"/></xsl:variable>
+ <xsl:variable name="lang_excel_help"><xsl:value-of
select="lang_excel_help"/></xsl:variable>
+ <xsl:variable name="lang_excel"><xsl:value-of
select="lang_excel"/></xsl:variable>
+ <a href="javascript:var
w=window.open('{$link_excel}','','')"
+ onMouseOver="overlib('{$lang_excel_help}',
CAPTION, '{$lang_excel}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="lang_excel"/></a>
+ </xsl:template>
+
+
+<!-- list_voucher -->
+
+ <xsl:template match="list_voucher">
+ <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
+ <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
+ <xsl:variable name="check_source"><xsl:value-of
select="check_source"/></xsl:variable>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{$check_source}"></SCRIPT>
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <tr>
+ <td>
+ <xsl:call-template name="cat_filter"/>
+ </td>
+ <td align="center">
+ <xsl:call-template
name="user_lid_filter"/>
+ </td>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ <td colspan="3" width="100%" class="small_text"
valign="top" align="left">
+ <xsl:call-template name="excel"/>
+ </td>
+ </tr>
+ </table>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" name="form" action="{$form_action}">
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_list_voucher"/>
+
+ <xsl:choose>
+ <xsl:when
test="values_list_voucher[voucher_id]">
+ <xsl:apply-templates
select="values_list_voucher"/>
+
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="img_check"><xsl:value-of
select="img_check"/></xsl:variable>
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td class="small_text" align="right">
+ <xsl:value-of select="sum"/>
+ </td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td align="center">
+ <a
href="javascript:check_all_radio('sign_none')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
+ </td>
+ <td align="center">
+ <a
href="javascript:check_all_radio('sign_janitor')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
+ </td>
+ <td align="center">
+ <a
href="javascript:check_all_radio('sign_supervisor')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
+ </td>
+ <td align="center">
+ <a
href="javascript:check_all_radio('sign_budget_responsible')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
+ </td>
+ <td align="right">
+ <a
href="javascript:check_all_checkbox('values[transfer]')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_save_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ </table>
+ </form>
+ <xsl:choose>
+ <xsl:when test="table_add_invoice !=''">
+ <xsl:apply-templates
select="table_add_invoice"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="table_add_invoice">
+ <table align = "left">
+ <tr>
+ <td height="50" align="left" valign="top">
+ <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
+ <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
+ <form method="post"
action="{$add_action}">
+ <input type="submit" name=""
value="{$lang_add}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_add_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+
+ <xsl:template match="table_header_list_voucher">
+ <xsl:variable name="sort_voucher"><xsl:value-of
select="sort_voucher"/></xsl:variable>
+ <xsl:variable name="sort_voucher_date"><xsl:value-of
select="sort_voucher_date"/></xsl:variable>
+ <xsl:variable name="sort_vendor_id"><xsl:value-of
select="sort_vendor_id"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="5%" align="right">
+ <a href="{$sort_voucher}"><xsl:value-of
select="lang_voucher"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <a
href="{$sort_voucher_date}"><xsl:value-of select="lang_voucher_date"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_days"/>
+ </td>
+ <td class="th_text" width="8%" align="right">
+ <xsl:value-of select="lang_sum"/>
+ </td>
+ <td class="th_text" width="4%" align="right">
+ <a
href="{$sort_vendor_id}"><xsl:value-of select="lang_vendor_id"/></a>
+ </td>
+ <td class="th_text" width="3%" align="right">
+ <xsl:value-of
select="lang_num_sub_invoice"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_type"/>
+ </td>
+ <td class="th_text" width="3%" align="right">
+ <xsl:value-of select="lang_period"/>
+ </td>
+ <td class="th_text" width="3%" align="right">
+ <xsl:value-of select="lang_kredit"/>
+ </td>
+ <td class="th_text" width="3%" align="right">
+ <xsl:value-of select="lang_none"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_janitor"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_supervisor"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of
select="lang_budget_responsible"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_transfer"/>
+ </td>
+ <xsl:choose>
+ <xsl:when test="//acl_delete!=''">
+ <td class="th_text" width="5%"
align="center">
+ <xsl:value-of
select="lang_delete"/>
+ </td>
+ </xsl:when>
+ </xsl:choose>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_list_voucher">
+
+ <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
+ <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td class="small_text" align="right">
+ <input type="hidden"
name="values[counter][{$counter}]" value="{counter}">
+ </input>
+ <input type="hidden"
name="values[voucher_id][{$counter}]" value="{voucher_id}">
+ </input>
+ <xsl:variable
name="link_sub"><xsl:value-of select="link_sub"/>&voucher_id=<xsl:value-of
select="voucher_id"/></xsl:variable>
+ <xsl:variable
name="lang_sub_help"><xsl:value-of select="lang_sub_help"/></xsl:variable>
+ <xsl:variable
name="lang_sub"><xsl:value-of select="lang_sub"/></xsl:variable>
+ <a href="{$link_sub}"
+
onMouseOver="overlib('{$lang_sub_help}', CAPTION, '{$lang_sub}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="voucher_id"/></a>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:variable
name="lang_payment_date"><xsl:value-of
select="lang_payment_date"/></xsl:variable>
+ <xsl:variable
name="payment_date"><xsl:value-of select="payment_date"/></xsl:variable>
+ <a href="javascript:void()"
+ onMouseOver="overlib('{$payment_date}',
CAPTION, '{$lang_payment_date}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="voucher_date"/></a>
+ </td>
+ <td class="small_text" align="right">
+ <input type="hidden"
name="values[sign_orig][{$counter}]" value="{sign_orig}">
+ </input>
+ <input type="hidden"
name="values[num_days_orig][{$counter}]" value="{num_days}">
+ </input>
+ <input type="hidden"
name="values[timestamp_voucher_date][{$counter}]"
value="{timestamp_voucher_date}">
+ </input>
+ <input type="text" size="2"
name="values[num_days][{$counter}]" value="{num_days}">
+ </input>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:value-of select="amount"/>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:variable
name="vendor"><xsl:value-of select="vendor"/></xsl:variable>
+ <xsl:variable
name="vendor_id"><xsl:value-of select="vendor_id"/></xsl:variable>
+ <a href="javascript:void()"
+ onMouseOver="overlib('{$vendor}',
CAPTION, '{$vendor_id}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="vendor_id"/></a>
+
+ </td>
+ <td class="small_text" align="right">
+ <input type="hidden"
name="values[invoice_count][{$counter}]" value="{invoice_count}">
+ </input>
+ <xsl:value-of select="invoice_count"/>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:value-of select="type"/>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:variable
name="link_period"><xsl:value-of
select="link_period"/>&voucher_id=<xsl:value-of
select="voucher_id"/>&period=<xsl:value-of select="period"/></xsl:variable>
+ <xsl:variable
name="lang_period_help"><xsl:value-of select="lang_period_help"/></xsl:variable>
+ <xsl:variable
name="lang_period"><xsl:value-of select="lang_period"/></xsl:variable>
+ <a href="javascript:var
w=window.open('{$link_period}','','width=150,height=150')"
+
onMouseOver="overlib('{$lang_period_help}', CAPTION, '{$lang_period}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="period"/></a>
+ </td>
+ <td align="center">
+ <xsl:choose>
+ <xsl:when test="kreditnota='1'">
+ <input type="checkbox"
name="values[kreditnota][{$counter}]" value="true" checked="checked"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="checkbox"
name="values[kreditnota][{$counter}]" value="true"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when test="is_janitor">
+ <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:when test="is_supervisor">
+ <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:when
test="is_budget_responsible">
+ <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="right">
+
+ <xsl:choose>
+ <xsl:when
test="is_janitor='32'">
+ <xsl:choose>
+ <xsl:when
test="jan_date=''">
+ <input
type="radio" name="values[sign][{$counter}]" value="sign_janitor"
onMouseout="window.status='';return true;">
+
</input>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:choose>
+
<xsl:when test="janitor = $current_user">
+
<input type="radio" name="values[sign][{$counter}]"
value="sign_janitor" checked="checked" onMouseout="window.status='';return
true;">
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
+
</xsl:otherwise>
+
</xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="jan_date=''">
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:value-of select="janitor"/>
+ </td>
+ <td class="small_text" align="right">
+
+ <xsl:choose>
+ <xsl:when
test="is_supervisor='64'"><xsl:value-of select="super_date"/>
+ <xsl:choose>
+ <xsl:when
test="super_date=''">
+ <input
type="radio" name="values[sign][{$counter}]" value="sign_supervisor"
onMouseout="window.status='';return true;">
+
</input>
+ </xsl:when>
+ <xsl:when
test="super_date!=''">
+
<xsl:choose>
+
<xsl:when test="supervisor = $current_user">
+
<input type="radio" name="values[sign][{$counter}]"
value="sign_supervisor" checked="checked" onMouseout="window.status='';return
true;">
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
+
</xsl:otherwise>
+
</xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="super_date=''">
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:value-of select="supervisor"/>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:choose>
+ <xsl:when
test="is_budget_responsible='128'">
+ <xsl:choose>
+ <xsl:when
test="budget_date=''">
+ <input
type="radio" name="values[sign][{$counter}]" value="sign_budget_responsible"
onMouseout="window.status='';return true;">
+
</input>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:choose>
+
<xsl:when test="budget_responsible = $current_user">
+
<input type="radio" name="values[sign][{$counter}]"
value="sign_budget_responsible" checked="checked"
onMouseout="window.status='';return true;">
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
+
</xsl:otherwise>
+
</xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="budget_date=''">
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of
select="budget_responsible"/>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:choose>
+ <xsl:when
test="is_transfer='16'">
+ <xsl:choose>
+ <xsl:when
test="transfer_date=''">
+ <input
type="checkbox" name="values[transfer][{$counter}]" value="true"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[transfer][{$counter}]" value="true"
checked="checked" onMouseout="window.status='';return true;">
+
</input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="transfer_id!=''">
+ <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="transfer_id"/>
+ </td>
+ <xsl:choose>
+ <xsl:when test="//acl_delete!=''">
+ <xsl:variable
name="lang_delete_statustext"><xsl:value-of
select="lang_delete_statustext"/></xsl:variable>
+ <td class="small_text"
align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_statustext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </xsl:when>
+ </xsl:choose>
+ </tr>
+ </xsl:template>
+
+
+
+<!-- list_voucher_paid -->
+
+ <xsl:template match="list_voucher_paid">
+ <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
+ <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
+
+ <script language="JavaScript">
+ self.name="first_Window";
+ function abook()
+ {
+ Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ function property_lookup()
+ {
+ Window1=window.open('<xsl:value-of
select="property_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ </script>
+
+ <xsl:call-template name="menu"/>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <div align="left">
+ <form method="post" name="form" action="{$form_action}">
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <tr>
+ <td>
+ <input type="text" id="start_date"
name="start_date" size="10" value="{start_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_start_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_start"/>
+ </script>
+ </td>
+ <td>
+ <input type="text" id="end_date"
name="end_date" size="10" value="{end_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_end_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_end"/>
+ </script>
+ </td>
+ <td>
+ <input type="text" size="8"
name="workorder_id" value="{workorder_id}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_workorder_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:void()"
+
onMouseOver="overlib('{lang_workorder_statustext}', CAPTION,
'{lang_workorder}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_workorder"/></a>
+ </td>
+
+ <td align="left">
+ <input type="text" name="vendor_id"
value="{vendor_id}" size="4" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:abook()"
+
onMouseOver="overlib('{lang_select_vendor_statustext}', CAPTION,
'{lang_vendor}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_vendor"/></a>
+
+ <input type="hidden"
name="vendor_name"></input>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <xsl:call-template name="cat_select"/>
+ </td>
+ <td align="left">
+ <xsl:call-template
name="user_lid_select"/>
+ </td>
+ <td align="left">
+ <input type="text" name="loc1"
value="{loc1}" size="4" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_property_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:property_lookup()"
+
onMouseOver="overlib('{lang_select_property_statustext}', CAPTION,
'{lang_property}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_property"/></a>
+
+ <input type="hidden"
name="loc1_name"></input>
+ </td>
+
+ <td align="left">
+ <input type="text" name="voucher_id"
value="{voucher_id}" size="8" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_voucher_id_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="lang_voucher_id"/>
+ </td>
+
+ <td align="left">
+ <xsl:variable
name="lang_search"><xsl:value-of select="lang_search"/></xsl:variable>
+ <input type="submit"
name="submit_search" value="{$lang_search}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_search_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="11" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_list_voucher_paid"/>
+
+ <xsl:choose>
+ <xsl:when
test="values_list_voucher_paid[voucher_id]">
+ <xsl:apply-templates
select="values_list_voucher_paid"/>
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td class="th_text"
align="right">
+ <xsl:value-of
select="sum"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="img_check"><xsl:value-of
select="img_check"/></xsl:variable>
+ </table>
+ </xsl:template>
+
+
+ <xsl:template match="table_header_list_voucher_paid">
+ <xsl:variable name="sort_voucher"><xsl:value-of
select="sort_voucher"/></xsl:variable>
+ <xsl:variable name="sort_voucher_date"><xsl:value-of
select="sort_voucher_date"/></xsl:variable>
+ <xsl:variable name="sort_vendor_id"><xsl:value-of
select="sort_vendor_id"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="5%" align="right">
+ <a href="{$sort_voucher}"><xsl:value-of
select="lang_voucher"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <a
href="{$sort_voucher_date}"><xsl:value-of select="lang_voucher_date"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_days"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_sum"/>
+ </td>
+ <td class="th_text" width="4%" align="right">
+ <a
href="{$sort_vendor_id}"><xsl:value-of select="lang_vendor_id"/></a>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of
select="lang_num_sub_invoice"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_type"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_janitor"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_supervisor"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of
select="lang_budget_responsible"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_transfer"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_list_voucher_paid">
+
+ <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
+ <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <xsl:variable
name="link_sub"><xsl:value-of select="link_sub"/>&voucher_id=<xsl:value-of
select="voucher_id"/>&paid=true</xsl:variable>
+ <xsl:variable
name="lang_sub_help"><xsl:value-of select="lang_sub_help"/></xsl:variable>
+ <xsl:variable
name="lang_sub"><xsl:value-of select="lang_sub"/></xsl:variable>
+ <a href="{$link_sub}"
+
onMouseOver="overlib('{$lang_sub_help}', CAPTION, '{$lang_sub}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="voucher_id"/></a>
+ </td>
+ <td align="right">
+ <xsl:variable
name="lang_payment_date"><xsl:value-of
select="lang_payment_date"/></xsl:variable>
+ <xsl:variable
name="payment_date"><xsl:value-of select="payment_date"/></xsl:variable>
+ <a href="javascript:void()"
+ onMouseOver="overlib('{$payment_date}',
CAPTION, '{$lang_payment_date}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="voucher_date"/></a>
+ </td>
+ <td align="right">
+ <xsl:value-of select="num_days"/>
+ </td>
+ <td align="right">
+ <xsl:value-of select="amount"/>
+ </td>
+ <td align="right">
+ <xsl:variable
name="vendor"><xsl:value-of select="vendor"/></xsl:variable>
+ <xsl:variable
name="vendor_id"><xsl:value-of select="vendor_id"/></xsl:variable>
+ <a href="javascript:void()"
+ onMouseOver="overlib('{$vendor}',
CAPTION, '{$vendor_id}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="vendor_id"/></a>
+
+ </td>
+ <td align="right">
+ <xsl:value-of select="invoice_count"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="type"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="jan_date"/> -
<xsl:value-of select="janitor"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="super_date"/> -
<xsl:value-of select="supervisor"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="budget_date"/> -
<xsl:value-of select="budget_responsible"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="transfer_date"/>
- <xsl:value-of select="transfer_id"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+<!-- consume -->
+
+ <xsl:template match="consume">
+ <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
+ <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
+
+ <script language="JavaScript">
+ self.name="first_Window";
+ function abook()
+ {
+ Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ function property_lookup()
+ {
+ Window1=window.open('<xsl:value-of
select="property_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ </script>
+
+ <xsl:call-template name="menu"/>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <div align="left">
+ <form method="post" name="form" action="{$form_action}">
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td>
+ <input type="text" id="start_date"
name="start_date" size="10" value="{start_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_start_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_start"/>
+ </script>
+ </td>
+ <td>
+ <input type="text" id="end_date"
name="end_date" size="10" value="{end_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_end_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_end"/>
+ </script>
+ </td>
+ <td>
+ <input type="text" size="8"
name="workorder_id" value="{workorder_id}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_workorder_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:void()"
+
onMouseOver="overlib('{lang_workorder_statustext}', CAPTION,
'{lang_workorder}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_workorder"/></a>
+ </td>
+
+ <td align="left">
+ <input type="text" name="vendor_id"
onClick="abook()" value="{vendor_id}" size="4"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:abook()"
+
onMouseOver="overlib('{lang_select_vendor_statustext}', CAPTION,
'{lang_vendor}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_vendor"/></a>
+
+ <input type="hidden" name="vendor_name"
value="{vendor_name}"></input>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <xsl:call-template name="cat_select"/>
+ </td>
+ <td align="left">
+ <xsl:call-template
name="select_district"/>
+ </td>
+ <td align="left">
+ <xsl:variable
name="lang_account_class_statustext"><xsl:value-of
select="lang_account_class_statustext"/></xsl:variable>
+ <xsl:variable
name="select_account_class_name"><xsl:value-of
select="select_account_class_name"/></xsl:variable>
+ <select
name="{$select_account_class_name}" class="forms"
onMouseover="window.status='{$lang_account_class_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_account_class_"/></option>
+ <xsl:apply-templates
select="account_class_list"/>
+ </select>
+
+ </td>
+
+ <td align="left">
+ <input type="text" name="loc1"
onClick="property_lookup()" value="{loc1}" size="4"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_property_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:property_lookup()"
+
onMouseOver="overlib('{lang_select_property_statustext}', CAPTION,
'{lang_property}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_property"/></a>
+
+ <input type="hidden"
name="loc1_name"></input>
+ </td>
+ <td align="left">
+ <xsl:variable
name="lang_search"><xsl:value-of select="lang_search"/></xsl:variable>
+ <input type="submit"
name="submit_search" value="{$lang_search}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_search_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="vendor_name!=''">
+ <tr>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="lang_vendor"/>
+ </td>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="vendor_name"/>
+ </td>
+ <td width="50%">
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="loc1!=''">
+ <tr>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="lang_property"/>
+ </td>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="loc1"/>
+ </td>
+ <td width="50%">
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="workorder_id!=''">
+ <tr>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="lang_workorder"/>
+ </td>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="workorder_id"/>
+ </td>
+ <td width="50%">
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ </table>
+
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates select="table_header_consume"/>
+
+ <xsl:choose>
+ <xsl:when test="values_consume[consume]">
+ <xsl:apply-templates
select="values_consume"/>
+
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td>
+ </td>
+ <td>
+ </td>
+ <td class="th_text" align="right">
+ <xsl:value-of select="lang_sum"/>
+ </td>
+ <td class="th_text" align="right">
+ <xsl:value-of select="sum"/>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="account_class_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="table_header_consume">
+ <tr class="th">
+ <td class="th_text" width="10%" align="right">
+ <xsl:value-of select="lang_district"/>
+ </td>
+ <td class="th_text" width="10%" align="right">
+ <xsl:value-of select="lang_period"/>
+ </td>
+ <td class="th_text" width="25%" align="right">
+ <xsl:value-of
select="lang_budget_account"/>
+ </td>
+ <td class="th_text" width="55%" align="right">
+ <xsl:value-of select="lang_consume"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_consume">
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <xsl:value-of select="district_id"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="period"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="account_class"/>
+ </td>
+ <td align="right">
+ <xsl:value-of select="consume"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+<!-- debug-->
+
+ <xsl:template match="debug">
+ <div align="left">
+ <table width="50%" cellpadding="2" cellspacing="2"
align="center">
+
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_bilagsnr"/>
+ </td>
+ <td>
+ <xsl:value-of select="bilagsnr"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_type"/>
+ </td>
+ <td>
+ <xsl:value-of select="artid"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_vendor"/>
+ </td>
+ <td>
+ <xsl:value-of select="spvend_code"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="vendor_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of
select="lang_fakturadato"/>
+ </td>
+ <td>
+ <xsl:value-of select="fakturadato"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of
select="lang_forfallsdato"/>
+ </td>
+ <td>
+ <xsl:value-of select="forfallsdato"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_janitor"/>
+ </td>
+ <td>
+ <xsl:value-of select="oppsynsmannid"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_supervisor"/>
+ </td>
+ <td>
+ <xsl:value-of select="saksbehandlerid"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of
select="lang_budget_responsible"/>
+ </td>
+ <td>
+ <xsl:value-of
select="budsjettansvarligid"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_project_id"/>
+ </td>
+ <td>
+ <xsl:value-of select="project_id"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_sum"/>
+ </td>
+ <td>
+ <xsl:value-of select="sum"/>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr class="th">
+ <xsl:call-template name="table_header"/>
+ </tr>
+ <xsl:call-template name="values_debug"/>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template name="values_debug">
+ <xsl:for-each select="values" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod 2 = 0">
+ <xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:for-each select="row" >
+ <td align="{align}">
+ <xsl:value-of select="value"/>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template match="table_add">
+ <tr>
+ <td height="50">
+ <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
+ <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
+ <form method="post"
action="{$add_action}">
+ <input type="submit" name="add"
value="{$lang_add}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_add_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ <td height="50">
+ <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+ <form method="post"
action="{$cancel_action}">
+ <input type="submit"
name="cancel" value="{$lang_cancel}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_cancel_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </xsl:template>
+
+<!-- add / edit -->
+ <xsl:template match="add">
+
+ <script language="JavaScript">
+ self.name="first_Window";
+ function abook()
+ {
+ Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ </script>
+
+ <xsl:call-template name="menu"/>
+ <div align="left">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <tr>
+ <td colspan="2" align="center">
+ <xsl:value-of select="message"/>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" name="form" action="{$form_action}">
+
+ <tr>
+ <td>
+ <xsl:value-of select="lang_auto_tax"/>
+ </td>
+ <td>
+ <input type="checkbox" name="auto_tax"
value="True" checked="checked" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_auto_tax_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <xsl:call-template name="location_form"/>
+ <xsl:call-template name="b_account_form"/>
+ <tr>
+ <td valign="top">
+ <xsl:variable
name="lang_vendor"><xsl:value-of select="lang_vendor"/></xsl:variable>
+ <input type="button" name="convert"
value="{$lang_vendor}" onClick="abook();" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_select_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ <td>
+ <input type="text" name="vendor_id"
value="{value_vendor_id}" size="4" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <input type="text" name="vendor_name"
value="{value_vendor_name}" size="20" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_name_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_janitor"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_janitor_statustext"><xsl:value-of
select="lang_janitor_statustext"/></xsl:variable>
+ <xsl:variable
name="select_janitor"><xsl:value-of select="select_janitor"/></xsl:variable>
+ <select name="{$select_janitor}"
class="forms" onMouseover="window.status='{$lang_janitor_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_janitor"/></option>
+ <xsl:apply-templates
select="janitor_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_supervisor"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_supervisor_statustext"><xsl:value-of
select="lang_supervisor_statustext"/></xsl:variable>
+ <xsl:variable
name="select_supervisor"><xsl:value-of
select="select_supervisor"/></xsl:variable>
+ <select name="{$select_supervisor}"
class="forms" onMouseover="window.status='{$lang_supervisor_statustext}';
return true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_supervisor"/></option>
+ <xsl:apply-templates
select="supervisor_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_budget_responsible"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_budget_responsible_statustext"><xsl:value-of
select="lang_budget_responsible_statustext"/></xsl:variable>
+ <xsl:variable
name="select_budget_responsible"><xsl:value-of
select="select_budget_responsible"/></xsl:variable>
+ <select
name="{$select_budget_responsible}" class="forms"
onMouseover="window.status='{$lang_budget_responsible_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_budget_responsible"/></option>
+ <xsl:apply-templates
select="budget_responsible_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_order"/>
+ </td>
+ <td>
+ <input type="text" name="order"
value="{value_order}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_order_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_art"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_art_statustext"><xsl:value-of
select="lang_art_statustext"/></xsl:variable>
+ <xsl:variable
name="select_art"><xsl:value-of select="select_art"/></xsl:variable>
+ <select name="{$select_art}"
class="forms" onMouseover="window.status='{$lang_art_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_art"/></option>
+ <xsl:apply-templates
select="art_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_type"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_type_statustext"><xsl:value-of
select="lang_type_statustext"/></xsl:variable>
+ <xsl:variable
name="select_type"><xsl:value-of select="select_type"/></xsl:variable>
+ <select name="{$select_type}"
class="forms" onMouseover="window.status='{$lang_type_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_type"/></option>
+ <xsl:apply-templates
select="type_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_dimb"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_dimb_statustext"><xsl:value-of
select="lang_dimb_statustext"/></xsl:variable>
+ <xsl:variable
name="select_dimb"><xsl:value-of select="select_dimb"/></xsl:variable>
+ <select name="{$select_dimb}"
class="forms" onMouseover="window.status='{$lang_dimb_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_dimb"/></option>
+ <xsl:apply-templates
select="dimb_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_invoice_number"/>
+ </td>
+ <td>
+ <input type="text" name="invoice_num"
value="{value_invoice_num}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_invoice_num_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_kidnr"/>
+ </td>
+ <td>
+ <input type="text" name="kid_nr"
value="{value_kid_nr}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_kid_nr_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_amount"/>
+ </td>
+ <td>
+ <input type="text" name="amount"
value="{value_amount}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_amount_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_invoice_date"/>
+ </td>
+ <td>
+ <input type="text" id="invoice_date"
name="invoice_date" size="10" value="{value_invoice_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_invoice_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="invoice_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_invoice"/>
+ </script>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_no_of_days"/>
+ </td>
+ <td>
+ <input type="text" name="num_days"
value="{value_num_days}" size="4" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_num_days_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+
+ <tr>
+
+ <td valign="top">
+ <xsl:value-of
select="lang_payment_date"/>
+ </td>
+ <td>
+ <input type="text" id="payment_date"
name="payment_date" size="10" value="{value_payment_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_payment_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="payment_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_payment"/>
+ </script>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_merknad"/>
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="merknad" wrap="virtual" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_merknad_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of
select="value_merknad"/>
+ </textarea>
+
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
+ <input type="submit" name="add_invoice"
value="{$lang_add}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_add_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+ <form method="post"
action="{$cancel_action}">
+ <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_cancel_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+<!-- import -->
+
+ <xsl:template match="import">
+
+ <script language="JavaScript">
+ self.name="first_Window";
+ function abook()
+ {
+ Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ </script>
+
+ <xsl:call-template name="menu"/>
+ <div align="left">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <tr>
+ <td colspan="2" align="center">
+ <xsl:value-of select="message"/>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form ENCTYPE="multipart/form-data" method="post"
name="form" action="{$form_action}">
+
+ <tr>
+ <td>
+ <xsl:value-of select="lang_auto_tax"/>
+ </td>
+ <td>
+ <input type="checkbox" name="auto_tax"
value="True" checked="checked" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_auto_tax_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_art"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_art_statustext"><xsl:value-of
select="lang_art_statustext"/></xsl:variable>
+ <xsl:variable
name="select_art"><xsl:value-of select="select_art"/></xsl:variable>
+ <select name="{$select_art}"
class="forms" onMouseover="window.status='{$lang_art_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_art"/></option>
+ <xsl:apply-templates
select="art_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_type"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_type_statustext"><xsl:value-of
select="lang_type_statustext"/></xsl:variable>
+ <xsl:variable
name="select_type"><xsl:value-of select="select_type"/></xsl:variable>
+ <select name="{$select_type}"
class="forms" onMouseover="window.status='{$lang_type_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_type"/></option>
+ <xsl:apply-templates
select="type_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_dimb"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_dimb_statustext"><xsl:value-of
select="lang_dimb_statustext"/></xsl:variable>
+ <xsl:variable
name="select_dimb"><xsl:value-of select="select_dimb"/></xsl:variable>
+ <select name="{$select_dimb}"
class="forms" onMouseover="window.status='{$lang_dimb_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_dimb"/></option>
+ <xsl:apply-templates
select="dimb_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_invoice_number"/>
+ </td>
+ <td>
+ <input type="text" name="invoice_num"
value="{value_invoice_num}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_invoice_num_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_kidnr"/>
+ </td>
+ <td>
+ <input type="text" name="kid_nr"
value="{value_kid_nr}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_kid_nr_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:variable
name="lang_vendor"><xsl:value-of select="lang_vendor"/></xsl:variable>
+ <input type="button" name="convert"
value="{$lang_vendor}" onClick="abook();" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_select_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ <td>
+ <input type="text" name="vendor_id"
value="{value_vendor_id}" size="6" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <input type="text" name="vendor_name"
value="{value_vendor_name}" size="20" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_name_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_janitor"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_janitor_statustext"><xsl:value-of
select="lang_janitor_statustext"/></xsl:variable>
+ <xsl:variable
name="select_janitor"><xsl:value-of select="select_janitor"/></xsl:variable>
+ <select name="{$select_janitor}"
class="forms" onMouseover="window.status='{$lang_janitor_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_janitor"/></option>
+ <xsl:apply-templates
select="janitor_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_supervisor"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_supervisor_statustext"><xsl:value-of
select="lang_supervisor_statustext"/></xsl:variable>
+ <xsl:variable
name="select_supervisor"><xsl:value-of
select="select_supervisor"/></xsl:variable>
+ <select name="{$select_supervisor}"
class="forms" onMouseover="window.status='{$lang_supervisor_statustext}';
return true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_supervisor"/></option>
+ <xsl:apply-templates
select="supervisor_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_budget_responsible"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_budget_responsible_statustext"><xsl:value-of
select="lang_budget_responsible_statustext"/></xsl:variable>
+ <xsl:variable
name="select_budget_responsible"><xsl:value-of
select="select_budget_responsible"/></xsl:variable>
+ <select
name="{$select_budget_responsible}" class="forms"
onMouseover="window.status='{$lang_budget_responsible_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_budget_responsible"/></option>
+ <xsl:apply-templates
select="budget_responsible_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_invoice_date"/>
+ </td>
+ <td>
+ <input type="text" id="invoice_date"
name="invoice_date" size="10" value="{value_invoice_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_invoice_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="invoice_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_invoice"/>
+ </script>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_no_of_days"/>
+ </td>
+ <td>
+ <input type="text" name="num_days"
value="{value_num_days}" size="4" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_num_days_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+
+ <tr>
+
+ <td valign="top">
+ <xsl:value-of
select="lang_payment_date"/>
+ </td>
+ <td>
+ <input type="text" id="payment_date"
name="payment_date" size="10" value="{value_payment_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_payment_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="payment_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_payment"/>
+ </script>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_file"/>
+ </td>
+ <td>
+ <input type="file" name="tsvfile"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_file_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_conv"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
+ <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
+ <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_conversion"/></option>
+ <xsl:apply-templates
select="conv_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <xsl:value-of select="lang_debug"/>
+ </td>
+ <td>
+ <input type="checkbox" name="download"
value="True" checked="checked" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_debug_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_import"><xsl:value-of select="lang_import"/></xsl:variable>
+ <input type="submit" name="convert"
value="{$lang_import}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_import_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+ <form method="post"
action="{$cancel_action}">
+ <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_cancel_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+<!-- art_list -->
+
+ <xsl:template match="art_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- type_list -->
+
+ <xsl:template match="type_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- dimb_list -->
+
+ <xsl:template match="dimb_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+<!-- janitor_list -->
+
+ <xsl:template match="janitor_list">
+ <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- supervisor_list -->
+
+ <xsl:template match="supervisor_list">
+ <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- budget_responsible_list -->
+
+ <xsl:template match="budget_responsible_list">
+ <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+<!-- conv_list -->
+
+ <xsl:template match="conv_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- rollback_file_list -->
+
+ <xsl:template match="rollback_file_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- tax_code_list -->
+
+ <xsl:template match="tax_code_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- export -->
+
+ <xsl:template match="export">
+ <xsl:call-template name="menu"/>
+ <div align="left">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" name="form" action="{$form_action}">
+
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_select_conv"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
+ <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
+ <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_conv"/></option>
+ <xsl:apply-templates
select="conv_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_force_period_year"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_force_period_year_statustext"><xsl:value-of
select="lang_force_period_year_statustext"/></xsl:variable>
+ <select
name="values[force_period_year]" class="forms"
onMouseover="window.status='{$lang_force_period_year_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_year"/></option>
+ <xsl:apply-templates
select="force_period_year"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_export_to_file"/>
+ </td>
+ <td>
+ <input type="checkbox"
name="values[download]" value="on" checked="checked"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_debug_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ </td>
+ <td>
+ <xsl:variable
name="link_rollback_file"><xsl:value-of
select="link_rollback_file"/></xsl:variable>
+ <a
href="{$link_rollback_file}"><xsl:value-of select="lang_rollback_file"/></a>
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_submit"><xsl:value-of select="lang_submit"/></xsl:variable>
+ <input type="submit"
name="values[submit]" value="{$lang_submit}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_import_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+ <form method="post"
action="{$cancel_action}">
+ <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_cancel_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+
+<!-- rollback -->
+
+ <xsl:template match="rollback">
+ <xsl:call-template name="menu"/>
+ <div align="left">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" name="form" action="{$form_action}">
+
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_select_conv"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
+ <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
+ <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_conv"/></option>
+ <xsl:apply-templates
select="conv_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_select_file"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_file_statustext"><xsl:value-of
select="lang_file_statustext"/></xsl:variable>
+ <xsl:variable
name="select_file"><xsl:value-of select="select_file"/></xsl:variable>
+ <select name="{$select_file}"
class="forms" onMouseover="window.status='{$lang_file_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_file"/></option>
+ <xsl:apply-templates
select="rollback_file_list"/>
+ </select>
+ </td>
+ </tr>
+
+
+ <tr>
+
+ <td valign="top">
+ <xsl:value-of select="lang_date"/>
+ </td>
+ <td>
+ <input type="text" id="date"
name="date" size="10" value="{value_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of select="calendar_setup"/>
+ </script>
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_submit"><xsl:value-of select="lang_submit"/></xsl:variable>
+ <input type="submit"
name="values[submit]" value="{$lang_submit}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_import_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+ <form method="post"
action="{$cancel_action}">
+ <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_cancel_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+
+<!--list_invoice_sub-->
+
+ <xsl:template match="list_invoice_sub">
+ <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
+ <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{check_source}"></SCRIPT>
+
+ <xsl:call-template name="menu"/>
+ <table width="80%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="vendor!=''">
+ <tr>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="lang_vendor"/>
+ </td>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="vendor"/>
+ </td>
+ <td width="50%">
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="voucher_id!=''">
+ <tr>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="lang_voucher_id"/>
+ </td>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="voucher_id"/>
+ </td>
+ <td width="50%">
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" name="form" action="{$form_action}">
+ <xsl:apply-templates
select="table_header_list_invoice_sub"/>
+
+ <xsl:choose>
+ <xsl:when test="values_list_invoice_sub[id]">
+ <xsl:apply-templates
select="values_list_invoice_sub"/>
+ <xsl:variable
name="img_check"><xsl:value-of select="img_check"/></xsl:variable>
+ <tr>
+ <td></td>
+ <td align="center">
+ <a
href="javascript:check_all_checkbox('values[close_order]')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
+ </td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td class="small_text"
align="right">
+ <xsl:value-of
select="sum"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr height="50">
+ <td>
+ <xsl:choose>
+ <xsl:when test="paid=''">
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_save_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </xsl:when>
+ </xsl:choose>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_done_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+
+ </table>
+ </xsl:template>
+
+ <xsl:template match="table_header_list_invoice_sub">
+ <xsl:variable name="sort_workorder"><xsl:value-of
select="sort_workorder"/></xsl:variable>
+ <xsl:variable name="sort_budget_account"><xsl:value-of
select="sort_budget_account"/></xsl:variable>
+ <xsl:variable name="sort_sum"><xsl:value-of
select="sort_sum"/></xsl:variable>
+ <xsl:variable name="sort_dima"><xsl:value-of
select="sort_dima"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="5%" align="right">
+ <a
href="{$sort_workorder}"><xsl:value-of select="lang_workorder"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of
select="lang_close_order"/>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of
select="lang_charge_tenant"/>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_invoice_id"/>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <a
href="{$sort_budget_account}"><xsl:value-of select="lang_budget_account"/></a>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <a href="{$sort_sum}"><xsl:value-of
select="lang_sum"/></a>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <a href="{$sort_dima}"><xsl:value-of
select="lang_dima"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_dimb"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_dimd"/>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_tax_code"/>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_remark"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_list_invoice_sub">
+
+ <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
+ <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <input type="hidden"
name="values[counter][{$counter}]" value="{counter}">
+ </input>
+ <input type="hidden"
name="values[id][{$counter}]" value="{id}">
+ </input>
+ <input type="hidden"
name="values[workorder_id][{$counter}]" value="{workorder_id}">
+ </input>
+ <xsl:variable
name="link_order"><xsl:value-of
select="link_order"/>&order_id=<xsl:value-of
select="workorder_id"/></xsl:variable>
+ <a href="{$link_order}"
target="_blank"><xsl:value-of select="workorder_id"/></a>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when
test="workorder_id=''">
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="paid=''">
+ <input
type="hidden" name="values[close_order_orig][{$counter}]" value="{closed}">
+ </input>
+
<xsl:choose>
+
<xsl:when test="closed='1'">
+
<input type="checkbox" name="values[close_order][{$counter}]"
value="true" checked="checked" onMouseout="window.status='';return true;">
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[close_order][{$counter}]"
value="true" onMouseout="window.status='';return true;">
+
</input>
+
</xsl:otherwise>
+
</xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:choose>
+
<xsl:when test="closed='1'">
+
<b>x</b>
+
</xsl:when>
+
</xsl:choose>
+
</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when
test="charge_tenant='1'">
+ <xsl:choose>
+ <xsl:when
test="claim_issued=''">
+
<xsl:variable name="link_claim"><xsl:value-of
select="link_claim"/>&project_id=<xsl:value-of
select="project_id"/></xsl:variable>
+ <a
href="{$link_claim}" target="_blank"><xsl:value-of select="//lang_claim"/></a>
+ </xsl:when>
+ </xsl:choose>
+ <b>x</b>
+ </xsl:when>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:value-of select="invoice_id"/>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:choose>
+ <xsl:when test="paid='true'">
+ <xsl:value-of
select="budget_account"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="text"
size="7" name="values[budget_account][{$counter}]" value="{budget_account}">
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:value-of select="amount"/>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when test="paid='true'">
+ <xsl:value-of
select="dima"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="text"
size="7" name="values[dima][{$counter}]" value="{dima}">
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:value-of select="dimb"/>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when test="paid='true'">
+ <xsl:value-of
select="dimd"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="text"
size="4" name="values[dimd][{$counter}]" value="{dimd}">
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when test="paid='true'">
+ <xsl:value-of
select="tax_code"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
name="lang_tax_code_statustext"><xsl:value-of
select="lang_tax_code_statustext"/></xsl:variable>
+ <select
name="values[tax_code][{$counter}]" class="forms"
onMouseover="window.status='{$lang_tax_code_statustext}'; return true;"
onMouseout="window.status='';return true;">
+
<xsl:apply-templates select="tax_code_list"/>
+ </select>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:choose>
+ <xsl:when test="remark='1'">
+ <xsl:variable
name="link_remark"><xsl:value-of select="link_remark"/>&id=<xsl:value-of
select="id"/>&paid=<xsl:value-of select="paid"/></xsl:variable>
+ <xsl:variable
name="lang_remark_help"><xsl:value-of select="lang_remark_help"/></xsl:variable>
+ <xsl:variable
name="lang_remark"><xsl:value-of select="lang_remark"/></xsl:variable>
+ <a href="javascript:var
w=window.open('{$link_remark}','','width=550,height=400,scrollbars')"
+
onMouseOver="overlib('{$lang_remark_help}', CAPTION, '{$lang_remark}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_remark"/></a>
+ </xsl:when>
+ </xsl:choose>
+ </td>
+
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="force_period_year">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected='selected'">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
Index: property/templates/default/admin_entity.xsl
diff -u property/templates/default/admin_entity.xsl:1.5
property/templates/default/admin_entity.xsl:1.6
--- property/templates/default/admin_entity.xsl:1.5 Mon Oct 24 10:45:29 2005
+++ property/templates/default/admin_entity.xsl Fri Feb 3 12:05:49 2006
@@ -1,1835 +1,1835 @@
-<!-- $Id: admin_entity.xsl,v 1.5 2005/10/24 10:45:29 sigurdne Exp $ -->
-
- <xsl:template name="app_data">
- <xsl:choose>
- <xsl:when test="edit">
- <xsl:apply-templates select="edit"/>
- </xsl:when>
- <xsl:when test="edit_status">
- <xsl:apply-templates select="edit_status"/>
- </xsl:when>
- <xsl:when test="list_attribute">
- <xsl:apply-templates select="list_attribute"/>
- </xsl:when>
- <xsl:when test="list_status">
- <xsl:apply-templates select="list_status"/>
- </xsl:when>
- <xsl:when test="edit_attrib">
- <xsl:apply-templates select="edit_attrib"/>
- </xsl:when>
- <xsl:when test="list_config">
- <xsl:apply-templates select="list_config"/>
- </xsl:when>
- <xsl:when test="edit_config">
- <xsl:apply-templates select="edit_config"/>
- </xsl:when>
- <xsl:when test="list_category">
- <xsl:apply-templates select="list_category"/>
- </xsl:when>
- <xsl:when test="list_custom_function">
- <xsl:apply-templates
select="list_custom_function"/>
- </xsl:when>
- <xsl:when test="edit_custom_function">
- <xsl:apply-templates
select="edit_custom_function"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="list"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <xsl:template match="list">
- <xsl:call-template name="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates select="table_header"/>
- <xsl:apply-templates select="values"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
-
- <xsl:template match="table_header">
- <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="10%" align="right">
- <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
- </td>
- <td class="th_text" width="10%" align="center">
- <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
- </td>
- <td class="th_text" width="20%" align="center">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_categories"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_delete"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values">
- <xsl:variable name="lang_attribute_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
- <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
- <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <xsl:value-of select="id"/>
- </td>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="left">
- <xsl:value-of select="descr"/>
- </td>
- <td align="center">
- <xsl:variable
name="link_categories"><xsl:value-of select="link_categories"/></xsl:variable>
- <a href="{$link_categories}"
onMouseover="window.status='{lang_category_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_categories"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="list_status">
- <xsl:call-template name="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_status"/>
- <xsl:apply-templates select="values_status"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
-
- <xsl:template match="table_header_status">
- <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="10%" align="right">
- <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
- </td>
- <td class="th_text" width="20%" align="center">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_delete"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_status">
- <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
- <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <xsl:value-of select="id"/>
- </td>
- <td align="left">
- <xsl:value-of select="descr"/>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="list_category">
- <xsl:call-template name="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_category"/>
- <xsl:apply-templates select="values_category"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
-
- <xsl:template match="table_header_category">
- <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="5%" align="right">
- <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
- </td>
- <td class="th_text" width="10%" align="center">
- <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
- </td>
- <td class="th_text" width="20%" align="center">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_prefix"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_attribute"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_custom_function"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_delete"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_category">
- <xsl:variable name="lang_attribute_standardtext"><xsl:value-of
select="lang_attribute_standardtext"/></xsl:variable>
- <xsl:variable
name="lang_custom_function_standardtext"><xsl:value-of
select="lang_custom_function_standardtext"/></xsl:variable>
- <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
- <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <xsl:value-of select="id"/>
- </td>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="left">
- <xsl:value-of select="descr"/>
- </td>
- <td align="left">
- <xsl:value-of select="prefix"/>
- </td>
- <td align="center">
- <xsl:variable
name="link_attribute"><xsl:value-of select="link_attribute"/></xsl:variable>
- <a href="{$link_attribute}"
onMouseover="window.status='{$lang_attribute_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_attribute"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_custom_function"><xsl:value-of
select="link_custom_function"/></xsl:variable>
- <a href="{$link_custom_function}"
onMouseover="window.status='{$lang_custom_function_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_custom_function"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </tr>
- </xsl:template>
-
-
- <xsl:template match="list_config">
- <xsl:call-template name="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template
name="search_field"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template
name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_list_config"/>
- <xsl:apply-templates
select="values_list_config"/>
- </table>
- </xsl:template>
-
- <xsl:template match="table_header_list_config">
- <xsl:variable name="sort_column_name"><xsl:value-of
select="sort_column_name"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="10%" align="center">
- <a
href="{$sort_column_name}"><xsl:value-of select="lang_column_name"/></a>
- </td>
- <td class="th_text" width="10%" align="center">
- <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_list_config">
- <xsl:variable
name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="left">
- <xsl:value-of
select="column_name"/>
- </td>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- </tr>
- </xsl:template>
-
-
- <xsl:template match="table_add">
- <tr>
- <td height="50">
- <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
- <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
- <form method="post"
action="{$add_action}">
- <input type="submit" name="add"
value="{$lang_add}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_standardtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- <td height="50">
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit" name="add"
value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_standardtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </xsl:template>
-
-<!-- add / edit -->
- <xsl:template match="edit">
- <div align="left">
-
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" action="{$form_action}">
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="value_id != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_id"/>
- </td>
- <td>
- <xsl:value-of
select="value_id"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_name"/>
- </td>
- <td>
- <input type="text" name="values[name]"
value="{value_name}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_name_standardtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td>
- <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_descr_standardtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of
select="value_descr"/>
- </textarea>
-
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="lang_location_form != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_location_form"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_location_form = 1">
-
<input type="checkbox" name="values[location_form]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_location_form_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[location_form]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_location_form_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="lang_documentation != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_documentation"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_documentation = 1">
-
<input type="checkbox" name="values[documentation]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_documentation_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[documentation]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_documentation_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="value_location_form = 1">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_include_in_location_form"/>
- </td>
- <td>
- <xsl:call-template
name="include_list"/>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_include_this_entity"/>
- </td>
- <td>
- <xsl:call-template
name="include_list_2"/>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_start_this_entity"/>
- </td>
- <td>
- <xsl:call-template
name="include_list_3"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
-
- <xsl:choose>
- <xsl:when test="lang_prefix != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_prefix"/>
- </td>
- <td>
- <input type="text"
name="values[prefix]" value="{value_prefix}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_prefix_standardtext"/>
-
<xsl:text>'; return true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="lang_lookup_tenant != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_lookup_tenant"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_lookup_tenant = 1">
-
<input type="checkbox" name="values[lookup_tenant]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_lookup_tenant_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[lookup_tenant]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_lookup_tenant_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="lang_tracking != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_tracking"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_tracking = 1">
-
<input type="checkbox" name="values[tracking]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_tracking_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[tracking]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_tracking_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="lang_fileupload != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_fileupload"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_fileupload = 1">
-
<input type="checkbox" name="values[fileupload]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_fileupload_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[fileupload]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_fileupload_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="lang_loc_link != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_loc_link"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_loc_link = 1">
-
<input type="checkbox" name="values[loc_link]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_loc_link_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[loc_link]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_loc_link_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="lang_start_project != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_start_project"/>
- </td>
- <td>
- <xsl:choose>
-
<xsl:when test="value_start_project = 1">
-
<input type="checkbox" name="values[start_project]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_start_project_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[start_project]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_start_project_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
-
</input>
-
</xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when test="lang_location_level != ''">
- <tr>
- <td>
- <xsl:value-of
select="lang_location_level"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_location_level_statustext"><xsl:value-of
select="lang_location_level_statustext"/></xsl:variable>
- <select
name="values[location_level]" class="forms"
onMouseover="window.status='{$lang_location_level_statustext}'; return true;"
onMouseout="window.status='';return true;">
- <option
value=""><xsl:value-of select="lang_no_location_level"/></option>
-
<xsl:apply-templates select="location_level_list"/>
- </select>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_standardtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_done_standardtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-<!-- add_status / edit_status -->
- <xsl:template match="edit_status">
- <div align="left">
-
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" action="{$form_action}">
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_id"/>
- </td>
- <xsl:choose>
- <xsl:when test="value_id != ''">
- <td>
- <xsl:value-of
select="value_id"/>
- <input type="hidden"
name="values[id]" value="{value_id}"></input>
- </td>
- </xsl:when>
- <xsl:otherwise>
- <td>
- <input type="text"
name="values[id]" value="{value_id}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_id_standardtext"/>
-
<xsl:text>'; return true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </xsl:otherwise>
- </xsl:choose>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td>
- <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_descr_standardtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of
select="value_descr"/>
- </textarea>
-
- </td>
- </tr>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_standardtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_done_standardtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-<!-- list attribute -->
-
- <xsl:template match="list_attribute">
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_attrib"/>
- <xsl:apply-templates select="values_attrib"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
- <xsl:template match="table_header_attrib">
- <xsl:variable name="sort_sorting"><xsl:value-of
select="sort_sorting"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="10%" align="left">
- <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
- </td>
- <td class="th_text" width="20%" align="left">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td class="th_text" width="1%" align="left">
- <xsl:value-of select="lang_datatype"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <a href="{$sort_sorting}"><xsl:value-of
select="lang_sorting"/></a>
- </td>
- <td class="th_text" width="1%" align="center">
- <xsl:value-of select="lang_search"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_delete"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_attrib">
- <xsl:variable name="lang_up_text"><xsl:value-of
select="lang_up_text"/></xsl:variable>
- <xsl:variable name="lang_down_text"><xsl:value-of
select="lang_down_text"/></xsl:variable>
- <xsl:variable name="lang_edit_text"><xsl:value-of
select="lang_edit_text"/></xsl:variable>
- <xsl:variable name="lang_delete_text"><xsl:value-of
select="lang_delete_text"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="column_name"/>
- </td>
- <td>
- <xsl:value-of select="input_text"/>
- </td>
- <td>
- <xsl:value-of select="datatype"/>
- </td>
- <td>
- <table align="left">
- <tr>
- <td>
- <xsl:value-of
select="sorting"/>
- </td>
-
- <td align="left">
- <xsl:variable
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
- <a
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
- <xsl:text> |
</xsl:text>
- <xsl:variable
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
- <a
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return
true;" onMouseout="window.status='';return true;"><xsl:value-of
select="text_down"/></a>
- </td>
-
- </tr>
- </table>
- </td>
- <td align="center">
- <xsl:value-of select="search"/>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </tr>
- </xsl:template>
-
-
-<!-- add attribute / edit attribute -->
-
- <xsl:template match="edit_attrib">
- <div align="left">
-
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" action="{$form_action}">
-
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="value_id != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_id"/>
- </td>
- <td>
- <xsl:value-of
select="value_id"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_column_name"/>
- </td>
- <td>
- <input type="text"
name="values[column_name]" value="{value_column_name}" maxlength="20"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_column_name_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_input_text"/>
- </td>
- <td>
- <input type="text"
name="values[input_text]" value="{value_input_text}" maxlength="20"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_input_text_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_statustext"/>
- </td>
- <td>
- <textarea cols="60" rows="10"
name="values[statustext]" wrap="virtual" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_statustext_attribtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of
select="value_statustext"/>
- </textarea>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_datatype"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_datatype_statustext"><xsl:value-of
select="lang_datatype_statustext"/></xsl:variable>
- <select
name="values[column_info][type]" class="forms"
onMouseover="window.status='{$lang_datatype_statustext}'; return true;"
onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_datatype"/></option>
- <xsl:apply-templates
select="datatype_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_precision"/>
- </td>
- <td>
- <input type="text"
name="values[column_info][precision]" value="{value_precision}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_precision_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_scale"/>
- </td>
- <td>
- <input type="text"
name="values[column_info][scale]" value="{value_scale}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_scale_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_default"/>
- </td>
- <td>
- <input type="text"
name="values[column_info][default]" value="{value_default}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_default_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_nullable"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_nullable_statustext"><xsl:value-of
select="lang_nullable_statustext"/></xsl:variable>
- <select
name="values[column_info][nullable]" class="forms"
onMouseover="window.status='{$lang_nullable_statustext}'; return true;"
onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_nullable"/></option>
- <xsl:apply-templates
select="nullable_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td>
- <xsl:value-of select="lang_list"/>
- </td>
- <td>
- <xsl:choose>
- <xsl:when
test="value_list = 1">
- <input
type="checkbox" name="values[list]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_list_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[list]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_list_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <tr>
- <td>
- <xsl:value-of
select="lang_include_search"/>
- </td>
- <td>
- <xsl:choose>
- <xsl:when
test="value_search = 1">
- <input
type="checkbox" name="values[search]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_include_search_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[search]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_include_search_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="multiple_choice != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_choice"/>
- </td>
- <td align="right">
- <xsl:call-template
name="choice"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_attribtext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-
- </form>
- <tr>
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_done_attribtext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-
-
-<!-- list custom_function -->
-
- <xsl:template match="list_custom_function">
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_custom_function"/>
- <xsl:choose>
- <xsl:when test="values_custom_function != ''">
- <xsl:apply-templates
select="values_custom_function"/>
- </xsl:when>
- </xsl:choose>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
- <xsl:template match="table_header_custom_function">
- <xsl:variable name="sort_sorting"><xsl:value-of
select="sort_sorting"/></xsl:variable>
- <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="10%" align="left">
- <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
- </td>
- <td class="th_text" width="20%" align="left">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_active"/>
- </td>
- <td class="th_text" width="10%" align="center">
- <a href="{$sort_sorting}"><xsl:value-of
select="lang_sorting"/></a>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_edit"/>
- </td>
- <td class="th_text" width="5%" align="center">
- <xsl:value-of select="lang_delete"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_custom_function">
- <xsl:variable name="lang_up_text"><xsl:value-of
select="lang_up_text"/></xsl:variable>
- <xsl:variable name="lang_down_text"><xsl:value-of
select="lang_down_text"/></xsl:variable>
- <xsl:variable name="lang_edit_text"><xsl:value-of
select="lang_edit_text"/></xsl:variable>
- <xsl:variable name="lang_delete_text"><xsl:value-of
select="lang_delete_text"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="file_name"/>
- </td>
- <td>
- <xsl:value-of select="descr"/>
- </td>
- <td align = 'center'>
- <xsl:value-of select="active"/>
- </td>
- <td>
- <table align="left">
- <tr>
- <td>
- <xsl:value-of
select="sorting"/>
- </td>
-
- <td align="left">
- <xsl:variable
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
- <a
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
- <xsl:text> |
</xsl:text>
- <xsl:variable
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
- <a
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return
true;" onMouseout="window.status='';return true;"><xsl:value-of
select="text_down"/></a>
- </td>
-
- </tr>
- </table>
- </td>
- <td align="center">
- <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
- <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
- </td>
- <td align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </tr>
- </xsl:template>
-
-
-<!-- add custom_function / edit custom_function -->
-
- <xsl:template match="edit_custom_function">
- <div align="left">
-
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" action="{$form_action}">
-
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_entity"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="entity_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left">
- <xsl:value-of select="lang_category"/>
- </td>
- <td class="th_text" align="left">
- <xsl:value-of select="category_name"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="value_id != ''">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_id"/>
- </td>
- <td>
- <xsl:value-of
select="value_id"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_descr"/>
- </td>
- <td>
- <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_descr_custom_functiontext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of
select="value_descr"/>
- </textarea>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_custom_function"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_custom_function_statustext"><xsl:value-of
select="lang_custom_function_statustext"/></xsl:variable>
- <select
name="values[custom_function_file]" class="forms"
onMouseover="window.status='{$lang_custom_function_statustext}'; return true;"
onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_custom_function"/></option>
- <xsl:apply-templates
select="custom_function_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td>
- <xsl:value-of select="lang_active"/>
- </td>
- <td>
- <xsl:choose>
- <xsl:when
test="value_active = 1">
- <input
type="checkbox" name="values[active]" value="1" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_active_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[active]" value="1"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_active_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_custom_functiontext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-
- </form>
- <tr>
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_done_custom_functiontext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-
-
-<!-- location_level_list -->
-
- <xsl:template match="location_level_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- datatype_list -->
-
- <xsl:template match="datatype_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- custom_function_list -->
-
- <xsl:template match="custom_function_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected='selected'">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- nullable_list -->
-
- <xsl:template match="nullable_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="choice">
- <table cellpadding="2" cellspacing="2" width="80%"
align="left">
- <xsl:choose>
- <xsl:when test="value_choice!=''">
- <tr class="th">
- <td class="th_text" width="85%"
align="left">
- <xsl:value-of
select="lang_value"/>
- </td>
- <td class="th_text" width="15%"
align="center">
- <xsl:value-of
select="lang_delete_value"/>
- </td>
- </tr>
- <xsl:for-each select="value_choice" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when
test="@class">
-
<xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="value"/>
- <xsl:text> </xsl:text>
- </td>
- <td align="center">
- <input type="checkbox"
name="values[delete_choice][]" value="{id}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_delete_choice_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </xsl:for-each>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_new_value"/>
- </td>
- <td>
- <input type="text"
name="values[new_choice]" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_new_value_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <xsl:template name="include_list">
- <table cellpadding="2" cellspacing="2" width="80%"
align="left">
- <tr class="th">
- <td class="th_text" width="85%"
align="left">
- <xsl:value-of
select="lang_name"/>
- </td>
- <td class="th_text" width="15%"
align="center">
- <xsl:value-of
select="lang_select"/>
- </td>
- </tr>
- <xsl:for-each select="include_list" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when
test="@class">
-
<xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="center">
- <xsl:choose>
- <xsl:when
test="selected='selected'">
- <input
type="checkbox" name="values[lookup_entity][]" value="{id}" checked="checked"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_include_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[lookup_entity][]" value="{id}"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_include_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
-
- <xsl:template name="include_list_2">
- <table cellpadding="2" cellspacing="2" width="80%"
align="left">
- <tr class="th">
- <td class="th_text" width="85%"
align="left">
- <xsl:value-of
select="lang_name"/>
- </td>
- <td class="th_text" width="15%"
align="center">
- <xsl:value-of
select="lang_select"/>
- </td>
- </tr>
- <xsl:for-each select="include_list_2" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when
test="@class">
-
<xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="center">
- <xsl:choose>
- <xsl:when
test="selected='selected'">
- <input
type="checkbox" name="values[include_entity_for][]" value="{id}"
checked="checked" onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_include_2_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[include_entity_for][]" value="{id}"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_include_2_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
- <xsl:template name="include_list_3">
- <table cellpadding="2" cellspacing="2" width="80%"
align="left">
- <tr class="th">
- <td class="th_text" width="85%"
align="left">
- <xsl:value-of
select="lang_name"/>
- </td>
- <td class="th_text" width="15%"
align="center">
- <xsl:value-of
select="lang_select"/>
- </td>
- </tr>
- <xsl:for-each select="include_list_3" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when
test="@class">
-
<xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when
test="position() mod 2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="name"/>
- </td>
- <td align="center">
- <xsl:choose>
- <xsl:when
test="selected='selected'">
- <input
type="checkbox" name="values[start_entity_from][]" value="{id}"
checked="checked" onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[start_entity_from][]" value="{id}"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="//lang_include_3_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
-
</xsl:attribute>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
-
+<!-- $Id: admin_entity.xsl,v 1.6 2006/02/03 12:05:49 sigurdne Exp $ -->
+
+ <xsl:template name="app_data">
+ <xsl:choose>
+ <xsl:when test="edit">
+ <xsl:apply-templates select="edit"/>
+ </xsl:when>
+ <xsl:when test="edit_status">
+ <xsl:apply-templates select="edit_status"/>
+ </xsl:when>
+ <xsl:when test="list_attribute">
+ <xsl:apply-templates select="list_attribute"/>
+ </xsl:when>
+ <xsl:when test="list_status">
+ <xsl:apply-templates select="list_status"/>
+ </xsl:when>
+ <xsl:when test="edit_attrib">
+ <xsl:apply-templates select="edit_attrib"/>
+ </xsl:when>
+ <xsl:when test="list_config">
+ <xsl:apply-templates select="list_config"/>
+ </xsl:when>
+ <xsl:when test="edit_config">
+ <xsl:apply-templates select="edit_config"/>
+ </xsl:when>
+ <xsl:when test="list_category">
+ <xsl:apply-templates select="list_category"/>
+ </xsl:when>
+ <xsl:when test="list_custom_function">
+ <xsl:apply-templates
select="list_custom_function"/>
+ </xsl:when>
+ <xsl:when test="edit_custom_function">
+ <xsl:apply-templates
select="edit_custom_function"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="list"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template match="list">
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates select="table_header"/>
+ <xsl:apply-templates select="values"/>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="table_header">
+ <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="10%" align="right">
+ <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
+ </td>
+ <td class="th_text" width="10%" align="center">
+ <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
+ </td>
+ <td class="th_text" width="20%" align="center">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_categories"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values">
+ <xsl:variable name="lang_attribute_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
+ <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
+ <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <xsl:value-of select="id"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="descr"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_categories"><xsl:value-of select="link_categories"/></xsl:variable>
+ <a href="{$link_categories}"
onMouseover="window.status='{lang_category_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_categories"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="list_status">
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_status"/>
+ <xsl:apply-templates select="values_status"/>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="table_header_status">
+ <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="10%" align="right">
+ <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
+ </td>
+ <td class="th_text" width="20%" align="center">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_status">
+ <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
+ <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <xsl:value-of select="id"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="descr"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="list_category">
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_category"/>
+ <xsl:apply-templates select="values_category"/>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="table_header_category">
+ <xsl:variable name="sort_id"><xsl:value-of
select="sort_id"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="5%" align="right">
+ <a href="{$sort_id}"><xsl:value-of
select="lang_id"/></a>
+ </td>
+ <td class="th_text" width="10%" align="center">
+ <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
+ </td>
+ <td class="th_text" width="20%" align="center">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_prefix"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_attribute"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_custom_function"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_category">
+ <xsl:variable name="lang_attribute_standardtext"><xsl:value-of
select="lang_attribute_standardtext"/></xsl:variable>
+ <xsl:variable
name="lang_custom_function_standardtext"><xsl:value-of
select="lang_custom_function_standardtext"/></xsl:variable>
+ <xsl:variable name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
+ <xsl:variable name="lang_delete_standardtext"><xsl:value-of
select="lang_delete_standardtext"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <xsl:value-of select="id"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="descr"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="prefix"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_attribute"><xsl:value-of select="link_attribute"/></xsl:variable>
+ <a href="{$link_attribute}"
onMouseover="window.status='{$lang_attribute_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_attribute"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_custom_function"><xsl:value-of
select="link_custom_function"/></xsl:variable>
+ <a href="{$link_custom_function}"
onMouseover="window.status='{$lang_custom_function_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_custom_function"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+ <xsl:template match="list_config">
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template
name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template
name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_list_config"/>
+ <xsl:apply-templates
select="values_list_config"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="table_header_list_config">
+ <xsl:variable name="sort_column_name"><xsl:value-of
select="sort_column_name"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="10%" align="center">
+ <a
href="{$sort_column_name}"><xsl:value-of select="lang_column_name"/></a>
+ </td>
+ <td class="th_text" width="10%" align="center">
+ <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_list_config">
+ <xsl:variable
name="lang_edit_standardtext"><xsl:value-of
select="lang_edit_standardtext"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when
test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="left">
+ <xsl:value-of
select="column_name"/>
+ </td>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_standardtext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+ <xsl:template match="table_add">
+ <tr>
+ <td height="50">
+ <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
+ <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
+ <form method="post"
action="{$add_action}">
+ <input type="submit" name="add"
value="{$lang_add}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_add_standardtext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ <td height="50">
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit" name="add"
value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_add_standardtext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </xsl:template>
+
+<!-- add / edit -->
+ <xsl:template match="edit">
+ <div align="left">
+
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="value_id != ''">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_id"/>
+ </td>
+ <td>
+ <xsl:value-of
select="value_id"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_name"/>
+ </td>
+ <td>
+ <input type="text" name="values[name]"
value="{value_name}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_name_standardtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_descr_standardtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of
select="value_descr"/>
+ </textarea>
+
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="lang_location_form != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_location_form"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_location_form = 1">
+
<input type="checkbox" name="values[location_form]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_location_form_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[location_form]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_location_form_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="lang_documentation != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_documentation"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_documentation = 1">
+
<input type="checkbox" name="values[documentation]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_documentation_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[documentation]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_documentation_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="value_location_form = 1">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_include_in_location_form"/>
+ </td>
+ <td>
+ <xsl:call-template
name="include_list"/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_include_this_entity"/>
+ </td>
+ <td>
+ <xsl:call-template
name="include_list_2"/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_start_this_entity"/>
+ </td>
+ <td>
+ <xsl:call-template
name="include_list_3"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+
+ <xsl:choose>
+ <xsl:when test="lang_prefix != ''">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_prefix"/>
+ </td>
+ <td>
+ <input type="text"
name="values[prefix]" value="{value_prefix}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_prefix_standardtext"/>
+
<xsl:text>'; return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="lang_lookup_tenant != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_lookup_tenant"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_lookup_tenant = 1">
+
<input type="checkbox" name="values[lookup_tenant]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_lookup_tenant_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[lookup_tenant]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_lookup_tenant_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="lang_tracking != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_tracking"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_tracking = 1">
+
<input type="checkbox" name="values[tracking]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_tracking_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[tracking]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_tracking_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="lang_fileupload != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_fileupload"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_fileupload = 1">
+
<input type="checkbox" name="values[fileupload]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_fileupload_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[fileupload]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_fileupload_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="lang_loc_link != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_loc_link"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_loc_link = 1">
+
<input type="checkbox" name="values[loc_link]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_loc_link_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[loc_link]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_loc_link_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="lang_start_project != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_start_project"/>
+ </td>
+ <td>
+ <xsl:choose>
+
<xsl:when test="value_start_project = 1">
+
<input type="checkbox" name="values[start_project]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_start_project_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[start_project]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_start_project_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+
</input>
+
</xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="lang_location_level != ''">
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_location_level"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_location_level_statustext"><xsl:value-of
select="lang_location_level_statustext"/></xsl:variable>
+ <select
name="values[location_level]" class="forms"
onMouseover="window.status='{$lang_location_level_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <option
value=""><xsl:value-of select="lang_no_location_level"/></option>
+
<xsl:apply-templates select="location_level_list"/>
+ </select>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_save_standardtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_done_standardtext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+<!-- add_status / edit_status -->
+ <xsl:template match="edit_status">
+ <div align="left">
+
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_id"/>
+ </td>
+ <xsl:choose>
+ <xsl:when test="value_id != ''">
+ <td>
+ <xsl:value-of
select="value_id"/>
+ <input type="hidden"
name="values[id]" value="{value_id}"></input>
+ </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <td>
+ <input type="text"
name="values[id]" value="{value_id}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_id_standardtext"/>
+
<xsl:text>'; return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </xsl:otherwise>
+ </xsl:choose>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_descr_standardtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of
select="value_descr"/>
+ </textarea>
+
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_save_standardtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_done_standardtext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+<!-- list attribute -->
+
+ <xsl:template match="list_attribute">
+
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_attrib"/>
+ <xsl:apply-templates select="values_attrib"/>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+ <xsl:template match="table_header_attrib">
+ <xsl:variable name="sort_sorting"><xsl:value-of
select="sort_sorting"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="10%" align="left">
+ <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
+ </td>
+ <td class="th_text" width="20%" align="left">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td class="th_text" width="1%" align="left">
+ <xsl:value-of select="lang_datatype"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <a href="{$sort_sorting}"><xsl:value-of
select="lang_sorting"/></a>
+ </td>
+ <td class="th_text" width="1%" align="center">
+ <xsl:value-of select="lang_search"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_attrib">
+ <xsl:variable name="lang_up_text"><xsl:value-of
select="lang_up_text"/></xsl:variable>
+ <xsl:variable name="lang_down_text"><xsl:value-of
select="lang_down_text"/></xsl:variable>
+ <xsl:variable name="lang_edit_text"><xsl:value-of
select="lang_edit_text"/></xsl:variable>
+ <xsl:variable name="lang_delete_text"><xsl:value-of
select="lang_delete_text"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="column_name"/>
+ </td>
+ <td>
+ <xsl:value-of select="input_text"/>
+ </td>
+ <td>
+ <xsl:value-of select="datatype"/>
+ </td>
+ <td>
+ <table align="left">
+ <tr>
+ <td>
+ <xsl:value-of
select="sorting"/>
+ </td>
+
+ <td align="left">
+ <xsl:variable
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
+ <a
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
+ <xsl:text> |
</xsl:text>
+ <xsl:variable
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
+ <a
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return
true;" onMouseout="window.status='';return true;"><xsl:value-of
select="text_down"/></a>
+ </td>
+
+ </tr>
+ </table>
+ </td>
+ <td align="center">
+ <xsl:value-of select="search"/>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+<!-- add attribute / edit attribute -->
+
+ <xsl:template match="edit_attrib">
+ <div align="left">
+
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="value_id != ''">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_id"/>
+ </td>
+ <td>
+ <xsl:value-of
select="value_id"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_column_name"/>
+ </td>
+ <td>
+ <input type="text"
name="values[column_name]" value="{value_column_name}" maxlength="20"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_column_name_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_input_text"/>
+ </td>
+ <td>
+ <input type="text"
name="values[input_text]" value="{value_input_text}" maxlength="20"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_input_text_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_statustext"/>
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="values[statustext]" wrap="virtual" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_statustext_attribtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of
select="value_statustext"/>
+ </textarea>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_datatype"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_datatype_statustext"><xsl:value-of
select="lang_datatype_statustext"/></xsl:variable>
+ <select
name="values[column_info][type]" class="forms"
onMouseover="window.status='{$lang_datatype_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_datatype"/></option>
+ <xsl:apply-templates
select="datatype_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_precision"/>
+ </td>
+ <td>
+ <input type="text"
name="values[column_info][precision]" value="{value_precision}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_precision_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_scale"/>
+ </td>
+ <td>
+ <input type="text"
name="values[column_info][scale]" value="{value_scale}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_scale_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_default"/>
+ </td>
+ <td>
+ <input type="text"
name="values[column_info][default]" value="{value_default}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_default_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_nullable"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_nullable_statustext"><xsl:value-of
select="lang_nullable_statustext"/></xsl:variable>
+ <select
name="values[column_info][nullable]" class="forms"
onMouseover="window.status='{$lang_nullable_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_nullable"/></option>
+ <xsl:apply-templates
select="nullable_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of select="lang_list"/>
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when
test="value_list = 1">
+ <input
type="checkbox" name="values[list]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_list_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[list]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_list_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_include_search"/>
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when
test="value_search = 1">
+ <input
type="checkbox" name="values[search]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_include_search_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[search]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_include_search_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="multiple_choice != ''">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_choice"/>
+ </td>
+ <td align="right">
+ <xsl:call-template
name="choice"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_save_attribtext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_done_attribtext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+
+
+<!-- list custom_function -->
+
+ <xsl:template match="list_custom_function">
+
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_custom_function"/>
+ <xsl:choose>
+ <xsl:when test="values_custom_function != ''">
+ <xsl:apply-templates
select="values_custom_function"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+ <xsl:template match="table_header_custom_function">
+ <xsl:variable name="sort_sorting"><xsl:value-of
select="sort_sorting"/></xsl:variable>
+ <xsl:variable name="sort_name"><xsl:value-of
select="sort_name"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="10%" align="left">
+ <a href="{$sort_name}"><xsl:value-of
select="lang_name"/></a>
+ </td>
+ <td class="th_text" width="20%" align="left">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_active"/>
+ </td>
+ <td class="th_text" width="10%" align="center">
+ <a href="{$sort_sorting}"><xsl:value-of
select="lang_sorting"/></a>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_edit"/>
+ </td>
+ <td class="th_text" width="5%" align="center">
+ <xsl:value-of select="lang_delete"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_custom_function">
+ <xsl:variable name="lang_up_text"><xsl:value-of
select="lang_up_text"/></xsl:variable>
+ <xsl:variable name="lang_down_text"><xsl:value-of
select="lang_down_text"/></xsl:variable>
+ <xsl:variable name="lang_edit_text"><xsl:value-of
select="lang_edit_text"/></xsl:variable>
+ <xsl:variable name="lang_delete_text"><xsl:value-of
select="lang_delete_text"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="file_name"/>
+ </td>
+ <td>
+ <xsl:value-of select="descr"/>
+ </td>
+ <td align = 'center'>
+ <xsl:value-of select="active"/>
+ </td>
+ <td>
+ <table align="left">
+ <tr>
+ <td>
+ <xsl:value-of
select="sorting"/>
+ </td>
+
+ <td align="left">
+ <xsl:variable
name="link_up"><xsl:value-of select="link_up"/></xsl:variable>
+ <a
href="{$link_up}" onMouseover="window.status='{$lang_up_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of select="text_up"/></a>
+ <xsl:text> |
</xsl:text>
+ <xsl:variable
name="link_down"><xsl:value-of select="link_down"/></xsl:variable>
+ <a
href="{$link_down}" onMouseover="window.status='{$lang_down_text}';return
true;" onMouseout="window.status='';return true;"><xsl:value-of
select="text_down"/></a>
+ </td>
+
+ </tr>
+ </table>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_edit"><xsl:value-of select="link_edit"/></xsl:variable>
+ <a href="{$link_edit}"
onMouseover="window.status='{$lang_edit_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_edit"/></a>
+ </td>
+ <td align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_text}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+<!-- add custom_function / edit custom_function -->
+
+ <xsl:template match="edit_custom_function">
+ <div align="left">
+
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_entity"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="entity_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text" align="left">
+ <xsl:value-of select="lang_category"/>
+ </td>
+ <td class="th_text" align="left">
+ <xsl:value-of select="category_name"/>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="value_id != ''">
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_id"/>
+ </td>
+ <td>
+ <xsl:value-of
select="value_id"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_descr"/>
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="values[descr]" wrap="virtual" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_descr_custom_functiontext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of
select="value_descr"/>
+ </textarea>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_custom_function"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_custom_function_statustext"><xsl:value-of
select="lang_custom_function_statustext"/></xsl:variable>
+ <select
name="values[custom_function_file]" class="forms"
onMouseover="window.status='{$lang_custom_function_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_custom_function"/></option>
+ <xsl:apply-templates
select="custom_function_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of select="lang_active"/>
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when
test="value_active = 1">
+ <input
type="checkbox" name="values[active]" value="1" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_active_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[active]" value="1"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_active_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_save_custom_functiontext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_done_custom_functiontext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+
+
+<!-- location_level_list -->
+
+ <xsl:template match="location_level_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- datatype_list -->
+
+ <xsl:template match="datatype_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- custom_function_list -->
+
+ <xsl:template match="custom_function_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected='selected'">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- nullable_list -->
+
+ <xsl:template match="nullable_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="choice">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="left">
+ <xsl:choose>
+ <xsl:when test="value_choice!=''">
+ <tr class="th">
+ <td class="th_text" width="85%"
align="left">
+ <xsl:value-of
select="lang_value"/>
+ </td>
+ <td class="th_text" width="15%"
align="center">
+ <xsl:value-of
select="lang_delete_value"/>
+ </td>
+ </tr>
+ <xsl:for-each select="value_choice" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when
test="@class">
+
<xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when
test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="value"/>
+ <xsl:text> </xsl:text>
+ </td>
+ <td align="center">
+ <input type="checkbox"
name="values[delete_choice][]" value="{id}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_delete_choice_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_new_value"/>
+ </td>
+ <td>
+ <input type="text"
name="values[new_choice]" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_new_value_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template name="include_list">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="left">
+ <tr class="th">
+ <td class="th_text" width="85%"
align="left">
+ <xsl:value-of
select="lang_name"/>
+ </td>
+ <td class="th_text" width="15%"
align="center">
+ <xsl:value-of
select="lang_select"/>
+ </td>
+ </tr>
+ <xsl:for-each select="include_list" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when
test="@class">
+
<xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when
test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="center">
+ <xsl:choose>
+ <xsl:when
test="selected='selected'">
+ <input
type="checkbox" name="values[lookup_entity][]" value="{id}" checked="checked"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_include_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[lookup_entity][]" value="{id}"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_include_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:template>
+
+ <xsl:template name="include_list_2">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="left">
+ <tr class="th">
+ <td class="th_text" width="85%"
align="left">
+ <xsl:value-of
select="lang_name"/>
+ </td>
+ <td class="th_text" width="15%"
align="center">
+ <xsl:value-of
select="lang_select"/>
+ </td>
+ </tr>
+ <xsl:for-each select="include_list_2" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when
test="@class">
+
<xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when
test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="center">
+ <xsl:choose>
+ <xsl:when
test="selected='selected'">
+ <input
type="checkbox" name="values[include_entity_for][]" value="{id}"
checked="checked" onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_include_2_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[include_entity_for][]" value="{id}"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_include_2_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:template>
+ <xsl:template name="include_list_3">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="left">
+ <tr class="th">
+ <td class="th_text" width="85%"
align="left">
+ <xsl:value-of
select="lang_name"/>
+ </td>
+ <td class="th_text" width="15%"
align="center">
+ <xsl:value-of
select="lang_select"/>
+ </td>
+ </tr>
+ <xsl:for-each select="include_list_3" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when
test="@class">
+
<xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when
test="position() mod 2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td align="left">
+ <xsl:value-of select="name"/>
+ </td>
+ <td align="center">
+ <xsl:choose>
+ <xsl:when
test="selected='selected'">
+ <input
type="checkbox" name="values[start_entity_from][]" value="{id}"
checked="checked" onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[start_entity_from][]" value="{id}"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="//lang_include_3_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+
</xsl:attribute>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </xsl:template>
+
Index: property/templates/default/invoice.xsl
diff -u property/templates/default/invoice.xsl:1.13
property/templates/default/invoice.xsl:1.14
--- property/templates/default/invoice.xsl:1.13 Fri Jan 27 14:05:59 2006
+++ property/templates/default/invoice.xsl Fri Feb 3 12:05:49 2006
@@ -1,2542 +1,2542 @@
-<!-- $Id: invoice.xsl,v 1.13 2006/01/27 14:05:59 sigurdne Exp $ -->
-
- <xsl:template name="app_data">
- <xsl:choose>
- <xsl:when test="add">
- <xsl:apply-templates select="add"/>
- </xsl:when>
- <xsl:when test="edit">
- <xsl:apply-templates select="edit"/>
- </xsl:when>
- <xsl:when test="import">
- <xsl:apply-templates select="import"/>
- </xsl:when>
- <xsl:when test="export">
- <xsl:apply-templates select="export"/>
- </xsl:when>
- <xsl:when test="rollback">
- <xsl:apply-templates select="rollback"/>
- </xsl:when>
- <xsl:when test="debug">
- <xsl:apply-templates select="debug"/>
- </xsl:when>
- <xsl:when test="edit_period">
- <xsl:apply-templates select="edit_period"/>
- </xsl:when>
- <xsl:when test="list_voucher">
- <xsl:apply-templates select="list_voucher"/>
- </xsl:when>
- <xsl:when test="list_voucher_paid">
- <xsl:apply-templates
select="list_voucher_paid"/>
- </xsl:when>
- <xsl:when test="consume">
- <xsl:apply-templates select="consume"/>
- </xsl:when>
- <xsl:when test="remark">
- <xsl:apply-templates select="remark"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="list_invoice_sub"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="edit_period">
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" action="{$form_action}">
- <div align="center">
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td>
- <xsl:variable name="select_name"><xsl:value-of
select="select_name"/></xsl:variable>
- <select name="{$select_name}" class="forms" >
- <xsl:apply-templates
select="period_list"/>
- </select>
- </td>
- </tr>
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit" name="submit"
value="{$lang_save}" >
- </input>
- </td>
- </tr>
- </table>
- </div>
- </form>
- </xsl:template>
-
- <xsl:template match="period_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <xsl:template match="remark">
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr>
- <td colspan="2" align="center">
- <xsl:value-of select="message"/>
- </td>
- </tr>
- <tr>
- <td align="center">
- <textarea cols="60" rows="15"
name="remark" readonly="readonly" wrap="virtual"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_content_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of select="remark"/>
- </textarea>
- </td>
- </tr>
-
- </table>
- </xsl:template>
-
- <xsl:template name="excel">
- <xsl:variable name="link_excel"><xsl:value-of
select="link_excel"/></xsl:variable>
- <xsl:variable name="lang_excel_help"><xsl:value-of
select="lang_excel_help"/></xsl:variable>
- <xsl:variable name="lang_excel"><xsl:value-of
select="lang_excel"/></xsl:variable>
- <a href="javascript:var
w=window.open('{$link_excel}','','')"
- onMouseOver="overlib('{$lang_excel_help}',
CAPTION, '{$lang_excel}')"
- onMouseOut="nd()">
- <xsl:value-of select="lang_excel"/></a>
- </xsl:template>
-
-
-<!-- list_voucher -->
-
- <xsl:template match="list_voucher">
- <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
- <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
- <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
- <xsl:variable name="check_source"><xsl:value-of
select="check_source"/></xsl:variable>
- <SCRIPT LANGUAGE="JavaScript" SRC="{$check_source}"></SCRIPT>
- <xsl:call-template name="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <tr>
- <td>
- <xsl:call-template name="cat_filter"/>
- </td>
- <td align="center">
- <xsl:call-template
name="user_lid_filter"/>
- </td>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- </tr>
- <tr>
- <td colspan="3" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- <td colspan="3" width="100%" class="small_text"
valign="top" align="left">
- <xsl:call-template name="excel"/>
- </td>
- </tr>
- </table>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" name="form" action="{$form_action}">
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_list_voucher"/>
-
- <xsl:choose>
- <xsl:when
test="values_list_voucher[voucher_id]">
- <xsl:apply-templates
select="values_list_voucher"/>
-
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="img_check"><xsl:value-of
select="img_check"/></xsl:variable>
- <tr>
- <td></td>
- <td></td>
- <td></td>
- <td class="small_text" align="right">
- <xsl:value-of select="sum"/>
- </td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td align="center">
- <a
href="javascript:check_all_radio('sign_none')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
- </td>
- <td align="center">
- <a
href="javascript:check_all_radio('sign_janitor')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
- </td>
- <td align="center">
- <a
href="javascript:check_all_radio('sign_supervisor')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
- </td>
- <td align="center">
- <a
href="javascript:check_all_radio('sign_budget_responsible')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
- </td>
- <td align="right">
- <a
href="javascript:check_all_checkbox('values[transfer]')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
- </td>
- </tr>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-
- </table>
- </form>
- <xsl:choose>
- <xsl:when test="table_add_invoice !=''">
- <xsl:apply-templates
select="table_add_invoice"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="table_add_invoice">
- <table align = "left">
- <tr>
- <td height="50" align="left" valign="top">
- <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
- <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
- <form method="post"
action="{$add_action}">
- <input type="submit" name=""
value="{$lang_add}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </xsl:template>
-
-
- <xsl:template match="table_header_list_voucher">
- <xsl:variable name="sort_voucher"><xsl:value-of
select="sort_voucher"/></xsl:variable>
- <xsl:variable name="sort_voucher_date"><xsl:value-of
select="sort_voucher_date"/></xsl:variable>
- <xsl:variable name="sort_vendor_id"><xsl:value-of
select="sort_vendor_id"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="5%" align="right">
- <a href="{$sort_voucher}"><xsl:value-of
select="lang_voucher"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <a
href="{$sort_voucher_date}"><xsl:value-of select="lang_voucher_date"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_days"/>
- </td>
- <td class="th_text" width="8%" align="right">
- <xsl:value-of select="lang_sum"/>
- </td>
- <td class="th_text" width="4%" align="right">
- <a
href="{$sort_vendor_id}"><xsl:value-of select="lang_vendor_id"/></a>
- </td>
- <td class="th_text" width="3%" align="right">
- <xsl:value-of
select="lang_num_sub_invoice"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_type"/>
- </td>
- <td class="th_text" width="3%" align="right">
- <xsl:value-of select="lang_period"/>
- </td>
- <td class="th_text" width="3%" align="right">
- <xsl:value-of select="lang_kredit"/>
- </td>
- <td class="th_text" width="3%" align="right">
- <xsl:value-of select="lang_none"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_janitor"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_supervisor"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of
select="lang_budget_responsible"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_transfer"/>
- </td>
- <xsl:choose>
- <xsl:when test="//acl_delete!=''">
- <td class="th_text" width="5%"
align="center">
- <xsl:value-of
select="lang_delete"/>
- </td>
- </xsl:when>
- </xsl:choose>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_list_voucher">
-
- <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
- <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td class="small_text" align="right">
- <input type="hidden"
name="values[counter][{$counter}]" value="{counter}">
- </input>
- <input type="hidden"
name="values[voucher_id][{$counter}]" value="{voucher_id}">
- </input>
- <xsl:variable
name="link_sub"><xsl:value-of select="link_sub"/>&voucher_id=<xsl:value-of
select="voucher_id"/></xsl:variable>
- <xsl:variable
name="lang_sub_help"><xsl:value-of select="lang_sub_help"/></xsl:variable>
- <xsl:variable
name="lang_sub"><xsl:value-of select="lang_sub"/></xsl:variable>
- <a href="{$link_sub}"
-
onMouseOver="overlib('{$lang_sub_help}', CAPTION, '{$lang_sub}')"
- onMouseOut="nd()">
- <xsl:value-of select="voucher_id"/></a>
- </td>
- <td class="small_text" align="right">
- <xsl:variable
name="lang_payment_date"><xsl:value-of
select="lang_payment_date"/></xsl:variable>
- <xsl:variable
name="payment_date"><xsl:value-of select="payment_date"/></xsl:variable>
- <a href="javascript:void()"
- onMouseOver="overlib('{$payment_date}',
CAPTION, '{$lang_payment_date}')"
- onMouseOut="nd()">
- <xsl:value-of
select="voucher_date"/></a>
- </td>
- <td class="small_text" align="right">
- <input type="hidden"
name="values[sign_orig][{$counter}]" value="{sign_orig}">
- </input>
- <input type="hidden"
name="values[num_days_orig][{$counter}]" value="{num_days}">
- </input>
- <input type="hidden"
name="values[timestamp_voucher_date][{$counter}]"
value="{timestamp_voucher_date}">
- </input>
- <input type="text" size="2"
name="values[num_days][{$counter}]" value="{num_days}">
- </input>
- </td>
- <td class="small_text" align="right">
- <xsl:value-of select="amount"/>
- </td>
- <td class="small_text" align="right">
- <xsl:variable
name="vendor"><xsl:value-of select="vendor"/></xsl:variable>
- <xsl:variable
name="vendor_id"><xsl:value-of select="vendor_id"/></xsl:variable>
- <a href="javascript:void()"
- onMouseOver="overlib('{$vendor}',
CAPTION, '{$vendor_id}')"
- onMouseOut="nd()">
- <xsl:value-of select="vendor_id"/></a>
-
- </td>
- <td class="small_text" align="right">
- <input type="hidden"
name="values[invoice_count][{$counter}]" value="{invoice_count}">
- </input>
- <xsl:value-of select="invoice_count"/>
- </td>
- <td class="small_text" align="center">
- <xsl:value-of select="type"/>
- </td>
- <td class="small_text" align="right">
- <xsl:variable
name="link_period"><xsl:value-of
select="link_period"/>&voucher_id=<xsl:value-of
select="voucher_id"/>&period=<xsl:value-of select="period"/></xsl:variable>
- <xsl:variable
name="lang_period_help"><xsl:value-of select="lang_period_help"/></xsl:variable>
- <xsl:variable
name="lang_period"><xsl:value-of select="lang_period"/></xsl:variable>
- <a href="javascript:var
w=window.open('{$link_period}','','width=150,height=150')"
-
onMouseOver="overlib('{$lang_period_help}', CAPTION, '{$lang_period}')"
- onMouseOut="nd()">
- <xsl:value-of select="period"/></a>
- </td>
- <td align="center">
- <xsl:choose>
- <xsl:when test="kreditnota='1'">
- <input type="checkbox"
name="values[kreditnota][{$counter}]" value="true" checked="checked"
onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input type="checkbox"
name="values[kreditnota][{$counter}]" value="true"
onMouseout="window.status='';return true;">
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when test="is_janitor">
- <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:when test="is_supervisor">
- <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:when
test="is_budget_responsible">
- <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:otherwise>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="right">
-
- <xsl:choose>
- <xsl:when
test="is_janitor='32'">
- <xsl:choose>
- <xsl:when
test="jan_date=''">
- <input
type="radio" name="values[sign][{$counter}]" value="sign_janitor"
onMouseout="window.status='';return true;">
-
</input>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:choose>
-
<xsl:when test="janitor = $current_user">
-
<input type="radio" name="values[sign][{$counter}]"
value="sign_janitor" checked="checked" onMouseout="window.status='';return
true;">
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
-
</xsl:otherwise>
-
</xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when
test="jan_date=''">
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:value-of select="janitor"/>
- </td>
- <td class="small_text" align="right">
-
- <xsl:choose>
- <xsl:when
test="is_supervisor='64'"><xsl:value-of select="super_date"/>
- <xsl:choose>
- <xsl:when
test="super_date=''">
- <input
type="radio" name="values[sign][{$counter}]" value="sign_supervisor"
onMouseout="window.status='';return true;">
-
</input>
- </xsl:when>
- <xsl:when
test="super_date!=''">
-
<xsl:choose>
-
<xsl:when test="supervisor = $current_user">
-
<input type="radio" name="values[sign][{$counter}]"
value="sign_supervisor" checked="checked" onMouseout="window.status='';return
true;">
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
-
</xsl:otherwise>
-
</xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when
test="super_date=''">
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:value-of select="supervisor"/>
- </td>
- <td class="small_text" align="right">
- <xsl:choose>
- <xsl:when
test="is_budget_responsible='128'">
- <xsl:choose>
- <xsl:when
test="budget_date=''">
- <input
type="radio" name="values[sign][{$counter}]" value="sign_budget_responsible"
onMouseout="window.status='';return true;">
-
</input>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:choose>
-
<xsl:when test="budget_responsible = $current_user">
-
<input type="radio" name="values[sign][{$counter}]"
value="sign_budget_responsible" checked="checked"
onMouseout="window.status='';return true;">
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
-
</xsl:otherwise>
-
</xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when
test="budget_date=''">
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of
select="budget_responsible"/>
- </td>
- <td class="small_text" align="right">
- <xsl:choose>
- <xsl:when
test="is_transfer='16'">
- <xsl:choose>
- <xsl:when
test="transfer_date=''">
- <input
type="checkbox" name="values[transfer][{$counter}]" value="true"
onMouseout="window.status='';return true;">
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input
type="checkbox" name="values[transfer][{$counter}]" value="true"
checked="checked" onMouseout="window.status='';return true;">
-
</input>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when
test="transfer_id!=''">
- <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
- </xsl:when>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="transfer_id"/>
- </td>
- <xsl:choose>
- <xsl:when test="//acl_delete!=''">
- <xsl:variable
name="lang_delete_statustext"><xsl:value-of
select="lang_delete_statustext"/></xsl:variable>
- <td class="small_text"
align="center">
- <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
- <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_statustext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
- </td>
- </xsl:when>
- </xsl:choose>
- </tr>
- </xsl:template>
-
-
-
-<!-- list_voucher_paid -->
-
- <xsl:template match="list_voucher_paid">
- <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
- <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
- <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
-
- <script language="JavaScript">
- self.name="first_Window";
- function abook()
- {
- Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- function property_lookup()
- {
- Window1=window.open('<xsl:value-of
select="property_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- </script>
-
- <xsl:call-template name="menu"/>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <div align="left">
- <form method="post" name="form" action="{$form_action}">
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <tr>
- <td>
- <input type="text" id="start_date"
name="start_date" size="10" value="{start_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_start_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_start"/>
- </script>
- </td>
- <td>
- <input type="text" id="end_date"
name="end_date" size="10" value="{end_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_end_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_end"/>
- </script>
- </td>
- <td>
- <input type="text" size="8"
name="workorder_id" value="{workorder_id}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_workorder_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:void()"
-
onMouseOver="overlib('{lang_workorder_statustext}', CAPTION,
'{lang_workorder}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_workorder"/></a>
- </td>
-
- <td align="left">
- <input type="text" name="vendor_id"
value="{vendor_id}" size="4" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:abook()"
-
onMouseOver="overlib('{lang_select_vendor_statustext}', CAPTION,
'{lang_vendor}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_vendor"/></a>
-
- <input type="hidden"
name="vendor_name"></input>
- </td>
- </tr>
-
- <tr>
- <td>
- <xsl:call-template name="cat_select"/>
- </td>
- <td align="left">
- <xsl:call-template
name="user_lid_select"/>
- </td>
- <td align="left">
- <input type="text" name="loc1"
value="{loc1}" size="4" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_property_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:property_lookup()"
-
onMouseOver="overlib('{lang_select_property_statustext}', CAPTION,
'{lang_property}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_property"/></a>
-
- <input type="hidden"
name="loc1_name"></input>
- </td>
-
- <td align="left">
- <input type="text" name="voucher_id"
value="{voucher_id}" size="8" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_voucher_id_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <xsl:text> </xsl:text>
- <xsl:value-of select="lang_voucher_id"/>
- </td>
-
- <td align="left">
- <xsl:variable
name="lang_search"><xsl:value-of select="lang_search"/></xsl:variable>
- <input type="submit"
name="submit_search" value="{$lang_search}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_search_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td colspan="11" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates
select="table_header_list_voucher_paid"/>
-
- <xsl:choose>
- <xsl:when
test="values_list_voucher_paid[voucher_id]">
- <xsl:apply-templates
select="values_list_voucher_paid"/>
- <tr>
- <td></td>
- <td></td>
- <td></td>
- <td class="th_text"
align="right">
- <xsl:value-of
select="sum"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="img_check"><xsl:value-of
select="img_check"/></xsl:variable>
- </table>
- </xsl:template>
-
-
- <xsl:template match="table_header_list_voucher_paid">
- <xsl:variable name="sort_voucher"><xsl:value-of
select="sort_voucher"/></xsl:variable>
- <xsl:variable name="sort_voucher_date"><xsl:value-of
select="sort_voucher_date"/></xsl:variable>
- <xsl:variable name="sort_vendor_id"><xsl:value-of
select="sort_vendor_id"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="5%" align="right">
- <a href="{$sort_voucher}"><xsl:value-of
select="lang_voucher"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <a
href="{$sort_voucher_date}"><xsl:value-of select="lang_voucher_date"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_days"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_sum"/>
- </td>
- <td class="th_text" width="4%" align="right">
- <a
href="{$sort_vendor_id}"><xsl:value-of select="lang_vendor_id"/></a>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of
select="lang_num_sub_invoice"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_type"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_janitor"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_supervisor"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of
select="lang_budget_responsible"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_transfer"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_list_voucher_paid">
-
- <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
- <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <xsl:variable
name="link_sub"><xsl:value-of select="link_sub"/>&voucher_id=<xsl:value-of
select="voucher_id"/>&paid=true</xsl:variable>
- <xsl:variable
name="lang_sub_help"><xsl:value-of select="lang_sub_help"/></xsl:variable>
- <xsl:variable
name="lang_sub"><xsl:value-of select="lang_sub"/></xsl:variable>
- <a href="{$link_sub}"
-
onMouseOver="overlib('{$lang_sub_help}', CAPTION, '{$lang_sub}')"
- onMouseOut="nd()">
- <xsl:value-of select="voucher_id"/></a>
- </td>
- <td align="right">
- <xsl:variable
name="lang_payment_date"><xsl:value-of
select="lang_payment_date"/></xsl:variable>
- <xsl:variable
name="payment_date"><xsl:value-of select="payment_date"/></xsl:variable>
- <a href="javascript:void()"
- onMouseOver="overlib('{$payment_date}',
CAPTION, '{$lang_payment_date}')"
- onMouseOut="nd()">
- <xsl:value-of
select="voucher_date"/></a>
- </td>
- <td align="right">
- <xsl:value-of select="num_days"/>
- </td>
- <td align="right">
- <xsl:value-of select="amount"/>
- </td>
- <td align="right">
- <xsl:variable
name="vendor"><xsl:value-of select="vendor"/></xsl:variable>
- <xsl:variable
name="vendor_id"><xsl:value-of select="vendor_id"/></xsl:variable>
- <a href="javascript:void()"
- onMouseOver="overlib('{$vendor}',
CAPTION, '{$vendor_id}')"
- onMouseOut="nd()">
- <xsl:value-of select="vendor_id"/></a>
-
- </td>
- <td align="right">
- <xsl:value-of select="invoice_count"/>
- </td>
- <td align="center">
- <xsl:value-of select="type"/>
- </td>
- <td align="center">
- <xsl:value-of select="jan_date"/> -
<xsl:value-of select="janitor"/>
- </td>
- <td align="center">
- <xsl:value-of select="super_date"/> -
<xsl:value-of select="supervisor"/>
- </td>
- <td align="center">
- <xsl:value-of select="budget_date"/> -
<xsl:value-of select="budget_responsible"/>
- </td>
- <td align="center">
- <xsl:value-of select="transfer_date"/>
- <xsl:value-of select="transfer_id"/>
- </td>
- </tr>
- </xsl:template>
-
-
-<!-- consume -->
-
- <xsl:template match="consume">
- <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
- <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
- <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
-
- <script language="JavaScript">
- self.name="first_Window";
- function abook()
- {
- Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- function property_lookup()
- {
- Window1=window.open('<xsl:value-of
select="property_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- </script>
-
- <xsl:call-template name="menu"/>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <div align="left">
- <form method="post" name="form" action="{$form_action}">
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr>
- <td>
- <input type="text" id="start_date"
name="start_date" size="10" value="{start_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_start_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_start"/>
- </script>
- </td>
- <td>
- <input type="text" id="end_date"
name="end_date" size="10" value="{end_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_end_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_end"/>
- </script>
- </td>
- <td>
- <input type="text" size="8"
name="workorder_id" value="{workorder_id}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_workorder_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:void()"
-
onMouseOver="overlib('{lang_workorder_statustext}', CAPTION,
'{lang_workorder}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_workorder"/></a>
- </td>
-
- <td align="left">
- <input type="text" name="vendor_id"
onClick="abook()" value="{vendor_id}" size="4"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:abook()"
-
onMouseOver="overlib('{lang_select_vendor_statustext}', CAPTION,
'{lang_vendor}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_vendor"/></a>
-
- <input type="hidden" name="vendor_name"
value="{vendor_name}"></input>
- </td>
- </tr>
-
- <tr>
- <td>
- <xsl:call-template name="cat_select"/>
- </td>
- <td align="left">
- <xsl:call-template
name="select_district"/>
- </td>
- <td align="left">
- <xsl:variable
name="lang_account_class_statustext"><xsl:value-of
select="lang_account_class_statustext"/></xsl:variable>
- <xsl:variable
name="select_account_class_name"><xsl:value-of
select="select_account_class_name"/></xsl:variable>
- <select
name="{$select_account_class_name}" class="forms"
onMouseover="window.status='{$lang_account_class_statustext}'; return true;"
onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_account_class_"/></option>
- <xsl:apply-templates
select="account_class_list"/>
- </select>
-
- </td>
-
- <td align="left">
- <input type="text" name="loc1"
onClick="property_lookup()" value="{loc1}" size="4"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_property_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <a href="javascript:property_lookup()"
-
onMouseOver="overlib('{lang_select_property_statustext}', CAPTION,
'{lang_property}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_property"/></a>
-
- <input type="hidden"
name="loc1_name"></input>
- </td>
- <td align="left">
- <xsl:variable
name="lang_search"><xsl:value-of select="lang_search"/></xsl:variable>
- <input type="submit"
name="submit_search" value="{$lang_search}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_search_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </table>
- </form>
- </div>
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="vendor_name!=''">
- <tr>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="lang_vendor"/>
- </td>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="vendor_name"/>
- </td>
- <td width="50%">
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="loc1!=''">
- <tr>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="lang_property"/>
- </td>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="loc1"/>
- </td>
- <td width="50%">
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="workorder_id!=''">
- <tr>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="lang_workorder"/>
- </td>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="workorder_id"/>
- </td>
- <td width="50%">
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- </table>
-
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:apply-templates select="table_header_consume"/>
-
- <xsl:choose>
- <xsl:when test="values_consume[consume]">
- <xsl:apply-templates
select="values_consume"/>
-
- </xsl:when>
- </xsl:choose>
- <tr>
- <td>
- </td>
- <td>
- </td>
- <td class="th_text" align="right">
- <xsl:value-of select="lang_sum"/>
- </td>
- <td class="th_text" align="right">
- <xsl:value-of select="sum"/>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <xsl:template match="account_class_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="table_header_consume">
- <tr class="th">
- <td class="th_text" width="10%" align="right">
- <xsl:value-of select="lang_district"/>
- </td>
- <td class="th_text" width="10%" align="right">
- <xsl:value-of select="lang_period"/>
- </td>
- <td class="th_text" width="25%" align="right">
- <xsl:value-of
select="lang_budget_account"/>
- </td>
- <td class="th_text" width="55%" align="right">
- <xsl:value-of select="lang_consume"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_consume">
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <xsl:value-of select="district_id"/>
- </td>
- <td align="center">
- <xsl:value-of select="period"/>
- </td>
- <td align="center">
- <xsl:value-of select="account_class"/>
- </td>
- <td align="right">
- <xsl:value-of select="consume"/>
- </td>
- </tr>
- </xsl:template>
-
-<!-- debug-->
-
- <xsl:template match="debug">
- <div align="left">
- <table width="50%" cellpadding="2" cellspacing="2"
align="center">
-
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_bilagsnr"/>
- </td>
- <td>
- <xsl:value-of select="bilagsnr"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_type"/>
- </td>
- <td>
- <xsl:value-of select="artid"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_vendor"/>
- </td>
- <td>
- <xsl:value-of select="spvend_code"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="vendor_name"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of
select="lang_fakturadato"/>
- </td>
- <td>
- <xsl:value-of select="fakturadato"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of
select="lang_forfallsdato"/>
- </td>
- <td>
- <xsl:value-of select="forfallsdato"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_janitor"/>
- </td>
- <td>
- <xsl:value-of select="oppsynsmannid"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_supervisor"/>
- </td>
- <td>
- <xsl:value-of select="saksbehandlerid"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of
select="lang_budget_responsible"/>
- </td>
- <td>
- <xsl:value-of
select="budsjettansvarligid"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_project_id"/>
- </td>
- <td>
- <xsl:value-of select="project_id"/>
- </td>
- </tr>
- <tr>
- <td class="th_text">
- <xsl:value-of select="lang_sum"/>
- </td>
- <td>
- <xsl:value-of select="sum"/>
- </td>
- </tr>
- </table>
- </div>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <tr class="th">
- <xsl:call-template name="table_header"/>
- </tr>
- <xsl:call-template name="values_debug"/>
- <xsl:apply-templates select="table_add"/>
- </table>
- </xsl:template>
-
- <xsl:template name="values_debug">
- <xsl:for-each select="values" >
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod 2 = 0">
- <xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:for-each select="row" >
- <td align="{align}">
- <xsl:value-of select="value"/>
- </td>
- </xsl:for-each>
- </tr>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="table_add">
- <tr>
- <td height="50">
- <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
- <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
- <form method="post"
action="{$add_action}">
- <input type="submit" name="add"
value="{$lang_add}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_add_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- <td height="50">
- <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <form method="post"
action="{$cancel_action}">
- <input type="submit"
name="cancel" value="{$lang_cancel}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_cancel_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </xsl:template>
-
-<!-- add / edit -->
- <xsl:template match="add">
-
- <script language="JavaScript">
- self.name="first_Window";
- function abook()
- {
- Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- </script>
-
- <xsl:call-template name="menu"/>
- <div align="left">
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <tr>
- <td colspan="2" align="center">
- <xsl:value-of select="message"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" name="form" action="{$form_action}">
-
- <tr>
- <td>
- <xsl:value-of select="lang_auto_tax"/>
- </td>
- <td>
- <input type="checkbox" name="auto_tax"
value="True" checked="checked" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_auto_tax_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <xsl:call-template name="location_form"/>
- <xsl:call-template name="b_account_form"/>
- <tr>
- <td valign="top">
- <xsl:variable
name="lang_vendor"><xsl:value-of select="lang_vendor"/></xsl:variable>
- <input type="button" name="convert"
value="{$lang_vendor}" onClick="abook();" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_select_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- <td>
- <input type="text" name="vendor_id"
value="{value_vendor_id}" size="4" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <input type="text" name="vendor_name"
value="{value_vendor_name}" size="20" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_name_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_janitor"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_janitor_statustext"><xsl:value-of
select="lang_janitor_statustext"/></xsl:variable>
- <xsl:variable
name="select_janitor"><xsl:value-of select="select_janitor"/></xsl:variable>
- <select name="{$select_janitor}"
class="forms" onMouseover="window.status='{$lang_janitor_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_janitor"/></option>
- <xsl:apply-templates
select="janitor_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_supervisor"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_supervisor_statustext"><xsl:value-of
select="lang_supervisor_statustext"/></xsl:variable>
- <xsl:variable
name="select_supervisor"><xsl:value-of
select="select_supervisor"/></xsl:variable>
- <select name="{$select_supervisor}"
class="forms" onMouseover="window.status='{$lang_supervisor_statustext}';
return true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_supervisor"/></option>
- <xsl:apply-templates
select="supervisor_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_budget_responsible"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_budget_responsible_statustext"><xsl:value-of
select="lang_budget_responsible_statustext"/></xsl:variable>
- <xsl:variable
name="select_budget_responsible"><xsl:value-of
select="select_budget_responsible"/></xsl:variable>
- <select
name="{$select_budget_responsible}" class="forms"
onMouseover="window.status='{$lang_budget_responsible_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_budget_responsible"/></option>
- <xsl:apply-templates
select="budget_responsible_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_order"/>
- </td>
- <td>
- <input type="text" name="order"
value="{value_order}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_order_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_art"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_art_statustext"><xsl:value-of
select="lang_art_statustext"/></xsl:variable>
- <xsl:variable
name="select_art"><xsl:value-of select="select_art"/></xsl:variable>
- <select name="{$select_art}"
class="forms" onMouseover="window.status='{$lang_art_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_art"/></option>
- <xsl:apply-templates
select="art_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_type"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_type_statustext"><xsl:value-of
select="lang_type_statustext"/></xsl:variable>
- <xsl:variable
name="select_type"><xsl:value-of select="select_type"/></xsl:variable>
- <select name="{$select_type}"
class="forms" onMouseover="window.status='{$lang_type_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_type"/></option>
- <xsl:apply-templates
select="type_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_dimb"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_dimb_statustext"><xsl:value-of
select="lang_dimb_statustext"/></xsl:variable>
- <xsl:variable
name="select_dimb"><xsl:value-of select="select_dimb"/></xsl:variable>
- <select name="{$select_dimb}"
class="forms" onMouseover="window.status='{$lang_dimb_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_dimb"/></option>
- <xsl:apply-templates
select="dimb_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_invoice_number"/>
- </td>
- <td>
- <input type="text" name="invoice_num"
value="{value_invoice_num}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_invoice_num_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_kidnr"/>
- </td>
- <td>
- <input type="text" name="kid_nr"
value="{value_kid_nr}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_kid_nr_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_amount"/>
- </td>
- <td>
- <input type="text" name="amount"
value="{value_amount}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_amount_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_invoice_date"/>
- </td>
- <td>
- <input type="text" id="invoice_date"
name="invoice_date" size="10" value="{value_invoice_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_invoice_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="invoice_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_invoice"/>
- </script>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_no_of_days"/>
- </td>
- <td>
- <input type="text" name="num_days"
value="{value_num_days}" size="4" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_num_days_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
-
- <tr>
-
- <td valign="top">
- <xsl:value-of
select="lang_payment_date"/>
- </td>
- <td>
- <input type="text" id="payment_date"
name="payment_date" size="10" value="{value_payment_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_payment_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="payment_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_payment"/>
- </script>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_merknad"/>
- </td>
- <td>
- <textarea cols="60" rows="10"
name="merknad" wrap="virtual" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_merknad_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- <xsl:value-of
select="value_merknad"/>
- </textarea>
-
- </td>
- </tr>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
- <input type="submit" name="add_invoice"
value="{$lang_add}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_add_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <form method="post"
action="{$cancel_action}">
- <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_cancel_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-<!-- import -->
-
- <xsl:template match="import">
-
- <script language="JavaScript">
- self.name="first_Window";
- function abook()
- {
- Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
- }
- </script>
-
- <xsl:call-template name="menu"/>
- <div align="left">
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <tr>
- <td colspan="2" align="center">
- <xsl:value-of select="message"/>
- </td>
- </tr>
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form ENCTYPE="multipart/form-data" method="post"
name="form" action="{$form_action}">
-
- <tr>
- <td>
- <xsl:value-of select="lang_auto_tax"/>
- </td>
- <td>
- <input type="checkbox" name="auto_tax"
value="True" checked="checked" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_auto_tax_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_art"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_art_statustext"><xsl:value-of
select="lang_art_statustext"/></xsl:variable>
- <xsl:variable
name="select_art"><xsl:value-of select="select_art"/></xsl:variable>
- <select name="{$select_art}"
class="forms" onMouseover="window.status='{$lang_art_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_art"/></option>
- <xsl:apply-templates
select="art_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_type"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_type_statustext"><xsl:value-of
select="lang_type_statustext"/></xsl:variable>
- <xsl:variable
name="select_type"><xsl:value-of select="select_type"/></xsl:variable>
- <select name="{$select_type}"
class="forms" onMouseover="window.status='{$lang_type_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_type"/></option>
- <xsl:apply-templates
select="type_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_dimb"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_dimb_statustext"><xsl:value-of
select="lang_dimb_statustext"/></xsl:variable>
- <xsl:variable
name="select_dimb"><xsl:value-of select="select_dimb"/></xsl:variable>
- <select name="{$select_dimb}"
class="forms" onMouseover="window.status='{$lang_dimb_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_dimb"/></option>
- <xsl:apply-templates
select="dimb_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_invoice_number"/>
- </td>
- <td>
- <input type="text" name="invoice_num"
value="{value_invoice_num}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_invoice_num_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_kidnr"/>
- </td>
- <td>
- <input type="text" name="kid_nr"
value="{value_kid_nr}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_kid_nr_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:variable
name="lang_vendor"><xsl:value-of select="lang_vendor"/></xsl:variable>
- <input type="button" name="convert"
value="{$lang_vendor}" onClick="abook();" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_select_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- <td>
- <input type="text" name="vendor_id"
value="{value_vendor_id}" size="6" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- <input type="text" name="vendor_name"
value="{value_vendor_name}" size="20" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_vendor_name_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_janitor"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_janitor_statustext"><xsl:value-of
select="lang_janitor_statustext"/></xsl:variable>
- <xsl:variable
name="select_janitor"><xsl:value-of select="select_janitor"/></xsl:variable>
- <select name="{$select_janitor}"
class="forms" onMouseover="window.status='{$lang_janitor_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_janitor"/></option>
- <xsl:apply-templates
select="janitor_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_supervisor"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_supervisor_statustext"><xsl:value-of
select="lang_supervisor_statustext"/></xsl:variable>
- <xsl:variable
name="select_supervisor"><xsl:value-of
select="select_supervisor"/></xsl:variable>
- <select name="{$select_supervisor}"
class="forms" onMouseover="window.status='{$lang_supervisor_statustext}';
return true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_supervisor"/></option>
- <xsl:apply-templates
select="supervisor_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_budget_responsible"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_budget_responsible_statustext"><xsl:value-of
select="lang_budget_responsible_statustext"/></xsl:variable>
- <xsl:variable
name="select_budget_responsible"><xsl:value-of
select="select_budget_responsible"/></xsl:variable>
- <select
name="{$select_budget_responsible}" class="forms"
onMouseover="window.status='{$lang_budget_responsible_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_budget_responsible"/></option>
- <xsl:apply-templates
select="budget_responsible_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_invoice_date"/>
- </td>
- <td>
- <input type="text" id="invoice_date"
name="invoice_date" size="10" value="{value_invoice_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_invoice_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="invoice_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_invoice"/>
- </script>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_no_of_days"/>
- </td>
- <td>
- <input type="text" name="num_days"
value="{value_num_days}" size="4" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_num_days_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
-
- <tr>
-
- <td valign="top">
- <xsl:value-of
select="lang_payment_date"/>
- </td>
- <td>
- <input type="text" id="payment_date"
name="payment_date" size="10" value="{value_payment_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_payment_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="payment_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of
select="calendar_setup_payment"/>
- </script>
- </td>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_file"/>
- </td>
- <td>
- <input type="file" name="tsvfile"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_file_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of select="lang_conv"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
- <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
- <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_conversion"/></option>
- <xsl:apply-templates
select="conv_list"/>
- </select>
- </td>
- </tr>
-
- <tr>
- <td>
- <xsl:value-of select="lang_debug"/>
- </td>
- <td>
- <input type="checkbox" name="download"
value="True" checked="checked" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_debug_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr height="50">
- <td>
- <xsl:variable
name="lang_import"><xsl:value-of select="lang_import"/></xsl:variable>
- <input type="submit" name="convert"
value="{$lang_import}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_import_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <form method="post"
action="{$cancel_action}">
- <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_cancel_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-<!-- art_list -->
-
- <xsl:template match="art_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- type_list -->
-
- <xsl:template match="type_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- dimb_list -->
-
- <xsl:template match="dimb_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
-<!-- janitor_list -->
-
- <xsl:template match="janitor_list">
- <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- supervisor_list -->
-
- <xsl:template match="supervisor_list">
- <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- budget_responsible_list -->
-
- <xsl:template match="budget_responsible_list">
- <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
-<!-- conv_list -->
-
- <xsl:template match="conv_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- rollback_file_list -->
-
- <xsl:template match="rollback_file_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- tax_code_list -->
-
- <xsl:template match="tax_code_list">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-<!-- export -->
-
- <xsl:template match="export">
- <xsl:call-template name="menu"/>
- <div align="left">
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" name="form" action="{$form_action}">
-
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_select_conv"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
- <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
- <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_conv"/></option>
- <xsl:apply-templates
select="conv_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_force_period_year"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_force_period_year_statustext"><xsl:value-of
select="lang_force_period_year_statustext"/></xsl:variable>
- <select
name="values[force_period_year]" class="forms"
onMouseover="window.status='{$lang_force_period_year_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_year"/></option>
- <xsl:apply-templates
select="force_period_year"/>
- </select>
- </td>
- </tr>
- <tr>
- <td>
- <xsl:value-of
select="lang_export_to_file"/>
- </td>
- <td>
- <input type="checkbox"
name="values[download]" value="on" checked="checked"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_debug_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-
- <tr>
- <td>
- </td>
- <td>
- <xsl:variable
name="link_rollback_file"><xsl:value-of
select="link_rollback_file"/></xsl:variable>
- <a
href="{$link_rollback_file}"><xsl:value-of select="lang_rollback_file"/></a>
- </td>
- </tr>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_submit"><xsl:value-of select="lang_submit"/></xsl:variable>
- <input type="submit"
name="values[submit]" value="{$lang_submit}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_import_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <form method="post"
action="{$cancel_action}">
- <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_cancel_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-
-<!-- rollback -->
-
- <xsl:template match="rollback">
- <xsl:call-template name="menu"/>
- <div align="left">
- <table cellpadding="2" cellspacing="2" width="80%"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" name="form" action="{$form_action}">
-
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_select_conv"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
- <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
- <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_select_conv"/></option>
- <xsl:apply-templates
select="conv_list"/>
- </select>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_select_file"/>
- </td>
- <td valign="top">
- <xsl:variable
name="lang_file_statustext"><xsl:value-of
select="lang_file_statustext"/></xsl:variable>
- <xsl:variable
name="select_file"><xsl:value-of select="select_file"/></xsl:variable>
- <select name="{$select_file}"
class="forms" onMouseover="window.status='{$lang_file_statustext}'; return
true;" onMouseout="window.status='';return true;">
- <option value=""><xsl:value-of
select="lang_no_file"/></option>
- <xsl:apply-templates
select="rollback_file_list"/>
- </select>
- </td>
- </tr>
-
-
- <tr>
-
- <td valign="top">
- <xsl:value-of select="lang_date"/>
- </td>
- <td>
- <input type="text" id="date"
name="date" size="10" value="{value_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_date_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
-
- <script type="text/javascript">
- document.writeln('<img
id="date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
- <xsl:value-of select="calendar_setup"/>
- </script>
- </td>
- </tr>
-
- <tr height="50">
- <td>
- <xsl:variable
name="lang_submit"><xsl:value-of select="lang_submit"/></xsl:variable>
- <input type="submit"
name="values[submit]" value="{$lang_submit}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_import_statustext"/>
- <xsl:text>'; return
true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
- <form method="post"
action="{$cancel_action}">
- <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_cancel_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </xsl:template>
-
-
-<!--list_invoice_sub-->
-
- <xsl:template match="list_invoice_sub">
- <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
- <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
- <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
- <SCRIPT LANGUAGE="JavaScript" SRC="{check_source}"></SCRIPT>
-
- <xsl:call-template name="menu"/>
- <table width="80%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:choose>
- <xsl:when test="msgbox_data != ''">
- <tr>
- <td align="left" colspan="3">
- <xsl:call-template
name="msgbox"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="vendor!=''">
- <tr>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="lang_vendor"/>
- </td>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="vendor"/>
- </td>
- <td width="50%">
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="voucher_id!=''">
- <tr>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="lang_voucher_id"/>
- </td>
- <td width="25%" class="th_text"
align="left">
- <xsl:value-of
select="voucher_id"/>
- </td>
- <td width="50%">
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2"
align="center">
- <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
- <form method="post" name="form" action="{$form_action}">
- <xsl:apply-templates
select="table_header_list_invoice_sub"/>
-
- <xsl:choose>
- <xsl:when test="values_list_invoice_sub[id]">
- <xsl:apply-templates
select="values_list_invoice_sub"/>
- <xsl:variable
name="img_check"><xsl:value-of select="img_check"/></xsl:variable>
- <tr>
- <td></td>
- <td align="center">
- <a
href="javascript:check_all_checkbox('values[close_order]')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
- </td>
- <td></td>
- <td></td>
- <td></td>
- <td class="small_text"
align="right">
- <xsl:value-of
select="sum"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- <tr height="50">
- <td>
- <xsl:choose>
- <xsl:when test="paid=''">
- <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
- <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_save_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
- </xsl:attribute>
- </input>
- </xsl:when>
- </xsl:choose>
- </td>
- </tr>
- </form>
- <tr>
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
-
<xsl:value-of select="lang_done_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
-
- </table>
- </xsl:template>
-
- <xsl:template match="table_header_list_invoice_sub">
- <xsl:variable name="sort_workorder"><xsl:value-of
select="sort_workorder"/></xsl:variable>
- <xsl:variable name="sort_budget_account"><xsl:value-of
select="sort_budget_account"/></xsl:variable>
- <xsl:variable name="sort_sum"><xsl:value-of
select="sort_sum"/></xsl:variable>
- <xsl:variable name="sort_dima"><xsl:value-of
select="sort_dima"/></xsl:variable>
- <tr class="th">
- <td class="th_text" width="5%" align="right">
- <a
href="{$sort_workorder}"><xsl:value-of select="lang_workorder"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of
select="lang_close_order"/>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of
select="lang_charge_tenant"/>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_invoice_id"/>
- </td>
- <td class="th_text" width="2%" align="right">
- <a
href="{$sort_budget_account}"><xsl:value-of select="lang_budget_account"/></a>
- </td>
- <td class="th_text" width="5%" align="right">
- <a href="{$sort_sum}"><xsl:value-of
select="lang_sum"/></a>
- </td>
- <td class="th_text" width="5%" align="right">
- <a href="{$sort_dima}"><xsl:value-of
select="lang_dima"/></a>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_dimb"/>
- </td>
- <td class="th_text" width="5%" align="right">
- <xsl:value-of select="lang_dimd"/>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_tax_code"/>
- </td>
- <td class="th_text" width="2%" align="right">
- <xsl:value-of select="lang_remark"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="values_list_invoice_sub">
-
- <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
- <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of
select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod
2 = 0">
-
<xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <td align="right">
- <input type="hidden"
name="values[counter][{$counter}]" value="{counter}">
- </input>
- <input type="hidden"
name="values[id][{$counter}]" value="{id}">
- </input>
- <input type="hidden"
name="values[workorder_id][{$counter}]" value="{workorder_id}">
- </input>
- <xsl:variable
name="link_order"><xsl:value-of
select="link_order"/>&order_id=<xsl:value-of
select="workorder_id"/></xsl:variable>
- <a href="{$link_order}"
target="_blank"><xsl:value-of select="workorder_id"/></a>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when
test="workorder_id=''">
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when
test="paid=''">
- <input
type="hidden" name="values[close_order_orig][{$counter}]" value="{closed}">
- </input>
-
<xsl:choose>
-
<xsl:when test="closed='1'">
-
<input type="checkbox" name="values[close_order][{$counter}]"
value="true" checked="checked" onMouseout="window.status='';return true;">
-
</input>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type="checkbox" name="values[close_order][{$counter}]"
value="true" onMouseout="window.status='';return true;">
-
</input>
-
</xsl:otherwise>
-
</xsl:choose>
- </xsl:when>
- <xsl:otherwise>
-
<xsl:choose>
-
<xsl:when test="closed='1'">
-
<b>x</b>
-
</xsl:when>
-
</xsl:choose>
-
</xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when
test="charge_tenant='1'">
- <xsl:choose>
- <xsl:when
test="claim_issued=''">
-
<xsl:variable name="link_claim"><xsl:value-of
select="link_claim"/>&project_id=<xsl:value-of
select="project_id"/></xsl:variable>
- <a
href="{$link_claim}" target="_blank"><xsl:value-of select="//lang_claim"/></a>
- </xsl:when>
- </xsl:choose>
- <b>x</b>
- </xsl:when>
- </xsl:choose>
- </td>
- <td class="small_text" align="right">
- <xsl:value-of select="invoice_id"/>
- </td>
- <td class="small_text" align="right">
- <xsl:choose>
- <xsl:when test="paid='true'">
- <xsl:value-of
select="budget_account"/>
- </xsl:when>
- <xsl:otherwise>
- <input type="text"
size="7" name="values[budget_account][{$counter}]" value="{budget_account}">
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="right">
- <xsl:value-of select="amount"/>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when test="paid='true'">
- <xsl:value-of
select="dima"/>
- </xsl:when>
- <xsl:otherwise>
- <input type="text"
size="7" name="values[dima][{$counter}]" value="{dima}">
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="right">
- <xsl:value-of select="dimb"/>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when test="paid='true'">
- <xsl:value-of
select="dimd"/>
- </xsl:when>
- <xsl:otherwise>
- <input type="text"
size="4" name="values[dimd][{$counter}]" value="{dimd}">
- </input>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="center">
- <xsl:choose>
- <xsl:when test="paid='true'">
- <xsl:value-of
select="tax_code"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable
name="lang_tax_code_statustext"><xsl:value-of
select="lang_tax_code_statustext"/></xsl:variable>
- <select
name="values[tax_code][{$counter}]" class="forms"
onMouseover="window.status='{$lang_tax_code_statustext}'; return true;"
onMouseout="window.status='';return true;">
-
<xsl:apply-templates select="tax_code_list"/>
- </select>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- <td class="small_text" align="right">
- <xsl:choose>
- <xsl:when test="remark='1'">
- <xsl:variable
name="link_remark"><xsl:value-of select="link_remark"/>&id=<xsl:value-of
select="id"/>&paid=<xsl:value-of select="paid"/></xsl:variable>
- <xsl:variable
name="lang_remark_help"><xsl:value-of select="lang_remark_help"/></xsl:variable>
- <xsl:variable
name="lang_remark"><xsl:value-of select="lang_remark"/></xsl:variable>
- <a href="javascript:var
w=window.open('{$link_remark}','','width=550,height=400,scrollbars')"
-
onMouseOver="overlib('{$lang_remark_help}', CAPTION, '{$lang_remark}')"
- onMouseOut="nd()">
- <xsl:value-of
select="lang_remark"/></a>
- </xsl:when>
- </xsl:choose>
- </td>
-
- </tr>
- </xsl:template>
-
- <xsl:template match="force_period_year">
- <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
- <xsl:choose>
- <xsl:when test="selected='selected'">
- <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
- </xsl:when>
- <xsl:otherwise>
- <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+<!-- $Id: invoice.xsl,v 1.14 2006/02/03 12:05:49 sigurdne Exp $ -->
+
+ <xsl:template name="app_data">
+ <xsl:choose>
+ <xsl:when test="add">
+ <xsl:apply-templates select="add"/>
+ </xsl:when>
+ <xsl:when test="edit">
+ <xsl:apply-templates select="edit"/>
+ </xsl:when>
+ <xsl:when test="import">
+ <xsl:apply-templates select="import"/>
+ </xsl:when>
+ <xsl:when test="export">
+ <xsl:apply-templates select="export"/>
+ </xsl:when>
+ <xsl:when test="rollback">
+ <xsl:apply-templates select="rollback"/>
+ </xsl:when>
+ <xsl:when test="debug">
+ <xsl:apply-templates select="debug"/>
+ </xsl:when>
+ <xsl:when test="edit_period">
+ <xsl:apply-templates select="edit_period"/>
+ </xsl:when>
+ <xsl:when test="list_voucher">
+ <xsl:apply-templates select="list_voucher"/>
+ </xsl:when>
+ <xsl:when test="list_voucher_paid">
+ <xsl:apply-templates
select="list_voucher_paid"/>
+ </xsl:when>
+ <xsl:when test="consume">
+ <xsl:apply-templates select="consume"/>
+ </xsl:when>
+ <xsl:when test="remark">
+ <xsl:apply-templates select="remark"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="list_invoice_sub"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="edit_period">
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" action="{$form_action}">
+ <div align="center">
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td>
+ <xsl:variable name="select_name"><xsl:value-of
select="select_name"/></xsl:variable>
+ <select name="{$select_name}" class="forms" >
+ <xsl:apply-templates
select="period_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit" name="submit"
value="{$lang_save}" >
+ </input>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </form>
+ </xsl:template>
+
+ <xsl:template match="period_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template match="remark">
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr>
+ <td colspan="2" align="center">
+ <xsl:value-of select="message"/>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">
+ <textarea cols="60" rows="15"
name="remark" readonly="readonly" wrap="virtual"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_content_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of select="remark"/>
+ </textarea>
+ </td>
+ </tr>
+
+ </table>
+ </xsl:template>
+
+ <xsl:template name="excel">
+ <xsl:variable name="link_excel"><xsl:value-of
select="link_excel"/></xsl:variable>
+ <xsl:variable name="lang_excel_help"><xsl:value-of
select="lang_excel_help"/></xsl:variable>
+ <xsl:variable name="lang_excel"><xsl:value-of
select="lang_excel"/></xsl:variable>
+ <a href="javascript:var
w=window.open('{$link_excel}','','')"
+ onMouseOver="overlib('{$lang_excel_help}',
CAPTION, '{$lang_excel}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="lang_excel"/></a>
+ </xsl:template>
+
+
+<!-- list_voucher -->
+
+ <xsl:template match="list_voucher">
+ <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
+ <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
+ <xsl:variable name="check_source"><xsl:value-of
select="check_source"/></xsl:variable>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{$check_source}"></SCRIPT>
+ <xsl:call-template name="menu"/>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <tr>
+ <td>
+ <xsl:call-template name="cat_filter"/>
+ </td>
+ <td align="center">
+ <xsl:call-template
name="user_lid_filter"/>
+ </td>
+ <td align="right">
+ <xsl:call-template name="search_field"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ <td colspan="3" width="100%" class="small_text"
valign="top" align="left">
+ <xsl:call-template name="excel"/>
+ </td>
+ </tr>
+ </table>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" name="form" action="{$form_action}">
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_list_voucher"/>
+
+ <xsl:choose>
+ <xsl:when
test="values_list_voucher[voucher_id]">
+ <xsl:apply-templates
select="values_list_voucher"/>
+
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="img_check"><xsl:value-of
select="img_check"/></xsl:variable>
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td class="small_text" align="right">
+ <xsl:value-of select="sum"/>
+ </td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td align="center">
+ <a
href="javascript:check_all_radio('sign_none')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
+ </td>
+ <td align="center">
+ <a
href="javascript:check_all_radio('sign_janitor')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
+ </td>
+ <td align="center">
+ <a
href="javascript:check_all_radio('sign_supervisor')"><img src="{$img_check}"
border="0" height="16" width="21" alt="{lang_select_all}"/></a>
+ </td>
+ <td align="center">
+ <a
href="javascript:check_all_radio('sign_budget_responsible')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
+ </td>
+ <td align="right">
+ <a
href="javascript:check_all_checkbox('values[transfer]')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_save_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ </table>
+ </form>
+ <xsl:choose>
+ <xsl:when test="table_add_invoice !=''">
+ <xsl:apply-templates
select="table_add_invoice"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="table_add_invoice">
+ <table align = "left">
+ <tr>
+ <td height="50" align="left" valign="top">
+ <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
+ <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
+ <form method="post"
action="{$add_action}">
+ <input type="submit" name=""
value="{$lang_add}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_add_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+
+ <xsl:template match="table_header_list_voucher">
+ <xsl:variable name="sort_voucher"><xsl:value-of
select="sort_voucher"/></xsl:variable>
+ <xsl:variable name="sort_voucher_date"><xsl:value-of
select="sort_voucher_date"/></xsl:variable>
+ <xsl:variable name="sort_vendor_id"><xsl:value-of
select="sort_vendor_id"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="5%" align="right">
+ <a href="{$sort_voucher}"><xsl:value-of
select="lang_voucher"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <a
href="{$sort_voucher_date}"><xsl:value-of select="lang_voucher_date"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_days"/>
+ </td>
+ <td class="th_text" width="8%" align="right">
+ <xsl:value-of select="lang_sum"/>
+ </td>
+ <td class="th_text" width="4%" align="right">
+ <a
href="{$sort_vendor_id}"><xsl:value-of select="lang_vendor_id"/></a>
+ </td>
+ <td class="th_text" width="3%" align="right">
+ <xsl:value-of
select="lang_num_sub_invoice"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_type"/>
+ </td>
+ <td class="th_text" width="3%" align="right">
+ <xsl:value-of select="lang_period"/>
+ </td>
+ <td class="th_text" width="3%" align="right">
+ <xsl:value-of select="lang_kredit"/>
+ </td>
+ <td class="th_text" width="3%" align="right">
+ <xsl:value-of select="lang_none"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_janitor"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_supervisor"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of
select="lang_budget_responsible"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_transfer"/>
+ </td>
+ <xsl:choose>
+ <xsl:when test="//acl_delete!=''">
+ <td class="th_text" width="5%"
align="center">
+ <xsl:value-of
select="lang_delete"/>
+ </td>
+ </xsl:when>
+ </xsl:choose>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_list_voucher">
+
+ <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
+ <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td class="small_text" align="right">
+ <input type="hidden"
name="values[counter][{$counter}]" value="{counter}">
+ </input>
+ <input type="hidden"
name="values[voucher_id][{$counter}]" value="{voucher_id}">
+ </input>
+ <xsl:variable
name="link_sub"><xsl:value-of select="link_sub"/>&voucher_id=<xsl:value-of
select="voucher_id"/></xsl:variable>
+ <xsl:variable
name="lang_sub_help"><xsl:value-of select="lang_sub_help"/></xsl:variable>
+ <xsl:variable
name="lang_sub"><xsl:value-of select="lang_sub"/></xsl:variable>
+ <a href="{$link_sub}"
+
onMouseOver="overlib('{$lang_sub_help}', CAPTION, '{$lang_sub}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="voucher_id"/></a>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:variable
name="lang_payment_date"><xsl:value-of
select="lang_payment_date"/></xsl:variable>
+ <xsl:variable
name="payment_date"><xsl:value-of select="payment_date"/></xsl:variable>
+ <a href="javascript:void()"
+ onMouseOver="overlib('{$payment_date}',
CAPTION, '{$lang_payment_date}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="voucher_date"/></a>
+ </td>
+ <td class="small_text" align="right">
+ <input type="hidden"
name="values[sign_orig][{$counter}]" value="{sign_orig}">
+ </input>
+ <input type="hidden"
name="values[num_days_orig][{$counter}]" value="{num_days}">
+ </input>
+ <input type="hidden"
name="values[timestamp_voucher_date][{$counter}]"
value="{timestamp_voucher_date}">
+ </input>
+ <input type="text" size="2"
name="values[num_days][{$counter}]" value="{num_days}">
+ </input>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:value-of select="amount"/>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:variable
name="vendor"><xsl:value-of select="vendor"/></xsl:variable>
+ <xsl:variable
name="vendor_id"><xsl:value-of select="vendor_id"/></xsl:variable>
+ <a href="javascript:void()"
+ onMouseOver="overlib('{$vendor}',
CAPTION, '{$vendor_id}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="vendor_id"/></a>
+
+ </td>
+ <td class="small_text" align="right">
+ <input type="hidden"
name="values[invoice_count][{$counter}]" value="{invoice_count}">
+ </input>
+ <xsl:value-of select="invoice_count"/>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:value-of select="type"/>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:variable
name="link_period"><xsl:value-of
select="link_period"/>&voucher_id=<xsl:value-of
select="voucher_id"/>&period=<xsl:value-of select="period"/></xsl:variable>
+ <xsl:variable
name="lang_period_help"><xsl:value-of select="lang_period_help"/></xsl:variable>
+ <xsl:variable
name="lang_period"><xsl:value-of select="lang_period"/></xsl:variable>
+ <a href="javascript:var
w=window.open('{$link_period}','','width=150,height=150')"
+
onMouseOver="overlib('{$lang_period_help}', CAPTION, '{$lang_period}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="period"/></a>
+ </td>
+ <td align="center">
+ <xsl:choose>
+ <xsl:when test="kreditnota='1'">
+ <input type="checkbox"
name="values[kreditnota][{$counter}]" value="true" checked="checked"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="checkbox"
name="values[kreditnota][{$counter}]" value="true"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when test="is_janitor">
+ <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:when test="is_supervisor">
+ <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:when
test="is_budget_responsible">
+ <input type="radio"
name="values[sign][{$counter}]" value="sign_none"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="right">
+
+ <xsl:choose>
+ <xsl:when
test="is_janitor='32'">
+ <xsl:choose>
+ <xsl:when
test="jan_date=''">
+ <input
type="radio" name="values[sign][{$counter}]" value="sign_janitor"
onMouseout="window.status='';return true;">
+
</input>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:choose>
+
<xsl:when test="janitor = $current_user">
+
<input type="radio" name="values[sign][{$counter}]"
value="sign_janitor" checked="checked" onMouseout="window.status='';return
true;">
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
+
</xsl:otherwise>
+
</xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="jan_date=''">
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:value-of select="janitor"/>
+ </td>
+ <td class="small_text" align="right">
+
+ <xsl:choose>
+ <xsl:when
test="is_supervisor='64'"><xsl:value-of select="super_date"/>
+ <xsl:choose>
+ <xsl:when
test="super_date=''">
+ <input
type="radio" name="values[sign][{$counter}]" value="sign_supervisor"
onMouseout="window.status='';return true;">
+
</input>
+ </xsl:when>
+ <xsl:when
test="super_date!=''">
+
<xsl:choose>
+
<xsl:when test="supervisor = $current_user">
+
<input type="radio" name="values[sign][{$counter}]"
value="sign_supervisor" checked="checked" onMouseout="window.status='';return
true;">
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
+
</xsl:otherwise>
+
</xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="super_date=''">
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:value-of select="supervisor"/>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:choose>
+ <xsl:when
test="is_budget_responsible='128'">
+ <xsl:choose>
+ <xsl:when
test="budget_date=''">
+ <input
type="radio" name="values[sign][{$counter}]" value="sign_budget_responsible"
onMouseout="window.status='';return true;">
+
</input>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:choose>
+
<xsl:when test="budget_responsible = $current_user">
+
<input type="radio" name="values[sign][{$counter}]"
value="sign_budget_responsible" checked="checked"
onMouseout="window.status='';return true;">
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="" value="" checked="checked"
disabled="disabled" ></input>
+
</xsl:otherwise>
+
</xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="budget_date=''">
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of
select="budget_responsible"/>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:choose>
+ <xsl:when
test="is_transfer='16'">
+ <xsl:choose>
+ <xsl:when
test="transfer_date=''">
+ <input
type="checkbox" name="values[transfer][{$counter}]" value="true"
onMouseout="window.status='';return true;">
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input
type="checkbox" name="values[transfer][{$counter}]" value="true"
checked="checked" onMouseout="window.status='';return true;">
+
</input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="transfer_id!=''">
+ <input
type="checkbox" name="" value="" checked="checked" disabled="disabled" ></input>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="transfer_id"/>
+ </td>
+ <xsl:choose>
+ <xsl:when test="//acl_delete!=''">
+ <xsl:variable
name="lang_delete_statustext"><xsl:value-of
select="lang_delete_statustext"/></xsl:variable>
+ <td class="small_text"
align="center">
+ <xsl:variable
name="link_delete"><xsl:value-of select="link_delete"/></xsl:variable>
+ <a href="{$link_delete}"
onMouseover="window.status='{$lang_delete_statustext}';return true;"
onMouseout="window.status='';return true;"><xsl:value-of
select="text_delete"/></a>
+ </td>
+ </xsl:when>
+ </xsl:choose>
+ </tr>
+ </xsl:template>
+
+
+
+<!-- list_voucher_paid -->
+
+ <xsl:template match="list_voucher_paid">
+ <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
+ <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
+
+ <script language="JavaScript">
+ self.name="first_Window";
+ function abook()
+ {
+ Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ function property_lookup()
+ {
+ Window1=window.open('<xsl:value-of
select="property_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ </script>
+
+ <xsl:call-template name="menu"/>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <div align="left">
+ <form method="post" name="form" action="{$form_action}">
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ <tr>
+ <td>
+ <input type="text" id="start_date"
name="start_date" size="10" value="{start_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_start_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_start"/>
+ </script>
+ </td>
+ <td>
+ <input type="text" id="end_date"
name="end_date" size="10" value="{end_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_end_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_end"/>
+ </script>
+ </td>
+ <td>
+ <input type="text" size="8"
name="workorder_id" value="{workorder_id}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_workorder_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:void()"
+
onMouseOver="overlib('{lang_workorder_statustext}', CAPTION,
'{lang_workorder}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_workorder"/></a>
+ </td>
+
+ <td align="left">
+ <input type="text" name="vendor_id"
value="{vendor_id}" size="4" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:abook()"
+
onMouseOver="overlib('{lang_select_vendor_statustext}', CAPTION,
'{lang_vendor}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_vendor"/></a>
+
+ <input type="hidden"
name="vendor_name"></input>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <xsl:call-template name="cat_select"/>
+ </td>
+ <td align="left">
+ <xsl:call-template
name="user_lid_select"/>
+ </td>
+ <td align="left">
+ <input type="text" name="loc1"
value="{loc1}" size="4" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_property_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:property_lookup()"
+
onMouseOver="overlib('{lang_select_property_statustext}', CAPTION,
'{lang_property}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_property"/></a>
+
+ <input type="hidden"
name="loc1_name"></input>
+ </td>
+
+ <td align="left">
+ <input type="text" name="voucher_id"
value="{voucher_id}" size="8" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_voucher_id_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="lang_voucher_id"/>
+ </td>
+
+ <td align="left">
+ <xsl:variable
name="lang_search"><xsl:value-of select="lang_search"/></xsl:variable>
+ <input type="submit"
name="submit_search" value="{$lang_search}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_search_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="11" width="100%">
+ <xsl:call-template name="nextmatchs"/>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates
select="table_header_list_voucher_paid"/>
+
+ <xsl:choose>
+ <xsl:when
test="values_list_voucher_paid[voucher_id]">
+ <xsl:apply-templates
select="values_list_voucher_paid"/>
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td class="th_text"
align="right">
+ <xsl:value-of
select="sum"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="img_check"><xsl:value-of
select="img_check"/></xsl:variable>
+ </table>
+ </xsl:template>
+
+
+ <xsl:template match="table_header_list_voucher_paid">
+ <xsl:variable name="sort_voucher"><xsl:value-of
select="sort_voucher"/></xsl:variable>
+ <xsl:variable name="sort_voucher_date"><xsl:value-of
select="sort_voucher_date"/></xsl:variable>
+ <xsl:variable name="sort_vendor_id"><xsl:value-of
select="sort_vendor_id"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="5%" align="right">
+ <a href="{$sort_voucher}"><xsl:value-of
select="lang_voucher"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <a
href="{$sort_voucher_date}"><xsl:value-of select="lang_voucher_date"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_days"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_sum"/>
+ </td>
+ <td class="th_text" width="4%" align="right">
+ <a
href="{$sort_vendor_id}"><xsl:value-of select="lang_vendor_id"/></a>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of
select="lang_num_sub_invoice"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_type"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_janitor"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_supervisor"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of
select="lang_budget_responsible"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_transfer"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_list_voucher_paid">
+
+ <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
+ <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <xsl:variable
name="link_sub"><xsl:value-of select="link_sub"/>&voucher_id=<xsl:value-of
select="voucher_id"/>&paid=true</xsl:variable>
+ <xsl:variable
name="lang_sub_help"><xsl:value-of select="lang_sub_help"/></xsl:variable>
+ <xsl:variable
name="lang_sub"><xsl:value-of select="lang_sub"/></xsl:variable>
+ <a href="{$link_sub}"
+
onMouseOver="overlib('{$lang_sub_help}', CAPTION, '{$lang_sub}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="voucher_id"/></a>
+ </td>
+ <td align="right">
+ <xsl:variable
name="lang_payment_date"><xsl:value-of
select="lang_payment_date"/></xsl:variable>
+ <xsl:variable
name="payment_date"><xsl:value-of select="payment_date"/></xsl:variable>
+ <a href="javascript:void()"
+ onMouseOver="overlib('{$payment_date}',
CAPTION, '{$lang_payment_date}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="voucher_date"/></a>
+ </td>
+ <td align="right">
+ <xsl:value-of select="num_days"/>
+ </td>
+ <td align="right">
+ <xsl:value-of select="amount"/>
+ </td>
+ <td align="right">
+ <xsl:variable
name="vendor"><xsl:value-of select="vendor"/></xsl:variable>
+ <xsl:variable
name="vendor_id"><xsl:value-of select="vendor_id"/></xsl:variable>
+ <a href="javascript:void()"
+ onMouseOver="overlib('{$vendor}',
CAPTION, '{$vendor_id}')"
+ onMouseOut="nd()">
+ <xsl:value-of select="vendor_id"/></a>
+
+ </td>
+ <td align="right">
+ <xsl:value-of select="invoice_count"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="type"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="jan_date"/> -
<xsl:value-of select="janitor"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="super_date"/> -
<xsl:value-of select="supervisor"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="budget_date"/> -
<xsl:value-of select="budget_responsible"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="transfer_date"/>
- <xsl:value-of select="transfer_id"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+
+<!-- consume -->
+
+ <xsl:template match="consume">
+ <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
+ <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
+
+ <script language="JavaScript">
+ self.name="first_Window";
+ function abook()
+ {
+ Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ function property_lookup()
+ {
+ Window1=window.open('<xsl:value-of
select="property_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ </script>
+
+ <xsl:call-template name="menu"/>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <div align="left">
+ <form method="post" name="form" action="{$form_action}">
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td>
+ <input type="text" id="start_date"
name="start_date" size="10" value="{start_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_start_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="start_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_start"/>
+ </script>
+ </td>
+ <td>
+ <input type="text" id="end_date"
name="end_date" size="10" value="{end_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_end_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="end_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_end"/>
+ </script>
+ </td>
+ <td>
+ <input type="text" size="8"
name="workorder_id" value="{workorder_id}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_workorder_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:void()"
+
onMouseOver="overlib('{lang_workorder_statustext}', CAPTION,
'{lang_workorder}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_workorder"/></a>
+ </td>
+
+ <td align="left">
+ <input type="text" name="vendor_id"
onClick="abook()" value="{vendor_id}" size="4"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:abook()"
+
onMouseOver="overlib('{lang_select_vendor_statustext}', CAPTION,
'{lang_vendor}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_vendor"/></a>
+
+ <input type="hidden" name="vendor_name"
value="{vendor_name}"></input>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <xsl:call-template name="cat_select"/>
+ </td>
+ <td align="left">
+ <xsl:call-template
name="select_district"/>
+ </td>
+ <td align="left">
+ <xsl:variable
name="lang_account_class_statustext"><xsl:value-of
select="lang_account_class_statustext"/></xsl:variable>
+ <xsl:variable
name="select_account_class_name"><xsl:value-of
select="select_account_class_name"/></xsl:variable>
+ <select
name="{$select_account_class_name}" class="forms"
onMouseover="window.status='{$lang_account_class_statustext}'; return true;"
onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_account_class_"/></option>
+ <xsl:apply-templates
select="account_class_list"/>
+ </select>
+
+ </td>
+
+ <td align="left">
+ <input type="text" name="loc1"
onClick="property_lookup()" value="{loc1}" size="4"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_property_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <a href="javascript:property_lookup()"
+
onMouseOver="overlib('{lang_select_property_statustext}', CAPTION,
'{lang_property}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_property"/></a>
+
+ <input type="hidden"
name="loc1_name"></input>
+ </td>
+ <td align="left">
+ <xsl:variable
name="lang_search"><xsl:value-of select="lang_search"/></xsl:variable>
+ <input type="submit"
name="submit_search" value="{$lang_search}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_search_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="vendor_name!=''">
+ <tr>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="lang_vendor"/>
+ </td>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="vendor_name"/>
+ </td>
+ <td width="50%">
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="loc1!=''">
+ <tr>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="lang_property"/>
+ </td>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="loc1"/>
+ </td>
+ <td width="50%">
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="workorder_id!=''">
+ <tr>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="lang_workorder"/>
+ </td>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="workorder_id"/>
+ </td>
+ <td width="50%">
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
+ </table>
+
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:apply-templates select="table_header_consume"/>
+
+ <xsl:choose>
+ <xsl:when test="values_consume[consume]">
+ <xsl:apply-templates
select="values_consume"/>
+
+ </xsl:when>
+ </xsl:choose>
+ <tr>
+ <td>
+ </td>
+ <td>
+ </td>
+ <td class="th_text" align="right">
+ <xsl:value-of select="lang_sum"/>
+ </td>
+ <td class="th_text" align="right">
+ <xsl:value-of select="sum"/>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+ <xsl:template match="account_class_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="table_header_consume">
+ <tr class="th">
+ <td class="th_text" width="10%" align="right">
+ <xsl:value-of select="lang_district"/>
+ </td>
+ <td class="th_text" width="10%" align="right">
+ <xsl:value-of select="lang_period"/>
+ </td>
+ <td class="th_text" width="25%" align="right">
+ <xsl:value-of
select="lang_budget_account"/>
+ </td>
+ <td class="th_text" width="55%" align="right">
+ <xsl:value-of select="lang_consume"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_consume">
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <xsl:value-of select="district_id"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="period"/>
+ </td>
+ <td align="center">
+ <xsl:value-of select="account_class"/>
+ </td>
+ <td align="right">
+ <xsl:value-of select="consume"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+<!-- debug-->
+
+ <xsl:template match="debug">
+ <div align="left">
+ <table width="50%" cellpadding="2" cellspacing="2"
align="center">
+
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_bilagsnr"/>
+ </td>
+ <td>
+ <xsl:value-of select="bilagsnr"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_type"/>
+ </td>
+ <td>
+ <xsl:value-of select="artid"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_vendor"/>
+ </td>
+ <td>
+ <xsl:value-of select="spvend_code"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="vendor_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of
select="lang_fakturadato"/>
+ </td>
+ <td>
+ <xsl:value-of select="fakturadato"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of
select="lang_forfallsdato"/>
+ </td>
+ <td>
+ <xsl:value-of select="forfallsdato"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_janitor"/>
+ </td>
+ <td>
+ <xsl:value-of select="oppsynsmannid"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_supervisor"/>
+ </td>
+ <td>
+ <xsl:value-of select="saksbehandlerid"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of
select="lang_budget_responsible"/>
+ </td>
+ <td>
+ <xsl:value-of
select="budsjettansvarligid"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_project_id"/>
+ </td>
+ <td>
+ <xsl:value-of select="project_id"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text">
+ <xsl:value-of select="lang_sum"/>
+ </td>
+ <td>
+ <xsl:value-of select="sum"/>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <tr class="th">
+ <xsl:call-template name="table_header"/>
+ </tr>
+ <xsl:call-template name="values_debug"/>
+ <xsl:apply-templates select="table_add"/>
+ </table>
+ </xsl:template>
+
+ <xsl:template name="values_debug">
+ <xsl:for-each select="values" >
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod 2 = 0">
+ <xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:for-each select="row" >
+ <td align="{align}">
+ <xsl:value-of select="value"/>
+ </td>
+ </xsl:for-each>
+ </tr>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template match="table_add">
+ <tr>
+ <td height="50">
+ <xsl:variable
name="add_action"><xsl:value-of select="add_action"/></xsl:variable>
+ <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
+ <form method="post"
action="{$add_action}">
+ <input type="submit" name="add"
value="{$lang_add}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_add_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ <td height="50">
+ <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+ <form method="post"
action="{$cancel_action}">
+ <input type="submit"
name="cancel" value="{$lang_cancel}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_cancel_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </xsl:template>
+
+<!-- add / edit -->
+ <xsl:template match="add">
+
+ <script language="JavaScript">
+ self.name="first_Window";
+ function abook()
+ {
+ Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ </script>
+
+ <xsl:call-template name="menu"/>
+ <div align="left">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <tr>
+ <td colspan="2" align="center">
+ <xsl:value-of select="message"/>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" name="form" action="{$form_action}">
+
+ <tr>
+ <td>
+ <xsl:value-of select="lang_auto_tax"/>
+ </td>
+ <td>
+ <input type="checkbox" name="auto_tax"
value="True" checked="checked" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_auto_tax_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <xsl:call-template name="location_form"/>
+ <xsl:call-template name="b_account_form"/>
+ <tr>
+ <td valign="top">
+ <xsl:variable
name="lang_vendor"><xsl:value-of select="lang_vendor"/></xsl:variable>
+ <input type="button" name="convert"
value="{$lang_vendor}" onClick="abook();" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_select_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ <td>
+ <input type="text" name="vendor_id"
value="{value_vendor_id}" size="4" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <input type="text" name="vendor_name"
value="{value_vendor_name}" size="20" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_name_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_janitor"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_janitor_statustext"><xsl:value-of
select="lang_janitor_statustext"/></xsl:variable>
+ <xsl:variable
name="select_janitor"><xsl:value-of select="select_janitor"/></xsl:variable>
+ <select name="{$select_janitor}"
class="forms" onMouseover="window.status='{$lang_janitor_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_janitor"/></option>
+ <xsl:apply-templates
select="janitor_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_supervisor"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_supervisor_statustext"><xsl:value-of
select="lang_supervisor_statustext"/></xsl:variable>
+ <xsl:variable
name="select_supervisor"><xsl:value-of
select="select_supervisor"/></xsl:variable>
+ <select name="{$select_supervisor}"
class="forms" onMouseover="window.status='{$lang_supervisor_statustext}';
return true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_supervisor"/></option>
+ <xsl:apply-templates
select="supervisor_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_budget_responsible"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_budget_responsible_statustext"><xsl:value-of
select="lang_budget_responsible_statustext"/></xsl:variable>
+ <xsl:variable
name="select_budget_responsible"><xsl:value-of
select="select_budget_responsible"/></xsl:variable>
+ <select
name="{$select_budget_responsible}" class="forms"
onMouseover="window.status='{$lang_budget_responsible_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_budget_responsible"/></option>
+ <xsl:apply-templates
select="budget_responsible_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_order"/>
+ </td>
+ <td>
+ <input type="text" name="order"
value="{value_order}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_order_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_art"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_art_statustext"><xsl:value-of
select="lang_art_statustext"/></xsl:variable>
+ <xsl:variable
name="select_art"><xsl:value-of select="select_art"/></xsl:variable>
+ <select name="{$select_art}"
class="forms" onMouseover="window.status='{$lang_art_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_art"/></option>
+ <xsl:apply-templates
select="art_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_type"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_type_statustext"><xsl:value-of
select="lang_type_statustext"/></xsl:variable>
+ <xsl:variable
name="select_type"><xsl:value-of select="select_type"/></xsl:variable>
+ <select name="{$select_type}"
class="forms" onMouseover="window.status='{$lang_type_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_type"/></option>
+ <xsl:apply-templates
select="type_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_dimb"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_dimb_statustext"><xsl:value-of
select="lang_dimb_statustext"/></xsl:variable>
+ <xsl:variable
name="select_dimb"><xsl:value-of select="select_dimb"/></xsl:variable>
+ <select name="{$select_dimb}"
class="forms" onMouseover="window.status='{$lang_dimb_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_dimb"/></option>
+ <xsl:apply-templates
select="dimb_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_invoice_number"/>
+ </td>
+ <td>
+ <input type="text" name="invoice_num"
value="{value_invoice_num}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_invoice_num_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_kidnr"/>
+ </td>
+ <td>
+ <input type="text" name="kid_nr"
value="{value_kid_nr}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_kid_nr_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_amount"/>
+ </td>
+ <td>
+ <input type="text" name="amount"
value="{value_amount}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_amount_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_invoice_date"/>
+ </td>
+ <td>
+ <input type="text" id="invoice_date"
name="invoice_date" size="10" value="{value_invoice_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_invoice_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="invoice_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_invoice"/>
+ </script>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_no_of_days"/>
+ </td>
+ <td>
+ <input type="text" name="num_days"
value="{value_num_days}" size="4" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_num_days_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+
+ <tr>
+
+ <td valign="top">
+ <xsl:value-of
select="lang_payment_date"/>
+ </td>
+ <td>
+ <input type="text" id="payment_date"
name="payment_date" size="10" value="{value_payment_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_payment_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="payment_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_payment"/>
+ </script>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_merknad"/>
+ </td>
+ <td>
+ <textarea cols="60" rows="10"
name="merknad" wrap="virtual" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_merknad_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ <xsl:value-of
select="value_merknad"/>
+ </textarea>
+
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_add"><xsl:value-of select="lang_add"/></xsl:variable>
+ <input type="submit" name="add_invoice"
value="{$lang_add}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_add_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+ <form method="post"
action="{$cancel_action}">
+ <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_cancel_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+<!-- import -->
+
+ <xsl:template match="import">
+
+ <script language="JavaScript">
+ self.name="first_Window";
+ function abook()
+ {
+ Window1=window.open('<xsl:value-of
select="addressbook_link"/>',"Search","width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+ }
+ </script>
+
+ <xsl:call-template name="menu"/>
+ <div align="left">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <tr>
+ <td colspan="2" align="center">
+ <xsl:value-of select="message"/>
+ </td>
+ </tr>
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form ENCTYPE="multipart/form-data" method="post"
name="form" action="{$form_action}">
+
+ <tr>
+ <td>
+ <xsl:value-of select="lang_auto_tax"/>
+ </td>
+ <td>
+ <input type="checkbox" name="auto_tax"
value="True" checked="checked" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_auto_tax_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_art"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_art_statustext"><xsl:value-of
select="lang_art_statustext"/></xsl:variable>
+ <xsl:variable
name="select_art"><xsl:value-of select="select_art"/></xsl:variable>
+ <select name="{$select_art}"
class="forms" onMouseover="window.status='{$lang_art_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_art"/></option>
+ <xsl:apply-templates
select="art_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_type"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_type_statustext"><xsl:value-of
select="lang_type_statustext"/></xsl:variable>
+ <xsl:variable
name="select_type"><xsl:value-of select="select_type"/></xsl:variable>
+ <select name="{$select_type}"
class="forms" onMouseover="window.status='{$lang_type_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_type"/></option>
+ <xsl:apply-templates
select="type_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_dimb"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_dimb_statustext"><xsl:value-of
select="lang_dimb_statustext"/></xsl:variable>
+ <xsl:variable
name="select_dimb"><xsl:value-of select="select_dimb"/></xsl:variable>
+ <select name="{$select_dimb}"
class="forms" onMouseover="window.status='{$lang_dimb_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_dimb"/></option>
+ <xsl:apply-templates
select="dimb_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_invoice_number"/>
+ </td>
+ <td>
+ <input type="text" name="invoice_num"
value="{value_invoice_num}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_invoice_num_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_kidnr"/>
+ </td>
+ <td>
+ <input type="text" name="kid_nr"
value="{value_kid_nr}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_kid_nr_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:variable
name="lang_vendor"><xsl:value-of select="lang_vendor"/></xsl:variable>
+ <input type="button" name="convert"
value="{$lang_vendor}" onClick="abook();" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_select_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ <td>
+ <input type="text" name="vendor_id"
value="{value_vendor_id}" size="6" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ <input type="text" name="vendor_name"
value="{value_vendor_name}" size="20" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_vendor_name_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_janitor"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_janitor_statustext"><xsl:value-of
select="lang_janitor_statustext"/></xsl:variable>
+ <xsl:variable
name="select_janitor"><xsl:value-of select="select_janitor"/></xsl:variable>
+ <select name="{$select_janitor}"
class="forms" onMouseover="window.status='{$lang_janitor_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_janitor"/></option>
+ <xsl:apply-templates
select="janitor_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_supervisor"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_supervisor_statustext"><xsl:value-of
select="lang_supervisor_statustext"/></xsl:variable>
+ <xsl:variable
name="select_supervisor"><xsl:value-of
select="select_supervisor"/></xsl:variable>
+ <select name="{$select_supervisor}"
class="forms" onMouseover="window.status='{$lang_supervisor_statustext}';
return true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_supervisor"/></option>
+ <xsl:apply-templates
select="supervisor_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_budget_responsible"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_budget_responsible_statustext"><xsl:value-of
select="lang_budget_responsible_statustext"/></xsl:variable>
+ <xsl:variable
name="select_budget_responsible"><xsl:value-of
select="select_budget_responsible"/></xsl:variable>
+ <select
name="{$select_budget_responsible}" class="forms"
onMouseover="window.status='{$lang_budget_responsible_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_budget_responsible"/></option>
+ <xsl:apply-templates
select="budget_responsible_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_invoice_date"/>
+ </td>
+ <td>
+ <input type="text" id="invoice_date"
name="invoice_date" size="10" value="{value_invoice_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_invoice_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="invoice_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_invoice"/>
+ </script>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_no_of_days"/>
+ </td>
+ <td>
+ <input type="text" name="num_days"
value="{value_num_days}" size="4" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_num_days_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+
+ <tr>
+
+ <td valign="top">
+ <xsl:value-of
select="lang_payment_date"/>
+ </td>
+ <td>
+ <input type="text" id="payment_date"
name="payment_date" size="10" value="{value_payment_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_payment_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="payment_date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of
select="calendar_setup_payment"/>
+ </script>
+ </td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_file"/>
+ </td>
+ <td>
+ <input type="file" name="tsvfile"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_file_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of select="lang_conv"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
+ <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
+ <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_conversion"/></option>
+ <xsl:apply-templates
select="conv_list"/>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <xsl:value-of select="lang_debug"/>
+ </td>
+ <td>
+ <input type="checkbox" name="download"
value="True" checked="checked" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_debug_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_import"><xsl:value-of select="lang_import"/></xsl:variable>
+ <input type="submit" name="convert"
value="{$lang_import}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_import_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+ <form method="post"
action="{$cancel_action}">
+ <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_cancel_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+<!-- art_list -->
+
+ <xsl:template match="art_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- type_list -->
+
+ <xsl:template match="type_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- dimb_list -->
+
+ <xsl:template match="dimb_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="num"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="num"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+<!-- janitor_list -->
+
+ <xsl:template match="janitor_list">
+ <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- supervisor_list -->
+
+ <xsl:template match="supervisor_list">
+ <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- budget_responsible_list -->
+
+ <xsl:template match="budget_responsible_list">
+ <xsl:variable name="lid"><xsl:value-of select="lid"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$lid}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="firstname"/> <xsl:value-of select="lastname"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$lid}"><xsl:value-of
disable-output-escaping="yes" select="firstname"/> <xsl:value-of
select="lastname"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+<!-- conv_list -->
+
+ <xsl:template match="conv_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- rollback_file_list -->
+
+ <xsl:template match="rollback_file_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="name"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="name"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- tax_code_list -->
+
+ <xsl:template match="tax_code_list">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+<!-- export -->
+
+ <xsl:template match="export">
+ <xsl:call-template name="menu"/>
+ <div align="left">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" name="form" action="{$form_action}">
+
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_select_conv"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
+ <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
+ <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_conv"/></option>
+ <xsl:apply-templates
select="conv_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_force_period_year"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_force_period_year_statustext"><xsl:value-of
select="lang_force_period_year_statustext"/></xsl:variable>
+ <select
name="values[force_period_year]" class="forms"
onMouseover="window.status='{$lang_force_period_year_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_year"/></option>
+ <xsl:apply-templates
select="force_period_year"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of
select="lang_export_to_file"/>
+ </td>
+ <td>
+ <input type="checkbox"
name="values[download]" value="on" checked="checked"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_debug_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ </td>
+ <td>
+ <xsl:variable
name="link_rollback_file"><xsl:value-of
select="link_rollback_file"/></xsl:variable>
+ <a
href="{$link_rollback_file}"><xsl:value-of select="lang_rollback_file"/></a>
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_submit"><xsl:value-of select="lang_submit"/></xsl:variable>
+ <input type="submit"
name="values[submit]" value="{$lang_submit}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_import_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+ <form method="post"
action="{$cancel_action}">
+ <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_cancel_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+
+<!-- rollback -->
+
+ <xsl:template match="rollback">
+ <xsl:call-template name="menu"/>
+ <div align="left">
+ <table cellpadding="2" cellspacing="2" width="80%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" name="form" action="{$form_action}">
+
+
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_select_conv"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_conv_statustext"><xsl:value-of
select="lang_conv_statustext"/></xsl:variable>
+ <xsl:variable
name="select_conv"><xsl:value-of select="select_conv"/></xsl:variable>
+ <select name="{$select_conv}"
class="forms" onMouseover="window.status='{$lang_conv_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_conv"/></option>
+ <xsl:apply-templates
select="conv_list"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_select_file"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_file_statustext"><xsl:value-of
select="lang_file_statustext"/></xsl:variable>
+ <xsl:variable
name="select_file"><xsl:value-of select="select_file"/></xsl:variable>
+ <select name="{$select_file}"
class="forms" onMouseover="window.status='{$lang_file_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_no_file"/></option>
+ <xsl:apply-templates
select="rollback_file_list"/>
+ </select>
+ </td>
+ </tr>
+
+
+ <tr>
+
+ <td valign="top">
+ <xsl:value-of select="lang_date"/>
+ </td>
+ <td>
+ <input type="text" id="date"
name="date" size="10" value="{value_date}" readonly="readonly"
onMouseout="window.status='';return true;" >
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_date_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+
+ <script type="text/javascript">
+ document.writeln('<img
id="date-trigger" src="{date_img}" title="{lang_datetitle}"
style="cursor:pointer; cursor:hand;"/>');
+ <xsl:value-of select="calendar_setup"/>
+ </script>
+ </td>
+ </tr>
+
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_submit"><xsl:value-of select="lang_submit"/></xsl:variable>
+ <input type="submit"
name="values[submit]" value="{$lang_submit}"
onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+ <xsl:value-of
select="lang_import_statustext"/>
+ <xsl:text>'; return
true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="cancel_action"><xsl:value-of select="cancel_action"/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="lang_cancel"/></xsl:variable>
+ <form method="post"
action="{$cancel_action}">
+ <input type="submit"
name="done" value="{$lang_cancel}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_cancel_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </xsl:template>
+
+
+<!--list_invoice_sub-->
+
+ <xsl:template match="list_invoice_sub">
+ <div id="overDiv" style="position:absolute;
visibility:hide;z-index:1;"></div>
+ <xsl:variable name="overlib_source"><xsl:value-of
select="overlib_source"/></xsl:variable>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{$overlib_source}"></SCRIPT>
+ <SCRIPT LANGUAGE="JavaScript" SRC="{check_source}"></SCRIPT>
+
+ <xsl:call-template name="menu"/>
+ <table width="80%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="vendor!=''">
+ <tr>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="lang_vendor"/>
+ </td>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="vendor"/>
+ </td>
+ <td width="50%">
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="voucher_id!=''">
+ <tr>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="lang_voucher_id"/>
+ </td>
+ <td width="25%" class="th_text"
align="left">
+ <xsl:value-of
select="voucher_id"/>
+ </td>
+ <td width="50%">
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ </table>
+ <table width="100%" cellpadding="2" cellspacing="2"
align="center">
+ <xsl:variable name="form_action"><xsl:value-of
select="form_action"/></xsl:variable>
+ <form method="post" name="form" action="{$form_action}">
+ <xsl:apply-templates
select="table_header_list_invoice_sub"/>
+
+ <xsl:choose>
+ <xsl:when test="values_list_invoice_sub[id]">
+ <xsl:apply-templates
select="values_list_invoice_sub"/>
+ <xsl:variable
name="img_check"><xsl:value-of select="img_check"/></xsl:variable>
+ <tr>
+ <td></td>
+ <td align="center">
+ <a
href="javascript:check_all_checkbox('values[close_order]')"><img
src="{$img_check}" border="0" height="16" width="21"
alt="{lang_select_all}"/></a>
+ </td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td class="small_text"
align="right">
+ <xsl:value-of
select="sum"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <tr height="50">
+ <td>
+ <xsl:choose>
+ <xsl:when test="paid=''">
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_save_statustext"/>
+
<xsl:text>'; return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </xsl:when>
+ </xsl:choose>
+ </td>
+ </tr>
+ </form>
+ <tr>
+ <td>
+ <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
+ <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
+ <form method="post"
action="{$done_action}">
+ <input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
+ <xsl:attribute
name="onMouseover">
+
<xsl:text>window.status='</xsl:text>
+
<xsl:value-of select="lang_done_statustext"/>
+ <xsl:text>';
return true;</xsl:text>
+ </xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </tr>
+
+ </table>
+ </xsl:template>
+
+ <xsl:template match="table_header_list_invoice_sub">
+ <xsl:variable name="sort_workorder"><xsl:value-of
select="sort_workorder"/></xsl:variable>
+ <xsl:variable name="sort_budget_account"><xsl:value-of
select="sort_budget_account"/></xsl:variable>
+ <xsl:variable name="sort_sum"><xsl:value-of
select="sort_sum"/></xsl:variable>
+ <xsl:variable name="sort_dima"><xsl:value-of
select="sort_dima"/></xsl:variable>
+ <tr class="th">
+ <td class="th_text" width="5%" align="right">
+ <a
href="{$sort_workorder}"><xsl:value-of select="lang_workorder"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of
select="lang_close_order"/>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of
select="lang_charge_tenant"/>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_invoice_id"/>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <a
href="{$sort_budget_account}"><xsl:value-of select="lang_budget_account"/></a>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <a href="{$sort_sum}"><xsl:value-of
select="lang_sum"/></a>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <a href="{$sort_dima}"><xsl:value-of
select="lang_dima"/></a>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_dimb"/>
+ </td>
+ <td class="th_text" width="5%" align="right">
+ <xsl:value-of select="lang_dimd"/>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_tax_code"/>
+ </td>
+ <td class="th_text" width="2%" align="right">
+ <xsl:value-of select="lang_remark"/>
+ </td>
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="values_list_invoice_sub">
+
+ <xsl:variable name="counter"><xsl:value-of
select="counter"/></xsl:variable>
+ <xsl:variable name="current_user"><xsl:value-of
select="current_user"/></xsl:variable>
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="@class">
+ <xsl:value-of
select="@class"/>
+ </xsl:when>
+ <xsl:when test="position() mod
2 = 0">
+
<xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <td align="right">
+ <input type="hidden"
name="values[counter][{$counter}]" value="{counter}">
+ </input>
+ <input type="hidden"
name="values[id][{$counter}]" value="{id}">
+ </input>
+ <input type="hidden"
name="values[workorder_id][{$counter}]" value="{workorder_id}">
+ </input>
+ <xsl:variable
name="link_order"><xsl:value-of
select="link_order"/>&order_id=<xsl:value-of
select="workorder_id"/></xsl:variable>
+ <a href="{$link_order}"
target="_blank"><xsl:value-of select="workorder_id"/></a>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when
test="workorder_id=''">
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when
test="paid=''">
+ <input
type="hidden" name="values[close_order_orig][{$counter}]" value="{closed}">
+ </input>
+
<xsl:choose>
+
<xsl:when test="closed='1'">
+
<input type="checkbox" name="values[close_order][{$counter}]"
value="true" checked="checked" onMouseout="window.status='';return true;">
+
</input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type="checkbox" name="values[close_order][{$counter}]"
value="true" onMouseout="window.status='';return true;">
+
</input>
+
</xsl:otherwise>
+
</xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:choose>
+
<xsl:when test="closed='1'">
+
<b>x</b>
+
</xsl:when>
+
</xsl:choose>
+
</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when
test="charge_tenant='1'">
+ <xsl:choose>
+ <xsl:when
test="claim_issued=''">
+
<xsl:variable name="link_claim"><xsl:value-of
select="link_claim"/>&project_id=<xsl:value-of
select="project_id"/></xsl:variable>
+ <a
href="{$link_claim}" target="_blank"><xsl:value-of select="//lang_claim"/></a>
+ </xsl:when>
+ </xsl:choose>
+ <b>x</b>
+ </xsl:when>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:value-of select="invoice_id"/>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:choose>
+ <xsl:when test="paid='true'">
+ <xsl:value-of
select="budget_account"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="text"
size="7" name="values[budget_account][{$counter}]" value="{budget_account}">
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:value-of select="amount"/>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when test="paid='true'">
+ <xsl:value-of
select="dima"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="text"
size="7" name="values[dima][{$counter}]" value="{dima}">
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:value-of select="dimb"/>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when test="paid='true'">
+ <xsl:value-of
select="dimd"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="text"
size="4" name="values[dimd][{$counter}]" value="{dimd}">
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="center">
+ <xsl:choose>
+ <xsl:when test="paid='true'">
+ <xsl:value-of
select="tax_code"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
name="lang_tax_code_statustext"><xsl:value-of
select="lang_tax_code_statustext"/></xsl:variable>
+ <select
name="values[tax_code][{$counter}]" class="forms"
onMouseover="window.status='{$lang_tax_code_statustext}'; return true;"
onMouseout="window.status='';return true;">
+
<xsl:apply-templates select="tax_code_list"/>
+ </select>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td class="small_text" align="right">
+ <xsl:choose>
+ <xsl:when test="remark='1'">
+ <xsl:variable
name="link_remark"><xsl:value-of select="link_remark"/>&id=<xsl:value-of
select="id"/>&paid=<xsl:value-of select="paid"/></xsl:variable>
+ <xsl:variable
name="lang_remark_help"><xsl:value-of select="lang_remark_help"/></xsl:variable>
+ <xsl:variable
name="lang_remark"><xsl:value-of select="lang_remark"/></xsl:variable>
+ <a href="javascript:var
w=window.open('{$link_remark}','','width=550,height=400,scrollbars')"
+
onMouseOver="overlib('{$lang_remark_help}', CAPTION, '{$lang_remark}')"
+ onMouseOut="nd()">
+ <xsl:value-of
select="lang_remark"/></a>
+ </xsl:when>
+ </xsl:choose>
+ </td>
+
+ </tr>
+ </xsl:template>
+
+ <xsl:template match="force_period_year">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected='selected'">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property inc/class.boXport.inc.php inc/class.bo...,
Sigurd Nes <=