fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16044] more on eventplanner


From: sigurdne
Subject: [Fmsystem-commits] [16044] more on eventplanner
Date: Sat, 3 Dec 2016 15:36:19 +0000 (UTC)

Revision: 16044
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16044
Author:   sigurdne
Date:     2016-12-03 15:36:19 +0000 (Sat, 03 Dec 2016)
Log Message:
-----------
more on eventplanner

Modified Paths:
--------------
    trunk/eventplanner/inc/class.bobooking.inc.php
    trunk/eventplanner/inc/class.sobooking.inc.php
    trunk/eventplanner/inc/class.uiapplication.inc.php
    trunk/eventplanner/inc/class.uibooking.inc.php
    trunk/eventplanner/inc/model/class.booking.inc.php
    trunk/eventplanner/inc/model/class.customer.inc.php
    trunk/eventplanner/js/portico/application.edit.js
    trunk/eventplanner/setup/tables_update.inc.php
    trunk/eventplanner/templates/base/booking.xsl
    trunk/phpgwapi/inc/class.jqcal2.inc.php
    trunk/phpgwapi/inc/class.phpgw.inc.php
    trunk/phpgwapi/inc/model/class.model.inc.php

Modified: trunk/eventplanner/inc/class.bobooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.bobooking.inc.php      2016-12-03 00:50:27 UTC 
(rev 16043)
+++ trunk/eventplanner/inc/class.bobooking.inc.php      2016-12-03 15:36:19 UTC 
(rev 16044)
@@ -102,8 +102,25 @@
                        return $values;
                }
 
-               public function update_bookings( $ids, $action )
+               public function update_active_status( $ids, $action )
                {
-                       return 
eventplanner_sobooking::get_instance()->update_bookings($ids, $action);
+                       return 
eventplanner_sobooking::get_instance()->update_active_status($ids, $action);
                }
+
+               public function update_schedule( $id, $from_ )
+               {
+                       $booking = 
eventplanner_sobooking::get_instance()->read_single($id, true);
+                       $booking->from_ = $from_;
+//                     $application = 
createObject('eventplanner.boapplication')->read_single($entity->application_id);
+//                     $booking->to_ = $booking->from_ + 
((int)$application->timespan * 60);
+                       $booking->customer_id = $booking->customer_id ? 
$booking->customer_id : '';//foreigns key
+
+                       if($booking->validate())
+                       {
+                               return $booking->store();
+                       }
+//                     return 
eventplanner_sobooking::get_instance()->update($booking);
+               }
+
+
        }
\ No newline at end of file

Modified: trunk/eventplanner/inc/class.sobooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.sobooking.inc.php      2016-12-03 00:50:27 UTC 
(rev 16043)
+++ trunk/eventplanner/inc/class.sobooking.inc.php      2016-12-03 15:36:19 UTC 
(rev 16044)
@@ -67,13 +67,22 @@
                protected function update( $object )
                {
                        $this->db->transaction_begin();
+                       $this->update_history($object, $this->fields);
+
+                       parent::update($object);
+
+                       return  $this->db->transaction_commit();
+               }
+
+               protected function update_history( $object, $fields )
+               {
        //              $status_text = eventplanner_booking::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)
+                       foreach ($fields as $field => $params)
                        {
                                $new_value = $object->$field;
                                $old_value = $original[$field];
@@ -90,6 +99,11 @@
                                                        $old_value = $old_value 
? $lang_active : $lang_inactive;
                                                        $new_value = $new_value 
? $lang_active : $lang_inactive;
                                                        break;
+                                               case 'from_':
+                                               case 'to_':
+                                                       $old_value = 
$GLOBALS['phpgw']->common->show_date($old_value, $dateformat);
+                                                       $new_value = 
$GLOBALS['phpgw']->common->show_date($new_value, $dateformat);
+                                                       break;
                                                default:
                                                        break;
                                        }
@@ -107,13 +121,9 @@
                                }
 
                        }
-
-                       parent::update($object);
-
-                       return  $this->db->transaction_commit();
                }
 
-               public function update_bookings($ids, $action )
+               public function update_active_status($ids, $action )
                {
                        if(!$ids || !is_array($ids))
                        {
@@ -136,6 +146,11 @@
                        }
 
                        $sql .= 'WHERE id IN(' . implode(',', $ids) . ')';
-                       return $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->transaction_begin();
+                       
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+
+                       return  $this->db->transaction_commit();
                }
        }
\ No newline at end of file

Modified: trunk/eventplanner/inc/class.uiapplication.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uiapplication.inc.php  2016-12-03 00:50:27 UTC 
(rev 16043)
+++ trunk/eventplanner/inc/class.uiapplication.inc.php  2016-12-03 15:36:19 UTC 
(rev 16044)
@@ -279,7 +279,7 @@
                        );
 
                        $dates_def = array(
-                               array('key' => 'id',  'hidden' => true),
+                               array('key' => 'id', 'label' => lang('id'), 
'sortable' => true, 'resizeable' => true,'formatter' => 
'JqueryPortico.formatLink'),
                                array('key' => 'from_', 'label' => 
lang('From'), 'sortable' => false, 'resizeable' => true),
                                array('key' => 'to_', 'label' => lang('To'), 
'sortable' => false, 'resizeable' => true),
                                array('key' => 'active', 'label' => 
lang('active'), 'sortable' => false, 'resizeable' => true),

Modified: trunk/eventplanner/inc/class.uibooking.inc.php
===================================================================
--- trunk/eventplanner/inc/class.uibooking.inc.php      2016-12-03 00:50:27 UTC 
(rev 16043)
+++ trunk/eventplanner/inc/class.uibooking.inc.php      2016-12-03 15:36:19 UTC 
(rev 16044)
@@ -42,7 +42,8 @@
                        'edit' => true,
                        'save' => true,
                        'save_ajax' => true,
-                       'update' => true
+                       'update_active_status' => true,
+                       'update_schedule'               => true
                );
                protected
                        $fields,
@@ -104,7 +105,7 @@
                                                'phpgw_return_as' => 'json'
                                        )),
                                        'allrows' => true,
-                                       'new_item' => 
self::link(array('menuaction' => 'eventplanner.uibooking.add')),
+                       //              'new_item' => 
self::link(array('menuaction' => 'eventplanner.uibooking.add')),
                                        'editor_action' => '',
                                        'field' => parent::_get_fields()
                                )
@@ -181,15 +182,15 @@
                        $comments = (array)$booking->comments;
                        foreach ($comments as $key => &$comment)
                        {
-                               $comment['value_count'] = $key + 1;
+                               $comment['value_count'] = $key +1;
                                $comment['value_date'] = 
$GLOBALS['phpgw']->common->show_date($comment['time']);
                        }
 
                        $comments_def = array(
-                               array('key' => 'from_', 'label' => 
lang('From'), 'sortable' => false, 'resizeable' => true),
-                               array('key' => 'to_', 'label' => lang('To'), 
'sortable' => false, 'resizeable' => true),
-                               array('key' => 'author', 'label' => 
lang('User'), 'sortable' => false, 'resizeable' => true),
-                               array('key' => 'comment', 'label' => 
lang('Note'), 'sortable' => false, 'resizeable' => true)
+                               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(
@@ -203,17 +204,47 @@
                                )
                        );
 
+                       $application = 
createObject('eventplanner.boapplication')->read_single($booking->application_id);
+
+                       $GLOBALS['phpgw']->jqcal2->add_listener('from_', 
'datetime', $booking->from_, array(
+                                       'min_date' => date('Y/m/d', 
$application->date_start),
+                                       'max_date' => date('Y/m/d', 
$application->date_end)
+                               )
+                       );
+                       $application_type_list = 
execMethod('eventplanner.bogeneric.get_list', array('type' => 
'application_type'));
+                       $types = (array)$application->types;
+                       if($types)
+                       {
+                               foreach ($application_type_list as 
&$application_type)
+                               {
+                                       foreach ($types as $type)
+                                       {
+                                               if((!empty($type['type_id']) && 
$type['type_id'] == $application_type['id']) || ($type == 
$application_type['id']))
+                                               {
+                                                       
$application_type['selected'] = 1;
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+
                        $data = array(
                                'datatable_def' => $datatable_def,
                                'form_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'eventplanner.uibooking.save')),
                                'cancel_url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'eventplanner.uibooking.index',)),
                                'booking' => $booking,
+                               'application' => $application,
+                               'application_type_list' => 
$application_type_list,
+                               'new_customer_url' => 
self::link(array('menuaction' => 'eventplanner.uicustomer.add')),
+                               'application_url' => 
self::link(array('menuaction' => 'eventplanner.uiapplication.edit', 'id' => 
$booking->application_id)),
+                               'customer_url' => self::link(array('menuaction' 
=> 'eventplanner.uicustomer.edit', 'id' => $booking->customer_id)),
                                'mode' => $mode,
                                'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
                                'value_active_tab' => $active_tab
                        );
                        phpgwapi_jquery::formvalidator_generate(array());
                        self::add_javascript('eventplanner', 'portico', 
'booking.edit.js');
+                       phpgwapi_jquery::load_widget('autocomplete');
                        self::render_template_xsl(array('booking', 
'datatable_inline'), array($mode => $data));
                }
 
@@ -227,12 +258,12 @@
                        return parent::save(true);
                }
 
-               public function update()
+               public function update_active_status()
                {
                        $ids = phpgw::get_var('ids', 'int');
                        $action = phpgw::get_var('action', 'string');
 
-                       if ($this->bo->update_bookings($ids, $action))
+                       if ($this->bo->update_active_status($ids, $action))
                        {
                                return array(
                                        'status_kode' => 'ok',
@@ -250,4 +281,28 @@
                                );
                        }
                }
+
+               public function update_schedule( )
+               {
+                       $id = phpgw::get_var('id', 'int');
+                       $from_ = phpgw::get_var('from_', 'date');
+                       if ($this->bo->update_schedule($id, $from_))
+                       {
+                               return array(
+                                       'status_kode' => 'ok',
+                                       'status' => lang('ok'),
+                                       'msg' => lang('messages_saved_form')
+                               );
+                       }
+                       else
+                       {
+                               return array
+                               (
+                                       'status_kode' => 'error',
+                                       'status' => lang('error'),
+                                       'msg' => lang('messages_form_error')
+                               );
+                       }
+
+               }
        }
\ No newline at end of file

Modified: trunk/eventplanner/inc/model/class.booking.inc.php
===================================================================
--- trunk/eventplanner/inc/model/class.booking.inc.php  2016-12-03 00:50:27 UTC 
(rev 16043)
+++ trunk/eventplanner/inc/model/class.booking.inc.php  2016-12-03 15:36:19 UTC 
(rev 16044)
@@ -51,6 +51,7 @@
                        $application_name,
                        $customer_id,
                        $customer_name,
+                       $comments,
                        $created,
                        $secret;
 
@@ -148,6 +149,16 @@
                                                'column' => 'name'
                                                )
                                        ),
+                               'comments' => array(
+                                       'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'type' => 'string',
+                                       'manytomany' => array(
+                                               'input_field' => 
'comment_input',
+                                               'table' => 
'eventplanner_booking_comment',
+                                               'key' => 'booking_id',
+                                               'column' => array('time', 
'author', 'comment', 'type'),
+                                               'order' => array('sort' => 
'time', 'dir' => 'ASC')
+                                       )),
                                'created' => array('action'=> PHPGW_ACL_READ,
                                        'type' => 'date',
                                        'label' => 'created',
@@ -189,6 +200,17 @@
                                );
                        }
 
+                       if(!$entity->get_id())
+                       {
+                               $entity->status = 
eventplanner_booking::STATUS_REGISTERED;
+                               $entity->secret = self::generate_secret();
+                       }
+
+                       if (empty($entity->completed))
+                       {
+                               $entity->completed = 0;
+                       }
+
                        if (!empty($entity->application_id))
                        {
                                $application = 
createObject('eventplanner.boapplication')->read_single($entity->application_id);
@@ -198,14 +220,6 @@
                        $entity->modified = time();
                        $entity->active = (int)$entity->active;
 
-                       if($entity->get_id())
-                       {
-                       }
-                       else
-                       {
-                               $entity->status = 
eventplanner_booking::STATUS_REGISTERED;
-                               $entity->secret = self::generate_secret();
-                       }
                }
 
                protected function generate_secret( $length = 10 )

Modified: trunk/eventplanner/inc/model/class.customer.inc.php
===================================================================
--- trunk/eventplanner/inc/model/class.customer.inc.php 2016-12-03 00:50:27 UTC 
(rev 16043)
+++ trunk/eventplanner/inc/model/class.customer.inc.php 2016-12-03 15:36:19 UTC 
(rev 16044)
@@ -247,6 +247,10 @@
                                        'type' => 'comment'
                                );
                        }
+                       if (!empty($entity->customer_organization_number))
+                       {
+                               $entity->customer_organization_number = 
str_replace(' ', '', $entity->customer_organization_number);
+                       }
 
                        $entity->modified = time();
                        $entity->active = (int)$entity->active;

Modified: trunk/eventplanner/js/portico/application.edit.js
===================================================================
--- trunk/eventplanner/js/portico/application.edit.js   2016-12-03 00:50:27 UTC 
(rev 16043)
+++ trunk/eventplanner/js/portico/application.edit.js   2016-12-03 15:36:19 UTC 
(rev 16044)
@@ -1,4 +1,5 @@
 
+var lang;
 var oArgs = {menuaction: 'eventplanner.uivendor.index', organization_number: 
true};
 var strURL = phpGWLink('index.php', oArgs, true);
 JqueryPortico.autocompleteHelper(strURL, 'vendor_name', 'vendor_id', 
'vendor_container', 'name');
@@ -171,7 +172,7 @@
 
 function calculate_total_amount()
 {
-       var total_amount = 0
+       var total_amount = 0;
 
        var number_of_units = $("#number_of_units").val();
        var charge_per_unit = $("#charge_per_unit").val();
@@ -185,7 +186,7 @@
 
 function calculate_stage_size()
 {
-       var total_size = 0
+       var total_size = 0;
 
        var stage_width = $("#stage_width").val();
        var stage_depth = $("#stage_depth").val();
@@ -197,7 +198,7 @@
        $("#stage_size").val(total_size);
 }
 
-add_booking = function (id)
+add_booking = function ()
 {
        var from_ = $("#from_").val();
        if (!from_)
@@ -213,34 +214,69 @@
        var requestUrl = phpGWLink('index.php', oArgs, true);
        var htmlString = '';
        $("#receipt").html("");
+       var data =  {from_: from_, active: 1};
 
-       $.ajax({
-               type: 'POST',
-               dataType: 'json',
-               data: {from_: from_, active: 1, id:id || ''},
-               url: requestUrl,
-               success: function (data)
+       JqueryPortico.execute_ajax(requestUrl,
+               function (result)
                {
-                       if (data != null)
+                       if (result.status_kode === 'ok')
                        {
-                               if (data.status_kode == 'ok')
-                               {
-                                       $("#from_").val('');
-                                       htmlString += "<div 
class=\"msg_good\">";
-                               }
-                               else
-                               {
-                                       htmlString += "<div class=\"error\">";
-                               }
-                               htmlString += data.msg;
-                               htmlString += '</div>';
-                               $("#receipt").html(htmlString);
+                               $("#from_").val('');
+                               htmlString += "<div class=\"msg_good\">";
                        }
-               }
-       });
-       JqueryPortico.updateinlineTableHelper('datatable-container_1');
+                       else
+                       {
+                               htmlString += "<div class=\"error\">";
+                       }
+                       htmlString += result.msg;
+                       htmlString += '</div>';
+                       $("#receipt").html(htmlString);
+
+                       
JqueryPortico.updateinlineTableHelper('datatable-container_1');
+
+               }, data, "POST", "json"
+       );
+
 };
 
+update_schedule = function (id)
+{
+       var from_ = $("#from_").val();
+       if (!from_)
+       {
+               return;
+       }
+       oArgs = {menuaction: 'eventplanner.uibooking.update_schedule'};
+
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+       var htmlString = '';
+       $("#receipt").html("");
+
+       var data = {from_: from_, id: id};
+
+       JqueryPortico.execute_ajax(requestUrl,
+               function (result)
+               {
+                       if (result.status_kode === 'ok')
+                       {
+                               $("#from_").val('');
+                               htmlString += "<div class=\"msg_good\">";
+                       }
+                       else
+                       {
+                               htmlString += "<div class=\"error\">";
+                       }
+                       htmlString += result.msg;
+                       htmlString += '</div>';
+                       $("#receipt").html(htmlString);
+
+                       
JqueryPortico.updateinlineTableHelper('datatable-container_1');
+
+               }, data, "POST", "json"
+       );
+
+};
+
 this.onActionsClick = function (action)
 {
        $("#receipt").html("");
@@ -268,50 +304,46 @@
 
                if (action === 'edit')
                {
-                       add_booking(aData['id']);
+                       if (numSelected > 1)
+                       {
+                               alert('There must be only one...');
+                               return false;
+                       }
+                       update_schedule(aData['id']);
                        return;
                }
-
        }
 
        if (ids.length > 0)
        {
                var data = {"ids": ids, "action": action, from_: 
$("#from_").val()};
 
-               oArgs = {
-                       menuaction: 'eventplanner.uibooking.update'
-               };
+               oArgs = {menuaction: 
'eventplanner.uibooking.update_active_status'};
 
                var requestUrl = phpGWLink('index.php', oArgs, true);
 
                var htmlString = '';
                $("#receipt").html("");
 
-               $.ajax({
-                       type: 'POST',
-                       dataType: 'json',
-                       url: requestUrl,
-                       data: data,
-                       success: function (data)
+               JqueryPortico.execute_ajax(requestUrl,
+                       function (result)
                        {
-                               if (data != null)
+                               if (result.status_kode === 'ok')
                                {
-                                       if (data.status_kode == 'ok')
-                                       {
-                                               $("#from_").val('');
-                                               htmlString += "<div 
class=\"msg_good\">";
-                                       }
-                                       else
-                                       {
-                                               htmlString += "<div 
class=\"error\">";
-                                       }
-                                       htmlString += data.msg;
-                                       htmlString += '</div>';
-                                       $("#receipt").html(htmlString);
+                                       $("#from_").val('');
+                                       htmlString += "<div 
class=\"msg_good\">";
                                }
-                       }
-               });
+                               else
+                               {
+                                       htmlString += "<div class=\"error\">";
+                               }
+                               htmlString += result.msg;
+                               htmlString += '</div>';
+                               $("#receipt").html(htmlString);
 
-               JqueryPortico.updateinlineTableHelper('datatable-container_1');
+                               
JqueryPortico.updateinlineTableHelper('datatable-container_1');
+
+                       }, data, "POST", "json"
+               );
        }
 };

Modified: trunk/eventplanner/setup/tables_update.inc.php
===================================================================
--- trunk/eventplanner/setup/tables_update.inc.php      2016-12-03 00:50:27 UTC 
(rev 16043)
+++ trunk/eventplanner/setup/tables_update.inc.php      2016-12-03 15:36:19 UTC 
(rev 16044)
@@ -19,19 +19,6 @@
        {
                $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
 
-               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
-               {
-                       $GLOBALS['setup_info']['eventplanner']['currentver'] = 
'0.9.18.002';
-               }
-               return $GLOBALS['setup_info']['eventplanner']['currentver'];
-       }
-
-       $test[] = '0.9.18.002';
-
-       function eventplanner_upgrade0_9_18_002()
-       {
-               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
                $GLOBALS['phpgw_setup']->oProc->CreateTable(
                        'eventplanner_booking_comment', array(
                                        'fd' => array(
@@ -52,7 +39,7 @@
 
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
-                       $GLOBALS['setup_info']['eventplanner']['currentver'] = 
'0.9.18.003';
+                       $GLOBALS['setup_info']['eventplanner']['currentver'] = 
'0.9.18.002';
                }
                return $GLOBALS['setup_info']['eventplanner']['currentver'];
        }

Modified: trunk/eventplanner/templates/base/booking.xsl
===================================================================
--- trunk/eventplanner/templates/base/booking.xsl       2016-12-03 00:50:27 UTC 
(rev 16043)
+++ trunk/eventplanner/templates/base/booking.xsl       2016-12-03 15:36:19 UTC 
(rev 16044)
@@ -16,6 +16,7 @@
 <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:text> H:i</xsl:text>
        </xsl:variable>
        <xsl:variable name="form_action">
                <xsl:value-of select="form_action"/>
@@ -26,128 +27,150 @@
 
        <div>
                <script type="text/javascript">
-                       var lang = <xsl:value-of 
select="php:function('js_lang', 'Name or company is required')"/>;
+                       var lang = <xsl:value-of 
select="php:function('js_lang', 'Name or company is required', 'customer')"/>;
                </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">
+                                       <xsl:if test="booking/id > 0">
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'id')"/>
+                                                       </label>
+                                                       <input type="hidden" 
name="id" value="{booking/id}"/>
+                                                       <input type="hidden" 
name="application_id" value="{booking/application_id}"/>
+                                                       <xsl:value-of 
select="booking/id"/>
+                                               </div>
+                                       </xsl:if>
                                        <fieldset>
-                                               <xsl:if test="booking/id > 0">
-                                                       <div 
class="pure-control-group">
-                                                               <label>
-                                                                       
<xsl:value-of select="php:function('lang', 'id')"/>
-                                                               </label>
-                                                               <input 
type="hidden" name="id" value="{booking/id}"/>
-                                                               <xsl:value-of 
select="booking/id"/>
-                                                       </div>
-                                               </xsl:if>
+                                               <legend>
+                                                       <xsl:value-of 
select="php:function('lang', 'vendor')"/>
+                                               </legend>
                                                <div class="pure-control-group">
                                                        <label>
-                                                               <xsl:value-of 
select="php:function('lang', 'active')"/>
+                                                               <a 
href="{application_url}" target="_blank">
+                                                                       
<xsl:value-of select="php:function('lang', 'application')"/>
+                                                               </a>
+
                                                        </label>
-                                                       <input type="checkbox" 
name="active" id="active" value="1">
-                                                               <xsl:if 
test="booking/active = 1">
-                                                                       
<xsl:attribute name="checked" value="checked"/>
-                                                               </xsl:if>
-                                                       </input>
+                                                       <xsl:value-of 
select="booking/application_name"/>
                                                </div>
+
+
+
                                                <div class="pure-control-group">
-                                                       <xsl:variable 
name="lang_category">
-                                                               <xsl:value-of 
select="php:function('lang', 'category')"/>
-                                                       </xsl:variable>
                                                        <label>
-                                                               <xsl:value-of 
select="$lang_category"/>
+                                                               <xsl:value-of 
select="php:function('lang', 'contact name')"/>
                                                        </label>
-                                                       <select 
name="category_id">
-                                                               <xsl:attribute 
name="title">
-                                                                       
<xsl:value-of select="$lang_category"/>
-                                                               </xsl:attribute>
-                                                               <xsl:attribute 
name="data-validation">
-                                                                       
<xsl:text>required</xsl:text>
-                                                               </xsl:attribute>
-                                                               <xsl:attribute 
name="data-validation-error-msg">
-                                                                       
<xsl:value-of select="$lang_category"/>
-                                                               </xsl:attribute>
-                                                               
<xsl:apply-templates select="category_list/options"/>
-                                                       </select>
+                                                       <xsl:value-of 
select="application/contact_name"/>
                                                </div>
                                                <div class="pure-control-group">
                                                        <label>
-                                                               <xsl:value-of 
select="php:function('lang', 'name')"/>
+                                                               <xsl:value-of 
select="php:function('lang', 'contact email')"/>
                                                        </label>
-                                                       <input type="text" 
name="name" value="{booking/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>
+                                                       <xsl:value-of 
select="application/contact_email"/>
                                                </div>
                                                <div class="pure-control-group">
-                                                       <xsl:variable 
name="lang_address_1">
-                                                               <xsl:value-of 
select="php:function('lang', 'address_1')"/>
-                                                       </xsl:variable>
-                                                       <xsl:variable 
name="lang_address_2">
-                                                               <xsl:value-of 
select="php:function('lang', 'address_2')"/>
-                                                       </xsl:variable>
                                                        <label>
-                                                               <xsl:value-of 
select="php:function('lang', 'address')"/>
+                                                               <xsl:value-of 
select="php:function('lang', 'contact phone')"/>
                                                        </label>
-                                                       <input type="text" 
name="address_1" value="{booking/address_1}">
-                                                               <xsl:attribute 
name="data-validation">
-                                                                       
<xsl:text>required</xsl:text>
-                                                               </xsl:attribute>
-                                                               <xsl:attribute 
name="placeholder">
-                                                                       
<xsl:value-of select="$lang_address_1"/>
-                                                               </xsl:attribute>
+                                                       <xsl:value-of 
select="application/contact_phone"/>
 
-                                                       </input>
-                                                       <input type="text" 
name="address_2" value="{booking/address_2}">
-                                                               <xsl:attribute 
name="data-validation">
-                                                                       
<xsl:text>required</xsl:text>
-                                                               </xsl:attribute>
-                                                               <xsl:attribute 
name="placeholder">
-                                                                       
<xsl:value-of select="$lang_address_2"/>
-                                                               </xsl:attribute>
-                                                       </input>
                                                </div>
                                                <div class="pure-control-group">
                                                        <label>
-                                                               <xsl:value-of 
select="php:function('lang', 'postal_code_place')"/>
+                                                               <xsl:value-of 
select="php:function('lang', 'type')"/>
                                                        </label>
-                                                       <input type="text" 
name="zip_code" value="{booking/zip_code}">
+                                                       <div 
class="pure-custom">
+                                                               <table 
class="pure-table pure-table-bordered" border="0" cellspacing="2" 
cellpadding="2">
+                                                                       <thead>
+                                                                               
<tr>
+                                                                               
        <th>
+                                                                               
                <xsl:value-of select="php:function('lang', 'select')"/>
+                                                                               
        </th>
+                                                                               
        <th>
+                                                                               
                <xsl:value-of select="php:function('lang', 'type')"/>
+                                                                               
        </th>
+                                                                               
</tr>
+                                                                       </thead>
+                                                                       <tbody>
+                                                                               
<xsl:for-each select="application_type_list">
+                                                                               
        <tr>
+                                                                               
                <td>
+                                                                               
                        <xsl:if test="selected = 1">
+                                                                               
                                <xsl:text>X</xsl:text>
+                                                                               
                        </xsl:if>
+                                                                               
                </td>
+                                                                               
                <td>
+                                                                               
                        <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+                                                                               
                </td>
+                                                                               
        </tr>
+                                                                               
</xsl:for-each>
+                                                                       </tbody>
+                                                               </table>
+                                                       </div>
+
+                                               </div>
+
+
+
+
+                                       </fieldset>
+
+                                       <fieldset>
+
+                                               <legend>
+                                                       <xsl:value-of 
select="php:function('lang', 'customer')"/>
+                                               </legend>
+
+                                               <div class="pure-control-group">
+                                                       <xsl:variable 
name="lang_customer">
+                                                               <xsl:value-of 
select="php:function('lang', 'customer')"/>
+                                                       </xsl:variable>
+                                                       <label>
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="booking/customer_id > 0">
+                                                                               
<div id="customer_url">
+                                                                               
        <a href="{customer_url}" target="_blank">
+                                                                               
                <xsl:value-of select="$lang_customer"/>
+                                                                               
        </a>
+                                                                               
</div>
+                                                                       
</xsl:when>
+                                                                       
<xsl:otherwise>
+                                                                               
<div id="customer_url">
+                                                                               
        <xsl:value-of select="$lang_customer"/>
+                                                                               
</div>
+                                                                       
</xsl:otherwise>
+                                                               </xsl:choose>
+                                                       </label>
+                                                       <input type="hidden" 
id="customer_id" name="customer_id"  value="{booking/customer_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_customer"/>
+                                                               </xsl:attribute>
                                                                <xsl:attribute 
name="placeholder">
-                                                                       
<xsl:value-of select="php:function('lang', 'zip_code')"/>
+                                                                       
<xsl:value-of select="$lang_customer"/>
                                                                </xsl:attribute>
                                                        </input>
-                                                       <input type="text" 
name="city" value="{booking/city}">
-                                                               <xsl:attribute 
name="data-validation">
-                                                                       
<xsl:text>required</xsl:text>
-                                                               </xsl:attribute>
+                                                       <input type="text" 
id="customer_name" name="customer_name" value="{booking/customer_name}">
                                                                <xsl:attribute 
name="placeholder">
-                                                                       
<xsl:value-of select="php:function('lang', 'city')"/>
+                                                                       
<xsl:value-of select="$lang_customer"/>
                                                                </xsl:attribute>
-                                                       </input>
-                                               </div>
-                                               <div class="pure-control-group">
-                                                       <label>
-                                                               <xsl:value-of 
select="php:function('lang', 'booking_organization_number')"/>
-                                                       </label>
-                                                       <input type="text" 
id="lastname" name="booking_organization_number" 
value="{booking/booking_organization_number}">
                                                                <xsl:attribute 
name="data-validation">
                                                                        
<xsl:text>required</xsl:text>
                                                                </xsl:attribute>
-                                                               <xsl:attribute 
name="placeholder">
-                                                                       
<xsl:value-of select="php:function('lang', 'booking_organization_number')"/>
-                                                               </xsl:attribute>
                                                        </input>
+                                                       <xsl:text> </xsl:text>
+                                                       <a 
href="{new_customer_url}" target="_blank">
+                                                               <xsl:value-of 
select="php:function('lang', 'new')"/>
+                                                       </a>
+                                                       <div 
id="customer_container"/>
                                                </div>
+
                                                <div class="pure-control-group">
                                                        <label>
                                                                <xsl:value-of 
select="php:function('lang', 'contact name')"/>
@@ -195,29 +218,72 @@
                                                                </xsl:attribute>
                                                        </input>
                                                </div>
+                                       </fieldset>
+
+                                       <fieldset>
+
+                                               <legend>
+                                                       <xsl:value-of 
select="php:function('lang', 'booking')"/>
+                                               </legend>
+
                                                <div class="pure-control-group">
                                                        <label>
-                                                               <xsl:value-of 
select="php:function('lang', 'account_number')"/>
+                                                               <xsl:value-of 
select="php:function('lang', 'active')"/>
                                                        </label>
-                                                       <input type="text" 
name="account_number" value="{booking/account_number}">
+                                                       <input type="checkbox" 
name="active" id="active" value="1">
+                                                               <xsl:if 
test="booking/active = 1">
+                                                                       
<xsl:attribute name="checked" value="checked"/>
+                                                               </xsl:if>
+                                                       </input>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'completed')"/>
+                                                       </label>
+                                                       <input type="checkbox" 
name="completed" id="completed" value="1">
+                                                               <xsl:if 
test="booking/completed = 1">
+                                                                       
<xsl:attribute name="checked" value="checked"/>
+                                                               </xsl:if>
+                                                       </input>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <xsl:variable 
name="lang_from">
+                                                               <xsl:value-of 
select="php:function('lang', 'from')"/>
+                                                       </xsl:variable>
+                                                       <label>
+                                                               <xsl:value-of 
select="$lang_from"/>
+                                                       </label>
+                                                       <input type="text" 
id="from_" name="from_" size="16" readonly="readonly">
+                                                               <xsl:if 
test="booking/from_ != 0 and booking/from_ != ''">
+                                                                       
<xsl:attribute name="value">
+                                                                               
<xsl:value-of select="php:function('date', $date_format, 
number(booking/from_))"/>
+                                                                       
</xsl:attribute>
+                                                               </xsl:if>
                                                                <xsl:attribute 
name="data-validation">
                                                                        
<xsl:text>required</xsl:text>
                                                                </xsl:attribute>
-                                                               <xsl:attribute 
name="placeholder">
-                                                                       
<xsl:value-of select="php:function('lang', 'account_number')"/>
+                                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                                       
<xsl:value-of select="$lang_from"/>
                                                                </xsl:attribute>
                                                        </input>
                                                </div>
                                                <div class="pure-control-group">
                                                        <label>
-                                                               <xsl:value-of 
select="php:function('lang', 'description')"/>
+                                                               <xsl:value-of 
select="php:function('lang', 'timespan')"/>
                                                        </label>
-                                                       <textarea cols="47" 
rows="7" name="description">
-                                                               <xsl:value-of 
select="booking/description"/>
-                                                       </textarea>
+                                                       <xsl:value-of 
select="application/timespan"/>
                                                </div>
+
                                                <div class="pure-control-group">
                                                        <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'to')"/>
+                                                       </label>
+                                                       <xsl:value-of 
select="php:function('date', $date_format, number(booking/to_))"/>
+                                               </div>
+                                               
+                                               <div class="pure-control-group">
+                                                       <label>
                                                                <xsl:value-of 
select="php:function('lang', 'remark')"/>
                                                        </label>
                                                        <textarea cols="47" 
rows="7" name="remark">

Modified: trunk/phpgwapi/inc/class.jqcal2.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.jqcal2.inc.php     2016-12-03 00:50:27 UTC (rev 
16043)
+++ trunk/phpgwapi/inc/class.jqcal2.inc.php     2016-12-03 15:36:19 UTC (rev 
16044)
@@ -43,7 +43,7 @@
 
                }
 
-               function add_listener($name, $type = 'date', $value = '', 
$config = array())
+               function add_listener($name, $type = 'date', $value = 0, 
$config = array())
                {
                        switch($type)
                        {
@@ -59,8 +59,15 @@
                                        $_type = 'date';
                                        $dateformat = "{$this->dateformat}";
                        }
-
-                       $this->_input_modern($name, $_type, $dateformat, 
$config);
+                       if(ctype_digit($value) && $value)
+                       {
+                               $start_value = date('Y/m/d H:i', $value);
+                       }
+                       else
+                       {
+                               $start_value = '';
+                       }
+                       $this->_input_modern($name, $_type, $dateformat, 
$config, $start_value);
                        return "<input id='{$name}' type='text' 
value='{$value}' size='10' name='{$name}'/>";
                }
 
@@ -70,7 +77,7 @@
                * @access private
                * @param string $name the element ID
                */
-               function _input_modern($id, $type, $dateformat, $config = 
array())
+               function _input_modern($id, $type, $dateformat, $config = 
array(), $start_value = '')
                {
                        $datepicker = $type == 'time' ? 0 : 1;
                        $timepicker = $type == 'date' ? 0 : 1;
@@ -91,7 +98,16 @@
                                $min_date .= ",maxDate:'{$config['max_date']}'";
                        }
 
+                       if(!$start_value)
+                       {
+                               $start_value = 'new Date()';
+                       }
+                       else
+                       {
+                               $start_value = "new Date('{$start_value}')";
+                       }
 
+
                        $js = <<<JS
                        $(document).ready(function()
                        {
@@ -108,7 +124,9 @@
                                        weeks: true,
                                        dayOfWeekStart:1,
 //                                     mask:true,
-                                       startDate: new Date,
+                                       formatDate:'Y/m/d', //Format date for 
minDate and maxDate
+                                       formatTime: 'H:i',
+                                       startDate: {$start_value},
                                        minDate:{$min_date}
                                });
                        });

Modified: trunk/phpgwapi/inc/class.phpgw.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.phpgw.inc.php      2016-12-03 00:50:27 UTC (rev 
16043)
+++ trunk/phpgwapi/inc/class.phpgw.inc.php      2016-12-03 15:36:19 UTC (rev 
16044)
@@ -577,6 +577,10 @@
                                                break;
                                        case 'date':
                                                $value = 
phpgwapi_datetime::date_to_timestamp($value);
+                                               if($value)
+                                               {
+                                                       $value -= 
phpgwapi_datetime::user_timezone();
+                                               }
                                                break;
                                }
                                return $value;

Modified: trunk/phpgwapi/inc/model/class.model.inc.php
===================================================================
--- trunk/phpgwapi/inc/model/class.model.inc.php        2016-12-03 00:50:27 UTC 
(rev 16043)
+++ trunk/phpgwapi/inc/model/class.model.inc.php        2016-12-03 15:36:19 UTC 
(rev 16044)
@@ -76,7 +76,7 @@
                                        {
                                                case 'int':
                                                case 'integert':
-                                                       $value = 
(int)$this->$name;
+                                                       $value = 
empty($this->$name) && $this->$name === '' ? null : (int)$this->$name;
                                                        break;
                                                case 'float':
                                                        $value = 
(float)$this->$name;




reply via email to

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