[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16094] more on rental
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16094] more on rental |
Date: |
Sat, 17 Dec 2016 16:00:30 +0000 (UTC) |
Revision: 16094
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16094
Author: sigurdne
Date: 2016-12-17 16:00:30 +0000 (Sat, 17 Dec 2016)
Log Message:
-----------
more on rental
Modified Paths:
--------------
trunk/admin/inc/class.ui_custom.inc.php
trunk/admin/templates/base/custom.xsl
trunk/eventplanner/inc/class.bocommon.inc.php
trunk/eventplanner/inc/class.uivendor_report.inc.php
trunk/phpgwapi/inc/class.socommon.inc.php
trunk/phpgwapi/inc/model/class.model.inc.php
trunk/rental/inc/class.bomoveout.inc.php
trunk/rental/inc/class.menu.inc.php
trunk/rental/inc/class.somoveout.inc.php
trunk/rental/inc/class.uimoveout.inc.php
trunk/rental/inc/model/class.moveout.inc.php
trunk/rental/setup/phpgw_no.lang
trunk/rental/setup/setup.inc.php
trunk/rental/setup/tables_current.inc.php
trunk/rental/setup/tables_update.inc.php
trunk/rental/templates/base/moveout.xsl
Modified: trunk/admin/inc/class.ui_custom.inc.php
===================================================================
--- trunk/admin/inc/class.ui_custom.inc.php 2016-12-17 11:09:13 UTC (rev
16093)
+++ trunk/admin/inc/class.ui_custom.inc.php 2016-12-17 16:00:30 UTC (rev
16094)
@@ -61,7 +61,7 @@
$this->bolocation->acl_app = $this->appname;
$this->acl = &
$GLOBALS['phpgw']->acl;
- $this->acl_location = 'admin';
+ $this->acl_location = '.admin';
$this->acl_read =
$this->acl->check($this->acl_location, PHPGW_ACL_READ, $this->appname);
$this->acl_add =
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, $this->appname);
$this->acl_edit =
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, $this->appname);
@@ -96,6 +96,11 @@
function list_attribute()
{
+ if(!$this->acl_read)
+ {
+ phpgw::no_access($this->appname);
+ }
+
$appname = $this->appname;
$location = $this->location;
$id = phpgw::get_var('id', 'int');
@@ -259,6 +264,11 @@
function edit_attrib()
{
+ if(!$this->acl_add)
+ {
+ phpgw::no_access($this->appname);
+ }
+
$appname = $this->appname;
$location = $this->location;
$id = phpgw::get_var('id', 'int');
@@ -477,6 +487,11 @@
function list_custom_function()
{
+ if(!$this->acl_read)
+ {
+ phpgw::no_access($this->appname);
+ }
+
if($this->local_menu_selection)
{
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::list_functions';
@@ -663,7 +678,12 @@
function edit_custom_function()
{
- // $GLOBALS['phpgw_info']['flags']['menu_selection'] .=
'::list_functions';
+ if(!$this->acl_add)
+ {
+ phpgw::no_access($this->appname);
+ }
+
+ //
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::list_functions';
$appname = $this->appname;
$location = $this->location;
$id = phpgw::get_var('id', 'int');
@@ -782,6 +802,11 @@
function delete()
{
+ if(!$this->acl_delete)
+ {
+ phpgw::no_access($this->appname);
+ }
+
$appname =
phpgw::get_var('appname');
$location =
phpgw::get_var('location');
$attrib_id =
phpgw::get_var('attrib_id', 'int');
@@ -1270,6 +1295,10 @@
public function query($data = array())
{
+ if(!$this->acl_read)
+ {
+ phpgw::no_access($this->appname);
+ }
$search = phpgw::get_var('search');
$order = phpgw::get_var('order');
Modified: trunk/admin/templates/base/custom.xsl
===================================================================
--- trunk/admin/templates/base/custom.xsl 2016-12-17 11:09:13 UTC (rev
16093)
+++ trunk/admin/templates/base/custom.xsl 2016-12-17 16:00:30 UTC (rev
16094)
@@ -286,7 +286,7 @@
<xsl:value-of
select="php:function('lang', 'column name')" />
</td>
<td>
- <input type="text"
name="values[column_name]" value="{value_column_name}" maxlength="20">
+ <input type="text"
name="values[column_name]" value="{value_column_name}" maxlength="50">
<xsl:attribute
name="title">
<xsl:value-of
select="php:function('lang', 'enter the name for the column')" />
</xsl:attribute>
Modified: trunk/eventplanner/inc/class.bocommon.inc.php
===================================================================
--- trunk/eventplanner/inc/class.bocommon.inc.php 2016-12-17 11:09:13 UTC
(rev 16093)
+++ trunk/eventplanner/inc/class.bocommon.inc.php 2016-12-17 16:00:30 UTC
(rev 16094)
@@ -104,6 +104,9 @@
}
}
}
+ $values_attribute = phpgw::get_var('values_attribute');
+ $object->set_field( 'values_attribute',
$values_attribute);
+
return $object;
}
Modified: trunk/eventplanner/inc/class.uivendor_report.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uivendor_report.inc.php 2016-12-17
11:09:13 UTC (rev 16093)
+++ trunk/eventplanner/inc/class.uivendor_report.inc.php 2016-12-17
16:00:30 UTC (rev 16094)
@@ -45,7 +45,8 @@
protected
$fields,
- $permissions;
+ $permissions,
+ $custom_fields;
public function __construct()
{
Modified: trunk/phpgwapi/inc/class.socommon.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.socommon.inc.php 2016-12-17 11:09:13 UTC (rev
16093)
+++ trunk/phpgwapi/inc/class.socommon.inc.php 2016-12-17 16:00:30 UTC (rev
16094)
@@ -1,4 +1,5 @@
<?php
+
/**
* phpGroupWare
*
@@ -10,23 +11,22 @@
* @subpackage phpgwapi
* @version $Id: class.custom_fields.inc.php 15409 2016-08-03 11:52:23Z
sigurdne $
*/
-
/*
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
- abstract class phpgwapi_socommon
+ abstract class phpgwapi_socommon
{
protected $db;
@@ -41,7 +41,7 @@
protected static $so;
protected $table_name;
- public function __construct($table_name, $fields)
+ public function __construct( $table_name, $fields )
{
$this->db = & $GLOBALS['phpgw']->db;
$this->db2 = clone($GLOBALS['phpgw']->db);
@@ -77,7 +77,7 @@
/**
* Rollback the current transaction
*
- * @return bool True if sucessful, False if fails
+ * @return bool True if successful, False if fails
*/
public function transaction_abort()
{
@@ -173,7 +173,6 @@
*/
public abstract static function get_instance();
-
/**
* Method for retrieving the db-object (security "forgotten")
*/
@@ -340,7 +339,7 @@
return $this->table_name . '.id=' . $id_value;
}
- function read_single( $id, $return_object = false)
+ function read_single( $id, $return_object = false )
{
if (!$id && !$return_object)
{
@@ -416,7 +415,7 @@
}
}
}
- if($return_object)
+ if ($return_object)
{
return $this->populate($row);
}
@@ -426,7 +425,6 @@
}
}
-
function _get_conditions( $query, $filters )
{
$clauses = array('1=1');
@@ -484,7 +482,7 @@
}
else
{
- $_column =
$this->fields[$key]['join'] ? $this->fields[$key]['join']['column'] : $key;
+ $_column =
$this->fields[$key]['join'] ? $this->fields[$key]['join']['column'] : $key;
$clauses[] =
"{$table}.{$_column}=" . $this->marshal($val, $this->fields[$key]['type']);
}
}
@@ -544,7 +542,6 @@
return array($cols, $joins);
}
-
/**
* Implementing classes must return the name of the field used
in the query
* returned from get_query().
@@ -558,7 +555,6 @@
protected abstract function populate( array $data );
-
protected function add( &$object )
{
$object->entry_date = time();
@@ -566,14 +562,11 @@
$fields = $object::get_fields();
- foreach ($fields as $field => $field_info)
+ foreach ($fields as $field => $field_info)
{
- if(($field_info['action'] & PHPGW_ACL_ADD)
- && empty($field_info['join'])
- && empty($field_info['related'])
- && empty($field_info['manytomany']))
+ if (($field_info['action'] & PHPGW_ACL_ADD) &&
empty($field_info['join']) && empty($field_info['related']) &&
empty($field_info['manytomany']))
{
- if($field_info['type'] == 'json')
+ if ($field_info['type'] == 'json')
{
$value_set[$field] =
json_encode($object->$field);
}
@@ -583,8 +576,25 @@
}
}
}
-
- $sql = "INSERT INTO {$this->table_name} (".
implode(',', array_keys($value_set))
+// $custom_fields = $object::get_custom_fields();
+ $values_attribute =
createObject('phpgwapi.custom_fields')->convert_attribute_save($object->values_attribute);
+
+ if ( $values_attribute)
+ {
+ foreach ($values_attribute as $attrib_id =>
$entry)
+ {
+ if ($entry['value'])
+ {
+ if ($entry['datatype'] == 'C'
|| $entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype']
== 'link')
+ {
+ $entry['value'] =
$this->db->db_addslashes($entry['value']);
+ }
+ $value_set[$entry['name']] =
$entry['value'];
+ }
+ }
+ }
+
+ $sql = "INSERT INTO {$this->table_name} (" .
implode(',', array_keys($value_set))
. ') VALUES ('
.
$this->db->validate_insert(array_values($value_set))
. ')';
@@ -598,7 +608,7 @@
$this->db->transaction_begin();
}
- $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql, __LINE__, __FILE__);
$id = $this->db->get_last_insert_id($this->table_name,
'id');
$object->set_id($id);
@@ -626,12 +636,9 @@
foreach ($this->fields as $field => $field_info)
{
- if(($field_info['action'] & PHPGW_ACL_EDIT)
- && empty($field_info['join'])
- && empty($field_info['related'])
- && empty($field_info['manytomany']))
+ if (($field_info['action'] & PHPGW_ACL_EDIT) &&
empty($field_info['join']) && empty($field_info['related']) &&
empty($field_info['manytomany']))
{
- if($field_info['type'] == 'json')
+ if ($field_info['type'] == 'json')
{
$value_set[$field] =
json_encode($object->$field);
}
@@ -641,12 +648,28 @@
}
}
}
+ $values_attribute =
createObject('phpgwapi.custom_fields')->convert_attribute_save($object->values_attribute);
+ if ( $values_attribute)
+ {
+ foreach ($values_attribute as $attrib_id =>
$entry)
+ {
+ if ($entry['value'])
+ {
+ if ($entry['datatype'] == 'C'
|| $entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype']
== 'link')
+ {
+ $entry['value'] =
$this->db->db_addslashes($entry['value']);
+ }
+ $value_set[$entry['name']] =
$entry['value'];
+ }
+ }
+ }
+
$sql = "UPDATE {$this->table_name} SET "
. $this->db->validate_update($value_set)
. " WHERE id = {$id}";
- $ret1 = $this->db->query($sql,__LINE__,__FILE__);
+ $ret1 = $this->db->query($sql, __LINE__, __FILE__);
$ret2 = $this->add_manytomany($object);
@@ -681,7 +704,7 @@
$colnames = join(',',
array_keys($colnames));
$v =
$object->get_field($params['manytomany']['input_field']);
-
+
$data = array();
foreach
($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
{
@@ -705,17 +728,17 @@
}
$v = join(',', $data);
$update_query = "INSERT INTO
$table ($key, $colnames) VALUES($id, $v)";
- return
$this->db->query($update_query,__LINE__,__FILE__);
+ return
$this->db->query($update_query, __LINE__, __FILE__);
}
else
{
$colname =
$params['manytomany']['column'];
$v =
$this->marshal($object->get_field($params['manytomany']['input_field']),
$params['type']);
$update_query = "INSERT INTO
$table ($key, $colname) VALUES($id, $v)";
- return
$this->db->query($update_query,__LINE__,__FILE__);
+ return
$this->db->query($update_query, __LINE__, __FILE__);
}
}
- else if(!empty($params['manytomany']) &&
is_array($value))
+ else if (!empty($params['manytomany']) &&
is_array($value))
{
$update_queries = array();
$table = $params['manytomany']['table'];
@@ -773,7 +796,6 @@
{
$this->db->query($update_query,
__LINE__, __FILE__);
}
-
}
}
return true;
@@ -796,4 +818,4 @@
return $this->add($object);
}
}
- }
+ }
\ No newline at end of file
Modified: trunk/phpgwapi/inc/model/class.model.inc.php
===================================================================
--- trunk/phpgwapi/inc/model/class.model.inc.php 2016-12-17 11:09:13 UTC
(rev 16093)
+++ trunk/phpgwapi/inc/model/class.model.inc.php 2016-12-17 16:00:30 UTC
(rev 16094)
@@ -279,7 +279,15 @@
return $errors ? false : true;
}
+
/**
+ * Implement in subclasses
+ */
+ public function get_custom_fields()
+ {
+ return array();
+ }
+ /**
* Implement in subclasses to perform actions on entity before
validation
*/
protected function preValidate( &$entity )
Modified: trunk/rental/inc/class.bomoveout.inc.php
===================================================================
--- trunk/rental/inc/class.bomoveout.inc.php 2016-12-17 11:09:13 UTC (rev
16093)
+++ trunk/rental/inc/class.bomoveout.inc.php 2016-12-17 16:00:30 UTC (rev
16094)
@@ -101,6 +101,22 @@
$values = new rental_moveout();
}
+ $custom_fields =
rental_moveout::get_instance()->get_custom_fields();
+ if($custom_fields)
+ {
+ $custom_fields =
rental_somoveout::get_instance()->read_custom_field_values($id, $custom_fields);
+ $_values =
createObject('property.custom_fields')->prepare(array('attributes' =>
$custom_fields), 'rental', rental_moveout::acl_location, $view = false);
+
+ if($return_object)
+ {
+ $values->attributes =
$_values[attributes];
+ }
+ else
+ {
+ $values['attributes'] =
$_values[attributes];
+ }
+ }
+
return $values;
}
}
\ No newline at end of file
Modified: trunk/rental/inc/class.menu.inc.php
===================================================================
--- trunk/rental/inc/class.menu.inc.php 2016-12-17 11:09:13 UTC (rev 16093)
+++ trunk/rental/inc/class.menu.inc.php 2016-12-17 16:00:30 UTC (rev 16094)
@@ -225,6 +225,18 @@
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.ui_custom.list_custom_function',
'appname' => 'rental',
'location' => '.contract', 'menu_selection' =>
'admin::rental::custom_functions'))
),
+ 'custom_field_groups' => array
+ (
+ 'text' => lang('custom field
groups'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.ui_custom.list_attribute_group',
+ 'appname' => 'rental',
'menu_selection' => 'admin::rental::custom_field_groups'))
+ ),
+ 'custom_fields' => array
+ (
+ 'text' => lang('custom fields'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.ui_custom.list_attribute',
+ 'appname' => 'rental',
'menu_selection' => 'admin::rental::custom_fields'))
+ ),
);
$menus['folders'] =
phpgwapi_menu::get_categories('bergen');
Modified: trunk/rental/inc/class.somoveout.inc.php
===================================================================
--- trunk/rental/inc/class.somoveout.inc.php 2016-12-17 11:09:13 UTC (rev
16093)
+++ trunk/rental/inc/class.somoveout.inc.php 2016-12-17 16:00:30 UTC (rev
16094)
@@ -47,12 +47,26 @@
{
if (self::$so == null)
{
- self::$so =
CreateObject('eventplanner.socustomer');
+ self::$so = CreateObject('rental.somoveout');
}
return self::$so;
}
+ public function read_custom_field_values( $id, $custom_fields )
+ {
+ $sql = "SELECT * FROM {$this->table_name} WHERE id = "
. (int)$id;
+ $this->db->query($sql,__LINE__,__FILE__);
+ if ($this->db->next_record() &&
is_array($custom_fields))
+ {
+ foreach ($custom_fields as &$attr)
+ {
+ $attr['value'] =
$this->db->f($attr['column_name']);
+ }
+ }
+ return $custom_fields;
+ }
+
protected function populate( array $data )
{
$object = new rental_moveout();
@@ -67,7 +81,7 @@
protected function update( $object )
{
$this->db->transaction_begin();
- // $status_text = rental_moveout::get_status_list();
+ // $status_text =
rental_moveout::get_status_list();
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
$lang_active = lang('active');
$lang_inactive = lang('inactive');
@@ -94,23 +108,21 @@
break;
}
$value_set = array
- (
- 'customer_id' =>
$object->get_id(),
- 'time' => time(),
- 'author' =>
$GLOBALS['phpgw_info']['user']['fullname'],
- 'comment' => $label . '::
' . lang('old value') . ': ' . $this->db->db_addslashes($old_value) . ', '
.lang('new value') . ': ' . $this->db->db_addslashes($new_value),
- 'type' => 'history',
+ (
+ 'moveout_id' =>
$object->get_id(),
+ 'time' => time(),
+ 'author' =>
$GLOBALS['phpgw_info']['user']['fullname'],
+ 'comment' => $label . ':: ' .
lang('old value') . ': ' . $this->db->db_addslashes($old_value) . ', ' .
lang('new value') . ': ' . $this->db->db_addslashes($new_value),
+ 'type' => 'history',
);
- $this->db->query( 'INSERT INTO
rental_moveout_comment (' . implode( ',', array_keys( $value_set ) ) . ')
VALUES ('
- . $this->db->validate_insert(
array_values( $value_set ) ) . ')',__LINE__,__FILE__);
+ $this->db->query('INSERT INTO
rental_moveout_comment (' . implode(',', array_keys($value_set)) . ') VALUES ('
+ .
$this->db->validate_insert(array_values($value_set)) . ')', __LINE__, __FILE__);
}
-
}
parent::update($object);
- return $this->db->transaction_commit();
+ return $this->db->transaction_commit();
}
-
}
\ No newline at end of file
Modified: trunk/rental/inc/class.uimoveout.inc.php
===================================================================
--- trunk/rental/inc/class.uimoveout.inc.php 2016-12-17 11:09:13 UTC (rev
16093)
+++ trunk/rental/inc/class.uimoveout.inc.php 2016-12-17 16:00:30 UTC (rev
16094)
@@ -44,8 +44,10 @@
'get' => true
);
protected
+ $bo,
$fields,
- $permissions;
+ $permissions,
+ $custom_fields;
public function __construct()
{
@@ -55,6 +57,7 @@
$this->bo = createObject('rental.bomoveout');
$this->fields = rental_moveout::get_fields();
$this->permissions =
rental_moveout::get_instance()->get_permission_array();
+ $this->custom_fields =
rental_moveout::get_instance()->get_custom_fields();
}
public function index()
@@ -181,19 +184,43 @@
)
);
+
+ $custom_values = $moveout->attributes ?
$moveout->attributes : array();
+
+ foreach ($custom_values as $attrib_id => &$attrib)
+ {
+ if (isset($attrib['choice']) &&
is_array($attrib['choice']) && $attrib['value'])
+ {
+ foreach ($attrib['choice'] as &$choice)
+ {
+ if (is_array($attrib['value']))
+ {
+ $choice['selected'] =
in_array($choice['id'], $attrib['value']) ? 1 : 0;
+ }
+ else
+ {
+ $choice['selected'] =
$choice['id'] == $attrib['value'] ? 1 : 0;
+ }
+ }
+ }
+ }
+ $organized_fields =
createObject('booking.custom_fields','rental')->organize_fields(rental_moveout::acl_location,
$custom_values);
+
$data = array(
'datatable_def' => $datatable_def,
'form_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'rental.uimoveout.save')),
'cancel_url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'rental.uimoveout.index',)),
'moveout' => $moveout,
+ 'contract' =>
createObject('rental.uicontract')->get($moveout->contract_id),
'mode' => $mode,
'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
- 'value_active_tab' => $active_tab
+ 'value_active_tab' => $active_tab,
+ 'attributes_group' => $organized_fields,
);
phpgwapi_jquery::formvalidator_generate(array());
phpgwapi_jquery::load_widget('autocomplete');
self::add_javascript('rental', 'rental',
'moveout.edit.js');
- self::render_template_xsl(array('moveout',
'datatable_inline'), array($mode => $data));
+ self::render_template_xsl(array('moveout',
'datatable_inline', 'attributes_form'), array($mode => $data));
}
/*
Modified: trunk/rental/inc/model/class.moveout.inc.php
===================================================================
--- trunk/rental/inc/model/class.moveout.inc.php 2016-12-17 11:09:13 UTC
(rev 16093)
+++ trunk/rental/inc/model/class.moveout.inc.php 2016-12-17 16:00:30 UTC
(rev 16094)
@@ -34,37 +34,22 @@
class rental_moveout extends phpgwapi_model
{
- const STATUS_REGISTERED = 1;
- const STATUS_PENDING = 2;
- const STATUS_REJECTED = 3;
- const STATUS_APPROVED = 4;
const acl_location = '.moveout';
protected
$id,
- $active,
- $category_id,
+ $contract_id,
+ $old_contract_id,
$created,
$modified,
- $secret,
- $name,
- $address_1,
- $address_2,
- $zip_code,
- $city,
- $moveout_organization_number,
- $contact_name,
- $contact_email,
- $contact_phone,
- $account_number,
- $description,
- $remark,
- // $moveout_identifier_type,
- // $moveout_ssn,
-
+ $account_id,
$comments,
- $comment;
+ $comment,
+ $attributes,// custom fields
+ $values_attribute;// custom fields
+ static $custom_fields = array();
+
protected $field_of_responsibility_name = '.moveout';
public function __construct( int $id = null )
@@ -83,16 +68,29 @@
return new rental_moveout();
}
- public static function get_status_list()
+ public function set_custom_fields()
{
- return array(
- self::STATUS_REGISTERED => lang('registered'),
- self::STATUS_PENDING => lang('pending'),
- self::STATUS_REJECTED => lang('rejected'),
- self::STATUS_APPROVED => lang('approved')
- );
+ $this->custom_fields =
$GLOBALS['phpgw']->custom_fields->find('rental', self::acl_location, 0, '',
'ASC', 'attrib_sort', true, true);
}
+ public function get_custom_fields()
+ {
+ if (!$this->custom_fields)
+ {
+ $this->set_custom_fields();
+ }
+ return $this->custom_fields;
+ }
+
+ public function get_organized_fields()
+ {
+ if (!$this->custom_fields)
+ {
+ $this->custom_fields =
createObject('booking.custom_fields',
'rental')->get_organized_fields(self::acl_location);
+ }
+ return $this->custom_fields;
+ }
+
public static function get_fields($debug = true)
{
$fields = array(
@@ -102,106 +100,37 @@
'sortable'=> true,
'formatter' =>
'JqueryPortico.formatLink',
),
- 'active' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
- 'type' => 'int',
- 'history' => true
- ),
- 'category_id' => array('action'=>
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
- 'type' => 'int'
- ),
'created' => array('action'=> PHPGW_ACL_READ,
'type' => 'date',
'label' => 'created',
'sortable' => true,
),
- 'modified' => array('action'=> PHPGW_ACL_READ |
PHPGW_ACL_EDIT,
+ 'modified' => array('action'=> PHPGW_ACL_READ |
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
'type' => 'date',
'label' => 'modified',
'sortable' => true,
),
- 'secret' => array('action'=> PHPGW_ACL_ADD,
- 'type' => 'string',
- 'label' => 'secret',
- 'sortable' => false,
+ 'account_id' => array('action'=> PHPGW_ACL_ADD,
+ 'type' => 'int',
+ 'label' => 'contract_id',
+ 'sortable' => true,
),
- 'name' => array(
- 'action'=> PHPGW_ACL_READ |
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'label' => 'name',
- 'required' => true,
- 'query' => true,
+ 'contract_id' => array('action'=> PHPGW_ACL_ADD
| PHPGW_ACL_EDIT,
+ 'type' => 'int',
+ 'label' => 'contract_id',
+ 'sortable' => true,
),
- 'address_1' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'old_contract_id' => array('action'=>
PHPGW_ACL_READ,
'type' => 'string',
- 'required' => true
- ),
- 'address_2' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'required' => false),
- 'zip_code' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'required' => true),
- 'city' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'required' => true),
- 'account_number' => array('action'=>
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'required' => true),
- 'description' => array('action'=> PHPGW_ACL_ADD
| PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'label' => 'description',
- 'sortable' => false,
- 'required' => true
- ),
- 'remark' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'label' => 'description',
- 'sortable' => false,
- ),
- 'contact_name' => array(
- 'action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'required' => true,
'query' => true,
- 'label' => 'contact name',
+ 'label' => 'contract',
+ 'join' => array(
+ 'table' => 'rental_contract',
+ 'fkey' => 'contract_id',
+ 'key' => 'id',
+ 'column' => 'old_contract_id'
+ )
),
- 'contact_email' => array(
- 'action'=> PHPGW_ACL_READ |
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'required' => true,
- 'query' => true,
- 'sf_validator' =>
createObject('booking.sfValidatorEmail', array(), array('invalid' => '%field%
is invalid')),
- 'label' => 'contact email',
- ),
- 'contact_phone' => array(
- 'action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'required' => true,
- 'query' => true,
- 'label' => 'contact phone',
- ),
-/* 'moveout_identifier_type' => array(
- 'action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'required' => true,
- 'label' => 'moveout_identifier_type',
- ),
- 'moveout_ssn' => array(
- 'action'=> PHPGW_ACL_READ |
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'required' => false,
- 'query' => true,
- 'sf_validator' =>
createObject('booking.sfValidatorNorwegianSSN', array('full_required' =>
false)),
- 'label' => 'moveout_ssn'
- ),*/
- 'moveout_organization_number' => array(
- 'action'=> PHPGW_ACL_READ |
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
- 'type' => 'string',
- 'required' => true,
- 'query' => true,
- 'sf_validator' =>
createObject('booking.sfValidatorNorwegianOrganizationNumber', array(),
array('invalid' => '%field% is invalid')),
- 'label' => 'organization_number'
- ),
'comments' => array(
'action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
'type' => 'string',
@@ -253,23 +182,14 @@
}
$entity->modified = time();
- $entity->active = (int)$entity->active;
-
- if($entity->get_id())
+ if(!$entity->get_id())
{
+ $entity->account_id =
(int)$GLOBALS['phpgw_info']['user']['account_id'];
}
- else
- {
- $entity->status =
rental_moveout::STATUS_REGISTERED;
- $entity->secret = self::generate_secret();
- }
- }
- protected function generate_secret( $length = 10 )
- {
- return substr(base64_encode(rand(1000000000,
9999999999)), 0, $length);
}
+
public function serialize()
{
return self::toArray();
Modified: trunk/rental/setup/phpgw_no.lang
===================================================================
--- trunk/rental/setup/phpgw_no.lang 2016-12-17 11:09:13 UTC (rev 16093)
+++ trunk/rental/setup/phpgw_no.lang 2016-12-17 16:00:30 UTC (rev 16094)
@@ -641,4 +641,6 @@
custom price rental no Taksering
price type rental no Pristype
schedule rental no Kalender
-moveout rental no Utflytting
\ No newline at end of file
+moveout rental no Utflytting
+custom fields rental no Egendefinerte felt
+custom field groups rental no Grupper for Egendefinerte felt
\ No newline at end of file
Modified: trunk/rental/setup/setup.inc.php
===================================================================
--- trunk/rental/setup/setup.inc.php 2016-12-17 11:09:13 UTC (rev 16093)
+++ trunk/rental/setup/setup.inc.php 2016-12-17 16:00:30 UTC (rev 16094)
@@ -30,7 +30,9 @@
'rental_adjustment', // Price regulations
'rental_application',
'rental_application_comment',
- 'rental_application_composite'
+ 'rental_application_composite',
+ 'rental_moveout',
+ 'rental_moveout_comment'
);
$setup_info['rental']['enable'] = 1;
$setup_info['rental']['app_group'] = 'office';
Modified: trunk/rental/setup/tables_current.inc.php
===================================================================
--- trunk/rental/setup/tables_current.inc.php 2016-12-17 11:09:13 UTC (rev
16093)
+++ trunk/rental/setup/tables_current.inc.php 2016-12-17 16:00:30 UTC (rev
16094)
@@ -568,5 +568,37 @@
),
'ix' => array(),
'uc' => array()
- )
+ ),
+ 'rental_moveout' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'nullable' =>
false),
+ 'contract_id' => array('type' => 'int',
'precision' => '4', 'nullable' => false),
+ 'account_id' => array('type' => 'int',
'precision' => '4', 'nullable' => false),
+ 'created' => array('type' => 'int', 'precision'
=> '8', 'nullable' => false, 'default' => 'current_timestamp'),
+ 'modified' => array('type' => 'int',
'precision' => '8', 'nullable' => false, 'default' => 'current_timestamp'),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(
+ 'rental_contract' => array('contract_id' =>
'id'),
+ 'phpgw_accounts' => array('account_id' =>
'account_id')
+ ),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'rental_moveout_comment' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'nullable' =>
False),
+ 'moveout_id' => array('type' => 'int',
'precision' => '4', 'nullable' => False),
+ 'time' => array('type' => 'int', 'precision' =>
'8', 'nullable' => False, 'default' => 'current_timestamp'),
+ 'author' => array('type' => 'text', 'nullable'
=> False),
+ 'comment' => array('type' => 'text', 'nullable'
=> False),
+ 'type' => array('type' => 'varchar',
'precision' => '20', 'nullable' => false,'default' => 'comment'),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(
+ 'rental_moveout' => array('moveout_id' =>
'id')),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+
);
Modified: trunk/rental/setup/tables_update.inc.php
===================================================================
--- trunk/rental/setup/tables_update.inc.php 2016-12-17 11:09:13 UTC (rev
16093)
+++ trunk/rental/setup/tables_update.inc.php 2016-12-17 16:00:30 UTC (rev
16094)
@@ -746,8 +746,45 @@
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
- // $GLOBALS['phpgw']->locations->add('.moveout', 'Moveout',
'rental', $allow_grant = true, $custom_tbl = false, $c_function = true);
+ // $GLOBALS['phpgw']->locations->add('.moveout', 'Moveout',
'rental', $allow_grant = true, $custom_tbl = false, $c_function = true,
$c_attrib = true);
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'rental_moveout', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto',
'nullable' => false),
+ 'contract_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => false),
+ 'account_id' => array('type' =>
'int', 'precision' => '4', 'nullable' => false),
+ 'created' => array('type' =>
'int', 'precision' => '8', 'nullable' => false, 'default' =>
'current_timestamp'),
+ 'modified' => array('type' =>
'int', 'precision' => '8', 'nullable' => false, 'default' =>
'current_timestamp'),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(
+ 'rental_contract' =>
array('contract_id' => 'id'),
+ 'phpgw_accounts' =>
array('account_id' => 'account_id')
+ ),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'rental_moveout_comment', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto',
'nullable' => False),
+ 'moveout_id' => array('type' =>
'int', 'precision' => '4', 'nullable' => False),
+ 'time' => array('type' =>
'int', 'precision' => '8', 'nullable' => False, 'default' =>
'current_timestamp'),
+ 'author' => array('type' =>
'text', 'nullable' => False),
+ 'comment' => array('type' =>
'text', 'nullable' => False),
+ 'type' => array('type' =>
'varchar', 'precision' => '20', 'nullable' => false,'default' => 'comment'),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(
+ 'rental_moveout' =>
array('moveout_id' => 'id')),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
{
$GLOBALS['setup_info']['rental']['currentver'] =
'0.1.0.31';
Modified: trunk/rental/templates/base/moveout.xsl
===================================================================
--- trunk/rental/templates/base/moveout.xsl 2016-12-17 11:09:13 UTC (rev
16093)
+++ trunk/rental/templates/base/moveout.xsl 2016-12-17 16:00:30 UTC (rev
16094)
@@ -34,6 +34,9 @@
<input type="hidden" id="active_tab"
name="active_tab" value="{value_active_tab}"/>
<div id="first_tab">
<fieldset>
+ <legend>
+ <xsl:value-of
select="php:function('lang', 'basis data')"/>
+ </legend>
<xsl:if test="moveout/id > 0">
<div
class="pure-control-group">
<label>
@@ -50,22 +53,9 @@
<xsl:value-of
select="php:function('lang', 'contract')"/>
</xsl:variable>
<label>
- <xsl:choose>
-
<xsl:when test="booking/contract_id > 0">
-
<div id="contract_url">
-
<a href="{contract_url}" target="_blank">
-
<xsl:value-of select="$lang_contract"/>
-
</a>
-
</div>
-
</xsl:when>
-
<xsl:otherwise>
-
<div id="contract_url">
-
<xsl:value-of select="$lang_contract"/>
-
</div>
-
</xsl:otherwise>
- </xsl:choose>
+ <xsl:value-of
select="$lang_contract"/>
</label>
- <input type="hidden"
id="contract_id" name="contract_id" value="{booking/contract_id}">
+ <input type="hidden"
id="contract_id" name="contract_id" value="{contract/id}">
<xsl:attribute
name="data-validation">
<xsl:text>required</xsl:text>
</xsl:attribute>
@@ -76,7 +66,12 @@
<xsl:value-of select="$lang_contract"/>
</xsl:attribute>
</input>
- <input type="text"
id="contract_name" name="contract_name" value="{booking/contract_name}">
+ <input type="text"
id="contract_name" name="contract_name" value="{contract/old_contract_id}">
+ <xsl:if
test="contract/id > 0">
+
<xsl:attribute name="readonly">
+
<xsl:text>readonly</xsl:text>
+
</xsl:attribute>
+ </xsl:if>
<xsl:attribute
name="placeholder">
<xsl:value-of select="$lang_contract"/>
</xsl:attribute>
@@ -207,179 +202,17 @@
<xsl:value-of
select="contract/term_label"/>
</div>
</div>
+ </fieldset>
+ <fieldset>
+ <legend>
+ <xsl:value-of
select="php:function('lang', 'report')"/>
+ </legend>
+ <xsl:call-template
name="attributes_values"/>
<div class="pure-control-group">
- <xsl:variable
name="lang_category">
- <xsl:value-of
select="php:function('lang', 'category')"/>
- </xsl:variable>
<label>
- <xsl:value-of
select="$lang_category"/>
- </label>
- <select
name="category_id">
- <xsl:attribute
name="title">
-
<xsl:value-of select="$lang_category"/>
- </xsl:attribute>
- <xsl:attribute
name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="data-validation-error-msg">
-
<xsl:value-of select="$lang_category"/>
- </xsl:attribute>
-
<xsl:apply-templates select="category_list/options"/>
- </select>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'name')"/>
- </label>
- <input type="text"
name="name" value="{moveout/name}">
- <xsl:attribute
name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="placeholder">
-
<xsl:value-of select="php:function('lang', 'name')"/>
- </xsl:attribute>
- </input>
- </div>
- <div class="pure-control-group">
- <xsl:variable
name="lang_address_1">
- <xsl:value-of
select="php:function('lang', 'address_1')"/>
- </xsl:variable>
- <xsl:variable
name="lang_address_2">
- <xsl:value-of
select="php:function('lang', 'address_2')"/>
- </xsl:variable>
- <label>
- <xsl:value-of
select="php:function('lang', 'address')"/>
- </label>
- <input type="text"
name="address_1" value="{moveout/address_1}">
- <xsl:attribute
name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="placeholder">
-
<xsl:value-of select="$lang_address_1"/>
- </xsl:attribute>
-
- </input>
- <input type="text"
name="address_2" value="{moveout/address_2}">
- <xsl:attribute
name="placeholder">
-
<xsl:value-of select="$lang_address_2"/>
- </xsl:attribute>
- </input>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'postal_code_place')"/>
- </label>
- <input type="text"
name="zip_code" value="{moveout/zip_code}">
- <xsl:attribute
name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="placeholder">
-
<xsl:value-of select="php:function('lang', 'zip_code')"/>
- </xsl:attribute>
- </input>
- <input type="text"
name="city" value="{moveout/city}">
- <xsl:attribute
name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="placeholder">
-
<xsl:value-of select="php:function('lang', 'city')"/>
- </xsl:attribute>
- </input>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'customer_organization_number')"/>
- </label>
- <input type="text"
id="lastname" name="customer_organization_number"
value="{moveout/customer_organization_number}">
- <xsl:attribute
name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="placeholder">
-
<xsl:value-of select="php:function('lang', 'customer_organization_number')"/>
- </xsl:attribute>
- </input>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'contact name')"/>
- </label>
- <input type="text"
name="contact_name" value="{moveout/contact_name}">
- <xsl:attribute
name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="placeholder">
-
<xsl:value-of select="php:function('lang', 'contact_name')"/>
- </xsl:attribute>
- </input>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'email')"/>
- </label>
- <input type="text"
name="contact_email" id="contact_email" value="{moveout/contact_email}">
- <xsl:attribute
name="data-validation">
-
<xsl:text>email</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="placeholder">
-
<xsl:value-of select="php:function('lang', 'email')"/>
- </xsl:attribute>
- </input>
- <xsl:choose>
- <xsl:when
test="valid_email = 1">
-
<xsl:text> </xsl:text>
- <a
href="{link_create_user}">
-
<xsl:value-of select="php:function('lang', 'create_user_based_on_email_link')"/>
- </a>
- </xsl:when>
- </xsl:choose>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'contact phone')"/>
- </label>
- <input type="text"
name="contact_phone" value="{moveout/contact_phone}">
- <xsl:attribute
name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="placeholder">
-
<xsl:value-of select="php:function('lang', 'contact_phone')"/>
- </xsl:attribute>
- </input>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'account_number')"/>
- </label>
- <input type="text"
name="account_number" value="{moveout/account_number}">
- <xsl:attribute
name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="placeholder">
-
<xsl:value-of select="php:function('lang', 'account_number')"/>
- </xsl:attribute>
- </input>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'description')"/>
- </label>
- <textarea cols="47"
rows="7" name="description">
- <xsl:value-of
select="moveout/description"/>
- </textarea>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of
select="php:function('lang', 'remark')"/>
- </label>
- <textarea cols="47"
rows="7" name="remark">
- <xsl:value-of
select="moveout/remark"/>
- </textarea>
- </div>
- <div class="pure-control-group">
- <label>
<xsl:value-of
select="php:function('lang', 'comment')"/>
</label>
<textarea cols="47"
rows="7" name="comment">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16094] more on rental,
sigurdne <=