fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [16121] more on rental


From: sigurdne
Subject: [Fmsystem-commits] [16121] more on rental
Date: Thu, 29 Dec 2016 15:53:40 +0000 (UTC)

Revision: 16121
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16121
Author:   sigurdne
Date:     2016-12-29 15:53:40 +0000 (Thu, 29 Dec 2016)
Log Message:
-----------
more on rental

Modified Paths:
--------------
    trunk/rental/inc/class.bomovein.inc.php
    trunk/rental/inc/class.sogeneric.inc.php
    trunk/rental/inc/class.uimovein.inc.php
    trunk/rental/inc/class.uimoveout.inc.php
    trunk/rental/setup/setup.inc.php
    trunk/rental/setup/tables_current.inc.php
    trunk/rental/setup/tables_update.inc.php

Added Paths:
-----------
    trunk/rental/inc/class.boemail_out.inc.php
    trunk/rental/inc/class.soemail_out.inc.php
    trunk/rental/inc/class.uiemail_out.inc.php
    trunk/rental/inc/model/class.email_out.inc.php
    trunk/rental/templates/base/email_out.xsl

Added: trunk/rental/inc/class.boemail_out.inc.php
===================================================================
--- trunk/rental/inc/class.boemail_out.inc.php                          (rev 0)
+++ trunk/rental/inc/class.boemail_out.inc.php  2016-12-29 15:53:40 UTC (rev 
16121)
@@ -0,0 +1,104 @@
+<?php
+       /**
+        * phpGroupWare
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 Free Software Foundation 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v2 or later
+        * @internal
+        * @package rental
+        * @subpackage email_out
+        * @version $Id:$
+        */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU Lesser General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       phpgw::import_class('phpgwapi.bocommon');
+       phpgw::import_class('rental.soemail_out');
+
+       include_class('rental', 'email_out', 'inc/model/');
+
+       class rental_boemail_out extends phpgwapi_bocommon
+       {
+               protected static
+                       $bo,
+                       $fields,
+                       $acl_location;
+
+               public function __construct()
+               {
+                       $this->fields = rental_email_out::get_fields();
+                       $this->acl_location = rental_email_out::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_boemail_out();
+                       }
+                       return self::$bo;
+               }
+
+               public function store($object)
+               {
+                       $this->store_pre_commit($object);
+                       $ret = 
rental_soemail_out::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_soemail_out::get_instance()->read($params);
+       //              $status_text = rental_email_out::get_status_list();
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       foreach ($values['results'] as &$entry)
+                       {
+       //                              $entry['status'] = 
$status_text[$entry['status']];
+                                       $entry['created'] = 
$GLOBALS['phpgw']->common->show_date($entry['created']);
+                                       $entry['modified'] = 
$GLOBALS['phpgw']->common->show_date($entry['modified']);
+                       }
+                       return $values;
+               }
+
+               public function read_single($id, $return_object = true)
+               {
+                       if ($id)
+                       {
+                               $values = 
rental_soemail_out::get_instance()->read_single($id, $return_object);
+                       }
+                       else
+                       {
+                               $values = new rental_email_out();
+                       }
+
+                       return $values;
+               }
+       }
\ No newline at end of file

Modified: trunk/rental/inc/class.bomovein.inc.php
===================================================================
--- trunk/rental/inc/class.bomovein.inc.php     2016-12-29 15:02:39 UTC (rev 
16120)
+++ trunk/rental/inc/class.bomovein.inc.php     2016-12-29 15:53:40 UTC (rev 
16121)
@@ -21,7 +21,6 @@
         * 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: $

Added: trunk/rental/inc/class.soemail_out.inc.php
===================================================================
--- trunk/rental/inc/class.soemail_out.inc.php                          (rev 0)
+++ trunk/rental/inc/class.soemail_out.inc.php  2016-12-29 15:53:40 UTC (rev 
16121)
@@ -0,0 +1,116 @@
+<?php
+       /**
+        * phpGroupWare - property: 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/
+        * @package rental
+        * @subpackage email_out
+        * @version $Id: $
+        */
+       phpgw::import_class('phpgwapi.socommon');
+
+       class rental_soemail_out extends phpgwapi_socommon
+       {
+
+               protected static $so;
+
+               public function __construct()
+               {
+                       parent::__construct('rental_email_out', 
rental_email_out::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.soemail_out');
+                       }
+                       return self::$so;
+               }
+
+
+               protected function populate( array $data )
+               {
+                       $object = new rental_email_out();
+                       foreach ($this->fields as $field => $field_info)
+                       {
+                               $object->set_field($field, $data[$field]);
+                       }
+
+                       return $object;
+               }
+
+               protected function update( $object )
+               {
+                       $this->db->transaction_begin();
+       //              $status_text = rental_email_out::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
+                                       (
+                                               'email_out_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_email_out_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();
+               }
+
+       }
\ No newline at end of file

Modified: trunk/rental/inc/class.sogeneric.inc.php
===================================================================
--- trunk/rental/inc/class.sogeneric.inc.php    2016-12-29 15:02:39 UTC (rev 
16120)
+++ trunk/rental/inc/class.sogeneric.inc.php    2016-12-29 15:53:40 UTC (rev 
16121)
@@ -205,8 +205,8 @@
                                                'default' => array
                                                        (
                                                        'user_id' => 
array('add' => '$this->account'),
-                                                       'entry_date' => 
array('add' => 'time()'),
-                                                       'modified_date' => 
array('edit' => 'time()'),
+                                                       'created' => 
array('add' => 'time()'),
+                                                       'modified' => 
array('edit' => 'time()'),
                                                ),
                                                'check_grant' => true
                                        );
@@ -218,6 +218,7 @@
                                default:
                                        $message = lang('ERROR: illegal type 
%1', $type);
                                        phpgwapi_cache::message_set($message, 
'error');
+                                       throw new Exception;
                        }
 
                        $this->location_info = $info;

Added: trunk/rental/inc/class.uiemail_out.inc.php
===================================================================
--- trunk/rental/inc/class.uiemail_out.inc.php                          (rev 0)
+++ trunk/rental/inc/class.uiemail_out.inc.php  2016-12-29 15:53:40 UTC (rev 
16121)
@@ -0,0 +1,228 @@
+<?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 email_out
+        * @version $Id: $
+        */
+       phpgw::import_class('phpgwapi.uicommon');
+       phpgw::import_class('phpgwapi.datetime');
+
+       include_class('rental', 'email_out', 'inc/model/');
+
+       class rental_uiemail_out extends phpgwapi_uicommon
+       {
+
+               public $public_functions = array(
+                       'add' => true,
+                       'index' => true,
+                       'query' => true,
+                       'view' => true,
+                       'edit' => true,
+                       'save' => true,
+                       'get' => true
+               );
+
+               protected
+                       $fields,
+                       $permissions;
+
+               public function __construct()
+               {
+                       parent::__construct();
+                       self::set_active_menu('rental::email_out');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' . 
lang('email_out');
+                       $this->bo = createObject('rental.boemail_out');
+                       $this->fields = rental_email_out::get_fields();
+                       $this->permissions = 
rental_email_out::get_instance()->get_permission_array();
+               }
+
+
+               public function index()
+               {
+                       if (empty($this->permissions[PHPGW_ACL_READ]))
+                       {
+                               phpgw::no_access();
+                       }
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+
+                       phpgwapi_jquery::load_widget('autocomplete');
+
+                       $function_msg = lang('email_out');
+
+                       $data = array(
+                               'datatable_name' => $function_msg,
+                               'form' => array(
+                                       'toolbar' => array(
+                                       )
+                               ),
+                               'datatable' => array(
+                                       'source' => self::link(array(
+                                               'menuaction' => 
'rental.uiemail_out.index',
+                                               'phpgw_return_as' => 'json'
+                                       )),
+                                       'allrows' => true,
+                                       'new_item' => 
self::link(array('menuaction' => 'rental.uiemail_out.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.uiemail_out.view'
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name' => 'edit',
+                               'text' => lang('edit'),
+                               'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                       'menuaction' => 
'rental.uiemail_out.edit'
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+
+                       self::add_javascript('rental', 'portico', 
'email_out.index.js');
+                       phpgwapi_jquery::load_widget('numberformat');
+
+                       self::render_template_xsl('datatable_jquery', $data);
+               }
+
+               /*
+                * Edit the price item with the id given in the http variable 
'id'
+                */
+
+               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']))
+                       {
+                               $email_out = $values['object'];
+                       }
+                       else
+                       {
+                               $id = !empty($values['id']) ? $values['id'] : 
phpgw::get_var('id', 'int');
+                               $email_out = $this->bo->read_single($id);
+                       }
+
+                       $tabs = array();
+                       $tabs['first_tab'] = array(
+                               'label' => lang('email_out'),
+                               'link' => '#first_tab',
+                               'function' => "set_tab('first_tab')"
+                       );
+
+                       $bocommon = CreateObject('property.bocommon');
+
+                       $comments = (array)$email_out->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' => true, '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',
+                               '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.uiemail_out.save')),
+                               'cancel_url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'rental.uiemail_out.index',)),
+                               'email_out' => $email_out,
+                               'mode' => $mode,
+                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+                               'value_active_tab' => $active_tab
+                       );
+                       phpgwapi_jquery::formvalidator_generate(array());
+                       self::add_javascript('rental', 'portico', 
'email_out.edit.js');
+                       self::render_template_xsl(array('email_out', 
'datatable_inline'), array($mode => $data));
+               }
+
+               /*
+                * Get the email_out 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');
+
+                       $email_out = $this->bo->read_single($id)->toArray();
+
+                       unset($email_out['secret']);
+
+                       return $email_out;
+               }
+
+               public function save()
+               {
+                       parent::save();
+               }
+       }
\ No newline at end of file

Modified: trunk/rental/inc/class.uimovein.inc.php
===================================================================
--- trunk/rental/inc/class.uimovein.inc.php     2016-12-29 15:02:39 UTC (rev 
16120)
+++ trunk/rental/inc/class.uimovein.inc.php     2016-12-29 15:53:40 UTC (rev 
16121)
@@ -21,7 +21,7 @@
         * 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
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/ and Nordlandssykehuset
         * @package rental
         * @subpackage movein
         * @version $Id: $

Modified: trunk/rental/inc/class.uimoveout.inc.php
===================================================================
--- trunk/rental/inc/class.uimoveout.inc.php    2016-12-29 15:02:39 UTC (rev 
16120)
+++ trunk/rental/inc/class.uimoveout.inc.php    2016-12-29 15:53:40 UTC (rev 
16121)
@@ -21,7 +21,7 @@
         * 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 moveout was funded by 
http://www.bergen.kommune.no/ and Nordlandssykehuset
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/ and Nordlandssykehuset
         * @package rental
         * @subpackage moveout
         * @version $Id: $

Added: trunk/rental/inc/model/class.email_out.inc.php
===================================================================
--- trunk/rental/inc/model/class.email_out.inc.php                              
(rev 0)
+++ trunk/rental/inc/model/class.email_out.inc.php      2016-12-29 15:53:40 UTC 
(rev 16121)
@@ -0,0 +1,159 @@
+<?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 email_out
+        * @version $Id: $
+        */
+
+       phpgw::import_class('rental.boemail_out');
+
+       include_class('phpgwapi', 'model', 'inc/model/');
+
+       class rental_email_out extends phpgwapi_model
+       {
+
+               const STATUS_PENDING = 1;
+               const STATUS_SENT = 2;
+               const STATUS_ERROR = 3;
+               const acl_location = '.email_out';
+
+               protected
+                       $id,
+                       $name,
+                       $remark,
+                       $subject,
+                       $content,
+                       $user_id,
+                       $created,
+                       $modified;
+
+
+               protected $field_of_responsibility_name = '.email_out';
+
+               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_email_out();
+               }
+
+               public static function get_status_list()
+               {
+                       return array(
+                               self::STATUS_PENDING    => lang('pending'),
+                               self::STATUS_SENT => lang('sent'),
+                               self::STATUS_ERROR      => lang('error')
+                       );
+               }
+
+               public static function get_fields($debug = true)
+               {
+                        $fields = array(
+                               'id' => array('action'=> PHPGW_ACL_READ,
+                                       'type' => 'int',
+                                       'label' => 'id',
+                                       'sortable'=> true,
+                                       'formatter' => 
'JqueryPortico.formatLink',
+                                       ),
+                               'name' => array(
+                                       'action'=> PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'string',
+                                       'label' => 'name',
+                                       'required' => true,
+                                       'query' => true,
+                                       ),
+                               'subject' => array(
+                                       'action'=> PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'string',
+                                       'label' => 'subject',
+                                       'required' => true,
+                                       'query' => true,
+                                       ),
+                               'content' => array(
+                                       'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'type' => 'string',
+                                       'label' => 'content',
+                                       'required' => true,
+                                       'query' => true,
+                                       ),
+                               'remark' => array('action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'type' => 'string',
+                                       'label' => 'description',
+                                       'sortable' => false,
+                                       ),
+                               'modified' => array('action'=> PHPGW_ACL_READ | 
PHPGW_ACL_EDIT,
+                                       'type' => 'date',
+                                       'label' => 'modified',
+                                       'sortable' => true,
+                                       )
+                       );
+
+                       if($debug)
+                       {
+                               foreach ($fields as $field => $field_info)
+                               {
+                                       if(!property_exists('rental_email_out', 
$field))
+                                       {
+                                          
phpgwapi_cache::message_set('$'."{$field},", 'error');
+                                       }
+
+                               }
+                       }
+                       return $fields;
+               }
+
+               /**
+                * Implement in subclasses to perform actions on entity before 
validation
+                */
+               protected function preValidate( &$entity )
+               {
+                       $entity->modified = time();
+               }
+
+
+               public function serialize()
+               {
+                       return self::toArray();
+               }
+
+               public function store()
+               {
+                       return rental_boemail_out::get_instance()->store($this);
+               }
+
+               public function read_single($id)
+               {
+                       return 
rental_boemail_out::get_instance()->read_single($id, true);
+               }
+       }

Modified: trunk/rental/setup/setup.inc.php
===================================================================
--- trunk/rental/setup/setup.inc.php    2016-12-29 15:02:39 UTC (rev 16120)
+++ trunk/rental/setup/setup.inc.php    2016-12-29 15:53:40 UTC (rev 16121)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['rental']['name'] = 'rental';  // Module identifier
-       $setup_info['rental']['version'] = '0.1.0.34'; // Current module version
+       $setup_info['rental']['version'] = '0.1.0.35'; // Current module version
        $setup_info['rental']['app_order'] = 51;  // (?)
        $setup_info['rental']['tables'] = array(
                'rental_party', // All contract participants, tenants etc.

Modified: trunk/rental/setup/tables_current.inc.php
===================================================================
--- trunk/rental/setup/tables_current.inc.php   2016-12-29 15:02:39 UTC (rev 
16120)
+++ trunk/rental/setup/tables_current.inc.php   2016-12-29 15:53:40 UTC (rev 
16121)
@@ -633,7 +633,6 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-
                'rental_email_out' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto', 'precision' => 
4, 'nullable' => False),
@@ -642,8 +641,8 @@
                                'subject' => array('type' => 'text', 'nullable' 
=> false),
                                'content' => array('type' => 'text', 'nullable' 
=> True),
                                'user_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => True),
-                               'entry_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
-                               'modified_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                               'created' => array('type' => 'int', 'precision' 
=> 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                               'modified' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/rental/setup/tables_update.inc.php
===================================================================
--- trunk/rental/setup/tables_update.inc.php    2016-12-29 15:02:39 UTC (rev 
16120)
+++ trunk/rental/setup/tables_update.inc.php    2016-12-29 15:53:40 UTC (rev 
16121)
@@ -877,8 +877,8 @@
                                        'content' => array('type' => 'text', 
'nullable' => True),
                                        'public' => array('type' => 'int', 
'precision' => 2, 'nullable' => True),
                                        'user_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                                       'entry_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
-                                       'modified_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                                       'created' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                                       'modified' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
                                ),
                                'pk' => array('id'),
                                'fk' => array(),
@@ -887,6 +887,42 @@
                        )
                );
 
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'rental_email_out', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => False),
+                                       'name' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                                       'remark' => array('type' => 'text', 
'nullable' => True),
+                                       'subject' => array('type' => 'text', 
'nullable' => false),
+                                       'content' => array('type' => 'text', 
'nullable' => True),
+                                       'user_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                                       'created' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                                       'modified' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'rental_email_out_party', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => False),
+                                       'email_out_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => True),
+                                       'party_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                                       'status' => array('type' => 'int', 
'precision' => 2, 'nullable' => True, 'default' => '0'),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(
+                                       'rental_email_out' => 
array('email_out_id' => 'id'),
+                                       'rental_party' => array('party_id' => 
'id')
+                               ),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
                        $GLOBALS['setup_info']['rental']['currentver'] = 
'0.1.0.35';

Added: trunk/rental/templates/base/email_out.xsl
===================================================================
--- trunk/rental/templates/base/email_out.xsl                           (rev 0)
+++ trunk/rental/templates/base/email_out.xsl   2016-12-29 15:53:40 UTC (rev 
16121)
@@ -0,0 +1,157 @@
+
+<!-- $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">
+                       <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>
+                                               <xsl:if test="email_out/id > 0">
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'id')"/>
+                                                               </label>
+                                                               <input 
type="hidden" name="id" value="{email_out/id}"/>
+                                                               <xsl:value-of 
select="email_out/id"/>
+                                                       </div>
+                                               </xsl:if>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'name')"/>
+                                                       </label>
+                                                       <input type="text" 
name="name" value="{email_out/name}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="php:function('lang', 'name')"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'remark')"/>
+                                                       </label>
+                                                       <textarea cols="47" 
rows="7" name="remark">
+                                                               <xsl:value-of 
select="email_out/remark"/>
+                                                       </textarea>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'subject')"/>
+                                                       </label>
+                                                       <textarea cols="47" 
rows="7" name="subject">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:value-of 
select="email_out/subject"/>
+                                                       </textarea>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'content')"/>
+                                                       </label>
+                                                       <textarea cols="47" 
rows="7" name="content">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:value-of 
select="email_out/content"/>
+                                                       </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_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>
+                                       </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">
+       <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="showing">
+
+                               </div>
+                       </div>
+                       <div class="proplist-col">
+                               <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}';"/>
+                       </div>
+               </form>
+       </div>
+</xsl:template>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]