fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16441] Stable: Merge 16428:16440 from trunk


From: sigurdne
Subject: [Fmsystem-commits] [16441] Stable: Merge 16428:16440 from trunk
Date: Thu, 16 Mar 2017 06:27:47 -0400 (EDT)

Revision: 16441
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16441
Author:   sigurdne
Date:     2017-03-16 06:27:47 -0400 (Thu, 16 Mar 2017)
Log Message:
-----------
Stable: Merge 16428:16440 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/eventplanner/inc/class.bobooking.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.bocustomer.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.menu.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.socustomer.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uievents.inc.php
    branches/Version-2_0-branch/eventplanner/inc/model/class.application.inc.php
    branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php
    branches/Version-2_0-branch/eventplanner/inc/model/class.customer.inc.php
    branches/Version-2_0-branch/eventplanner/js/portico/application.edit.js
    branches/Version-2_0-branch/eventplanner/setup/phpgw_no.lang
    branches/Version-2_0-branch/eventplanner/templates/base/config.tpl
    branches/Version-2_0-branch/eventplanner/templates/base/events.xsl
    branches/Version-2_0-branch/eventplannerfrontend/templates/base/events.xsl
    branches/Version-2_0-branch/property/inc/class.boentity.inc.php
    branches/Version-2_0-branch/property/inc/class.soentity.inc.php
    branches/Version-2_0-branch/property/templates/base/columns.xsl

Property Changed:
----------------
    branches/Version-2_0-branch/

Index: branches/Version-2_0-branch
===================================================================
--- branches/Version-2_0-branch 2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch 2017-03-16 10:27:47 UTC (rev 16441)

Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
 /branches/dev-syncromind:13653
 /branches/dev-syncromind-2:14933-16394
 /branches/stavangerkommune:12743-12875,12986
-/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427
\ No newline at end of property
+/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440
\ No newline at end of property
Modified: branches/Version-2_0-branch/eventplanner/inc/class.bobooking.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.bobooking.inc.php        
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/inc/class.bobooking.inc.php        
2017-03-16 10:27:47 UTC (rev 16441)
@@ -180,15 +180,14 @@
                {
                        $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
+                       $booking->process_update = true;
 
                        if($booking->validate())
                        {
                                return $booking->store();
                        }
-//                     return 
eventplanner_sobooking::get_instance()->update($booking);
+                       return false;
                }
 
 

Modified: branches/Version-2_0-branch/eventplanner/inc/class.bocustomer.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.bocustomer.inc.php       
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/inc/class.bocustomer.inc.php       
2017-03-16 10:27:47 UTC (rev 16441)
@@ -88,11 +88,11 @@
                        return $values;
                }
 
-               public function read_single($id, $return_object = true)
+               public function read_single($id, $return_object = true, 
$relaxe_acl = false)
                {
                        if ($id)
                        {
-                               $values = 
eventplanner_socustomer::get_instance()->read_single($id, $return_object);
+                               $values = 
eventplanner_socustomer::get_instance()->read_single($id, $return_object, 
$relaxe_acl);
                        }
                        else
                        {

Modified: branches/Version-2_0-branch/eventplanner/inc/class.menu.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.menu.inc.php     
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/inc/class.menu.inc.php     
2017-03-16 10:27:47 UTC (rev 16441)
@@ -78,11 +78,6 @@
                                                'text'  => lang('permission'),
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'eventplanner.uipermission.index') )
                                        ),
-                                       'list_atrribs' => array(
-                                               'text' => 
$GLOBALS['phpgw']->translation->translate('custom fields', array(), true),
-                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute',
-                                                       'appname' => 
'eventplanner'))
-                                       ),
                                        'list_functions' => array(
                                                'text' => 
$GLOBALS['phpgw']->translation->translate('custom functions', array(), true),
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_custom_function',

Modified: branches/Version-2_0-branch/eventplanner/inc/class.socustomer.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.socustomer.inc.php       
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/inc/class.socustomer.inc.php       
2017-03-16 10:27:47 UTC (rev 16441)
@@ -71,7 +71,15 @@
                                }
                        }
 
-                       return '(' . $acl_condition . ' OR 
eventplanner_customer.id IN (' . implode(',', $object_ids) . '))';
+                       if($acl_condition)
+                       {
+                               return '(' . $acl_condition . ' OR 
eventplanner_customer.id IN (' . implode(',', $object_ids) . '))';
+                       }
+                       else
+                       {
+                               return 'eventplanner_customer.id IN (' . 
implode(',', $object_ids) . ')';       
+                       }
+
                }
 
                protected function populate( array $data )

Modified: branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php        
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php        
2017-03-16 10:27:47 UTC (rev 16441)
@@ -385,11 +385,12 @@
                        }
                        else
                        {
+                               $messages = phpgwapi_cache::message_get(true);
                                return array
                                (
                                        'status_kode' => 'error',
                                        'status' => lang('error'),
-                                       'msg' => lang('messages_form_error')
+                                       'msg' => $messages ? $messages : 
lang('did not validate')
                                );
                        }
 

Modified: branches/Version-2_0-branch/eventplanner/inc/class.uievents.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.uievents.inc.php 
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/inc/class.uievents.inc.php 
2017-03-16 10:27:47 UTC (rev 16441)
@@ -243,6 +243,8 @@
                        }
 
                        $category = 
$this->cats->return_single($application->category_id);
+                       $config = CreateObject('phpgwapi.config', 
'eventplanner')->read();
+                       $booking_interval = !empty($config['booking_interval']) 
? $config['booking_interval'] : null;
 
                        $data = array(
                                'datatable_def' => $datatable_def,
@@ -249,6 +251,7 @@
                                'cancel_url' => self::link(array('menuaction' 
=> "{$this->currentapp}.uievents.index",)),
                                'application' => $application,
                                'category_name' => $category[0]['name'],
+                               'booking_interval' => $booking_interval,
                                'status_list' => array('options' => 
$this->get_status_options($application->status)),
                                'application_type_list' => 
$application_type_list,
                                'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),

Modified: 
branches/Version-2_0-branch/eventplanner/inc/model/class.application.inc.php
===================================================================
--- 
branches/Version-2_0-branch/eventplanner/inc/model/class.application.inc.php    
    2017-03-16 10:25:34 UTC (rev 16440)
+++ 
branches/Version-2_0-branch/eventplanner/inc/model/class.application.inc.php    
    2017-03-16 10:27:47 UTC (rev 16441)
@@ -416,6 +416,13 @@
                 */
                protected function preValidate( &$entity )
                {
+
+                       if($entity->date_start && $entity->date_start >  
$entity->date_end)
+                       {
+                               $entity->date_end = $entity->date_start;
+                               phpgwapi_cache::message_set(lang('End date 
cannot be before start date'), 'error');
+                       }
+
                        if (!empty($entity->comment))
                        {
                                $entity->comment_input = array(

Modified: 
branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php    
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php    
2017-03-16 10:27:47 UTC (rev 16441)
@@ -26,7 +26,6 @@
         * @subpackage booking
         * @version $Id: $
         */
-
        phpgw::import_class('eventplanner.bobooking');
 
        include_class('phpgwapi', 'model', 'inc/model/');
@@ -60,8 +59,8 @@
                        $comments,
                        $comment,
                        $created,
-                       $secret;
-
+                       $secret,
+                       $process_update;
                protected $field_of_responsibility_name = '.booking';
 
                public function __construct( int $id = null )
@@ -84,111 +83,111 @@
                {
                        return array(
                                self::STATUS_REGISTERED => lang('registered'),
-                               self::STATUS_PENDING    => lang('pending'),
+                               self::STATUS_PENDING => lang('pending'),
                                self::STATUS_REJECTED => lang('rejected'),
-                               self::STATUS_APPROVED   => lang('approved')
+                               self::STATUS_APPROVED => lang('approved')
                        );
                }
 
-               public static function get_fields($debug = true)
+               public static function get_fields( $debug = true )
                {
-                        $fields = array(
-                               'id' => array('action'=> PHPGW_ACL_READ,
+                       $fields = array(
+                               'id' => array('action' => PHPGW_ACL_READ,
                                        'type' => 'int',
                                        'label' => 'id',
-                                       'sortable'=> true,
+                                       'sortable' => true,
                                        'formatter' => 
'JqueryPortico.formatLink',
-                                       'public'        => true
-                                       ),
-                               'owner_id' => array('action'=> PHPGW_ACL_ADD,
+                                       'public' => true
+                               ),
+                               'owner_id' => array('action' => PHPGW_ACL_ADD,
                                        'type' => 'int',
                                        'required' => false
-                                       ),
-                               'active' => array('action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                               ),
+                               'active' => array('action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
                                        'type' => 'int',
-                                       'public'        => true,
-                                       'history'       => true
-                                       ),
-                               'completed' => array('action'=>  PHPGW_ACL_EDIT,
+                                       'public' => true,
+                                       'history' => true
+                               ),
+                               'completed' => array('action' => PHPGW_ACL_EDIT,
                                        'type' => 'int',
-                                       'history'       => true
-                                       ),
-                               'cost' => array('action'=>  PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'history' => true
+                               ),
+                               'cost' => array('action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
                                        'type' => 'decimal'
-                                       ),
-                               'from_' => array('action'=> PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                               ),
+                               'from_' => array('action' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
                                        'type' => 'date',
-                                       'label' => 'from',
+                                       'label' => 'from',
                                        'history' => true,
                                        'required' => true,
-                                       'public'        => true
-                                       ),
-                               'to_' => array('action'=> PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'public' => true
+                               ),
+                               'to_' => array('action' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
                                        'type' => 'date',
-                                       'label' => 'to',
+                                       'label' => 'to',
                                        'history' => true,
                                        'required' => true,
-                                       'public'        => true
+                                       'public' => true
                                ),
-                               'application_id' => array('action'=> 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                               'application_id' => array('action' => 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
                                        'type' => 'int',
                                        'label' => 'application',
                                        'sortable' => true,
                                        'required' => true,
-                                       'public'        => true
-                                       ),
-                               'application_name' => array('action'=>  
PHPGW_ACL_READ,
+                                       'public' => true
+                               ),
+                               'application_name' => array('action' => 
PHPGW_ACL_READ,
                                        'type' => 'string',
                                        'query' => true,
                                        'label' => 'application',
-                                       'public'        => true,
+                                       'public' => true,
                                        'join' => array(
                                                'table' => 
'eventplanner_application',
                                                'fkey' => 'application_id',
                                                'key' => 'id',
                                                'column' => 'title'
-                                               )
-                                       ),
-                               'vendor_name' => array('action'=>  
PHPGW_ACL_READ,
+                                       )
+                               ),
+                               'vendor_name' => array('action' => 
PHPGW_ACL_READ,
                                        'type' => 'string',
                                        'query' => true,
                                        'label' => 'vendor',
-                                       'public'        => true,
+                                       'public' => true,
                                        'multiple_join' => array(
                                                'statement' => 'LEFT JOIN 
eventplanner_application ON eventplanner_application.id = 
eventplanner_booking.application_id'
-                                                                               
. ' LEFT JOIN eventplanner_vendor ON eventplanner_application.vendor_id = 
eventplanner_vendor.id',
+                                               . ' LEFT JOIN 
eventplanner_vendor ON eventplanner_application.vendor_id = 
eventplanner_vendor.id',
                                                'column' => 
'eventplanner_vendor.name'
-                                               )
-                                       ),
-                               'customer_id' => array('action'=> PHPGW_ACL_ADD 
| PHPGW_ACL_EDIT,
+                                       )
+                               ),
+                               'customer_id' => array('action' => 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
                                        'type' => 'int',
                                        'label' => 'customer',
                                        'sortable' => true,
                                        'history' => true,
-                                       'public'        => true
-                                       ),
-                               'customer_name' => array('action'=>  
PHPGW_ACL_READ,
+                                       'public' => true
+                               ),
+                               'customer_name' => array('action' => 
PHPGW_ACL_READ,
                                        'type' => 'string',
                                        'query' => true,
                                        'label' => 'customer',
-                                       'public'        => true,
+                                       'public' => true,
                                        'join' => array(
                                                'table' => 
'eventplanner_customer',
                                                'fkey' => 'customer_id',
                                                'key' => 'id',
                                                'column' => 'name'
-                                               )
-                                       ),
+                                       )
+                               ),
                                'customer_contact_name' => array(
-                                       'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
                                        'type' => 'string',
                                        'required' => false,
                                        'query' => true,
                                        'label' => 'customer contact name',
                                        'history' => true,
-                                       ),
+                               ),
                                'customer_contact_email' => array(
-                                       'action'=> PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'action' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
                                        'type' => 'string',
                                        'required' => false,
                                        'query' => true,
@@ -195,26 +194,26 @@
                                        'sf_validator' => 
createObject('booking.sfValidatorEmail', array(), array('invalid' => '%field% 
is invalid')),
                                        'label' => 'customer contact email',
                                        'history' => true,
-                                       ),
+                               ),
                                'customer_contact_phone' => array(
-                                       'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
                                        'type' => 'string',
                                        'required' => false,
                                        'query' => true,
                                        'label' => 'customer contact phone',
                                        'history' => true,
-                                       ),
+                               ),
                                'location' => array(
-                                       'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
                                        'type' => 'string',
                                        'required' => false,
                                        'query' => true,
                                        'label' => 'location',
                                        'history' => true,
-                                       'public'        => true
-                                       ),
+                                       'public' => true
+                               ),
                                'comments' => array(
-                                       'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
                                        'type' => 'string',
                                        'manytomany' => array(
                                                'input_field' => 
'comment_input',
@@ -224,31 +223,30 @@
                                                'order' => array('sort' => 
'time', 'dir' => 'ASC')
                                        )),
                                'comment' => array(
-                                       'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
                                        'type' => 'string',
                                        'related' => true,
-                                       ),
-                               'created' => array('action'=> PHPGW_ACL_READ,
+                               ),
+                               'created' => array('action' => PHPGW_ACL_READ,
                                        'type' => 'date',
                                        'label' => 'created',
                                        'sortable' => true,
-                                       ),
-                               'secret' => array('action'=> PHPGW_ACL_ADD,
+                               ),
+                               'secret' => array('action' => PHPGW_ACL_ADD,
                                        'type' => 'string',
                                        'label' => 'secret',
                                        'sortable' => false,
-                                       ),
-                               );
+                               ),
+                       );
 
-                       if($debug)
+                       if ($debug)
                        {
                                foreach ($fields as $field => $field_info)
                                {
-                                       
if(!property_exists('eventplanner_booking', $field))
+                                       if 
(!property_exists('eventplanner_booking', $field))
                                        {
-                                          
phpgwapi_cache::message_set('$'."{$field},", 'error');
+                                               phpgwapi_cache::message_set('$' 
. "{$field},", 'error');
                                        }
-
                                }
                        }
                        return $fields;
@@ -269,7 +267,7 @@
                                );
                        }
 
-                       if(!$entity->get_id())
+                       if (!$entity->get_id())
                        {
                                $entity->status = 
eventplanner_booking::STATUS_REGISTERED;
                                $entity->secret = self::generate_secret();
@@ -289,7 +287,6 @@
 
                        $entity->modified = time();
                        $entity->active = (int)$entity->active;
-
                }
 
                protected function doValidate( $entity, &$errors )
@@ -299,10 +296,70 @@
                        $params['filters']['active'] = 1;
                        $params['filters']['application_id'] = 
$entity->application_id;
 
-                       $bookings =  
eventplanner_sobooking::get_instance()->read($params);
+                       $bookings = 
eventplanner_sobooking::get_instance()->read($params);
 
-                       if($entity->customer_id) // update
+                       foreach ($bookings['results'] as $booking)
                        {
+                               if ($booking['id'] == $entity->get_id())
+                               {
+                                       continue;
+                               }
+
+                               if (($entity->from_ > $booking['from_'] && 
$entity->from_ < $booking['to_']) || ($entity->to_ > $booking['from_'] && 
$entity->to_ < $booking['to_']))
+                               {
+                                       $errors['from_'] = lang('Time is 
already booked');
+                               }
+                       }
+
+                       $orig_customer_id = 0;
+                       if ($entity->get_id())
+                       {
+                               $orig_booking = 
createObject('eventplanner.bobooking')->read_single($entity->get_id());
+                               $orig_customer_id = $orig_booking->customer_id;
+                       }
+
+                       $number_of_customer_bookings = 0;
+                       if ($entity->customer_id && $entity->customer_id != 
$orig_customer_id)
+                       {
+                               $config = CreateObject('phpgwapi.config', 
'eventplanner')->read();
+                               $booking_interval = 
!empty($config['booking_interval']) ? (int)$config['booking_interval'] : 0;
+                               $customer = 
createObject('eventplanner.bocustomer')->read_single($entity->customer_id);
+                               $max_events = (int)$customer->max_events;
+                               foreach ($bookings['results'] as $booking)
+                               {
+                                       $current_interval = 0;
+
+                                       if ($booking['customer_id'] == 
$entity->customer_id)
+                                       {
+                                               $current_interval = 
floor(abs(($booking['from_'] - $entity->from_)) / (60 * 60 * 24));
+                                       }
+
+                                       if ($booking_interval && 
$current_interval && $current_interval < $booking_interval)
+                                       {
+                                               $errors['booking_interval'] = 
lang('There is a minimum interval of %1 day(s)', $booking_interval);
+                                       }
+
+                                       $booking_year = date('Y', 
$booking['from_']);
+
+                                       if ($booking_year != date('Y', 
$entity->from_))
+                                       {
+                                               continue;
+                                       }
+
+                                       if ($booking['customer_id'] == 
$entity->customer_id)
+                                       {
+                                               $number_of_customer_bookings ++;
+                                       }
+                               }
+
+                               if ($max_events && $number_of_customer_bookings 
>= $max_events)
+                               {
+                                       $errors['num_granted_events_year'] = 
lang('maximum of granted events per year (%1) are reached', $max_events);
+                               }
+                       }
+
+                       if ($entity->customer_id || $entity->process_update) // 
update
+                       {
                                $test_total_tecords = 
(int)$bookings['total_records'];
                        }
                        else // new entry
@@ -310,16 +367,16 @@
                                $test_total_tecords = 
(int)$bookings['total_records'] + 1;
                        }
 
-                       if($test_total_tecords > 
(int)$application->num_granted_events)
+                       if ($test_total_tecords > 
(int)$application->num_granted_events)
                        {
                                $errors['num_granted_events'] = lang('maximum 
of granted events are reached');
                        }
 
-                       $date_start = date('Ymd',$application->date_start);
-                       $date_end = date('Ymd',$application->date_end);
-                       $from_ = date('Ymd',$entity->from_);
+                       $date_start = date('Ymd', $application->date_start);
+                       $date_end = date('Ymd', $application->date_end);
+                       $from_ = date('Ymd', $entity->from_);
 
-                       if($from_ < $date_start || $from_ > $date_end)
+                       if ($from_ < $date_start || $from_ > $date_end)
                        {
                                $errors['from_'] = lang('date is outside the 
scope');
                        }
@@ -340,8 +397,8 @@
                        return 
eventplanner_bobooking::get_instance()->store($this);
                }
 
-               public function read_single($id)
+               public function read_single( $id )
                {
                        return 
eventplanner_bobooking::get_instance()->read_single($id, true);
                }
-       }
+       }
\ No newline at end of file

Modified: 
branches/Version-2_0-branch/eventplanner/inc/model/class.customer.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/model/class.customer.inc.php   
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/inc/model/class.customer.inc.php   
2017-03-16 10:27:47 UTC (rev 16441)
@@ -221,6 +221,13 @@
                                        'query' => true,
                                        'sf_validator' => 
createObject('booking.sfValidatorNorwegianOrganizationNumber', array(), 
array('invalid' => '%field% is invalid')),
                                        'label' => 'organization number'
+                                       ),
+                                       'max_events' => array(
+                                               'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                               'type' => 'int',
+                                               'required' => true,
+                                               'query' => false,
+                                               'label' => 'maximum number of 
events',
                                        )
                        );
 
@@ -245,14 +252,7 @@
                                                'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
                                                'type' => 'string',
                                                'related' => true,
-                                               ),
-                                       'max_events' => array(
-                                               'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
-                                               'type' => 'int',
-                                               'required' => true,
-                                               'query' => false,
-                                               'label' => 'maximum number of 
events',
-                                               ),
+                                               )
                                        );
 
                                foreach ($backend_fields as $key => $field_info)

Modified: 
branches/Version-2_0-branch/eventplanner/js/portico/application.edit.js
===================================================================
--- branches/Version-2_0-branch/eventplanner/js/portico/application.edit.js     
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/js/portico/application.edit.js     
2017-03-16 10:27:47 UTC (rev 16441)
@@ -334,12 +334,21 @@
                        {
                                $("#from_").val('');
                                htmlString += "<div class=\"msg_good\">";
+                               htmlString += result.msg;
                        }
                        else
                        {
                                htmlString += "<div class=\"error\">";
+                               var msg = result.msg;
+                               if (typeof (msg) == 'object')
+                               {
+                                       htmlString += msg['error'][0]['msg'];
+                               }
+                               else
+                               {
+                                       htmlString += result.msg;
+                               }
                        }
-                       htmlString += result.msg;
                        htmlString += '</div>';
                        $("#receipt").html(htmlString);
 

Modified: branches/Version-2_0-branch/eventplanner/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/eventplanner/setup/phpgw_no.lang        
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/setup/phpgw_no.lang        
2017-03-16 10:27:47 UTC (rev 16441)
@@ -111,5 +111,11 @@
 read   eventplanner    no      Les
 permission     eventplanner    no      Rettighet
 maximum number of events       eventplanner    no      Maksimum antall 
arrangement
+maximum of granted events per year (%1) are reached    eventplanner    no      
Maksimum antall arrangementer (%1) pr år er nådd
 number of users        eventplanner    no      Ca. antall brukere
-disconnect     eventplanner    no      Kople fra
\ No newline at end of file
+disconnect     eventplanner    no      Kople fra
+end date cannot be before start date   eventplanner    no      Siste dato kan 
ikke være før første dato
+Time is already booked eventplanner    no      Tiden er allerede booking
+booking interval       eventplanner    no      Booking intervall
+days   eventplanner    no      dager
+there is a minimum interval of %1 day(s)       eventplanner    no      Det er 
et minimumsintervall på %1 dag(er)
\ No newline at end of file

Modified: branches/Version-2_0-branch/eventplanner/templates/base/config.tpl
===================================================================
--- branches/Version-2_0-branch/eventplanner/templates/base/config.tpl  
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/templates/base/config.tpl  
2017-03-16 10:27:47 UTC (rev 16441)
@@ -14,6 +14,12 @@
                                </select>
                        </td>
                </tr>
+               <tr>
+                       <td>{lang_booking_interval}:</td>
+                       <td>
+                               <input type="number" 
name="newsettings[booking_interval]" value="{value_booking_interval}">
+                       </td>
+               </tr>
 
                <!-- END body -->
                <!-- BEGIN footer -->

Modified: branches/Version-2_0-branch/eventplanner/templates/base/events.xsl
===================================================================
--- branches/Version-2_0-branch/eventplanner/templates/base/events.xsl  
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplanner/templates/base/events.xsl  
2017-03-16 10:27:47 UTC (rev 16441)
@@ -66,6 +66,16 @@
                                                <xsl:value-of 
select="category_name"/>
                                        </div>
 
+                                       <xsl:if test="booking_interval != ''">
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'booking interval')"/>
+                                                       </label>
+                                                       <xsl:value-of 
select="booking_interval"/>
+                                                       <xsl:text> </xsl:text>
+                                                       <xsl:value-of 
select="php:function('lang', 'days')"/>
+                                               </div>
+                                       </xsl:if>
                                        
                                        <div class="pure-control-group">
                                                <label>

Modified: 
branches/Version-2_0-branch/eventplannerfrontend/templates/base/events.xsl
===================================================================
--- branches/Version-2_0-branch/eventplannerfrontend/templates/base/events.xsl  
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/eventplannerfrontend/templates/base/events.xsl  
2017-03-16 10:27:47 UTC (rev 16441)
@@ -66,6 +66,16 @@
                                                <xsl:value-of 
select="category_name"/>
                                        </div>
 
+                                       <xsl:if test="booking_interval != ''">
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'booking interval')"/>
+                                                       </label>
+                                                       <xsl:value-of 
select="booking_interval"/>
+                                                       <xsl:text> </xsl:text>
+                                                       <xsl:value-of 
select="php:function('lang', 'days')"/>
+                                               </div>
+                                       </xsl:if>
                                        
                                        <div class="pure-control-group">
                                                <label>

Modified: branches/Version-2_0-branch/property/inc/class.boentity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boentity.inc.php     
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/property/inc/class.boentity.inc.php     
2017-03-16 10:27:47 UTC (rev 16441)
@@ -282,22 +282,22 @@
                                        );
                                }
                        }
-                       /*
-                         $columns['user_id'] = array
-                         (
-                         'id'                  => 'user_id',
-                         'input_type'  => 'text',
-                         'name'                        => 'user_id',
-                         'descr'                       => lang('User'),
-                         'statustext'  => lang('User'),
-                         'align'               => '',
-                         'datatype'            => 'user',
-                         'sortable'            => false,
-                         'exchange'            => false,
-                         'formatter'           => '',
-                         'classname'           => ''
+                       
+                       $columns['user_name'] = array
+                       (
+                               'id'                    => 'user_name',
+                               'input_type'    => 'text',
+                               'name'                  => 'user_name',
+                               'descr'                 => lang('User'),
+                               'statustext'    => lang('User'),
+                               'align'                 => '',
+                               'datatype'              => 'user',
+                               'sortable'              => false,
+                               'exchange'              => false,
+                               'formatter'             => '',
+                               'classname'             => ''
                          );
-                        */
+                       
                        return $columns;
                }
 
@@ -466,34 +466,6 @@
                                        }
                                }
                        }
-                       /*
-                         $entity = $this->so->read(array
-                         (
-                         'start' => $this->start,
-                         'query' => $this->query,
-                         'sort' => $this->sort,
-                         'order' => $this->order,
-                         'filter' => $this->filter,
-                         'cat_id' => $this->cat_id,
-                         'district_id' => $this->district_id,
-                         'part_of_town_id' => $this->part_of_town_id,
-                         'lookup'=>isset($data['lookup'])?$data['lookup']:'',
-                         
'allrows'=>isset($data['allrows'])?$data['allrows']:'',
-                         'results' => $this->results,
-                         'entity_id'=>$this->entity_id,
-                         'status'=>$this->status,
-                         
'start_date'=>$this->bocommon->date_to_timestamp($data['start_date']),
-                         
'end_date'=>$this->bocommon->date_to_timestamp($data['end_date']),
-                         'dry_run'=>$data['dry_run'],
-                         'type'=>$data['type'],
-                         'location_code' => $this->location_code,
-                         'criteria_id' => $this->criteria_id,
-                         'attrib_filter' => $attrib_filter,
-                         'p_num' => $this->p_num,
-                         
'control_registered'=>isset($data['control_registered']) ? 
$data['control_registered'] : '',
-                         'control_id'=>isset($data['control_id']) ? 
$data['control_id'] : '',
-                         'org_units' => $this->org_units
-                         ) */
                        $entity = $this->so->read(array
                                (
                                'start' => $data['start'],
@@ -600,6 +572,12 @@
                                        $entry[$_name] = 
"javascript_action_{$_name}({$entry['id']},{$entry['location_code']})";
                                        
$this->uicols['javascript_action'][$_name] = true;
                                }
+
+                               if($entry['user_id'])
+                               {
+                                       $entry['user_name'] = 
$GLOBALS['phpgw']->accounts->get($entry['user_id'])->__toString();
+                               }
+
                        }
 
                        return $entity;

Modified: branches/Version-2_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soentity.inc.php     
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/property/inc/class.soentity.inc.php     
2017-03-16 10:27:47 UTC (rev 16441)
@@ -1077,6 +1077,12 @@
                                }
                                unset($key);
 
+                               $dataset[$j]['user_id'] = array
+                                       (
+                                       'value' => $this->db->f('user_id'),
+                                       'datatype' => false,
+                                       'attrib_id' => false
+                               );
 
                                //Start: get short descripion - if any
                                $_short_description = array();
@@ -1211,24 +1217,11 @@
 
                                $entity = 
$admin_entity->read_single($entity_id);
 
-
                                $cols_return_extra = array();
                                $cols_return = array();
                                $uicols = array();
                                $cols = "{$entity_table}.*";
 
-                               $cols_return[] = 'location_code';
-                               $uicols['input_type'][] = 'hidden';
-                               $uicols['name'][] = 'location_code';
-                               $uicols['descr'][] = 'dummy';
-                               $uicols['statustext'][] = 'dummy';
-                               $uicols['align'][] = '';
-                               $uicols['datatype'][] = '';
-                               $uicols['sortable'][] = true;
-                               $uicols['exchange'][] = false;
-                               $uicols['formatter'][] = '';
-                               $uicols['classname'][] = '';
-
                                $cols_return[] = 'num';
                                $uicols['input_type'][] = 'text';
                                $uicols['name'][] = 'num';
@@ -1241,6 +1234,21 @@
                                $uicols['formatter'][] = $lookup ? '' : 
'linktToEntity';
                                $uicols['classname'][] = '';
 
+                               if (!empty($category['location_level']))
+                               {
+                                       $cols_return[] = 'location_code';
+                                       $uicols['input_type'][] = 'text';
+                                       $uicols['name'][] = 'location_code';
+                                       $uicols['descr'][] = 
lang('location_code');
+                                       $uicols['statustext'][] = 
lang('location_code');
+                                       $uicols['align'][] = '';
+                                       $uicols['datatype'][] = '';
+                                       $uicols['sortable'][] = true;
+                                       $uicols['exchange'][] = false;
+                                       $uicols['formatter'][] = '';
+                                       $uicols['classname'][] = '';
+                               }
+
                                if (isset($entity['lookup_entity']) && 
is_array($entity['lookup_entity']))
                                {
                                        $uicols['input_type'][] = 'text';
@@ -1959,6 +1967,12 @@
                                                'get_single_function_input' => 
$uicols['get_single_function_input'][$key]
                                        );
                                }
+                               $dataset[$j]['user_id'] = array
+                                       (
+                                       'value' => $this->db->f('user_id'),
+                                       'datatype' => false,
+                                       'attrib_id' => false
+                               );
                                $dataset[$j]['location_id'] = array
                                        (
                                        'value' => $location_id,

Modified: branches/Version-2_0-branch/property/templates/base/columns.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/columns.xsl     
2017-03-16 10:25:34 UTC (rev 16440)
+++ branches/Version-2_0-branch/property/templates/base/columns.xsl     
2017-03-16 10:27:47 UTC (rev 16441)
@@ -11,30 +11,29 @@
 <!-- New template-->
 <xsl:template match="columns">
        <div class='body'>
-               <form method="post" name="form" action="{form_action}" class= 
"pure-form pure-form-aligned">
-                       <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
-                               <xsl:choose>
-                                       <xsl:when test="msgbox_data != ''">
-                                               <tr>
-                                                       <td align="left" 
colspan="3">
-                                                               
<xsl:call-template name="msgbox"/>
-                                                       </td>
-                                               </tr>
-                                       </xsl:when>
-                               </xsl:choose>
-                       </table>
-                       <div class="proplist-col">
-                               <input type="submit" class="pure-button 
pure-button-primary" name="values[save]">
-                                       <xsl:attribute name="value">
-                                               <xsl:value-of 
select="php:function('lang', 'save')"/>
-                                       </xsl:attribute>
-                               </input>
-                       </div>
-
+               <table cellpadding="2" cellspacing="2" width="80%" 
align="center">
+                       <xsl:choose>
+                               <xsl:when test="msgbox_data != ''">
+                                       <tr>
+                                               <td align="left" colspan="3">
+                                                       <xsl:call-template 
name="msgbox"/>
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
+               </table>
+               <form method="post" name="form" action="{form_action}" class= 
"pure-form pure-form-stacked">
                        <fieldset>
                                <legend>
                                        <xsl:value-of select="lang_columns"/>
                                </legend>
+                               <div class="proplist-col">
+                                       <input type="submit" class="pure-button 
pure-button-primary" name="values[save]">
+                                               <xsl:attribute name="value">
+                                                       <xsl:value-of 
select="php:function('lang', 'save')"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </div>
                                <div class="pure-g">
                                        <xsl:apply-templates 
select="column_list"/>
                                </div>
@@ -49,20 +48,17 @@
                <xsl:value-of select="id"/>
        </xsl:variable>
        <div class="pure-u-1 pure-u-sm-1-3">
-               <div class="pure-u-1">
-                       <div class="pure-control-group">
-                               <label>
-                                       <xsl:value-of select="name"/>
-                               </label>
-                               <xsl:choose>
-                                       <xsl:when test="selected">
-                                               <input id="column{$id}" 
name="values[columns][]" value="{$id}" checked="checked" type="checkbox"/>
-                                       </xsl:when>
-                                       <xsl:otherwise>
-                                               <input id="column{$id}" 
name="values[columns][]" value="{$id}" type="checkbox"/>
-                                       </xsl:otherwise>
-                               </xsl:choose>
-                       </div>
+               <div class="pure-control-group">
+                       <label for="column{$id}"  class="pure-checkbox">
+                       <input id="column{$id}" name="values[columns][]" 
value="{$id}" type="checkbox">
+                               <xsl:if test="selected">
+                                       <xsl:attribute name="checked">
+                                               <xsl:text>checked</xsl:text>
+                                       </xsl:attribute>
+                               </xsl:if>
+                       </input>
+                               <xsl:value-of select="name"/>
+                       </label>
                </div>
        </div>
 </xsl:template>




reply via email to

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