[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15525] exclude name field from filter
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15525] exclude name field from filter |
Date: |
Mon, 29 Aug 2016 08:53:50 +0000 (UTC) |
Revision: 15525
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15525
Author: sigurdne
Date: 2016-08-29 08:53:50 +0000 (Mon, 29 Aug 2016)
Log Message:
-----------
exclude name field from filter
Modified Paths:
--------------
trunk/phpgwapi/templates/base/datatable_jquery.xsl
trunk/rental/inc/class.menu.inc.php
trunk/rental/inc/class.soapplication.inc.php
trunk/rental/inc/class.socomposite.inc.php
trunk/rental/inc/class.uiapplication.inc.php
trunk/rental/inc/class.uicomposite.inc.php
trunk/rental/inc/class.uiproperty_location.inc.php
trunk/rental/inc/model/class.application.inc.php
trunk/rental/inc/model/class.composite.inc.php
trunk/rental/inc/model/class.model.inc.php
trunk/rental/setup/default_records.inc.php
trunk/rental/setup/setup.inc.php
trunk/rental/setup/tables_current.inc.php
trunk/rental/setup/tables_update.inc.php
trunk/rental/templates/base/application.xsl
trunk/rental/templates/base/composite.xsl
Modified: trunk/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- trunk/phpgwapi/templates/base/datatable_jquery.xsl 2016-08-29 08:52:00 UTC
(rev 15524)
+++ trunk/phpgwapi/templates/base/datatable_jquery.xsl 2016-08-29 08:53:50 UTC
(rev 15525)
@@ -136,7 +136,7 @@
<xsl:when
test="type = 'autocomplete'">
<td
class="auto">
<div class="auto">
-
<input id="filter_{name}_name" name="filter_{name}_name" type="text">
+
<input id="filter_{name}_name" name="{name}_name" type="text">
<xsl:attribute name="value">
<xsl:value-of select="../../../filters/*[local-name() =
$filter_key_name]"/>
</xsl:attribute>
Modified: trunk/rental/inc/class.menu.inc.php
===================================================================
--- trunk/rental/inc/class.menu.inc.php 2016-08-29 08:52:00 UTC (rev 15524)
+++ trunk/rental/inc/class.menu.inc.php 2016-08-29 08:53:50 UTC (rev 15525)
@@ -176,6 +176,12 @@
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index',
'type' => 'composite_standard',
'admin' => true))
),
+ 'location_factor' => array
+ (
+ 'text' => lang('location factor'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index',
+ 'type' => 'location_factor',
'admin' => true))
+ ),
'responsibility_unit' => array
(
'text' => lang('responsibility'),
Modified: trunk/rental/inc/class.soapplication.inc.php
===================================================================
--- trunk/rental/inc/class.soapplication.inc.php 2016-08-29 08:52:00 UTC
(rev 15524)
+++ trunk/rental/inc/class.soapplication.inc.php 2016-08-29 08:53:50 UTC
(rev 15525)
@@ -26,135 +26,21 @@
* @subpackage application
* @version $Id: $
*/
+ phpgw::import_class('phpgwapi.socommon');
- class rental_soapplication
+ class rental_soapplication extends phpgwapi_socommon
{
- protected $db;
- protected $like;
- protected $join;
- protected $left_join;
- protected $sort_field;
- protected $skip_limit_query;
protected static $so;
public function __construct()
{
- $this->db = & $GLOBALS['phpgw']->db;
- $this->like = & $this->db->like;
- $this->join = & $this->db->join;
- $this->left_join = & $this->db->left_join;
- $this->sort_field = null;
- $this->skip_limit_query = null;
+ parent::__construct('rental_application',
rental_application::get_fields());
}
/**
- * Begin transaction
- *
- * @return integer|bool current transaction id
- */
- public function transaction_begin()
- {
- return $this->db->transaction_begin();
- }
-
- /**
- * Complete the transaction
- *
- * @return bool True if sucessful, False if fails
- */
- public function transaction_commit()
- {
- return $this->db->transaction_commit();
- }
-
- /**
- * Rollback the current transaction
- *
- * @return bool True if sucessful, False if fails
- */
- public function transaction_abort()
- {
- return $this->db->transaction_abort();
- }
-
- /**
- * Marshal values according to type
- * @param $value the value
- * @param $type the type of value
- * @return database value
- */
- protected function marshal( $value, $type )
- {
- if ($value === null)
- {
- return 'NULL';
- }
- else if ($type == 'int')
- {
- if ($value == '')
- {
- return 'NULL';
- }
- return intval($value);
- }
- else if ($type == 'float')
- {
- return str_replace(',', '.', $value);
- }
- else if ($type == 'field')
- {
- return $this->db->db_addslashes($value);
- }
- return "'" . $this->db->db_addslashes($value) . "'";
- }
-
- /**
- * Unmarchal database values according to type
- * @param $value the field value
- * @param $type a string dictating value type
- * @return the php value
- */
- protected function unmarshal( $value, $type )
- {
- if ($type == 'bool')
- {
- return (bool)$value;
- }
- elseif ($type == 'int')
- {
- return (int)$value;
- }
- elseif ($value === null || $value == 'NULL')
- {
- return null;
- }
- elseif ($type == 'float')
- {
- return floatval($value);
- }
- return $value;
- }
-
- /**
- * Get the count of the specified query. Query must return a
signel column
- * called count.
- *
- * @param $sql the sql query
- * @return the count value
- */
- protected function get_query_count( $sql )
- {
- $result = $this->db->query($sql);
- if ($result && $this->db->next_record())
- {
- return $this->unmarshal($this->db->f('count',
true), 'int');
- }
- }
-
- /**
* Implementing classes must return an instance of itself.
- *
+ *
* @return the class instance.
*/
public static function get_instance()
@@ -164,137 +50,18 @@
self::$so =
CreateObject('rental.soapplication');
}
return self::$so;
-
}
- /**
- * Convenience method for getting one single object. Calls
get() with the
- * specified id as a filter.
- *
- * @param $id int with id of object to return.
- * @return object with the specified id, null if not found.
- */
- public function get_single( int $id )
- {
- $objects = $this->get(0, 0, '', false, '', '',
array($this->get_id_field_name() => $id));
- if (count($objects) > 0)
- {
- $keys = array_keys($objects);
- return $objects[$keys[0]];
- }
- return null;
- }
- /**
- * Method for retrieving the db-object (security "forgotten")
- */
- public function get_db()
+ protected function populate( array $data )
{
- return $this->db;
- }
-
- /**
- * Method for retreiving objects.
- *
- * @param $start_index int with index of first object.
- * @param $num_of_objects int with max number of objects to
return.
- * @param $sort_field string representing the object field to
sort on.
- * @param $ascending bool true for ascending sort on sort
field, false
- * for descending.
- * @param $search_for string with free text search query.
- * @param $search_type string with the query type.
- * @param $filters array with key => value of filters.
- * @return array of objects. May return an empty
- * array, never null. The array keys are the respective index
numbers.
- */
- public function get( int $start_index, int $num_of_objects,
string $sort_field, bool $ascending, string $search_for, string $search_type,
array $filters )
- {
- $results = array(); // Array to store result objects
-
- return $results;
- }
-
- /**
- * Returns count of matching objects.
- *
- * @param $search_for string with free text search query.
- * @param $search_type string with the query type.
- * @param $filters array with key => value of filters.
- * @return int with object count.
- */
- public function get_count( string $search_for, string
$search_type, array $filters )
- {
- return $this->get_query_count($this->get_query('',
false, $search_for, $search_type, $filters, true));
- }
-
- /**
- * Implementing classes must return the name of the field used
in the query
- * returned from get_query().
- *
- * @return string with name of id field.
- */
- protected function get_id_field_name()
- {
-
- }
-
- /**
- * Returns SQL for retrieving matching objects or object count.
- *
- * @param $start_index int with index of first object.
- * @param $num_of_objects int with max number of objects to
return.
- * @param $sort_field string representing the object field to
sort on.
- * @param $ascending bool true for ascending sort on sort
field, false
- * for descending.
- * @param $search_for string with free text search query.
- * @param $search_type string with the query type.
- * @param $filters array with key => value of filters.
- * @param $return_count bool telling to return only the count
of the
- * matching objects, or the objects themself.
- * @return string with SQL.
- */
- protected function get_query( string $sort_field, bool
$ascending, string $search_for, string $search_type, array $filters, bool
$return_count )
- {
-
- }
-
- protected function populate( int $object_id, &$object )
- {
-
- }
-
- protected function add( &$object )
- {
- _debug_array($object);
-
- }
-
- protected function update( $object )
- {
-
- }
-
- /**
- * Store the object in the database. If the object has no ID
it is assumed to be new and
- * inserted for the first time. The object is then updated
with the new insert id.
- */
- public function store( &$object )
- {
- if ($object->validates())
+ $object = new rental_application();
+ foreach ($this->fields as $field => $field_info)
{
- if ($object->get_id() > 0)
- {
- // We can assume this composite came
from the database since it has an ID. Update the existing row
- return $this->update($object);
- }
- else
- {
- // This object does not have an ID, so
will be saved as a new DB row
- return $this->add($object);
- }
+ $object->set_field($field, $data[$field]);
}
- // The object did not validate
- return false;
+ return $object;
}
+
}
\ No newline at end of file
Modified: trunk/rental/inc/class.socomposite.inc.php
===================================================================
--- trunk/rental/inc/class.socomposite.inc.php 2016-08-29 08:52:00 UTC (rev
15524)
+++ trunk/rental/inc/class.socomposite.inc.php 2016-08-29 08:53:50 UTC (rev
15525)
@@ -193,8 +193,12 @@
$cols = "rental_composite.id AS
composite_id,";
}
- $cols .= "rental_unit.id AS unit_id,
rental_unit.location_code, rental_composite.name,
rental_composite.has_custom_address, rental_composite.address_1,
rental_composite.house_number,
- rental_composite.address_2,
rental_composite.postcode, rental_composite.place, rental_composite.is_active,
rental_composite.area, rental_composite.description,
rental_composite.furnish_type_id, rental_composite.standard_id, ";
+ $cols .= "rental_unit.id AS unit_id,
rental_unit.location_code, rental_composite.name,
+ rental_composite.has_custom_address,
rental_composite.address_1, rental_composite.house_number,
+ rental_composite.address_2,
rental_composite.postcode, rental_composite.place,
+ rental_composite.is_active,
rental_composite.area, rental_composite.description,
+ rental_composite.furnish_type_id,
rental_composite.standard_id,
+ rental_composite.part_of_town_id,
rental_composite.custom_prize_factor,";
$cols .= "rental_contract.id AS contract_id,
rental_contract.date_start, rental_contract.date_end,
rental_contract.old_contract_id, ";
$cols .= "
CASE WHEN
@@ -259,6 +263,8 @@
$composite->set_area($this->unmarshal($this->db->f('area', true), 'float'));
$composite->set_furnish_type_id($this->unmarshal($this->db->f('furnish_type_id'),
'int'));
$composite->set_standard_id($this->unmarshal($this->db->f('standard_id'),
'int'));
+
$composite->set_part_of_town_id($this->unmarshal($this->db->f('part_of_town_id'),
'int'));
+
$composite->set_custom_prize_factor($this->unmarshal($this->db->f('custom_prize_factor',
true), 'float'));
}
// Location code
$location_code =
$this->unmarshal($this->db->f('location_code', true), 'string');
@@ -401,6 +407,8 @@
'area = ' .
$this->marshal($composite->get_area(), 'float'),
'furnish_type_id = ' .
$composite->get_furnish_type_id(),
'standard_id = ' .
$composite->get_standard_id(),
+ 'part_of_town_id = ' .
$composite->get_part_of_town_id(),
+ 'custom_prize_factor = \'' .
$composite->get_custom_prize_factor() . '\''
);
$result = $this->db->query('UPDATE rental_composite SET
' . join(',', $values) . " WHERE id=$id", __LINE__, __FILE__);
@@ -420,7 +428,7 @@
// Build a db-friendly array of the composite object
$cols = array('name', 'description',
'has_custom_address', 'address_1', 'address_2',
'house_number', 'postcode', 'place',
'object_type_id', 'area', 'furnish_type_id',
- 'standard_id');
+ 'standard_id', 'part_of_town_id',
'custom_prize_factor');
$values = array(
"'" . $composite->get_name() . "'",
"'" . $composite->get_description() . "'",
@@ -433,7 +441,9 @@
$composite->get_object_type_id(),
$this->marshal($composite->get_area(), 'float'),
$composite->get_furnish_type_id(),
- $composite->get_standard_id()
+ $composite->get_standard_id(),
+ $composite->get_part_of_town_id(),
+ $composite->get_custom_prize_factor()
);
$query = "INSERT INTO rental_composite (" . join(',',
$cols) . ") VALUES (" . join(',', $values) . ")";
Modified: trunk/rental/inc/class.uiapplication.inc.php
===================================================================
--- trunk/rental/inc/class.uiapplication.inc.php 2016-08-29 08:52:00 UTC
(rev 15524)
+++ trunk/rental/inc/class.uiapplication.inc.php 2016-08-29 08:53:50 UTC
(rev 15525)
@@ -27,7 +27,6 @@
* @version $Id: $
*/
phpgw::import_class('rental.uicommon');
- phpgw::import_class('rental.soapplication');
phpgw::import_class('phpgwapi.datetime');
include_class('rental', 'application', 'inc/model/');
@@ -43,20 +42,38 @@
'view' => true,
'edit' => true,
'save' => true,
- 'set_value' => true,
);
+ protected
+ $fields,
+ $composite_types,
+ $payment_methods;
+
public function __construct()
{
parent::__construct();
self::set_active_menu('rental::application');
$GLOBALS['phpgw_info']['flags']['app_header'] .= '::' .
lang('application');
+ $this->acl = & $GLOBALS['phpgw']->acl;
+ $this->acl_location = '.application';
+ $this->acl_read =
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'rental');
+ $this->acl_add = $this->acl->check($this->acl_location,
PHPGW_ACL_ADD, 'rental');
+ $this->acl_edit =
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'rental');
+ $this->acl_delete =
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'rental');
+ $this->acl_manage =
$this->acl->check($this->acl_location, PHPGW_ACL_PRIVATE, 'rental'); // manage
+ $this->composite_types =
rental_application::get_composite_types();
+ $this->payment_methods =
rental_application::get_payment_methods();
+ $this->fields = rental_application::get_fields();
}
private function get_status_options( $selected = 0 )
{
$status_options = array();
$status_options[] = array(
+ 'id' => '',
+ 'name' => lang('all')
+ );
+ $status_options[] = array(
'id' => rental_application::STATUS_REGISTERED,
'name' => lang('registered')
);
@@ -80,6 +97,31 @@
return $status_options;
}
+ private function _get_fields()
+ {
+ $values = array();
+ foreach ($this->fields as $field => $field_info)
+ {
+ if($field_info['action'] & PHPGW_ACL_READ)
+ {
+ $data = array(
+ 'key' => $field,
+ 'label' =>
!empty($field_info['label']) ? lang($field_info['label']) : $field,
+ 'sortable' =>
!empty($field_info['sortable']) ? true : false,
+ 'hidden' =>
!empty($field_info['hidden']) ? true : false,
+ );
+
+ if(!empty($field_info['formatter']))
+ {
+ $data['formatter'] =
$field_info['formatter'];
+ }
+
+ $values[] = $data;
+ }
+ }
+ return $values;
+ }
+
public function index()
{
if (!$this->isExecutiveOfficer())
@@ -104,16 +146,16 @@
'item' => array(
array(
'type' =>
'filter',
- 'name' =>
'responsibility_id',
+ 'name' =>
'filter_status',
'text' =>
lang('status'),
'list' =>
$status_options
),
array('type' =>
'autocomplete',
- 'name' =>
'dimb',
+ 'name' =>
'ecodimb',
'app' =>
'property',
'ui' =>
'generic',
'label_attr' =>
'descr',
- //
'show_id'=> true,
+ // 'show_id'=>
true,
'text' =>
lang('dimb') . ':',
'requestGenerator' => 'requestWithDimbFilter',
),
@@ -128,43 +170,7 @@
'allrows' => true,
'new_item' =>
self::link(array('menuaction' => 'rental.uiapplication.add')),
'editor_action' => '',
- 'field' => array(
- array(
- 'key' => 'title',
- 'label' => lang('name'),
- 'className' => '',
- 'sortable' => true,
- 'hidden' => false
- ),
- array(
- 'key' => 'is_area',
- 'label' => 'Avdeling',
- 'className' => '',
- 'sortable' => true,
- 'hidden' => false
- ),
- array(
- 'key' => 'status',
- 'label' =>
lang('status'),
- 'className' => '',
- 'sortable' => true,
- 'hidden' => false
- ),
- array(
- 'key' => 'assignedto',
- 'label' =>
'saksbehandler',
- 'className' => '',
- 'sortable' => true,
- 'hidden' => false
- ),
- array(
- 'key' => 'type',
- 'label' => lang('type'),
- 'className' => '',
- 'sortable' => false,
- 'hidden' => false
- )
- )
+ 'field' => $this->_get_fields()
)
);
@@ -199,15 +205,6 @@
'parameters' => json_encode($parameters)
);
- $code = <<<JS
- var thousandsSeparator =
'$this->thousandsSeparator';
- var decimalSeparator =
'$this->decimalSeparator';
- var decimalPlaces = '$this->decimalPlaces';
- var currency_suffix = '$this->currency_suffix';
-JS;
-
- $GLOBALS['phpgw']->js->add_code('', $code);
-
self::add_javascript('rental', 'rental',
'application.index.js');
phpgwapi_jquery::load_widget('numberformat');
@@ -235,74 +232,63 @@
public function edit( $values = array(), $mode = 'edit' )
{
$GLOBALS['phpgw_info']['flags']['app_header'] .= '::' .
lang('edit');
- if (!self::isExecutiveOfficer())
+ if (!$this->acl_add)
{
phpgw::no_access();
}
- $application_id = phpgw::get_var('id', 'int');
-
- if (!empty($values['application_id']))
+ if (!empty($values['application']))
{
- $application_id = $values['application_id'];
+ $application = $values['application'];
}
-
- if ($application_id)
- {
- $application =
rental_application::get($application_id);
- }
else
{
- if (!empty($values['application']))
+ $application_id = phpgw::get_var('id', 'int');
+
+ if (!empty($values['application_id']))
{
- $application = $values['application'];
+ $application_id =
$values['application_id'];
}
+ if ($application_id)
+ {
+ $application =
rental_application::get($application_id);
+ }
else
{
- $title =
phpgw::get_var('application_title');
$application = new rental_application();
- $application->set_title($title);
- //
$application->set_responsibility_id($responsibility_id);
- // $application->set_price_type_id(1); //
defaults to year
-
}
}
- // $responsibility_title =
($application->get_responsibility_title()) ?
$application->get_responsibility_title() :
rental_socontract::get_instance()->get_responsibility_title($responsibility_id);
+ if (!$this->acl_edit)
+ {
+ $step = 1;
+ }
+ else if ($application->get_id())
+ {
+ $step = 2;
+ }
- $link_save = array(
- 'menuaction' => 'rental.uiapplication.save'
- );
-
- $link_index = array(
- 'menuaction' => 'rental.uiapplication.index',
- );
-
$tabs = array();
$tabs['application'] = array('label' =>
lang('application'), 'link' => '#application');
$tabs['party'] = array('label' => lang('party'), 'link'
=> '#party');
- $tabs['assignment'] = array('label' =>
lang('assignment'), 'link' => '#assignment');
+ if($step > 1)
+ {
+ $tabs['assignment'] = array('label' =>
lang('assignment'), 'link' => '#assignment');
+ }
$active_tab = 'showing';
-// $current_price_type_id =
$application->get_price_type_id();
- $status_options = array();
-// foreach ($application->get_price_types() as
$price_type_id => $price_type_title)
-// {
-// $selected = ($current_price_type_id ==
$price_type_id) ? 1 : 0;
-// $status_options[] = array('id' =>
$price_type_id, 'name' => lang($price_type_title),
-// 'selected' => $selected);
-// }
-
-
$composite_type = array();
- $composite_type[] = array('id' => 1, 'name' => 'Hybel');
- $composite_type[] = array('id' => 2, 'name' =>
'Leilighet');
+ foreach ($this->composite_types as $_key => $_value)
+ {
+ $composite_type[] = array('id' => $_key, 'name'
=> $_value);
+ }
- $payment_method = array();
- $payment_method[] = array('id' => 1, 'name' =>
'Faktura');
- $payment_method[] = array('id' => 2, 'name' => 'Trekk i
lønn');
- $payment_method[] = array('id' => 3, 'name' => 'intern
faktura');
+ $payment_methods = array();
+ foreach ($this->payment_methods as $_key => $_value)
+ {
+ $payment_methods[] = array('id' => $_key,
'name' => $_value);
+ }
$bocommon = CreateObject('property.bocommon');
@@ -311,40 +297,32 @@
$GLOBALS['phpgw']->jqcal->add_listener('assign_date_start');
$GLOBALS['phpgw']->jqcal->add_listener('assign_date_end');
+ $accounts =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT,
$this->acl_location, 'rental');
+ $executive_officer_options[] = array('id' => '', 'name'
=> lang('nobody'), 'selected' => 0);
+ foreach ($accounts as $account)
+ {
+ $executive_officer_options[] = array(
+ 'id' => $account['account_id'],
+ 'name' =>
$GLOBALS['phpgw']->accounts->get($account['account_id'])->__toString(),
+ 'selected' => ($account['account_id']
== $application->executive_officer) ? 1 : 0
+ );
+ }
+
$data = array(
- 'form_action' =>
$GLOBALS['phpgw']->link('/index.php', $link_save),
- 'cancel_url' =>
$GLOBALS['phpgw']->link('/index.php', $link_index),
- 'lang_save' => lang('save'),
- 'lang_cancel' => lang('cancel'),
- 'value_ecodimb' => $application->get_ecodimb(),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'rental.uiapplication.save')),
+ 'cancel_url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'rental.uiapplication.index',)),
+ 'application' => $application,//->toArray(),
+ 'list_executive_officer' => array('options' =>
$executive_officer_options),
+ 'step' => $step,
'value_ecodimb_descr' =>
ExecMethod('property.bogeneric.get_single_attrib_value', array(
'type' => 'dimb',
- 'id' => $application->get_ecodimb(),
+ 'id' => $application->ecodimb_id,
'attrib_name' => 'descr')
),
- 'district_list' => array('options' =>
$bocommon->select_district_list('', $application->get_district_id())),
- 'composite_type_list' => array('options' =>
$bocommon->select_list($application->get_composite_type(), $composite_type)),
- 'value_date_start' =>
$GLOBALS['phpgw']->common->show_date($application->get_date_start(),
$this->dateFormat),
- 'value_date_end' =>
$GLOBALS['phpgw']->common->show_date($application->get_date_end(),
$this->dateFormat),
- 'value_cleaning' =>
$application->get_cleaning(),
- 'payment_method_list' => array('options' =>
$bocommon->select_list($application->get_payment_method(), $payment_method)),
- 'value_application_id' =>
$application->get_id(),
- 'status_list' => array('options' =>
$this->get_status_options($application->get_status())),
-// 'lang_current_price_type' =>
lang($application->get_price_type_title()),
-// 'lang_adjustable_text' =>
$application->get_adjustable_text(),
-// 'lang_standard_text' =>
$application->get_standard_text(),
-// 'value_title' => $application->get_title(),
-// 'value_field_of_responsibility' =>
lang($responsibility_title),
-// 'value_agresso_id' =>
$application->get_agresso_id(),
-// 'is_area' => ($application->is_area()) ? 1 : 0,
-// 'list_type' => array('options' =>
$status_options),
-// 'value_price' => $application->get_price(),
-// 'value_price_formatted' =>
number_format($application->get_price(), $this->decimalPlaces,
$this->decimalSeparator, $this->thousandsSeparator) . ' ' .
$this->currency_suffix,
-// 'has_active_contract' =>
(rental_soapplication::get_instance()->has_active_contract($application->get_id()))
? 1 : 0,
-// 'is_inactive' => ($application->is_inactive())
? 1 : 0,
-// 'is_adjustable' =>
($application->is_adjustable()) ? 1 : 0,
-// 'is_standard' => ($application->is_standard())
? 1 : 0,
-// 'responsibility_id' => $responsibility_id,
+ 'district_list' => array('options' =>
$bocommon->select_district_list('', $application->district_id)),
+ 'composite_type_list' => array('options' =>
$bocommon->select_list($application->composite_type, $composite_type)),
+ 'payment_method_list' => array('options' =>
$bocommon->select_list($application->payment_method, $payment_methods)),
+ 'status_list' => array('options' =>
$this->get_status_options($application->status)),
'mode' => $mode,
'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
);
@@ -361,7 +339,7 @@
public function add()
{
- if (!self::isExecutiveOfficer())
+ if (!$this->acl_add)
{
phpgw::no_access();
}
@@ -371,51 +349,30 @@
public function save()
{
+ if (!$this->acl_add)
+ {
+ phpgw::no_access();
+ }
_debug_array($_POST);
$application_id = phpgw::get_var('id', 'int');
if ($application_id)
{
- $application =
rental_application::get($application_id);
+ $application =
rental_soapplication::get_instance()->read_single($application_id, true);
}
else
{
$application = new rental_application();
+ $application->status =
$application::STATUS_REGISTERED;
}
+ /*
+ * Overrides with incoming data from POST
+ */
+ $application = $this->_populate($application);
- $application->set_ecodimb(phpgw::get_var('ecodimb',
'int'));
-
$application->set_district_id(phpgw::get_var('district_id', 'int'));
-
$application->set_composite_type(phpgw::get_var('composite_type_id', 'int'));
- $date_start =
phpgwapi_datetime::date_to_timestamp(phpgw::get_var('date_start', 'string'));
- $application->set_date_start($date_start);
- $date_end =
phpgwapi_datetime::date_to_timestamp(phpgw::get_var('date_end', 'string'));
- $application->set_date_start($date_end);
-
- $application->set_cleaning(phpgw::get_var('cleaning',
'bool'));
-
$application->set_payment_method(phpgw::get_var('payment_method', 'int'));
-
$application->set_identifier(phpgw::get_var('identifier'));
-
$application->set_firstname(phpgw::get_var('firstname'));
- $application->set_lastname(phpgw::get_var('lastname'));
- $application->set_title(phpgw::get_var('title'));
-
$application->set_company_name(phpgw::get_var('company_name'));
-
$application->set_department(phpgw::get_var('department'));
- $application->set_address1(phpgw::get_var('address1'));
- $application->set_address2(phpgw::get_var('address2'));
-
$application->set_postal_code(phpgw::get_var('postal_code'));
- $application->set_place(phpgw::get_var('place'));
-
$application->set_account_number(phpgw::get_var('account_number'));
- $application->set_phone(phpgw::get_var('phone'));
- $application->set_email(phpgw::get_var('email'));
-
$application->set_unit_leader(phpgw::get_var('unit_leader'));
- $application->set_comment(phpgw::get_var('comment'));
-
$application->set_assign_date_start(phpgw::get_var('assign_date_start'));
-
$application->set_assign_date_end(phpgw::get_var('assign_date_end'));
- $application->set_status(phpgw::get_var('status'));
-
-
- if(self::_validate($application))
+ if($application->validate())
{
- if
(rental_soapplication::get_instance()->store($application))
+ if($application->store($application))
{
phpgwapi_cache::message_set(lang('messages_saved_form'), 'message');
self::redirect(array(
@@ -430,112 +387,81 @@
}
}
- $this->edit(array(
- 'id' =>$application->get_id(),
- 'application' => $application
- )
- );
+ else
+ {
+ $this->edit(array('application' =>
$application));
+ }
}
-
- private function _validate( $application )
+ private function _populate($application)
{
- return true;
- }
-
- public function set_value()
- {
- if (!self::isExecutiveOfficer())
- {
- return;
- }
+ $fields = $this->fields;
- $field_name = phpgw::get_var('field_name');
- $value = phpgw::get_var('value');
- $id = phpgw::get_var('id');
-
- switch ($field_name)
+ foreach ($fields as $field => $field_info)
{
- case 'count':
- $value = (int)$value;
- break;
- case 'price':
- $value =
trim(str_replace(array($this->currency_suffix, " "), '', $value));
- break;
- case 'date_start':
- case 'date_end':
- $value =
phpgwapi_datetime::date_to_timestamp(phpgw::get_var('value'));
- break;
- default:
- $value = phpgw::get_var('value');
- break;
+ if($field_info['action'] & PHPGW_ACL_ADD)
+ {
+ $application->set_field( $field,
phpgw::get_var($field, $field_info['type'] ) );
+ }
}
-
- $application =
rental_socontract_application::get_instance()->get_single($id);
- $application->set_field($field_name, $value);
- $result =
rental_socontract_application::get_instance()->store($application);
-
- $message = array();
- if ($result)
- {
- $message['message'][] = array('msg' =>
lang('data has been saved'));
- }
- else
- {
- $message['error'][] = array('msg' => lang('data
has not been saved'));
- }
-
- return $message;
+ return $application;
}
+
/**
* (non-PHPdoc)
* @see rental/inc/rental_uicommon#query()
*/
public function query()
{
+ $params = $this->build_default_read_params();
+ $applications =
rental_soapplication::get_instance()->read($params);
+ $status_text = array(
+ rental_application::STATUS_REGISTERED =>
lang('registered'),
+ rental_application::STATUS_PENDING =>
lang('pending'),
+ rental_application::STATUS_REJECTED =>
lang('rejected'),
+ rental_application::STATUS_APPROVED =>
lang('approved')
+ );
- if
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+ foreach ($applications['results'] as &$application)
{
- $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ $application['status'] =
$status_text[$application['status']];
+ $application['composite_type'] =
$this->composite_types[$application['composite_type']];
+
+ $application['entry_date'] =
$GLOBALS['phpgw']->common->show_date($application['entry_date'], $dateformat);
+ $application['executive_officer'] =
$application['executive_officer'] ?
$GLOBALS['phpgw']->accounts->get($application['executive_officer'])->__toString()
: '';
}
- else
- {
- $user_rows_per_page = 10;
- }
+ array_walk($applications["results"], array($this,
"_add_links"), "rental.uiapplication.edit");
+ return $this->jquery_results($applications);
+ }
+
+ protected function build_default_read_params()
+ {
+ $fields = $this->fields;
+
+ $search = phpgw::get_var('search');
$order = phpgw::get_var('order');
$draw = phpgw::get_var('draw', 'int');
$columns = phpgw::get_var('columns');
- $start_index = phpgw::get_var('start', 'int',
'REQUEST', 0);
- $num_of_objects = (phpgw::get_var('length', 'int') <=
0) ? $user_rows_per_page : phpgw::get_var('length', 'int');
- $sort_field = ($columns[$order[0]['column']]['data']) ?
$columns[$order[0]['column']]['data'] : 'agresso_id';
- $sort_ascending = ($order[0]['dir'] == 'desc') ? false
: true;
+ $params = array(
+ 'start' => phpgw::get_var('start', 'int',
'REQUEST', 0),
+ 'results' => phpgw::get_var('length', 'int',
'REQUEST', 0),
+ 'query' => $search['value'],
+ 'sort' => $columns[$order[0]['column']]['data'],
+ 'dir' => $order[0]['dir'],
+ 'allrows' => phpgw::get_var('length', 'int') ==
-1,
+ );
- $search_for = '';
- $search_type = '';
-
-
- $filters = array();
- $result_objects =
rental_soapplication::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
- $object_count =
0;//rental_soapplication::get_instance()->get_count($search_for, $search_type,
$filters);
- // Create an empty row set
- $rows = array();
- foreach ($result_objects as $record)
+ foreach ($fields as $field => $_params)
{
- if (isset($record))
+ if (!empty($_REQUEST["filter_$field"]))
{
- // ... add a serialized record
- $rows[] = $record->serialize();
+ $params['filters'][$field] =
phpgw::get_var("filter_$field", $_params['type']);
}
}
-
- $result_data = array('results' => $rows);
- $result_data['total_records'] = $object_count;
- $result_data['draw'] = $draw;
-
- return $this->jquery_results($result_data);
+ return $params;
}
}
\ No newline at end of file
Modified: trunk/rental/inc/class.uicomposite.inc.php
===================================================================
--- trunk/rental/inc/class.uicomposite.inc.php 2016-08-29 08:52:00 UTC (rev
15524)
+++ trunk/rental/inc/class.uicomposite.inc.php 2016-08-29 08:53:50 UTC (rev
15525)
@@ -735,7 +735,9 @@
(
'container' =>
'datatable-container_1',
'requestUrl' =>
json_encode(self::link(array('menuaction' => 'rental.uiproperty_location.query',
- 'composite_id'
=> $composite_id, 'phpgw_return_as' => 'json'))),
+ 'composite_id' =>
$composite_id,
+ 'phpgw_return_as' =>
'json',
+ 'part_of_town_id' =>
$composite->get_part_of_town_id()))),
'ColumnDefs' => array(
array('key' =>
'location_code', 'label' => lang('location_code'), 'sortable' => true),
array('key' =>
'loc1_name', 'label' => lang('name'), 'sortable' => false),
@@ -942,6 +944,12 @@
'list_composite_standard' => array('options' =>
$composite_standard_options),
'value_furnish_type_name' => $furnish_type_name,
'list_furnish_type' => array('options' =>
$furnish_types_options),
+ 'contract_furnished_status' =>
!empty($this->config->config_data['contract_furnished_status']),
+
'value_part_of_town_id'=>$composite->get_part_of_town_id(),
+ 'list_part_of_town' => array('options' =>
execMethod('property.bogeneric.get_list', array(
+ 'type' => 'part_of_town',
'selected' => $composite->get_part_of_town_id(), 'add_empty' => true))),
+ 'value_custom_prize_factor' =>
$composite->get_custom_prize_factor(),
+ 'value_unit_count' =>
rental_sounit::get_instance()->get_count('', 'all', array('composite_id' =>
$composite_id)),
'value_address_1' => $address_1,
'has_custom_address' =>
($composite->has_custom_address()) ? 1 : 0,
'value_custom_address_1' =>
$composite->get_custom_address_1(),
@@ -1000,6 +1008,8 @@
$composite->set_description(phpgw::get_var('description'));
$composite->set_furnish_type_id(phpgw::get_var('furnish_type_id'));
$composite->set_standard_id(phpgw::get_var('composite_standard_id', 'int'));
+
$composite->set_part_of_town_id(phpgw::get_var('part_of_town_id', 'int'));
+
$composite->set_custom_prize_factor(phpgw::get_var('custom_prize_factor',
'float'));
if
(rental_socomposite::get_instance()->store($composite))
{
Modified: trunk/rental/inc/class.uiproperty_location.inc.php
===================================================================
--- trunk/rental/inc/class.uiproperty_location.inc.php 2016-08-29 08:52:00 UTC
(rev 15524)
+++ trunk/rental/inc/class.uiproperty_location.inc.php 2016-08-29 08:53:50 UTC
(rev 15525)
@@ -36,6 +36,7 @@
$type_id = phpgw::get_var('type_id');
//$composite_id = phpgw::get_var('composite_id');
$search_type = phpgw::get_var('search_option');
+ $part_of_town_id = phpgw::get_var('part_of_town_id',
'int');
// YUI variables for paging and sorting
$start_index = phpgw::get_var('start', 'int',
'REQUEST', 0);
@@ -56,7 +57,9 @@
'bruksnr' => empty($query[1]) ? '' :
$query[1],
'feste_nr' => empty($query[2]) ? '' :
$query[2],
'seksjons_nr' => empty($query[3]) ? ''
: $query[3],
- 'allrows' => true));
+ 'allrows' => true,
+ 'part_of_town_id' => $part_of_town_id,
+ ));
$rows_total = count($gabinfo);
$gab_list = array_slice($gabinfo, $start_index,
$num_of_objects);
@@ -81,7 +84,8 @@
'order' => $sort_field,
'sort' => $sort,
'allrows' => phpgw::get_var('length',
'int') == -1,
- 'type_id' => $type_id
+ 'type_id' => $type_id,
+ 'part_of_town_id' => $part_of_town_id,
);
$rows = $property_bolocation->read($params);
$rows_total =
$property_bolocation->total_records;
Modified: trunk/rental/inc/model/class.application.inc.php
===================================================================
--- trunk/rental/inc/model/class.application.inc.php 2016-08-29 08:52:00 UTC
(rev 15524)
+++ trunk/rental/inc/model/class.application.inc.php 2016-08-29 08:53:50 UTC
(rev 15525)
@@ -26,6 +26,9 @@
* @subpackage application
* @version $Id: $
*/
+
+ phpgw::import_class('rental.soapplication');
+
include_class('rental', 'model', 'inc/model/');
class rental_application extends rental_model
@@ -36,332 +39,195 @@
const STATUS_REJECTED = 3;
const STATUS_APPROVED = 4;
- protected $status;
- protected $ecodimb;
- protected $district_id;
- protected $composite_type;
- protected $date_start;
- protected $date_end;
- protected $cleaning;
- protected $payment_method;
- protected $title;
- protected $description;
- protected $firstname;
- protected $lastname;
- protected $company_name;
- protected $department;
- protected $address1;
- protected $address2;
- protected $postal_code;
- protected $place;
- protected $account_number;
- protected $phone;
- protected $email;
- protected $unit_leader;
- protected $comment;
- protected $assign_date_start;
- protected $assign_date_end;
+ protected
+ $id,
+ $status,
+ $ecodimb_id,
+ $ecodimb_name,
+ $district_id,
+ $composite_type,
+ $date_start,
+ $date_end,
+ $cleaning,
+ $payment_method,
+ $job_title,
+ $description,
+ $firstname,
+ $lastname,
+ $company_name,
+ $department,
+ $address1,
+ $address2,
+ $postal_code,
+ $place,
+ $account_number,
+ $phone,
+ $email,
+ $unit_leader,
+ $comment,
+ $assign_date_start,
+ $assign_date_end,
+ $entry_date,
+ $executive_officer,
+ $identifier;
- protected $type;
- protected $type_id;
- protected $party_id;
- protected $identifier;
public function __construct( int $id = null )
{
parent::__construct((int)$id);
}
- public function set_ecodimb( $ecodimb )
- {
- $this->ecodimb = $ecodimb;
- }
- public function get_ecodimb()
+ public static function get_composite_types()
{
- return $this->ecodimb;
+ return array(1 => 'Hybel', 2 => 'Leilighet');
}
- public function set_district_id( $district_id )
+ public static function get_payment_methods()
{
- $this->district_id = $district_id;
+ return array(1 => 'Faktura', 2 => 'Trekk i lønn',3 =>
'intern faktura');
}
- public function get_district_id()
+ public static function get_fields($debug = true)
{
- return $this->district_id;
- }
- public function set_composite_type( $composite_type )
- {
- $this->composite_type = $composite_type;
- }
+ $fields = array(
+ 'id' => array('action'=> PHPGW_ACL_READ,
+ 'type' => 'int',
+ 'label' => 'id',
+ 'sortable'=> true,
+ 'formatter' =>
'JqueryPortico.formatLink',
+ ),
+ 'ecodimb_id' => array(
+ 'action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'int',
+ 'label' => 'dimb',
+ ),
+ 'ecodimb_name' => array(
+ 'action'=> PHPGW_ACL_READ,
+ 'type' => 'string',
+ 'label' => 'dimb',
+ 'join' => array(
+ 'table' => 'fm_ecodimb',
+ 'fkey' => 'ecodimb_id',
+ 'key' => 'id',
+ 'column' => 'descr'
+ )
+ ),
+ 'district_id' => array('action'=> PHPGW_ACL_ADD
| PHPGW_ACL_EDIT,
+ 'type' => 'int'),
+ 'composite_type' => array('action'=>
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+ 'type' => 'int'),
+ 'date_start' => array('action'=> PHPGW_ACL_ADD
| PHPGW_ACL_EDIT,
+ 'type' => 'date'),
+ 'date_end' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'date'),
+ 'cleaning' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'bool'),
+ 'payment_method' => array('action'=>
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+ 'type' => 'int'),
+ 'firstname' => array(
+ 'action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string',
+ 'required' => true,
+ 'alternative' => array('company_name'),
+ 'query' => true,
+ 'label' => 'first name',
+ ),
+ 'lastname' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string',
+ 'required' => true,
+ 'query' => true,
+ 'alternative' => array('company_name'),
+ 'label' => 'last name',
+ ),
+ 'job_title' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ 'company_name' => array(
+ 'action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string',
+ 'required' => true,
+ 'alternative' =>
array('firstname','lastname'),
+ ),
+ 'department' => array('action'=> PHPGW_ACL_ADD
| PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ 'address1' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ 'address2' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ 'postal_code' => array('action'=> PHPGW_ACL_ADD
| PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ 'place' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ 'account_number' => array('action'=>
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ 'phone' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ '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'))),
+ 'unit_leader' => array('action'=> PHPGW_ACL_ADD
| PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ 'comment' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ 'assign_date_start' => array('action'=>
PHPGW_ACL_READ | PHPGW_ACL_EDIT,
+ 'type' => 'date'),
+ 'assign_date_end' => array('action'=>
PHPGW_ACL_READ | PHPGW_ACL_EDIT,
+ 'type' => 'date'),
+ 'status' => array('action'=> PHPGW_ACL_READ |
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+ 'type' => 'int'),
+ /* 'status_text' => array('action'=>
PHPGW_ACL_READ,
+ 'type' => 'string',
+ 'label' => 'status',
+ 'className' => '',
+ 'sortable' => true,
+ 'hidden' => false
+ ),*/
+ 'entry_date' => array('action'=> PHPGW_ACL_READ
| PHPGW_ACL_ADD,
+ 'type' => 'int',
+ 'label' => 'entry_date',
+ 'sortable' => true,
- public function get_composite_type()
- {
- return $this->composite_type;
- }
- public function set_date_start( $start_date )
- {
- $this->date_start = $start_date;
- }
+ ),
+ 'executive_officer' => array('action'=>
PHPGW_ACL_READ | PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+ 'type' => 'int',
+ 'label' => 'executive_officer',
+ 'sortable' => true,
+ 'hidden' => false
+ ),
+ 'identifier' => array('action'=> PHPGW_ACL_ADD
| PHPGW_ACL_EDIT,
+ 'type' => 'string'),
+ );
- public function get_date_start()
- {
- return $this->start_date;
- }
- public function set_date_end( $date_end )
- {
- $this->date_end = $date_end;
- }
- public function get_date_end()
- {
- return $this->date_end;
- }
+ if($debug)
+ {
+ foreach ($fields as $field => $field_info)
+ {
+
if(!property_exists('rental_application', $field))
+ {
+ phpgwapi_cache::message_set("$field
is missing from model-definition", 'error');
+ }
- public function set_cleaning( $cleaning )
- {
- $this->cleaning = $cleaning;
+ }
+ }
+ return $fields;
}
- public function get_cleaning()
- {
- return (bool)$this->cleaning;
- }
- public function set_payment_method( $payment_method )
+ public function serialize()
{
- $this->payment_method = $payment_method;
+ return self::toArray();
}
- public function get_payment_method()
+ public function store()
{
- return $this->payment_method;
+ return
rental_soapplication::get_instance()->store($this);
}
- public function set_title( $title )
+ public function get($id)
{
- $this->title = $title;
+ return
rental_soapplication::get_instance()->read_single($id, true);
}
- public function get_title()
- {
- return $this->title;
- }
-
- public function set_identifier( $identifier )
- {
- $this->identifier = $identifier;
- }
-
- public function get_identifier()
- {
- return $this->identifier;
- }
-
- public function set_description( $description )
- {
- $this->description = $description;
- }
-
- public function get_description()
- {
- return $this->description;
- }
-
- public function set_firstname( $firstname )
- {
- $this->firstname = $firstname;
- }
-
- public function get_firstname()
- {
- return $this->firstname;
- }
-
- public function set_lastname( $lastname )
- {
- $this->lastname = $lastname;
- }
-
- public function get_lastname()
- {
- return $this->lastname;
- }
-
-
- public function set_company_name( $company_name )
- {
- $this->company_name = $company_name;
- }
-
- public function get_company_name()
- {
- return $this->company_name;
- }
- public function set_department( $department )
- {
- $this->department = $department;
- }
-
- public function get_department()
- {
- return $this->department;
- }
-
- public function set_address1( $address1 )
- {
- $this->address1 = $address1;
- }
-
- public function get_address1()
- {
- return $this->address1;
- }
-
- public function set_address2( $address2 )
- {
- $this->address2 = $address2;
- }
-
- public function get_address2()
- {
- return $this->address2;
- }
-
- public function set_postal_code( $postal_code )
- {
- $this->postal_code = $postal_code;
- }
-
- public function get_postal_code()
- {
- return $this->postal_code;
- }
-
- public function set_place( $place )
- {
- $this->place = $place;
- }
-
- public function get_place()
- {
- return $this->place;
- }
-
- public function set_account_number( $account_number )
- {
- $this->account_number = $account_number;
- }
-
- public function get_account_number()
- {
- return $this->account_number;
- }
-
- public function set_phone( $phone )
- {
- $this->phone = $phone;
- }
-
- public function get_phone()
- {
- return $this->phone;
- }
-
- public function set_email( $email )
- {
- $this->email = $email;
- }
-
- public function get_email()
- {
- return $this->email;
- }
-
- public function set_unit_leader( $unit_leader )
- {
- $this->unit_leader = $unit_leader;
- }
-
- public function get_unit_leader()
- {
- return $this->unit_leader;
- }
-
- public function set_comment( $comment )
- {
- $this->comment = $comment;
- }
-
- public function get_comment()
- {
- return $this->comment;
- }
-
- public function set_assign_date_start( $assign_date_start )
- {
- $this->assign_date_start = $assign_date_start;
- }
-
- public function get_assign_date_start()
- {
- return $this->assign_date_start;
- }
- public function set_assign_date_end( $assign_date_end )
- {
- $this->assign_date_end = $assign_date_end;
- }
-
- public function get_assign_date_end()
- {
- return $this->assign_date_end;
- }
- public function set_status( $status )
- {
- $this->status = $status;
- }
-
- public function get_status()
- {
- return $this->status;
- }
- public function set_type( $type )
- {
- $this->type = $type;
- }
-
- public function get_type()
- {
- return $this->type;
- }
-
- public function set_type_id( $type_id )
- {
- $this->type_id = $type_id;
- }
-
- public function get_type_id()
- {
- return $this->type_id;
- }
-
- public function set_party_id( $party_id )
- {
- $this->party_id = $party_id;
- }
-
- public function get_party_id()
- {
- return $this->party_id;
- }
-
- public function serialize()
- {
- return array(
- 'id' => $this->get_id(),
- 'title' => $this->get_title(),
- 'description' => $this->get_description(),
- 'name' => $this->get_name(),
- 'type' => lang($this->get_type())
- );
- }
}
\ No newline at end of file
Modified: trunk/rental/inc/model/class.composite.inc.php
===================================================================
--- trunk/rental/inc/model/class.composite.inc.php 2016-08-29 08:52:00 UTC
(rev 15524)
+++ trunk/rental/inc/model/class.composite.inc.php 2016-08-29 08:53:50 UTC
(rev 15525)
@@ -27,6 +27,8 @@
protected $standard_id;
protected $units;
protected $contracts;
+ protected $part_of_town_id;
+ protected $custom_prize_factor = '1.00';
protected static $furnish_types_arr;
/**
@@ -35,7 +37,7 @@
*
* @param int $id the id of this composite
*/
- public function __construct( int $id = null )
+ public function __construct( int $id = 0 )
{
parent::__construct($id);
$this->units = array();
@@ -309,6 +311,26 @@
return (int)$this->furnish_type_id;
}
+ public function set_part_of_town_id( $part_of_town_id )
+ {
+ $this->part_of_town_id = $part_of_town_id;
+ }
+
+ public function get_part_of_town_id()
+ {
+ return $this->part_of_town_id;
+ }
+
+ public function set_custom_prize_factor( float
$custom_prize_factor )
+ {
+ $this->custom_prize_factor = $custom_prize_factor;
+ }
+
+ public function get_custom_prize_factor()
+ {
+ return (float)$this->custom_prize_factor;
+ }
+
public function get_furnish_type()
{
@@ -460,7 +482,10 @@
'area_net' => $this->get_area_net(),
'status' => $this->get_status(),
'contracts' => $contract_dates,
- 'furnished_status' => $this->get_furnish_type()
+ 'furnished_status' => $this->get_furnish_type(),
+ 'standard_id' => $this->get_standard_id(),
+ 'part_of_town_id' =>
$this->get_part_of_town_id(),
+ 'custom_prize_factor' =>
$this->get_custom_prize_factor(),
);
}
}
\ No newline at end of file
Modified: trunk/rental/inc/model/class.model.inc.php
===================================================================
--- trunk/rental/inc/model/class.model.inc.php 2016-08-29 08:52:00 UTC (rev
15524)
+++ trunk/rental/inc/model/class.model.inc.php 2016-08-29 08:53:50 UTC (rev
15525)
@@ -16,6 +16,55 @@
$this->id = (int)$id;
}
+ public function __set($name, $value)
+ {
+ $this->$name = $value;
+ }
+
+ /**
+ * Magic get method
+ *
+ * @param string $name the variable to fetch
+ *
+ * @return mixed the value of the variable sought - null if not
found
+ */
+ public function __get($name)
+ {
+ $called_class = get_called_class();
+
+ $datatype = 'string';
+ if( method_exists($called_class, 'get_fields'))
+ {
+ $fields = $called_class::get_fields();
+ $datatype = $fields[$name]['type'];
+ }
+
+ if ( isset($this->$name) )
+ {
+ switch ($datatype)
+ {
+ case 'int':
+ case 'integert':
+ $value = (int)$this->$name;
+ break;
+ case 'float':
+ $value = (float)$this->$name;
+ break;
+ case 'bool':
+ case 'boolean':
+ $value = (bool)$this->$name;
+ break;
+ default:
+ $value = $this->$name;
+ break;
+ }
+
+ return $value;
+ }
+
+ return null;
+ }
+
public function get_id()
{
return $this->id;
@@ -172,4 +221,132 @@
}
public abstract function serialize();
+
+ public function toArray()
+ {
+ $rental_item_arr = array();
+
+ $fields = get_object_vars($this);
+ foreach ($fields as $field => $value)
+ {
+ $rental_item_arr[$field] =
$this->get_field($field);
+ }
+ return $rental_item_arr;
+ }
+
+ function validate( )
+ {
+ $errors = array();
+ $this->preValidate( $this );
+ $this->_validate( $this, $this->get_fields(), $errors);
+ $this->doValidate( $this, $errors);
+ foreach ($errors as $key => $message)
+ {
+ phpgwapi_cache::message_set($message, 'error');
+ }
+ return $errors ? false : true;
+ }
+
+ /**
+ * Implement in subclasses to perform actions on entity before
validation
+ */
+ protected function preValidate( &$entity )
+ {
+
+ }
+
+ /**
+ * Implement in subclasses to perform custom validation.
+ */
+ protected function doValidate( $entity, &$errors )
+ {
+
+ }
+
+ private function _validate( $entity, array $fields, array
&$errors, $field_prefix = '' )
+ {
+
+ foreach ($fields as $field => $params)
+ {
+ if (!is_array($params))
+ {
+ continue;
+ }
+
+ $v = trim($entity->get_field($field));
+ $empty = false;
+
+ if (isset($params['manytomany']) &&
isset($params['manytomany']['column']))
+ {
+ $sub_entity_count = 0;
+
+ if (!empty($entity->get_field($field))
&& is_array($entity->get_field($field)))
+ {
+ foreach
($entity->get_field($field) as $key => $sub_entity)
+ {
+ $this->_validate(
+
(array)$sub_entity, (array)$params['manytomany']['column'], $errors,
sprintf('%s%s[%s]', $field_prefix, empty($field_prefix) ? $field :
"[{$field}]", (is_string($key) ? $key : $sub_entity_count))
+ );
+ $sub_entity_count++;
+ }
+ }
+
+ if ($params['required'] &&
$sub_entity_count == 0)
+ {
+ $errors[$field] = lang("Field
%1 is required", lang($field));
+ }
+ continue;
+ }
+
+ if(!empty($params['alternative']) &&
is_array($params['alternative']))
+ {
+ $alternatives_ok = false;
+ $found_alternatives = 0;
+ foreach ($params['alternative'] as
$alternative)
+ {
+
if($entity->get_field($alternative))
+ {
+ $found_alternatives ++;
+ }
+ }
+ if($found_alternatives ==
count($params['alternative']))
+ {
+ $alternatives_ok = true;
+ }
+ }
+ $error_key = empty($field_prefix) ? $field :
"{$field_prefix}[{$field}]";
+ if ($params['required'] && (!isset($v) || ($v
!== '0' && empty($v))) && !$alternatives_ok)
+ {
+
+ $errors[$error_key] = lang("Field %1 is
required", lang($error_key));
+ $empty = true;
+ }
+ if ($params['type'] == 'date' &&
!empty($entity->get_field($field)))
+ {
+ /**
+ * Already converted to integer
+ */
+ //$date =
date_parse($entity->get_field($field));
+ //if (!$date || count($date['errors'])
> 0)
+ if
(!ctype_digit($entity->get_field($field)))
+ {
+ $errors[$error_key] =
lang("Field %1: Invalid format", lang($error_key));
+ }
+ }
+
+ if (!$empty && $params['sf_validator'])
+ {
+ try
+ {
+
$params['sf_validator']->setOption('required', false);
+
$params['sf_validator']->clean($entity->get_field($field));
+ }
+ catch (sfValidatorError $e)
+ {
+ $errors[$error_key] =
lang(strtr($e->getMessage(), array('%field%' => $error_key)));
+ }
+ }
+ }
+ }
+
}
\ No newline at end of file
Modified: trunk/rental/setup/default_records.inc.php
===================================================================
--- trunk/rental/setup/default_records.inc.php 2016-08-29 08:52:00 UTC (rev
15524)
+++ trunk/rental/setup/default_records.inc.php 2016-08-29 08:53:50 UTC (rev
15525)
@@ -34,6 +34,7 @@
//Create groups, users, add users to groups and set preferences
$GLOBALS['phpgw']->locations->add('.', 'Root', 'rental', false);
$GLOBALS['phpgw']->locations->add('.contract', 'Contract', 'rental',
$allow_grant = false, $custom_tbl = false, $c_function = true);
+ $GLOBALS['phpgw']->locations->add('.application', 'Application',
'rental', $allow_grant = false, $custom_tbl = false, $c_function = true);
$GLOBALS['phpgw']->locations->add('.ORG', 'Locations for organisational
units', 'rental', false);
$GLOBALS['phpgw']->locations->add('.ORG.BK', 'Organisational units in
Bergen Kommune', 'rental', false);
Modified: trunk/rental/setup/setup.inc.php
===================================================================
--- trunk/rental/setup/setup.inc.php 2016-08-29 08:52:00 UTC (rev 15524)
+++ trunk/rental/setup/setup.inc.php 2016-08-29 08:53:50 UTC (rev 15525)
@@ -1,6 +1,6 @@
<?php
$setup_info['rental']['name'] = 'rental'; // Module identifier
- $setup_info['rental']['version'] = '0.1.0.24'; // Current module version
+ $setup_info['rental']['version'] = '0.1.0.25'; // Current module version
$setup_info['rental']['app_order'] = 51; // (?)
$setup_info['rental']['tables'] = array(
'rental_party', // All contract participants, tenants etc.
@@ -8,7 +8,8 @@
'rental_contract_composite', // Connection between contracts
and composites
'rental_contract_party', // Connection between tenants and
contracts
'rental_composite', // Rental object, an aggregation of rental
units
- 'rental_composite_standard', // Optional standard clsasses
+ 'rental_location_factor', // for location based prizing
+ 'rental_composite_standard', // Optional standard classes
'rental_contract_price_item', // Price items from the price
book tied to a contract
'rental_contract_responsibility_unit', // optional list of
candidates
'rental_billing', // Contains information about the job
creating invoices
Modified: trunk/rental/setup/tables_current.inc.php
===================================================================
--- trunk/rental/setup/tables_current.inc.php 2016-08-29 08:52:00 UTC (rev
15524)
+++ trunk/rental/setup/tables_current.inc.php 2016-08-29 08:53:50 UTC (rev
15525)
@@ -28,13 +28,30 @@
'default' => null),
'area' => array('type' => 'decimal',
'precision' => '20', 'scale' => '2', 'nullable' => true),
'furnish_type_id' => array('type' => 'int',
'precision' => 4, 'nullable' => true),
- 'standard_id' => array('type' => 'int',
'precision' => 4, 'nullable' => true)
+ 'standard_id' => array('type' => 'int',
'precision' => 4, 'nullable' => true),
+ 'part_of_town_id' => array('type' => 'int',
'precision' => 4, 'nullable' => true),
+ 'custom_prize_factor' => array('type' =>
'decimal', 'precision' => '20', 'scale' => '2', 'nullable' => true, 'default'
=> '1.00'),
),
'pk' => array('id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
),
+ 'rental_location_factor' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'nullable' =>
false),
+ 'part_of_town_id' => array('type' => 'int',
'precision' => 4, 'nullable' => false),
+ 'factor' => array('type' => 'decimal',
'precision' => '20', 'scale' => '2', 'nullable' => false, 'default' => '1.00'),
+ 'remark' => array('type' => 'text', 'nullable'
=> true),
+ 'user_id' => array('type' => 'int', 'precision'
=> 4, 'nullable' => true),
+ 'entry_date' => array('type' => 'int',
'precision' => 8, 'nullable' => true),
+ 'modified_date' => array('type' => 'int',
'precision' => 8, 'nullable' => true),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array('fm_part_of_town' =>
array('part_of_town_id' => 'id')),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
'rental_composite_standard' => array(
'fd' => array(
'id' => array('type' => 'int', 'precision' =>
4, 'nullable' => false),
@@ -476,25 +493,25 @@
'rental_application' => array(
'fd' => array(
'id' => array('type' => 'auto', 'nullable' =>
false),
- 'ecodimb' => array('type' => 'int', 'precision'
=> '4', 'nullable' => false),
+ 'ecodimb_id' => array('type' => 'int',
'precision' => '4', 'nullable' => false),
'district_id' => array('type' => 'int',
'precision' => '4', 'nullable' => false),
- 'composite_type_id' => array('type' => 'int',
'precision' => '4', 'nullable' => false),
- 'cleaning' => array('type' => 'int',
'precision' => '2', 'nullable' => false),
+ 'composite_type' => array('type' => 'int',
'precision' => '4', 'nullable' => false),
+ 'cleaning' => array('type' => 'int',
'precision' => '2', 'nullable' => true),
'payment_method' => array('type' => 'int',
'precision' => '2', 'nullable' => false),
'date_start' => array('type' => 'int',
'precision' => '8', 'nullable' => true),
'date_end' => array('type' => 'int',
'precision' => '8', 'nullable' => true),
'assign_date_start' => array('type' => 'int',
'precision' => '8', 'nullable' => true),
'assign_date_end' => array('type' => 'int',
'precision' => '8', 'nullable' => true),
'entry_date' => array('type' => 'int',
'precision' => '8', 'nullable' => true),
- 'identifier' => array('type' => 'int',
'precision' => '4', 'nullable' => false),
+ 'identifier' => array('type' => 'varchar',
'precision' => '20', 'nullable' => false),
'adjustment_type' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
'firstname' => array('type' => 'varchar',
'precision' => '64', 'nullable' => true),
'lastname' => array('type' => 'varchar',
'precision' => '64', 'nullable' => true),
- 'title' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
+ 'job_title' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
'company_name' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
'department' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
- 'address_1' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
- 'address_2' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
+ 'address1' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
+ 'address2' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
'postal_code' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
'place' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
'phone' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
@@ -503,7 +520,7 @@
'unit_leader' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
'comment' => array('type' => 'text', 'nullable'
=> true),
'status' => array('type' => 'int', 'precision'
=> '2', 'nullable' => false),
-
+ 'executive_officer' => array('type' => 'int',
'precision' => '4', 'nullable' => true),
),
'pk' => array('id'),
'fk' => array(),
Modified: trunk/rental/setup/tables_update.inc.php
===================================================================
--- trunk/rental/setup/tables_update.inc.php 2016-08-29 08:52:00 UTC (rev
15524)
+++ trunk/rental/setup/tables_update.inc.php 2016-08-29 08:53:50 UTC (rev
15525)
@@ -420,23 +420,23 @@
'id' => array('type' =>
'auto', 'nullable' => false),
'ecodimb' =>
array('type' => 'int', 'precision' => '4', 'nullable' => false),
'district_id' =>
array('type' => 'int', 'precision' => '4', 'nullable' => false),
- 'composite_type_id' =>
array('type' => 'int', 'precision' => '4', 'nullable' => false),
- 'cleaning' =>
array('type' => 'int', 'precision' => '2', 'nullable' => false),
+ 'composite_type' =>
array('type' => 'int', 'precision' => '4', 'nullable' => false),
+ 'cleaning' =>
array('type' => 'int', 'precision' => '2', 'nullable' => true),
'payment_method' =>
array('type' => 'int', 'precision' => '2', 'nullable' => false),
'date_start' =>
array('type' => 'int', 'precision' => '8', 'nullable' => true),
'date_end' =>
array('type' => 'int', 'precision' => '8', 'nullable' => true),
'assign_date_start' =>
array('type' => 'int', 'precision' => '8', 'nullable' => true),
'assign_date_end' =>
array('type' => 'int', 'precision' => '8', 'nullable' => true),
'entry_date' =>
array('type' => 'int', 'precision' => '8', 'nullable' => true),
- 'identifier' =>
array('type' => 'int', 'precision' => '4', 'nullable' => false),
+ 'identifier' =>
array('type' => 'varchar', 'precision' => '20', 'nullable' => false),
'adjustment_type' =>
array('type' => 'varchar', 'precision' => '255', 'nullable' => true),
'firstname' =>
array('type' => 'varchar', 'precision' => '64', 'nullable' => true),
'lastname' =>
array('type' => 'varchar', 'precision' => '64', 'nullable' => true),
'title' => array('type'
=> 'varchar', 'precision' => '255', 'nullable' => true),
'company_name' =>
array('type' => 'varchar', 'precision' => '255', 'nullable' => true),
'department' =>
array('type' => 'varchar', 'precision' => '255', 'nullable' => true),
- 'address_1' =>
array('type' => 'varchar', 'precision' => '255', 'nullable' => true),
- 'address_2' =>
array('type' => 'varchar', 'precision' => '255', 'nullable' => true),
+ 'address1' =>
array('type' => 'varchar', 'precision' => '255', 'nullable' => true),
+ 'address2' =>
array('type' => 'varchar', 'precision' => '255', 'nullable' => true),
'postal_code' =>
array('type' => 'varchar', 'precision' => '255', 'nullable' => true),
'place' => array('type'
=> 'varchar', 'precision' => '255', 'nullable' => true),
'phone' => array('type'
=> 'varchar', 'precision' => '255', 'nullable' => true),
@@ -475,3 +475,90 @@
}
+ $test[] = '0.1.0.24';
+ function rental_upgrade0_1_0_24()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+ $GLOBALS['phpgw_setup']->oProc->AddColumn('rental_composite',
'part_of_town_id', array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => true
+ ));
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn('rental_composite',
'custom_prize_factor', array(
+ 'type' => 'decimal',
+ 'precision' => '20',
+ 'scale' => '2',
+ 'nullable' => true,
+ 'default' => '1.00'
+ ));
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn('rental_application',
'executive_officer', array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => true
+ ));
+
+
$GLOBALS['phpgw_setup']->oProc->RenameColumn('rental_application', 'title',
'job_title');
+
$GLOBALS['phpgw_setup']->oProc->RenameColumn('rental_application', 'ecodimb',
'ecodimb_id');
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT DISTINCT
composite_id, part_of_town_id FROM rental_unit"
+ . " JOIN fm_locations ON rental_unit.location_code =
fm_locations.location_code"
+ . " JOIN fm_location1 ON fm_locations.loc1 =
fm_location1.loc1"
+ . " ORDER BY part_of_town_id", __LINE__, __FILE__);
+
+ $composites = array();
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $composites[] = array(
+ 'composite_id' =>
$GLOBALS['phpgw_setup']->oProc->f('composite_id'),
+ 'part_of_town_id' =>
$GLOBALS['phpgw_setup']->oProc->f('part_of_town_id'),
+ );
+ }
+
+ foreach ($composites as $composite)
+ {
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
rental_composite SET part_of_town_id = {$composite['part_of_town_id']} WHERE id
= {$composite['composite_id']}", __LINE__, __FILE__);
+ }
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'rental_location_factor', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto',
'nullable' => false),
+ 'part_of_town_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+ 'factor' => array('type' =>
'decimal', 'precision' => '20', 'scale' => '2', 'nullable' => false, 'default'
=> '1.00'),
+ 'remark' => array('type' =>
'text', 'nullable' => true),
+ 'user_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => true),
+ 'entry_date' => array('type' =>
'int', 'precision' => 8, 'nullable' => true),
+ 'modified_date' => array('type'
=> 'int', 'precision' => 8, 'nullable' => true),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array('fm_part_of_town' =>
array('part_of_town_id' => 'id')),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT id FROM
fm_part_of_town ORDER BY id", __LINE__, __FILE__);
+ $part_of_towns = array();
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $part_of_towns[] =
$GLOBALS['phpgw_setup']->oProc->f('id');
+ }
+
+ $now = time();
+ foreach ($part_of_towns as $part_of_town)
+ {
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
rental_location_factor"
+ . " (part_of_town_id, factor, entry_date,
modified_date) VALUES ({$part_of_town},'1.00',{$now}, {$now} )", __LINE__,
__FILE__);
+ }
+
+ $GLOBALS['phpgw']->locations->add('.application',
'Application', 'rental', $allow_grant = false, $custom_tbl = false, $c_function
= true);
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['rental']['currentver'] =
'0.1.0.25';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
+
Modified: trunk/rental/templates/base/application.xsl
===================================================================
--- trunk/rental/templates/base/application.xsl 2016-08-29 08:52:00 UTC (rev
15524)
+++ trunk/rental/templates/base/application.xsl 2016-08-29 08:53:50 UTC (rev
15525)
@@ -18,6 +18,10 @@
<!-- add / edit -->
<xsl:template xmlns:php="http://php.net/xsl" match="edit">
+ <xsl:variable name="date_format">
+ <xsl:value-of select="php:function('get_phpgw_info',
'user|preferences|common|dateformat')" />
+ </xsl:variable>
+
<div>
<xsl:variable name="form_action">
<xsl:value-of select="form_action"/>
@@ -31,13 +35,13 @@
<xsl:value-of disable-output-escaping="yes"
select="tabs"/>
<div id="application">
<fieldset>
- <xsl:if
test="value_application_id != ''">
+ <xsl:if test="application/id !=
''">
<div
class="pure-control-group">
<label>
<xsl:value-of select="php:function('lang', 'id')"/>
</label>
- <input
type="hidden" name="id" value="{value_application_id}"/>
- <xsl:value-of
select="value_application_id"/>
+ <input
type="hidden" name="id" value="{application/id}"/>
+ <xsl:value-of
select="application/id"/>
</div>
</xsl:if>
<div class="pure-control-group">
@@ -47,7 +51,7 @@
<label>
<xsl:value-of
select="$lang_dimb"/>
</label>
- <input type="hidden"
id="ecodimb" name="ecodimb" value="{value_ecodimb}"/>
+ <input type="hidden"
id="ecodimb_id" name="ecodimb_id" value="{application/ecodimb_id}"/>
<input type="text"
id="ecodimb_name" name="ecodimb_name" value="{value_ecodimb_descr}">
<xsl:attribute
name="data-validation">
<xsl:text>required</xsl:text>
@@ -93,7 +97,7 @@
<xsl:value-of
select="$lang_composite_type"/>
</label>
- <select
name="composite_type_id">
+ <select
name="composite_type">
<xsl:attribute
name="title">
<xsl:value-of select="$lang_composite_type"/>
</xsl:attribute>
@@ -116,7 +120,12 @@
<label>
<xsl:value-of
select="$lang_date_start"/>
</label>
- <input type="text"
id="date_start" name="date_start" size="10" value="{value_date_start}"
readonly="readonly">
+ <input type="text"
id="date_start" name="date_start" size="10" readonly="readonly">
+ <xsl:if
test="application/date_start != 0 and application/date_start != ''">
+
<xsl:attribute name="value">
+
<xsl:value-of select="php:function('date', $date_format,
number(application/date_start))"/>
+
</xsl:attribute>
+ </xsl:if>
<xsl:attribute
name="data-validation">
<xsl:text>required</xsl:text>
</xsl:attribute>
@@ -133,7 +142,12 @@
<label>
<xsl:value-of
select="$lang_date_end"/>
</label>
- <input type="text"
id="date_end" name="date_end" size="10" value="{value_date_end}"
readonly="readonly">
+ <input type="text"
id="date_end" name="date_end" size="10" readonly="readonly">
+ <xsl:if
test="application/date_end != 0 and application/date_end != ''">
+
<xsl:attribute name="value">
+
<xsl:value-of select="php:function('date', $date_format,
number(application/date_end))"/>
+
</xsl:attribute>
+ </xsl:if>
<xsl:attribute
name="data-validation">
<xsl:text>required</xsl:text>
</xsl:attribute>
@@ -148,7 +162,7 @@
<xsl:value-of
select="php:function('lang', 'cleaning')"/>
</label>
<input type="checkbox"
name="cleaning" id="cleaning" value="1">
- <xsl:if
test="value_cleaning = 1">
+ <xsl:if
test="application/cleaning = 1">
<xsl:attribute name="checked" value="checked"/>
</xsl:if>
</input>
@@ -184,7 +198,7 @@
<label>
<xsl:value-of
select="php:function('lang', 'identifier')"/>
</label>
- <input type="text"
name="identifier" value="{value_identifier}">
+ <input type="text"
name="identifier" value="{application/identifier}">
<xsl:attribute
name="data-validation">
<xsl:text>required</xsl:text>
</xsl:attribute>
@@ -197,7 +211,7 @@
<label>
<xsl:value-of
select="php:function('lang', 'firstname')"/>
</label>
- <input type="text"
id="firstname" name="firstname" value="{value_firstname}">
+ <input type="text"
id="firstname" name="firstname" value="{application/firstname}">
<xsl:attribute
name="data-validation">
<xsl:text>naming</xsl:text>
</xsl:attribute>
@@ -207,7 +221,7 @@
<label>
<xsl:value-of
select="php:function('lang', 'lastname')"/>
</label>
- <input type="text"
id="lastname" name="lastname" value="{value_lastname}">
+ <input type="text"
id="lastname" name="lastname" value="{application/lastname}">
<xsl:attribute
name="data-validation">
<xsl:text>naming</xsl:text>
</xsl:attribute>
@@ -218,13 +232,13 @@
<label>
<xsl:value-of
select="php:function('lang', 'job_title')"/>
</label>
- <input type="text"
name="title" value="{value_job_title}"></input>
+ <input type="text"
name="job_title" value="{application/job_title}"></input>
</div>
<div class="pure-control-group">
<label>
<xsl:value-of
select="php:function('lang', 'company')"/>
</label>
- <input type="text"
id="company_name" name="company_name" value="{value_company}">
+ <input type="text"
id="company_name" name="company_name" value="{application/company}">
<xsl:attribute
name="data-validation">
<xsl:text>naming</xsl:text>
</xsl:attribute>
@@ -235,7 +249,7 @@
<label>
<xsl:value-of
select="php:function('lang', 'department')"/>
</label>
- <input type="text"
id="department" name="department" value="{value_department}">
+ <input type="text"
id="department" name="department" value="{application/department}">
<xsl:attribute
name="data-validation">
<xsl:text>naming</xsl:text>
</xsl:attribute>
@@ -246,33 +260,33 @@
<label>
<xsl:value-of
select="php:function('lang', 'address')"/>
</label>
- <input type="text"
name="address1" value="{value_address1}"></input>
- <input type="text"
name="address2" value="{value_address2}"></input>
+ <input type="text"
name="address1" value="{application/address1}"></input>
+ <input type="text"
name="address2" value="{application/address2}"></input>
</div>
<div class="pure-control-group">
<label>
<xsl:value-of
select="php:function('lang', 'postal_code_place')"/>
</label>
- <input type="text"
name="postal_code" value="{value_postal_code}"></input>
- <input type="text"
name="place" value="{value_place}"></input>
+ <input type="text"
name="postal_code" value="{application/postal_code}"></input>
+ <input type="text"
name="place" value="{application/place}"></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="{value_account_number}"></input>
+ <input type="text"
name="account_number" value="{application/account_number}"></input>
</div>
<div class="pure-control-group">
<label>
<xsl:value-of
select="php:function('lang', 'phone')"/>
</label>
- <input type="text"
name="phone" value="{value_phone}"></input>
+ <input type="text"
name="phone" value="{application/phone}"></input>
</div>
<div class="pure-control-group">
<label>
<xsl:value-of
select="php:function('lang', 'email')"/>
</label>
- <input type="text"
name="email" id="email" value="{value_email}">
+ <input type="text"
name="email" id="email" value="{application/email}">
<xsl:attribute
name="data-validation">
<xsl:text>required</xsl:text>
</xsl:attribute>
@@ -290,14 +304,14 @@
<label>
<xsl:value-of
select="php:function('lang', 'unit_leader2')"/>
</label>
- <input type="text"
id="unit_leader" name="unit_leader" value="{value_unit_leader}"></input>
+ <input type="text"
id="unit_leader" name="unit_leader" value="{application/unit_leader}"></input>
</div>
<div class="pure-control-group">
<label>
<xsl:value-of
select="php:function('lang', 'comment')"/>
</label>
<textarea cols="47"
rows="7" name="comment">
- <xsl:value-of
select="value_comment"/>
+ <xsl:value-of
select="application/comment"/>
</textarea>
</div>
<xsl:choose>
@@ -314,76 +328,104 @@
</xsl:choose>
</fieldset>
</div>
- <div id="assignment">
- <fieldset>
- <div class="pure-control-group">
- <xsl:variable
name="lang_date_start">
- <xsl:value-of
select="php:function('lang', 'assign_start')"/>
- </xsl:variable>
- <label>
- <xsl:value-of
select="$lang_date_start"/>
- </label>
- <input type="text"
id="assign_date_start" name="assign_date_start" size="10"
value="{value_assign_date_start}" readonly="readonly">
-
<!--xsl:attribute name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="data-validation-error-msg">
+ <xsl:if test="step > 1">
+ <div id="assignment">
+ <fieldset>
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'executive_officer')"/>
+ </label>
+ <select
id="executive_officer" name="executive_officer">
+
<xsl:apply-templates select="list_executive_officer/options"/>
+ </select>
+ </div>
+ <div
class="pure-control-group">
+ <xsl:variable
name="lang_date_start">
+
<xsl:value-of select="php:function('lang', 'assign_start')"/>
+ </xsl:variable>
+ <label>
<xsl:value-of select="$lang_date_start"/>
-
</xsl:attribute-->
+ </label>
+ <input
type="text" id="assign_date_start" name="assign_date_start" size="10"
readonly="readonly">
+ <xsl:if
test="application/assign_date_start != 0 and application/assign_date_start !=
''">
+
<xsl:attribute name="value">
+
<xsl:value-of select="php:function('date', $date_format,
number(application/assign_date_start))"/>
+
</xsl:attribute>
+ </xsl:if>
+
<!--xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="$lang_date_start"/>
+
</xsl:attribute-->
- </input>
- </div>
- <div class="pure-control-group">
- <xsl:variable
name="lang_date_end">
- <xsl:value-of
select="php:function('lang', 'assign_end')"/>
- </xsl:variable>
- <label>
- <xsl:value-of
select="$lang_date_end"/>
- </label>
- <input type="text"
id="assign_date_end" name="assign_date_end" size="10"
value="{value_assign_date_end}" readonly="readonly">
-
<!--xsl:attribute name="data-validation">
-
<xsl:text>required</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="data-validation-error-msg">
+ </input>
+ </div>
+ <div
class="pure-control-group">
+ <xsl:variable
name="lang_date_end">
+
<xsl:value-of select="php:function('lang', 'assign_end')"/>
+ </xsl:variable>
+ <label>
<xsl:value-of select="$lang_date_end"/>
-
</xsl:attribute-->
+ </label>
+ <input
type="text" id="assign_date_end" name="assign_date_end" size="10"
readonly="readonly">
+ <xsl:if
test="application/assign_date_end != 0 and application/assign_date_end != ''">
+
<xsl:attribute name="value">
+
<xsl:value-of select="php:function('date', $date_format,
number(application/assign_date_end))"/>
+
</xsl:attribute>
+ </xsl:if>
+
<!--xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="$lang_date_end"/>
+
</xsl:attribute-->
- </input>
- </div>
- <div class="pure-control-group">
- <xsl:variable
name="lang_status">
- <xsl:value-of
select="php:function('lang', 'status')"/>
- </xsl:variable>
- <label>
- <xsl:value-of
select="$lang_status"/>
- </label>
- <select name="status">
- <xsl:attribute
name="title">
+ </input>
+ </div>
+ <div
class="pure-control-group">
+ <xsl:variable
name="lang_status">
+
<xsl:value-of select="php:function('lang', 'status')"/>
+ </xsl:variable>
+ <label>
<xsl:value-of select="$lang_status"/>
- </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_status"/>
-
</xsl:attribute-->
- <option
value="">
-
<xsl:value-of select="$lang_status"/>
- </option>
-
<xsl:apply-templates select="status_list/options"/>
- </select>
- </div>
+ </label>
+ <select
name="status">
+
<xsl:attribute name="title">
+
<xsl:value-of select="$lang_status"/>
+
</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_status"/>
+
</xsl:attribute-->
+ <option
value="">
+
<xsl:value-of select="$lang_status"/>
+
</option>
+
<xsl:apply-templates select="status_list/options"/>
+ </select>
+ </div>
- </fieldset>
- </div>
+ </fieldset>
+ </div>
+ </xsl:if>
</div>
<div class="proplist-col">
- <input type="submit" class="pure-button
pure-button-primary" name="save" value="{lang_save}"/>
+ <input type="submit" class="pure-button
pure-button-primary" name="save">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'save')"/>
+ </xsl:attribute>
+ </input>
<xsl:variable name="cancel_url">
<xsl:value-of select="cancel_url"/>
</xsl:variable>
- <input type="button" class="pure-button
pure-button-primary" name="cancel" value="{lang_cancel}"
onClick="window.location = '{cancel_url}';"/>
+ <input type="button" class="pure-button
pure-button-primary" name="cancel" onClick="window.location = '{cancel_url}';">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'cancel')"/>
+ </xsl:attribute>
+ </input>
</div>
</form>
</div>
Modified: trunk/rental/templates/base/composite.xsl
===================================================================
--- trunk/rental/templates/base/composite.xsl 2016-08-29 08:52:00 UTC (rev
15524)
+++ trunk/rental/templates/base/composite.xsl 2016-08-29 08:53:50 UTC (rev
15525)
@@ -56,24 +56,56 @@
</div>
<div class="pure-control-group">
<label>
- <xsl:value-of
select="php:function('lang', 'composite standard')"/>
+ <xsl:value-of
select="php:function('lang', 'location')"/>
</label>
- <xsl:if
test="count(//list_composite_standard/options) > 0">
- <select
id="composite_standard_id" name="composite_standard_id">
-
<xsl:apply-templates select="list_composite_standard/options"/>
- </select>
+ <xsl:if
test="value_unit_count > 0">
+ <input
type="text" name="part_of_town_id" value="{value_part_of_town_id}"/>
</xsl:if>
+ <select
id="part_of_town_id" name="part_of_town_id">
+ <xsl:choose>
+
<xsl:when test="value_unit_count > 0">
+
<xsl:attribute name="disabled">
+
<xsl:text>disabled</xsl:text>
+
</xsl:attribute>
+
</xsl:when>
+
<xsl:otherwise>
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
</xsl:otherwise>
+ </xsl:choose>
+
<xsl:apply-templates select="list_part_of_town/options"/>
+ </select>
</div>
+ <xsl:if
test="contract_furnished_status = 1">
+
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'custom prize factor')"/>
+ </label>
+ <input
type="text" name="custom_prize_factor" id="custom_prize_factor"
value="{value_custom_prize_factor}"/>
+ </div>
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'composite standard')"/>
+ </label>
+ <xsl:if
test="count(//list_composite_standard/options) > 0">
+ <select
id="composite_standard_id" name="composite_standard_id">
+
<xsl:apply-templates select="list_composite_standard/options"/>
+
</select>
+ </xsl:if>
+ </div>
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'furnish_type')"/>
+ </label>
+ <select
id="furnish_type_id" name="furnish_type_id">
+
<xsl:apply-templates select="list_furnish_type/options"/>
+ </select>
+ </div>
+ </xsl:if>
<div class="pure-control-group">
<label>
- <xsl:value-of
select="php:function('lang', 'furnish_type')"/>
- </label>
- <select
id="furnish_type_id" name="furnish_type_id">
-
<xsl:apply-templates select="list_furnish_type/options"/>
- </select>
- </div>
- <div class="pure-control-group">
- <label>
<xsl:value-of
select="php:function('lang', 'has_custom_address')"/>
</label>
<input type="checkbox"
name="has_custom_address" id="has_custom_address">
@@ -164,7 +196,7 @@
</label>
<select id="search_option" name="search_option">
<xsl:apply-templates select="list_search_option/options"/>
-
</select>
+
</select>
</div>
<div
class="pure-control-group">
<label>
@@ -190,7 +222,7 @@
</xsl:if>
</xsl:for-each>
</div>
- </div>
+ </div>
<div id="contracts">
<div
class="pure-control-group">
<label>
@@ -228,7 +260,7 @@
<select id="contract_type" name="contract_type">
<xsl:apply-templates
select="list_fields_of_responsibility_options/options"/>
</select>
- </div>
+ </div>
</div>
</div>
<div>
@@ -250,11 +282,19 @@
</xsl:choose>
</div>
<div class="proplist-col">
- <input type="submit" class="pure-button
pure-button-primary" name="save" value="{lang_save}"
onMouseout="window.status='';return true;"/>
+ <input type="submit" class="pure-button
pure-button-primary" name="save">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'save')"/>
+ </xsl:attribute>
+ </input>
<xsl:variable name="cancel_url">
<xsl:value-of select="cancel_url"/>
- </xsl:variable>
- <input type="button" class="pure-button
pure-button-primary" name="cancel" value="{lang_cancel}"
onMouseout="window.status='';return true;" onClick="window.location =
'{cancel_url}';"/>
+ </xsl:variable>
+ <input type="button" class="pure-button
pure-button-primary" name="cancel" onClick="window.location = '{cancel_url}';">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'cancel')"/>
+ </xsl:attribute>
+ </input>
</div>
</form>
</div>
@@ -281,7 +321,7 @@
<xsl:if
test="has_custom_address = 1">
<label>
<xsl:value-of select="php:function('lang', 'custom_address')"/>
- </label>
+ </label>
<div
class="pure-custom">
<div>
<xsl:value-of select="value_custom_address_1"/>
@@ -302,13 +342,13 @@
<xsl:text> </xsl:text>
<xsl:value-of select="value_custom_place"/>
</div>
-
</xsl:if>
+
</xsl:if>
</div>
</xsl:if>
<xsl:if
test="has_custom_address = 0">
<label>
<xsl:value-of select="php:function('lang', 'address')"/>
- </label>
+ </label>
<xsl:value-of
select="value_address_1"/>
</xsl:if>
</div>
@@ -323,7 +363,7 @@
<xsl:value-of
select="php:function('lang', 'furnish_type')"/>
</label>
<xsl:value-of
select="value_furnish_type_name"/>
- </div>
+ </div>
<div class="pure-control-group">
<label>
<xsl:value-of
select="php:function('lang', 'description')"/>
@@ -372,7 +412,7 @@
</xsl:if>
</xsl:for-each>
</div>
- </div>
+ </div>
<div id="contracts">
<div class="pure-control-group">
<label>
@@ -410,7 +450,7 @@
<select
id="contract_type" name="contract_type">
<xsl:apply-templates select="list_fields_of_responsibility_options/options"/>
</select>
- </div>
+ </div>
</div>
</div>
<div>
@@ -432,7 +472,7 @@
<div class="proplist-col">
<xsl:variable name="cancel_url">
<xsl:value-of select="cancel_url"/>
- </xsl:variable>
+ </xsl:variable>
<input type="button" class="pure-button
pure-button-primary" name="cancel" value="{lang_cancel}"
onMouseout="window.status='';return true;" onClick="window.location =
'{cancel_url}';"/>
</div>
</form>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15525] exclude name field from filter,
sigurdne <=