[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16108] more on rental
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16108] more on rental |
Date: |
Wed, 21 Dec 2016 19:41:39 +0000 (UTC) |
Revision: 16108
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16108
Author: sigurdne
Date: 2016-12-21 19:41:39 +0000 (Wed, 21 Dec 2016)
Log Message:
-----------
more on rental
Modified Paths:
--------------
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
Added Paths:
-----------
trunk/rental/inc/class.bomovein.inc.php
trunk/rental/inc/class.somovein.inc.php
trunk/rental/inc/class.uimovein.inc.php
trunk/rental/inc/model/class.movein.inc.php
trunk/rental/js/rental/movein.edit.js
trunk/rental/templates/base/contract_info.xsl
trunk/rental/templates/base/movein.xsl
Added: trunk/rental/inc/class.bomovein.inc.php
===================================================================
--- trunk/rental/inc/class.bomovein.inc.php (rev 0)
+++ trunk/rental/inc/class.bomovein.inc.php 2016-12-21 19:41:39 UTC (rev
16108)
@@ -0,0 +1,120 @@
+<?php
+ /**
+ * phpGroupWare - rental: a part of a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this customer was funded by
http://www.bergen.kommune.no/ and Nordlandssykehuset
+ * @package rental
+ * @subpackage movein
+ * @version $Id: $
+ */
+
+
+ phpgw::import_class('eventplanner.bocommon');
+ phpgw::import_class('rental.somovein');
+
+ include_class('rental', 'movein', 'inc/model/');
+
+ class rental_bomovein extends eventplanner_bocommon
+ {
+ protected static
+ $bo,
+ $fields,
+ $acl_location;
+
+ public function __construct()
+ {
+ $this->fields = rental_movein::get_fields();
+ $this->acl_location = rental_movein::acl_location;
+ }
+
+ /**
+ * Implementing classes must return an instance of itself.
+ *
+ * @return the class instance.
+ */
+ public static function get_instance()
+ {
+ if (self::$bo == null)
+ {
+ self::$bo = new rental_bomovein();
+ }
+ return self::$bo;
+ }
+
+ public function store($object)
+ {
+ $this->store_pre_commit($object);
+ $ret = rental_somovein::get_instance()->store($object);
+ $this->store_post_commit($object);
+ return $ret;
+ }
+
+ public function read($params)
+ {
+ if(empty($params['filters']['active']))
+ {
+ $params['filters']['active'] = 1;
+ }
+ else
+ {
+ unset($params['filters']['active']);
+ }
+ $values =
rental_somovein::get_instance()->read($params);
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ foreach ($values['results'] as &$entry)
+ {
+ $entry['created'] = date($dateformat,
$entry['created']);//$GLOBALS['phpgw']->common->show_date($entry['created']);
+ $entry['modified'] = date($dateformat,
$entry['modified']);//$GLOBALS['phpgw']->common->show_date($entry['modified']);
+ }
+ return $values;
+ }
+
+ public function read_single($id, $return_object = true)
+ {
+ if ($id)
+ {
+ $values =
rental_somovein::get_instance()->read_single($id, $return_object);
+ }
+ else
+ {
+ $values = new rental_movein();
+ }
+
+ $custom_fields = rental_movein::get_custom_fields();
+ if($custom_fields)
+ {
+ $custom_fields =
rental_somovein::get_instance()->read_custom_field_values($id, $custom_fields);
+ $_values =
createObject('property.custom_fields')->prepare(array('attributes' =>
$custom_fields), 'rental', rental_movein::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-20 16:39:37 UTC (rev 16107)
+++ trunk/rental/inc/class.menu.inc.php 2016-12-21 19:41:39 UTC (rev 16108)
@@ -148,6 +148,11 @@
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'rental.uimoveout.index')),
'image' => array('rental',
'text-x-generic'),
);
+ $menus['navigation']['movein'] = array(
+ 'text' => lang('movein'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'rental.uimovein.index')),
+ 'image' => array('rental',
'text-x-generic'),
+ );
$menus['navigation']['schedule'] = array(
'text' => lang('schedule'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'rental.uicomposite.schedule')),
Added: trunk/rental/inc/class.somovein.inc.php
===================================================================
--- trunk/rental/inc/class.somovein.inc.php (rev 0)
+++ trunk/rental/inc/class.somovein.inc.php 2016-12-21 19:41:39 UTC (rev
16108)
@@ -0,0 +1,89 @@
+<?php
+ /**
+ * phpGroupWare - rental: a part of a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/ and Nordlandssykehuset
+ * @package rental
+ * @subpackage movein
+ * @version $Id: $
+ */
+ phpgw::import_class('phpgwapi.socommon');
+
+ class rental_somovein extends phpgwapi_socommon
+ {
+
+ protected static $so;
+
+ public function __construct()
+ {
+ parent::__construct('rental_movein',
rental_movein::get_fields());
+ }
+
+ /**
+ * Implementing classes must return an instance of itself.
+ *
+ * @return the class instance.
+ */
+ public static function get_instance()
+ {
+ if (self::$so == null)
+ {
+ self::$so = CreateObject('rental.somovein');
+ }
+ 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_movein();
+ foreach ($this->fields as $field => $field_info)
+ {
+ $object->set_field($field, $data[$field]);
+ }
+
+ return $object;
+ }
+
+ protected function update( $object )
+ {
+ $this->db->transaction_begin();
+
+ parent::update($object);
+
+ return $this->db->transaction_commit();
+ }
+ }
\ No newline at end of file
Modified: trunk/rental/inc/class.somoveout.inc.php
===================================================================
--- trunk/rental/inc/class.somoveout.inc.php 2016-12-20 16:39:37 UTC (rev
16107)
+++ trunk/rental/inc/class.somoveout.inc.php 2016-12-21 19:41:39 UTC (rev
16108)
@@ -81,46 +81,7 @@
protected function update( $object )
{
$this->db->transaction_begin();
- // $status_text =
rental_moveout::get_status_list();
- $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $lang_active = lang('active');
- $lang_inactive = lang('inactive');
- $original =
$this->read_single($object->get_id());//returned as array()
- foreach ($this->fields as $field => $params)
- {
- $new_value = $object->$field;
- $old_value = $original[$field];
- if (!empty($params['history']) && ($new_value
!= $old_value))
- {
- $label = !empty($params['label']) ?
lang($params['label']) : $field;
- switch ($field)
- {
- case 'status':
- $old_value =
$status_text[$old_value];
- $new_value =
$status_text[$new_value];
- break;
- case 'active':
- $old_value = $old_value
? $lang_active : $lang_inactive;
- $new_value = $new_value
? $lang_active : $lang_inactive;
- break;
- default:
- break;
- }
- $value_set = array
- (
- '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__);
- }
- }
-
parent::update($object);
return $this->db->transaction_commit();
Added: trunk/rental/inc/class.uimovein.inc.php
===================================================================
--- trunk/rental/inc/class.uimovein.inc.php (rev 0)
+++ trunk/rental/inc/class.uimovein.inc.php 2016-12-21 19:41:39 UTC (rev
16108)
@@ -0,0 +1,322 @@
+<?php
+ /**
+ * phpGroupWare - rental: a part of a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this movein was funded by
http://www.bergen.kommune.no/ and Nordlandssykehuset
+ * @package rental
+ * @subpackage movein
+ * @version $Id: $
+ */
+ phpgw::import_class('eventplanner.uicommon');
+ phpgw::import_class('phpgwapi.datetime');
+
+ include_class('rental', 'movein', 'inc/model/');
+
+ class rental_uimovein extends eventplanner_uicommon
+ {
+
+ public $public_functions = array(
+ 'add' => true,
+ 'index' => true,
+ 'query' => true,
+ 'view' => true,
+ 'edit' => true,
+ 'save' => true,
+ 'get' => true,
+ 'get_files' => true,
+ 'view_file'=> true
+ );
+ protected
+ $bo,
+ $fields,
+ $permissions,
+ $custom_fields;
+
+ public function __construct()
+ {
+ parent::__construct();
+ self::set_active_menu('rental::movein');
+ $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' .
lang('movein');
+ $this->bo = createObject('rental.bomovein');
+ $this->fields = rental_movein::get_fields();
+ $this->permissions =
rental_movein::get_instance()->get_permission_array();
+ $this->custom_fields =
rental_movein::get_custom_fields();
+ }
+
+ public function index()
+ {
+ $function_msg = lang('movein');
+
+ if (empty($this->permissions[PHPGW_ACL_READ]))
+ {
+ phpgw::no_access($function_msg);
+ }
+
+ if (phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ return $this->query();
+ }
+
+ phpgwapi_jquery::load_widget('autocomplete');
+
+ $data = array(
+ 'datatable_name' => $function_msg,
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ )
+ )
+ ),
+ 'datatable' => array(
+ 'source' => self::link(array(
+ 'menuaction' =>
'rental.uimovein.index',
+ 'phpgw_return_as' => 'json'
+ )),
+ 'allrows' => true,
+ 'new_item' =>
self::link(array('menuaction' => 'rental.uimovein.add')),
+ 'editor_action' => '',
+ 'field' => parent::_get_fields()
+ )
+ );
+
+ $parameters = array(
+ 'parameter' => array(
+ array(
+ 'name' => 'id',
+ 'source' => 'id'
+ )
+ )
+ );
+
+ $data['datatable']['actions'][] = array
+ (
+ 'my_name' => 'view',
+ 'text' => lang('show'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php', array
+ (
+ 'menuaction' => 'rental.uimovein.view'
+ )),
+ 'parameters' => json_encode($parameters)
+ );
+
+ $data['datatable']['actions'][] = array
+ (
+ 'my_name' => 'edit',
+ 'text' => lang('edit'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php', array
+ (
+ 'menuaction' => 'rental.uimovein.edit'
+ )),
+ 'parameters' => json_encode($parameters)
+ );
+
+ self::add_javascript('rental', 'rental',
'movein.index.js');
+ phpgwapi_jquery::load_widget('numberformat');
+
+ self::render_template_xsl('datatable_jquery', $data);
+ }
+
+ public function edit( $values = array(), $mode = 'edit' )
+ {
+ $active_tab = !empty($values['active_tab']) ?
$values['active_tab'] : phpgw::get_var('active_tab', 'string', 'REQUEST',
'first_tab');
+ $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' .
lang('edit');
+ if (empty($this->permissions[PHPGW_ACL_ADD]))
+ {
+ phpgw::no_access();
+ }
+
+ if (!empty($values['object']))
+ {
+ $movein = $values['object'];
+ }
+ else
+ {
+ $id = !empty($values['id']) ? $values['id'] :
phpgw::get_var('id', 'int');
+ $movein = $this->bo->read_single($id);
+ }
+
+ $tabs = array();
+ $tabs['first_tab'] = array(
+ 'label' => lang('movein'),
+ 'link' => '#first_tab'
+ );
+// $tabs['signature'] = array(
+// 'label' => lang('signature'),
+// 'link' => '#signature'
+// );
+
+
+ $custom_values = $movein->attributes ?
$movein->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_movein::acl_location,
$custom_values);
+ $file_def = array(
+ array('key' => 'file_name', 'label' =>
lang('Filename'), 'sortable' => false,
+ 'resizeable' => true),
+ array('key' => 'picture', 'label' =>
lang('picture'), 'sortable' => false,
+ 'resizeable' => true, 'formatter' =>
'JqueryPortico.showPicture'),
+ array('key' => 'delete_file', 'label' =>
lang('Delete file'), 'sortable' => false,
+ 'resizeable' => true, 'formatter' =>
'JqueryPortico.FormatterCenter'),
+ );
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_0',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' => 'rental.uimovein.get_files',
+ 'id' => $id,
+ 'phpgw_return_as' => 'json'))),
+ 'ColumnDefs' => $file_def,
+ 'data' => json_encode(array()),
+ 'config' => array(
+ array('disableFilter' => true),
+ array('disablePagination' => true)
+ )
+ );
+
+ $comments = (array)$movein->comments;
+ foreach ($comments as $key => &$comment)
+ {
+ $comment['value_count'] = $key + 1;
+ $comment['value_date'] =
$GLOBALS['phpgw']->common->show_date($comment['time']);
+ }
+
+ $comments_def = array(
+ array('key' => 'value_count', 'label' => '#',
'sortable' => true, 'resizeable' => true),
+ array('key' => 'value_date', 'label' =>
lang('Date'), 'sortable' => false, 'resizeable' => true),
+ array('key' => 'author', 'label' =>
lang('User'), 'sortable' => true, 'resizeable' => true),
+ array('key' => 'comment', 'label' =>
lang('Note'), 'sortable' => true, 'resizeable' => true)
+ );
+
+ $datatable_def[] = array(
+ 'container' => 'datatable-container_1',
+ 'requestUrl' => "''",
+ 'ColumnDefs' => $comments_def,
+ 'data' => json_encode($comments),
+ 'config' => array(
+ array('disableFilter' => true),
+ array('disablePagination' => true)
+ )
+ );
+
+ $data = array(
+ 'datatable_def' => $datatable_def,
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'rental.uimovein.save')),
+ 'cancel_url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'rental.uimovein.index',)),
+ 'movein' => $movein,
+ 'contract' =>
createObject('rental.uicontract')->get($movein->contract_id),
+ 'mode' => $mode,
+ 'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+ 'value_active_tab' => $active_tab,
+ 'attributes_group' => $organized_fields,
+ );
+ phpgwapi_jquery::formvalidator_generate(array());
+ phpgwapi_jquery::load_widget('autocomplete');
+// self::add_javascript('phpgwapi', 'signature_pad',
'signature_pad.min.js');
+//
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/signature_pad/signature-pad.css');
+ $attributes_xsl = $mode == 'edit' ? 'attributes_form' :
'attributes_view';
+ self::add_javascript('rental', 'rental',
'movein.edit.js');
+ self::render_template_xsl(array('movein',
'contract_info', 'datatable_inline', $attributes_xsl), array($mode => $data));
+ }
+
+ /*
+ * Get the movein with the id given in the http variable 'id'
+ */
+
+ public function get( $id = 0 )
+ {
+ if (empty($this->permissions[PHPGW_ACL_ADD]))
+ {
+ phpgw::no_access();
+ }
+
+ $id = !empty($id) ? $id : phpgw::get_var('id', 'int');
+
+ $movein = $this->bo->read_single($id)->toArray();
+
+ unset($movein['secret']);
+
+ return $movein;
+ }
+
+ public function save()
+ {
+ parent::save();
+ }
+
+ /**
+ * (non-PHPdoc)
+ * @see eventplanner/inc/eventplanner_uicommon#query()
+ */
+ public function query()
+ {
+ $params = $this->bo->build_default_read_params();
+ $values = $this->bo->read($params);
+ array_walk($values["results"], array($this,
"_add_links"), "rental.uimovein.edit");
+
+ return $this->jquery_results($values);
+ }
+
+ public function view_file()
+ {
+ parent::view_file();
+ }
+
+ public function get_files()
+ {
+ if (empty($this->permissions[PHPGW_ACL_READ]))
+ {
+ phpgw::no_access();
+ }
+
+ $id = phpgw::get_var('id', 'int');
+ return parent::get_files('rental', 'movein',
'rental.uimovein.view_file', $id);
+ }
+ /**
+ * Store and / or delete files related to an entity
+ *
+ * @param int $id entity id
+ *
+ * @return void
+ */
+ protected function _handle_files( $id )
+ {
+ parent::_handle_files('rental', 'movein', $id);
+ }
+
+ }
\ No newline at end of file
Modified: trunk/rental/inc/class.uimoveout.inc.php
===================================================================
--- trunk/rental/inc/class.uimoveout.inc.php 2016-12-20 16:39:37 UTC (rev
16107)
+++ trunk/rental/inc/class.uimoveout.inc.php 2016-12-21 19:41:39 UTC (rev
16108)
@@ -41,7 +41,9 @@
'view' => true,
'edit' => true,
'save' => true,
- 'get' => true
+ 'get' => true,
+ 'get_files' => true,
+ 'view_file'=> true
);
protected
$bo,
@@ -162,7 +164,50 @@
// 'link' => '#signature'
// );
+ $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);
+ $file_def = array(
+ array('key' => 'file_name', 'label' =>
lang('Filename'), 'sortable' => false,
+ 'resizeable' => true),
+ array('key' => 'picture', 'label' =>
lang('picture'), 'sortable' => false,
+ 'resizeable' => true, 'formatter' =>
'JqueryPortico.showPicture'),
+ array('key' => 'delete_file', 'label' =>
lang('Delete file'), 'sortable' => false,
+ 'resizeable' => true, 'formatter' =>
'JqueryPortico.FormatterCenter'),
+ );
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_0',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' => 'rental.uimoveout.get_files',
+ 'id' => $id,
+ 'phpgw_return_as' => 'json'))),
+ 'ColumnDefs' => $file_def,
+ 'data' => json_encode(array()),
+ 'config' => array(
+ array('disableFilter' => true),
+ array('disablePagination' => true)
+ )
+ );
+
$comments = (array)$moveout->comments;
foreach ($comments as $key => &$comment)
{
@@ -172,13 +217,13 @@
$comments_def = array(
array('key' => 'value_count', 'label' => '#',
'sortable' => true, 'resizeable' => true),
- array('key' => 'value_date', 'label' =>
lang('Date'), 'sortable' => true, 'resizeable' => true),
+ array('key' => 'value_date', 'label' =>
lang('Date'), 'sortable' => false, 'resizeable' => true),
array('key' => 'author', 'label' =>
lang('User'), 'sortable' => true, 'resizeable' => true),
array('key' => 'comment', 'label' =>
lang('Note'), 'sortable' => true, 'resizeable' => true)
);
$datatable_def[] = array(
- 'container' => 'datatable-container_0',
+ 'container' => 'datatable-container_1',
'requestUrl' => "''",
'ColumnDefs' => $comments_def,
'data' => json_encode($comments),
@@ -188,28 +233,6 @@
)
);
-
- $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')),
@@ -227,7 +250,7 @@
//
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/signature_pad/signature-pad.css');
$attributes_xsl = $mode == 'edit' ? 'attributes_form' :
'attributes_view';
self::add_javascript('rental', 'rental',
'moveout.edit.js');
- self::render_template_xsl(array('moveout',
'datatable_inline', $attributes_xsl), array($mode => $data));
+ self::render_template_xsl(array('moveout',
'contract_info', 'datatable_inline', $attributes_xsl), array($mode => $data));
}
/*
@@ -268,4 +291,31 @@
return $this->jquery_results($values);
}
+ public function view_file()
+ {
+ parent::view_file();
+ }
+
+ public function get_files()
+ {
+ if (empty($this->permissions[PHPGW_ACL_READ]))
+ {
+ phpgw::no_access();
+ }
+
+ $id = phpgw::get_var('id', 'int');
+ return parent::get_files('rental', 'moveout',
'rental.uimoveout.view_file', $id);
+ }
+ /**
+ * Store and / or delete files related to an entity
+ *
+ * @param int $id entity id
+ *
+ * @return void
+ */
+ protected function _handle_files( $id )
+ {
+ parent::_handle_files('rental', 'moveout', $id);
+ }
+
}
\ No newline at end of file
Added: trunk/rental/inc/model/class.movein.inc.php
===================================================================
--- trunk/rental/inc/model/class.movein.inc.php (rev 0)
+++ trunk/rental/inc/model/class.movein.inc.php 2016-12-21 19:41:39 UTC (rev
16108)
@@ -0,0 +1,212 @@
+<?php
+ /**
+ * phpGroupWare - rental: a part of a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/ and Nordlandssykehuset
+ * @package rental
+ * @subpackage movein
+ * @version $Id: $
+ */
+
+ phpgw::import_class('rental.bomovein');
+
+ include_class('phpgwapi', 'model', 'inc/model/');
+
+ class rental_movein extends phpgwapi_model
+ {
+
+ const acl_location = '.movein';
+
+ protected
+ $id,
+ $contract_id,
+ $old_contract_id,
+ $created,
+ $modified,
+ $account_id,
+ $comments,
+ $comment,
+ $attributes,// custom fields
+ $values_attribute;// custom fields
+
+ protected $field_of_responsibility_name = '.movein';
+
+ public function __construct( int $id = null )
+ {
+ parent::__construct((int)$id);
+ $this->field_of_responsibility_name =
self::acl_location;
+ }
+
+ /**
+ * Implementing classes must return an instance of itself.
+ *
+ * @return the class instance.
+ */
+ public static function get_instance()
+ {
+ return new rental_movein();
+ }
+
+ public static function get_custom_fields()
+ {
+ static $custom_fields = array();
+ if(!$custom_fields)
+ {
+ $custom_fields =
$GLOBALS['phpgw']->custom_fields->find('rental', self::acl_location, 0, '',
'ASC', 'attrib_sort', true, true);
+ }
+ return $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(
+ 'id' => array('action'=> PHPGW_ACL_READ,
+ 'type' => 'int',
+ 'label' => 'id',
+ 'sortable'=> true,
+ 'formatter' =>
'JqueryPortico.formatLink',
+ ),
+ 'created' => array('action'=> PHPGW_ACL_READ,
+ 'type' => 'date',
+ 'label' => 'created',
+ 'sortable' => true,
+ ),
+ 'modified' => array('action'=> PHPGW_ACL_READ |
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+ 'type' => 'date',
+ 'label' => 'modified',
+ 'sortable' => true,
+ ),
+ 'account_id' => array('action'=> PHPGW_ACL_ADD,
+ 'type' => 'int',
+ 'label' => 'contract_id',
+ 'sortable' => true,
+ ),
+ 'contract_id' => array('action'=> PHPGW_ACL_ADD
| PHPGW_ACL_EDIT,
+ 'type' => 'int',
+ 'label' => 'contract_id',
+ 'sortable' => true,
+ ),
+ 'old_contract_id' => array('action'=>
PHPGW_ACL_READ,
+ 'type' => 'string',
+ 'query' => true,
+ 'label' => 'contract',
+ 'join' => array(
+ 'table' => 'rental_contract',
+ 'fkey' => 'contract_id',
+ 'key' => 'id',
+ 'column' => 'old_contract_id'
+ )
+ ),
+ 'comments' => array(
+ 'action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string',
+ 'manytomany' => array(
+ 'input_field' =>
'comment_input',
+ 'table' =>
'rental_movein_comment',
+ 'key' => 'movein_id',
+ 'column' => array('time',
'author', 'comment', 'type'),
+ 'order' => array('sort' =>
'time', 'dir' => 'ASC')
+ )),
+ 'comment' => array(
+ 'action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string',
+ 'related' => true,
+ )
+ );
+
+
+ if($debug)
+ {
+ foreach ($fields as $field => $field_info)
+ {
+ if(!property_exists('rental_movein',
$field))
+ {
+
phpgwapi_cache::message_set('$'."{$field},", 'error');
+ }
+
+ }
+ }
+
+ $custom_fields = self::get_custom_fields();
+
+ foreach ($custom_fields as $attrib_id => $attrtib)
+ {
+ $fields[$attrtib['name']] = array(
+ 'action'=> $attrtib['list'],
+ 'type' => $attrtib['datatype']
== 'D' || $attrtib['datatype'] == 'DT' ? 'datestring' : 'string',
+ 'label' =>
$attrtib['input_text'],
+ 'translated_label' =>
$attrtib['input_text'],
+ 'sortable' =>
!!$attrtib['attrib_sort'],
+ 'query' => !!$attrtib['search']
+ );
+ }
+ return $fields;
+ }
+
+ /**
+ * Implement in subclasses to perform actions on entity before
validation
+ */
+ protected function preValidate( &$entity )
+ {
+ if (!empty($entity->comment))
+ {
+ $entity->comment_input = array(
+ 'time' => time(),
+ 'author' =>
$GLOBALS['phpgw_info']['user']['fullname'],
+ 'comment' => $entity->comment,
+ 'type' => 'comment'
+ );
+ }
+
+ $entity->modified = time();
+ if(!$entity->get_id())
+ {
+ $entity->account_id =
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+ }
+
+ }
+
+
+ public function serialize()
+ {
+ return self::toArray();
+ }
+
+ public function store()
+ {
+ return rental_bomovein::get_instance()->store($this);
+ }
+
+ public function read_single($id)
+ {
+ return
rental_bomovein::get_instance()->read_single($id, true);
+ }
+ }
Modified: trunk/rental/inc/model/class.moveout.inc.php
===================================================================
--- trunk/rental/inc/model/class.moveout.inc.php 2016-12-20 16:39:37 UTC
(rev 16107)
+++ trunk/rental/inc/model/class.moveout.inc.php 2016-12-21 19:41:39 UTC
(rev 16108)
@@ -185,10 +185,6 @@
'type' => 'comment'
);
}
- if (!empty($entity->moveout_organization_number))
- {
- $entity->moveout_organization_number =
str_replace(' ', '', $entity->moveout_organization_number);
- }
$entity->modified = time();
if(!$entity->get_id())
Added: trunk/rental/js/rental/movein.edit.js
===================================================================
--- trunk/rental/js/rental/movein.edit.js (rev 0)
+++ trunk/rental/js/rental/movein.edit.js 2016-12-21 19:41:39 UTC (rev
16108)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2016 hc483
+ *
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+var contract_id_selection;
+var lang;
+var oArgs = {menuaction: 'rental.uicontract.index', organization_number: true};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'contract_name', 'contract_id',
'contract_container', 'old_contract_id');
+
+$(window).on('load', function ()
+{
+ contract_id = $('#contract_id').val();
+ if (contract_id)
+ {
+ contract_id_selection = contract_id;
+ }
+ $("#contract_name").on("autocompleteselect", function (event, ui)
+ {
+ var contract_id = ui.item.value;
+ if (contract_id !== contract_id_selection)
+ {
+ populateContractParty(contract_id);
+ }
+ });
+});
+
+function populateContractParty(contract_id)
+{
+ contract_id = contract_id || $('#contract_id').val();
+
+ if (!contract_id)
+ {
+ return;
+ }
+ oArgs = {
+ menuaction: 'rental.uicontract.get',
+ id: contract_id
+ };
+
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ var data = {};
+
+ JqueryPortico.execute_ajax(requestUrl,
+ function (result)
+ {
+
+ $("#executive_officer").html(result.executive_officer);
+ $("#composite").html(result.composite);
+ $("#rented_area").html(result.rented_area);
+ $("#security_amount").html(result.security_amount);
+ $("#date_start").html(result.date_start);
+ $("#date_end").html(result.date_end);
+ $("#type").html(result.type);
+ $("#party").html(result.party);
+ $("#identifier").html(result.identifier);
+ $("#mobile_phone").html(result.mobile_phone);
+ $("#department").html(result.department);
+ $("#contract_status").html(result.contract_status);
+ $("#rented_area").html(result.rented_area);
+ $("#term_label").html(result.term_label);
+
+ }, data, "POST", "json"
+ );
+}
+
+/*
+$(document).ready(function ()
+{
+
+ var wrapper = document.getElementById("signature-pad"),
+ clearButton = wrapper.querySelector("[data-action=clear]"),
+ saveButton = wrapper.querySelector("[data-action=save]"),
+ canvas = wrapper.querySelector("canvas"),
+ signaturePad;
+
+// Adjust canvas coordinate space taking into account pixel ratio,
+// to make it look crisp on mobile devices.
+// This also causes canvas to be cleared.
+ function resizeCanvas()
+ {
+ // When zoomed out to less than 100%, for some very strange
reason,
+ // some browsers report devicePixelRatio as less than 1
+ // and only part of the canvas is cleared then.
+ var ratio = Math.max(window.devicePixelRatio || 1, 1);
+ canvas.width = canvas.offsetWidth * ratio;
+ canvas.height = canvas.offsetHeight * ratio;
+ canvas.getContext("2d").scale(ratio, ratio);
+ }
+
+ window.onresize = resizeCanvas;
+ resizeCanvas();
+
+ signaturePad = new SignaturePad(canvas);
+
+ clearButton.addEventListener("click", function (event)
+ {
+ signaturePad.clear();
+ });
+
+ saveButton.addEventListener("click", function (event)
+ {
+ if (signaturePad.isEmpty())
+ {
+ alert("Please provide signature first.");
+ }
+ else
+ {
+ window.open(signaturePad.toDataURL());
+ }
+ });
+});
+ */
\ No newline at end of file
Modified: trunk/rental/setup/phpgw_no.lang
===================================================================
--- trunk/rental/setup/phpgw_no.lang 2016-12-20 16:39:37 UTC (rev 16107)
+++ trunk/rental/setup/phpgw_no.lang 2016-12-21 19:41:39 UTC (rev 16108)
@@ -642,9 +642,14 @@
price type rental no Pristype
schedule rental no Kalender
moveout rental no Utflytting
+movein rental no Innflytting
custom fields rental no Egendefinerte felt
custom field groups rental no Grupper for Egendefinerte felt
report rental no Rapport
basis data rental no Grunnlagsdata
created rental no Registrert
-modified rental no Endret
\ No newline at end of file
+modified rental no Endret
+picture rental no Bilde
+delete file rental no Slett fil
+user rental no Bruker
+note rental no Merknad
\ No newline at end of file
Modified: trunk/rental/setup/setup.inc.php
===================================================================
--- trunk/rental/setup/setup.inc.php 2016-12-20 16:39:37 UTC (rev 16107)
+++ trunk/rental/setup/setup.inc.php 2016-12-21 19:41:39 UTC (rev 16108)
@@ -1,6 +1,6 @@
<?php
$setup_info['rental']['name'] = 'rental'; // Module identifier
- $setup_info['rental']['version'] = '0.1.0.32'; // Current module version
+ $setup_info['rental']['version'] = '0.1.0.33'; // Current module version
$setup_info['rental']['app_order'] = 51; // (?)
$setup_info['rental']['tables'] = array(
'rental_party', // All contract participants, tenants etc.
@@ -32,7 +32,9 @@
'rental_application_comment',
'rental_application_composite',
'rental_moveout',
- 'rental_moveout_comment'
+ 'rental_moveout_comment',
+ 'rental_movein',
+ 'rental_movein_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-20 16:39:37 UTC (rev
16107)
+++ trunk/rental/setup/tables_current.inc.php 2016-12-21 19:41:39 UTC (rev
16108)
@@ -600,5 +600,36 @@
'ix' => array(),
'uc' => array()
),
+ 'rental_movein' => 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_movein_comment' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'nullable' =>
False),
+ 'movein_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_movein' => array('movein_id' => 'id')),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
);
Modified: trunk/rental/setup/tables_update.inc.php
===================================================================
--- trunk/rental/setup/tables_update.inc.php 2016-12-20 16:39:37 UTC (rev
16107)
+++ trunk/rental/setup/tables_update.inc.php 2016-12-21 19:41:39 UTC (rev
16108)
@@ -746,7 +746,7 @@
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
- $GLOBALS['phpgw']->locations->add('.moveout', 'Moveout',
'rental', $allow_grant = true, $custom_tbl = 'rental_moveout', $c_function =
true, $c_attrib = true);
+ $GLOBALS['phpgw']->locations->add('.moveout', 'Movein',
'rental', $allow_grant = true, $custom_tbl = 'rental_moveout', $c_function =
true, $c_attrib = true);
$GLOBALS['phpgw_setup']->oProc->CreateTable(
'rental_moveout', array(
@@ -791,3 +791,54 @@
return $GLOBALS['setup_info']['rental']['currentver'];
}
}
+
+ $test[] = '0.1.0.32';
+ function rental_upgrade0_1_0_32()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw']->locations->add('.movein', 'Movein',
'rental', $allow_grant = true, $custom_tbl = 'rental_movein', $c_function =
true, $c_attrib = true);
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'rental_movein', 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_movein_comment', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto',
'nullable' => False),
+ 'movein_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_movein' =>
array('movein_id' => 'id')),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['rental']['currentver'] =
'0.1.0.33';
+ return $GLOBALS['setup_info']['rental']['currentver'];
+ }
+ }
Added: trunk/rental/templates/base/contract_info.xsl
===================================================================
--- trunk/rental/templates/base/contract_info.xsl
(rev 0)
+++ trunk/rental/templates/base/contract_info.xsl 2016-12-21 19:41:39 UTC
(rev 16108)
@@ -0,0 +1,115 @@
+
+<xsl:template name="contract_info" xmlns:php="http://php.net/xsl">
+ <xsl:param name="contract" />
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'executive_officer')"/>
+ </label>
+ <div id="executive_officer" class="pure-custom">
+ <xsl:value-of select="contract/executive_officer"/>
+ </div>
+ </div>
+
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'composite')"/>
+ </label>
+ <div id="composite" class="pure-custom">
+ <xsl:value-of select="contract/composite"/>
+ </div>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'rented_area')"/>
+ </label>
+ <div id="rented_area" class="pure-custom">
+ <xsl:value-of select="contract/rented_area"/>
+ </div>
+ </div>
+
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'security_amount')"/>
+ </label>
+ <div id="security_amount" class="pure-custom">
+ <xsl:value-of select="contract/security_amount"/>
+ </div>
+ </div>
+
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'date_start')"/>
+ </label>
+ <div id="date_start" class="pure-custom">
+ <xsl:value-of select="contract/date_start"/>
+ </div>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'date_end')"/>
+ </label>
+ <div id="date_end" class="pure-custom">
+ <xsl:value-of select="contract/date_end"/>
+ </div>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang', 'type')"/>
+ </label>
+ <div id="type" class="pure-custom">
+ <xsl:value-of select="contract/type"/>
+ </div>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang', 'party')"/>
+ </label>
+ <div id="party" class="pure-custom">
+ <xsl:value-of select="contract/party"/>
+ </div>
+ </div>
+
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'identifier')"/>
+ </label>
+ <div id="identifier" class="pure-custom">
+ <xsl:value-of select="contract/identifier"/>
+ </div>
+ </div>
+
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'mobile_phone')"/>
+ </label>
+ <div id="mobile_phone" class="pure-custom">
+ <xsl:value-of select="contract/mobile_phone"/>
+ </div>
+ </div>
+
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'department')"/>
+ </label>
+ <div id="department" class="pure-custom">
+ <xsl:value-of select="contract/department"/>
+ </div>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'contract_status')"/>
+ </label>
+ <div id="contract_status" class="pure-custom">
+ <xsl:value-of select="contract/contract_status"/>
+ </div>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of select="php:function('lang',
'billing_terms')"/>
+ </label>
+ <div id="term_label" class="pure-custom">
+ <xsl:value-of select="contract/term_label"/>
+ </div>
+ </div>
+
+</xsl:template>
Added: trunk/rental/templates/base/movein.xsl
===================================================================
--- trunk/rental/templates/base/movein.xsl (rev 0)
+++ trunk/rental/templates/base/movein.xsl 2016-12-21 19:41:39 UTC (rev
16108)
@@ -0,0 +1,292 @@
+
+<!-- $Id: price_item.xsl 12604 2015-01-15 17:06:11Z nelson224 $ -->
+<xsl:template match="data">
+ <xsl:choose>
+ <xsl:when test="edit">
+ <xsl:apply-templates select="edit" />
+ </xsl:when>
+ <xsl:when test="view">
+ <xsl:apply-templates select="view" />
+ </xsl:when>
+ </xsl:choose>
+
+</xsl:template>
+
+<!-- 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>
+ <xsl:variable name="form_action">
+ <xsl:value-of select="form_action"/>
+ </xsl:variable>
+ <xsl:variable name="mode">
+ <xsl:value-of select="mode"/>
+ </xsl:variable>
+
+ <div>
+ <script type="text/javascript">
+ var lang = <xsl:value-of
select="php:function('js_lang', 'Name or company is required')"/>;
+ </script>
+ <form id="form" name="form" method="post"
action="{$form_action}" class="pure-form pure-form-aligned"
enctype="multipart/form-data">
+ <div id="tab-content">
+ <xsl:value-of disable-output-escaping="yes"
select="tabs"/>
+ <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="movein/id > 0">
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'id')"/>
+ </label>
+ <input
type="hidden" name="id" value="{movein/id}"/>
+ <xsl:value-of
select="movein/id"/>
+ </div>
+ </xsl:if>
+
+
+ <div class="pure-control-group">
+ <xsl:variable
name="lang_contract">
+ <xsl:value-of
select="php:function('lang', 'contract')"/>
+ </xsl:variable>
+ <label>
+ <xsl:value-of
select="$lang_contract"/>
+ </label>
+ <input type="hidden"
id="contract_id" name="contract_id" value="{contract/id}">
+ <xsl:attribute
name="data-validation">
+
<xsl:text>required</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute
name="data-validation-error-msg">
+
<xsl:value-of select="$lang_contract"/>
+ </xsl:attribute>
+ <xsl:attribute
name="placeholder">
+
<xsl:value-of select="$lang_contract"/>
+ </xsl:attribute>
+ </input>
+ <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>
+ <xsl:attribute
name="data-validation">
+
<xsl:text>required</xsl:text>
+ </xsl:attribute>
+ </input>
+ <div
id="contract_container"/>
+ </div>
+
+ <xsl:call-template
name="contract_info">
+ <xsl:with-param
name="contract" select ='contract'/>
+ </xsl:call-template>
+
+ </fieldset>
+
+ <fieldset>
+ <legend>
+ <xsl:value-of
select="php:function('lang', 'report')"/>
+ </legend>
+
+ <xsl:call-template
name="attributes_values"/>
+
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'picture')"/>
+ </label>
+ <input type="file"
id="file" name="file" accept="image/*" capture="camera"></input>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'files')"/>
+ </label>
+ <div
class="pure-custom">
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_0'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl'/>
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+
<xsl:with-param name="data" select ='data'/>
+
<xsl:with-param name="config" select ='config'/>
+
</xsl:call-template>
+
</xsl:if>
+ </xsl:for-each>
+ </div>
+ </div>
+
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'note')"/>
+ </label>
+ <textarea cols="47"
rows="7" name="comment">
+ <xsl:value-of
select="movein/comment"/>
+ </textarea>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'details')"/>
+ </label>
+ <div
class="pure-custom">
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_1'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl'/>
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+
<xsl:with-param name="data" select ='data'/>
+
<xsl:with-param name="config" select ='config'/>
+
</xsl:call-template>
+
</xsl:if>
+ </xsl:for-each>
+ </div>
+ </div>
+ </fieldset>
+ </div>
+ </div>
+ <div class="proplist-col">
+ <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" onClick="window.location = '{cancel_url}';">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'cancel')"/>
+ </xsl:attribute>
+ </input>
+ </div>
+ </form>
+ </div>
+</xsl:template>
+
+<xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected"/>
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes" select="name"/>
+ </option>
+</xsl:template>
+
+
+<xsl:template xmlns:php="http://php.net/xsl" match="view">
+ <xsl:variable name="date_format">
+ <xsl:value-of select="php:function('get_phpgw_info',
'user|preferences|common|dateformat')" />
+ </xsl:variable>
+ <xsl:variable name="form_action">
+ <xsl:value-of select="form_action"/>
+ </xsl:variable>
+ <xsl:variable name="mode">
+ <xsl:value-of select="mode"/>
+ </xsl:variable>
+ <div>
+ <form id="form" name="form" method="post" action=""
class="pure-form pure-form-aligned">
+ <div id="tab-content">
+ <xsl:value-of disable-output-escaping="yes"
select="tabs"/>
+ <div id="first_tab">
+ <fieldset>
+ <legend>
+ <xsl:value-of
select="php:function('lang', 'basis data')"/>
+ </legend>
+ <xsl:if test="movein/id > 0">
+ <div
class="pure-control-group">
+ <label>
+
<xsl:value-of select="php:function('lang', 'id')"/>
+ </label>
+ <input
type="hidden" name="id" value="{movein/id}"/>
+ <xsl:value-of
select="movein/id"/>
+ </div>
+ </xsl:if>
+
+
+ <div class="pure-control-group">
+ <xsl:variable
name="lang_contract">
+ <xsl:value-of
select="php:function('lang', 'contract')"/>
+ </xsl:variable>
+ <label>
+ <xsl:value-of
select="$lang_contract"/>
+ </label>
+ <div id="composite"
class="pure-custom">
+ <xsl:value-of
select="contract/old_contract_id"/>
+ </div>
+ </div>
+
+ <xsl:call-template
name="contract_info">
+ <xsl:with-param
name="contract" select ='contract'/>
+ </xsl:call-template>
+
+ </fieldset>
+
+ <fieldset>
+ <legend>
+ <xsl:value-of
select="php:function('lang', 'report')"/>
+ </legend>
+
+ <xsl:call-template
name="attributes_values"/>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'picture')"/>
+ </label>
+ <input type="file"
id="file" name="file" accept="image/*" capture="camera"></input>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'files')"/>
+ </label>
+ <div
class="pure-custom">
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_0'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl'/>
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+
<xsl:with-param name="data" select ='data'/>
+
<xsl:with-param name="config" select ='config'/>
+
</xsl:call-template>
+
</xsl:if>
+ </xsl:for-each>
+ </div>
+ </div>
+
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'details')"/>
+ </label>
+ <div
class="pure-custom">
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_1'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl'/>
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+
<xsl:with-param name="data" select ='data'/>
+
<xsl:with-param name="config" select ='config'/>
+
</xsl:call-template>
+
</xsl:if>
+ </xsl:for-each>
+ </div>
+ </div>
+ </fieldset>
+ </div>
+ </div>
+ <div class="proplist-col">
+ <xsl:variable name="cancel_url">
+ <xsl:value-of select="cancel_url"/>
+ </xsl:variable>
+ <xsl:variable name="lang_cancel">
+ <xsl:value-of
select="php:function('lang', 'cancel')"/>
+ </xsl:variable>
+ <input type="button" class="pure-button
pure-button-primary" name="cancel" value="{$lang_cancel}"
onClick="window.location = '{cancel_url}';"/>
+ </div>
+ </form>
+ </div>
+</xsl:template>
Modified: trunk/rental/templates/base/moveout.xsl
===================================================================
--- trunk/rental/templates/base/moveout.xsl 2016-12-20 16:39:37 UTC (rev
16107)
+++ trunk/rental/templates/base/moveout.xsl 2016-12-21 19:41:39 UTC (rev
16108)
@@ -28,7 +28,7 @@
<script type="text/javascript">
var lang = <xsl:value-of
select="php:function('js_lang', 'Name or company is required')"/>;
</script>
- <form id="form" name="form" method="post"
action="{$form_action}" class="pure-form pure-form-aligned">
+ <form id="form" name="form" method="post"
action="{$form_action}" class="pure-form pure-form-aligned"
enctype="multipart/form-data">
<div id="tab-content">
<xsl:value-of disable-output-escaping="yes"
select="tabs"/>
<input type="hidden" id="active_tab"
name="active_tab" value="{value_active_tab}"/>
@@ -97,8 +97,33 @@
<div class="pure-control-group">
<label>
- <xsl:value-of
select="php:function('lang', 'comment')"/>
+ <xsl:value-of
select="php:function('lang', 'picture')"/>
</label>
+ <input type="file"
id="file" name="file" accept="image/*" capture="camera"></input>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'files')"/>
+ </label>
+ <div
class="pure-custom">
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_0'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl'/>
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+
<xsl:with-param name="data" select ='data'/>
+
<xsl:with-param name="config" select ='config'/>
+
</xsl:call-template>
+
</xsl:if>
+ </xsl:for-each>
+ </div>
+ </div>
+
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'note')"/>
+ </label>
<textarea cols="47"
rows="7" name="comment">
<xsl:value-of
select="moveout/comment"/>
</textarea>
@@ -109,7 +134,7 @@
</label>
<div
class="pure-custom">
<xsl:for-each
select="datatable_def">
- <xsl:if
test="container = 'datatable-container_0'">
+ <xsl:if
test="container = 'datatable-container_1'">
<xsl:call-template name="table_setup">
<xsl:with-param name="container" select ='container'/>
<xsl:with-param name="requestUrl" select ='requestUrl'/>
@@ -207,6 +232,30 @@
</legend>
<xsl:call-template
name="attributes_values"/>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'picture')"/>
+ </label>
+ <input type="file"
id="file" name="file" accept="image/*" capture="camera"></input>
+ </div>
+ <div class="pure-control-group">
+ <label>
+ <xsl:value-of
select="php:function('lang', 'files')"/>
+ </label>
+ <div
class="pure-custom">
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_0'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl'/>
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+
<xsl:with-param name="data" select ='data'/>
+
<xsl:with-param name="config" select ='config'/>
+
</xsl:call-template>
+
</xsl:if>
+ </xsl:for-each>
+ </div>
+ </div>
<div class="pure-control-group">
<label>
@@ -214,7 +263,7 @@
</label>
<div
class="pure-custom">
<xsl:for-each
select="datatable_def">
- <xsl:if
test="container = 'datatable-container_0'">
+ <xsl:if
test="container = 'datatable-container_1'">
<xsl:call-template name="table_setup">
<xsl:with-param name="container" select ='container'/>
<xsl:with-param name="requestUrl" select ='requestUrl'/>
@@ -241,119 +290,3 @@
</form>
</div>
</xsl:template>
-
-
-<xsl:template name="contract_info" xmlns:php="http://php.net/xsl">
- <xsl:param name="contract" />
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'executive_officer')"/>
- </label>
- <div id="executive_officer" class="pure-custom">
- <xsl:value-of select="contract/executive_officer"/>
- </div>
- </div>
-
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'composite')"/>
- </label>
- <div id="composite" class="pure-custom">
- <xsl:value-of select="contract/composite"/>
- </div>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'rented_area')"/>
- </label>
- <div id="rented_area" class="pure-custom">
- <xsl:value-of select="contract/rented_area"/>
- </div>
- </div>
-
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'security_amount')"/>
- </label>
- <div id="security_amount" class="pure-custom">
- <xsl:value-of select="contract/security_amount"/>
- </div>
- </div>
-
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'date_start')"/>
- </label>
- <div id="date_start" class="pure-custom">
- <xsl:value-of select="contract/date_start"/>
- </div>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'date_end')"/>
- </label>
- <div id="date_end" class="pure-custom">
- <xsl:value-of select="contract/date_end"/>
- </div>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang', 'type')"/>
- </label>
- <div id="type" class="pure-custom">
- <xsl:value-of select="contract/type"/>
- </div>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang', 'party')"/>
- </label>
- <div id="party" class="pure-custom">
- <xsl:value-of select="contract/party"/>
- </div>
- </div>
-
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'identifier')"/>
- </label>
- <div id="identifier" class="pure-custom">
- <xsl:value-of select="contract/identifier"/>
- </div>
- </div>
-
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'mobile_phone')"/>
- </label>
- <div id="mobile_phone" class="pure-custom">
- <xsl:value-of select="contract/mobile_phone"/>
- </div>
- </div>
-
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'department')"/>
- </label>
- <div id="department" class="pure-custom">
- <xsl:value-of select="contract/department"/>
- </div>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'contract_status')"/>
- </label>
- <div id="contract_status" class="pure-custom">
- <xsl:value-of select="contract/contract_status"/>
- </div>
- </div>
- <div class="pure-control-group">
- <label>
- <xsl:value-of select="php:function('lang',
'billing_terms')"/>
- </label>
- <div id="term_label" class="pure-custom">
- <xsl:value-of select="contract/term_label"/>
- </div>
- </div>
-
-</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16108] more on rental,
sigurdne <=