fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17158] Stable: Merge 17151:17157 from trunk


From: sigurdne
Subject: [Fmsystem-commits] [17158] Stable: Merge 17151:17157 from trunk
Date: Tue, 17 Oct 2017 08:07:58 -0400 (EDT)

Revision: 17158
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17158
Author:   sigurdne
Date:     2017-10-17 08:07:58 -0400 (Tue, 17 Oct 2017)
Log Message:
-----------
Stable: Merge 17151:17157 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/booking/inc/class.bocommon.inc.php
    branches/Version-2_0-branch/booking/inc/class.menu.inc.php
    
branches/Version-2_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
    
branches/Version-2_0-branch/booking/inc/class.socompleted_reservation_export_file.inc.php
    branches/Version-2_0-branch/booking/inc/class.uigroup.inc.php
    branches/Version-2_0-branch/booking/inc/class.uiorganization.inc.php
    branches/Version-2_0-branch/booking/setup/phpgw_no.lang
    branches/Version-2_0-branch/booking/setup/setup.inc.php
    branches/Version-2_0-branch/booking/setup/tables_current.inc.php
    branches/Version-2_0-branch/booking/setup/tables_update.inc.php
    
branches/Version-2_0-branch/booking/templates/base/account_code_dimension.xsl
    branches/Version-2_0-branch/bookingfrontend/inc/class.bouser.inc.php
    branches/Version-2_0-branch/bookingfrontend/inc/class.uiorganization.inc.php
    
branches/Version-2_0-branch/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
    branches/Version-2_0-branch/bookingfrontend/inc/custom/default/MinId.php
    branches/Version-2_0-branch/bookingfrontend/templates/base/organization.xsl
    branches/Version-2_0-branch/controller/inc/class.uicontrol_group.inc.php

Added Paths:
-----------
    branches/Version-2_0-branch/booking/inc/class.bodelegate.inc.php
    branches/Version-2_0-branch/booking/inc/class.sodelegate.inc.php
    branches/Version-2_0-branch/booking/inc/class.sopermission_delegate.inc.php
    branches/Version-2_0-branch/booking/inc/class.uidelegate.inc.php
    branches/Version-2_0-branch/booking/js/booking/delegate_new.js
    branches/Version-2_0-branch/booking/templates/base/delegate.xsl
    branches/Version-2_0-branch/booking/templates/base/delegate_edit.xsl
    branches/Version-2_0-branch/bookingfrontend/inc/class.uidelegate.inc.php
    branches/Version-2_0-branch/bookingfrontend/templates/base/delegate.xsl
    branches/Version-2_0-branch/bookingfrontend/templates/base/delegate_edit.xsl

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

Index: branches/Version-2_0-branch
===================================================================
--- branches/Version-2_0-branch 2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch 2017-10-17 12:07:58 UTC (rev 17158)

Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
 /branches/dev-syncromind:13653
 /branches/dev-syncromind-2:14933-16846
 /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,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16600-16601,16603-16608,16610-16614,16616-16618,16620-16621,16623-16624,16626,16628,16630,16632-16638,16640,16642,16644,16646-16651,16653-16663,16665,16667,16669,16671,16673,16675,16677,16679-16680,16682,16684,16686,16688-16692,16694-16695,16697-16699,16701,16703,16705-16706,16708,16710,16712,16714,16716-16718,16720-16728,16730-16732,16734-16739,16741,16743-16746,16748-16750,16752-16755,16757,16759-16761,16763,16765,16767,16769-16774,16776,16778-16783,16785-16788,16790,16792,16794,16796-16802,16804-16807,16809,16811-16817,16819,16821-16825,16827-16831,16833,16835-16836,16838,16840-16844,16846-16847,16849,16851,16853-16854,16856-16859,16861,16863-16865,16867,16869-16871,16873,16875-16876,16878,16880-16881,16883,16885,16887-16888,16890,16892,16894-16900,16902,16904,16906,16908-16909,16911-16916,16918-16919,16921,16923,16925,16927,16929-16930,16932,16934,16936-16937,16939-16942,16944,16946,16948,16950,16952-16953,16955-16959,16961,16963,16965-16970,16972,16974-16977,16979-16982,16984,16986,16988-16999,17001,17003,17005-17018,17020-17023,17025-17026,17028-17033,17035,17037,17039-17040,17042-17050,17052-17053,17055,17057-17058,17060,17062-17064,17066,17068-17074,17076-17088,17090,17092,17094,17096,17098,17100-17101,17103-17104,17106-17108,17110-17121,17123-17124,17126-17132,17134-17143,17145-17150
\ 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,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16600-16601,16603-16608,16610-16614,16616-16618,16620-16621,16623-16624,16626,16628,16630,16632-16638,16640,16642,16644,16646-16651,16653-16663,16665,16667,16669,16671,16673,16675,16677,16679-16680,16682,16684,16686,16688-16692,16694-16695,16697-16699,16701,16703,16705-16706,16708,16710,16712,16714,16716-16718,16720-16728,16730-16732,16734-16739,16741,16743-16746,16748-16750,16752-16755,16757,16759-16761,16763,16765,16767,16769-16774,16776,16778-16783,16785-16788,16790,16792,16794,16796-16802,16804-16807,16809,16811-16817,16819,16821-16825,16827-16831,16833,16835-16836,16838,16840-16844,16846-16847,16849,16851,16853-16854,16856-16859,16861,16863-16865,16867,16869-16871,16873,16875-16876,16878,16880-16881,16883,16885,16887-16888,16890,16892,16894-16900,16902,16904,16906,16908-16909,16911-16916,16918-16919,16921,16923,16925,16927,16929-16930,16932,16934,16936-16937,16939-16942,16944,16946,16948,16950,16952-16953,16955-16959,16961,16963,16965-16970,16972,16974-16977,16979-16982,16984,16986,16988-16999,17001,17003,17005-17018,17020-17023,17025-17026,17028-17033,17035,17037,17039-17040,17042-17050,17052-17053,17055,17057-17058,17060,17062-17064,17066,17068-17074,17076-17088,17090,17092,17094,17096,17098,17100-17101,17103-17104,17106-17108,17110-17121,17123-17124,17126-17132,17134-17143,17145-17150,17152-17157
\ No newline at end of property
Index: branches/Version-2_0-branch/booking
===================================================================
--- branches/Version-2_0-branch/booking 2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/booking 2017-10-17 12:07:58 UTC (rev 17158)

Property changes on: branches/Version-2_0-branch/booking
___________________________________________________________________
Modified: svn:mergeinfo
## -1,3 +1,3 ##
 /branches/dev-syncromind-2/booking:14933-16846
 /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
-/trunk/booking:14721-14732,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14871,14886-14896,14900-14902,14917-14919,14924-14978,14980-15258,15266-15285,15287-15288,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15360-15541,15543-15566,15568-15569,15585-15617,15621-15630,15637-15639,15641-15643,15645,15647-15665,15667-15668,15695-15712,15714-15764,15820-15849,15889-15900,15902-16046,16055,16101-16130,16144-16212,16297-16305,16307-16314,16393-16395,16490-16497,16514-16517,16534,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16616-16618,16730,16734-16739,16748-16750,16769-16774,16785-16788,16796-16802,16835-16836,16846-16847,16883,16885,16908-16909,16939-16942,16944,16946,16948,17020-17023,17028-17033,17039-17040,17076-17088,17126-17132,17134-17143
\ No newline at end of property
+/trunk/booking:14721-14732,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14871,14886-14896,14900-14902,14917-14919,14924-14978,14980-15258,15266-15285,15287-15288,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15360-15541,15543-15566,15568-15569,15585-15617,15621-15630,15637-15639,15641-15643,15645,15647-15665,15667-15668,15695-15712,15714-15764,15820-15849,15889-15900,15902-16046,16055,16101-16130,16144-16212,16297-16305,16307-16314,16393-16395,16490-16497,16514-16517,16534,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16616-16618,16730,16734-16739,16748-16750,16769-16774,16785-16788,16796-16802,16835-16836,16846-16847,16883,16885,16908-16909,16939-16942,16944,16946,16948,17020-17023,17028-17033,17039-17040,17076-17088,17126-17132,17134-17143,17152-17157
\ No newline at end of property
Modified: branches/Version-2_0-branch/booking/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.bocommon.inc.php      
2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/booking/inc/class.bocommon.inc.php      
2017-10-17 12:07:58 UTC (rev 17158)
@@ -87,8 +87,12 @@
 
                        if (!isset($_SESSION['showall']))
                        {
-                               if (!isset($filters['application_id']))
+                               if(!empty($filters['active']) && 
$filters['active'] == "-1")
                                {
+                                       unset($filters['active']);
+                               }
+                               else if (!isset($filters['application_id']))
+                               {
                                        $filters['active'] = "1";
                                }
                        }
@@ -130,8 +134,12 @@
 
                        if (!isset($_SESSION['showall']))
                        {
-                               if 
(!isset($params['filters']['application_id']))
+                               if(!empty($params['filters']['active']) && 
$params['filters']['active'] == "-1")
                                {
+                                       unset($params['filters']['active']);
+                               }
+                               else if 
(!isset($params['filters']['application_id']))
+                               {
                                        $params['filters']['active'] = "1";
                                }
                        }

Copied: branches/Version-2_0-branch/booking/inc/class.bodelegate.inc.php (from 
rev 17157, trunk/booking/inc/class.bodelegate.inc.php)
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.bodelegate.inc.php            
                (rev 0)
+++ branches/Version-2_0-branch/booking/inc/class.bodelegate.inc.php    
2017-10-17 12:07:58 UTC (rev 17158)
@@ -0,0 +1,87 @@
+<?php
+       phpgw::import_class('booking.bocommon_authorized');
+
+       class booking_bodelegate extends booking_bocommon_authorized
+       {
+
+               function __construct()
+               {
+                       parent::__construct();
+                       $this->so = CreateObject('booking.sodelegate');
+                       $this->org_bo = CreateObject('booking.boorganization');
+               }
+
+               /**
+                * @see bocommon_authorized
+                */
+               protected function include_subject_parent_roles( array 
$for_object = null )
+               {
+                       $parent_roles = null;
+                       $parent_org = null;
+
+                       if (is_array($for_object))
+                       {
+                               if (!isset($for_object['organization_id']))
+                               {
+                                       throw new 
InvalidArgumentException('Cannot initialize object parent roles unless 
organization_id is provided');
+                               }
+
+                               $parent_org = 
$this->org_bo->read_single($for_object['organization_id']);
+                       }
+
+                       //Note that a null value for $parent_org is acceptable. 
That only signifies
+                       //that any roles specified for any organization are 
returned rather than the roles 
+                       //for a specific organization
+                       $parent_roles['organization'] = 
$this->org_bo->get_subject_roles($parent_org);
+
+                       return $parent_roles;
+               }
+
+               /**
+                * @see bocommon_authorized
+                */
+               protected function get_object_role_permissions( $forObject, 
$defaultPermissions )
+               {
+                       if ($this->current_app() == 'booking')
+                       {
+                               
$defaultPermissions[booking_sopermission::ROLE_DEFAULT] = array
+                                       (
+                                       'read' => true,
+                                       'delete' => true,
+                                       'write' => true,
+                                       'create' => true,
+                               );
+
+                               
$defaultPermissions['parent_role_permissions']['organization'] = array();
+                       }
+
+                       if ($this->current_app() == 'bookingfrontend')
+                       {
+                               
$defaultPermissions['parent_role_permissions']['organization'][booking_boorganization::ROLE_ADMIN]
 = array
+                                       (
+                                       'write' => true,
+                                       'create' => true,
+                               );
+                       }
+
+                       return $defaultPermissions;
+               }
+
+               /**
+                * @see bocommon_authorized
+                */
+               protected function get_collection_role_permissions( 
$defaultPermissions )
+               {
+                       if ($this->current_app() == 'booking')
+                       {
+                               
$defaultPermissions[booking_sopermission::ROLE_DEFAULT]['create'] = true;
+                       }
+
+                       if ($this->current_app() == 'bookingfrontend')
+                       {
+                               
$defaultPermissions['parent_role_permissions']['organization'][booking_boorganization::ROLE_ADMIN]['create']
 = true;
+                       }
+
+                       return $defaultPermissions;
+               }
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/booking/inc/class.menu.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.menu.inc.php  2017-10-16 
18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/booking/inc/class.menu.inc.php  2017-10-17 
12:07:58 UTC (rev 17158)
@@ -151,6 +151,12 @@
                                                        'text' => 
lang('Groups'),
                                                        'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'booking.uigroup.index')),
                                                        'image' => 
array('property', 'location_tenant'),
+                                               ),
+                                               'delegates' => array
+                                                       (
+                                                       'text' => 
lang('delegates'),
+                                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'booking.uidelegate.index')),
+                                                       'image' => 
array('property', 'location_tenant'),
                                                )
                                        )
                                ),

Modified: 
branches/Version-2_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
===================================================================
--- 
branches/Version-2_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
        2017-10-16 18:25:35 UTC (rev 17157)
+++ 
branches/Version-2_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
        2017-10-17 12:07:58 UTC (rev 17158)
@@ -344,6 +344,10 @@
                        {
                                $export_format = 'kommfakt';
                        }
+                       elseif ($config->config_data['external_format'] == 
'VISMA')
+                       {
+                               $export_format = 'visma';
+                       }
 
                        if (is_array($reservations))
                        {
@@ -373,6 +377,12 @@
                                                                $export_format, 
count(array_filter($external_reservations, array($this, 'not_free'))), 
$this->calculate_total_cost($external_reservations), 
$this->format_kommfakt($external_reservations, $account_codes, 
$number_generator)
                                                );
                                        }
+                                       elseif 
($config->config_data['external_format'] == 'VISMA')
+                                       {
+                                               return 
$this->build_export_result(
+                                                               $export_format, 
count(array_filter($external_reservations, array($this, 'not_free'))), 
$this->calculate_total_cost($external_reservations), 
$this->format_visma($external_reservations, $account_codes, $number_generator)
+                                               );
+                                       }
                                }
                        }
                        return $this->build_export_result($export_format, 0, 
0.0);
@@ -426,6 +436,12 @@
                                                                $export_format, 
count(array_filter($internal_reservations, array($this, 'not_free'))), 
$this->calculate_total_cost($internal_reservations), 
$this->format_kommfakt($internal_reservations, $account_codes, 
$number_generator)
                                                );
                                        }
+                                       elseif 
($config->config_data['internal_format'] == 'VISMA')
+                                       {
+                                               return 
$this->build_export_result(
+                                                               $export_format, 
count(array_filter($internal_reservations, array($this, 'not_free'))), 
$this->calculate_total_cost($internal_reservations), 
$this->format_visma($internal_reservations, $account_codes, $number_generator)
+                                               );
+                                       }
                                }
                        }
                        return $this->build_export_result($export_format, 0, 
0.0);
@@ -546,6 +562,123 @@
                        }
                }
 
+               /**
+                * Implement me
+                * @param array $reservations
+                * @param array $account_codes
+                * @param type $sequential_number_generator
+                */
+               public function format_visma( array &$reservations, array 
$account_codes, $sequential_number_generator )
+               {
+//                     Format for overføring av fakturagrunnlag til Visma 
Enterprise Fakturering via fil
+//                     
=================================================================================
+//
+//                     Fom. Fakturering 2014.1.04 er det lagt til rette for et 
utvidet format på FL-linjene som blant
+//                     annet inneholder kontering og profil-informasjon. 
Dokumentasjon av dette ligger nederst i
+//                     denne beskrivelsen. Innlesningsprogrammet skiller 
mellom de to formatene ved å sjekke
+//                     på verdien av FORMAT-feltet på ST-linjen.
+//
+//
+//                     POSTTYPER
+//                     =========
+//
+//                     ST = Startpost
+//                     FL = Fakturalinje
+//                     LT = Linjetekst  (er mulig å knytte fritekst til 
fakturalinjen)
+//                     SL = Sluttpost
+//
+//                     M/K
+//                     M = Må angis
+//                     K = Kan angis
+//
+//
+//                     Type Felt    Lengde Posisjon Beskrivelse             
M/K Merknader
+//                     ---- ------- ------ -------- ----------------------- 
--- ----------
+//                     ST   POSTTYPE   2   001-002  Posttype                 M 
 Verdi 'ST'
+//                     ST   REFERANSE 60   003-062  Referanse                K 
 ST01
+//                     ST   FORMAT     1   063-063  Utvidet format           K 
 ST02
+//
+//                     FL   POSTTYPE   2   001-002  Posttype                 M 
 Verdi 'FL'
+//                     FL   KUNDENR   11   003-013  Kundenummer              M
+//                     FL   NAVN      30   014-043  Kundens navn             K
+//                     FL   ADRESSE1  30   044-073  Adresselinje 1           K
+//                     FL   ADRESSE2  30   074-103  Adresselinje 2           K
+//                     FL   POSTNR     4   104-107  Postnummer               K
+//                     FL   BETFORM    2   108-109  Betalingstype (BG,PG)    M 
 MRK01
+//                     FL   OPPDRGNR   3   110-112  Oppdragsgivernummer      M 
 MRK02
+//                     FL   VARENR     4   113-116  Varenummer               M 
 MRK02
+//                     FL   LØPENR     2   117-118  Løpenummer               M 
 MRK03
+//                     FL   PRIS       9   119-127  Varens pris              M 
 MRK04
+//                     FL   GRUNNLAG   9   128-136  Antall av varen          M 
 MRK05
+//                     FL   BELØP     11   137-147  Utregnet beløp           M 
 MRK04
+//                     FL   SAKSNR    16   148-163  Saksnr                   K
+//
+//                     LT   POSTTYPE   2   001-002  Posttype                 M 
 Verdi 'LT'
+//                     LT   KUNDENR   11   003-013  Kundenummer              M
+//                     LT   OPPDRGNR   3   014-016  Oppdragsgivernummer      M
+//                     LT   VARENR     4   017-020  Varenummer               M
+//                     LT   LØPENR     2   021-022  Løpenummer               M
+//                     LT   LINJENR    2   023-024  Linjenummer              M 
 MRK06
+//                     LT   TEKST     50   025-074  Fritekstlinje            K
+//
+//                     SL   POSTTYPE   2   001-002  Posttype                 M 
 Verdi 'SL'
+//                     SL   ANTPOST    8   003-010  Antall poster            M 
 Inkl. Start/Sluttpost
+//
+//
+//                     UTVIDET FORMAT PÅ FL-LINJENE
+//                     ============================
+//
+//                     FL   POSTTYPE   2   001-002  Posttype                 M 
 Verdi 'FL'
+//                     FL   KUNDENR   11   003-013  Kundenummer              M
+//                     FL   NAVN      40   014-053  Kundens navn             K
+//                     FL   ADRESSE1  40   054-093  Adresselinje 1           K
+//                     FL   ADRESSE2  40   094-133  Adresselinje 2           K
+//                     FL   POSTNR     4   134-137  Postnummer               K
+//                     FL   BETFORM    2   138-139  Betalingstype (BG,PG)    M 
 MRK01
+//                     FL   OPPDRGNR   3   140-142  Oppdragsgivernummer      M 
 MRK02
+//                     FL   VARENR     4   143-146  Varenummer               M 
 MRK02
+//                     FL   LØPENR     2   147-148  Løpenummer               M 
 MRK03
+//                     FL   PRIS       9   149-157  Varens pris              M 
 MRK04
+//                     FL   GRUNNLAG   9   158-166  Antall av varen          M 
 MRK05
+//                     FL   BELØP     11   167-177  Utregnet beløp           M 
 MRK04
+//                     FL   SAKSNR    16   178-193  Saksnr                   K
+//                     FL   INTFAKT    1   194-194  Internfaktura            K 
 MRK07
+//                     FL   KB01      12   195-206  1. konteringsverdi       K
+//                     FL   KB02      12   207-218  2. konteringsverdi       K
+//                     FL   KB03      12   219-230  3. konteringsverdi       K
+//                     FL   KB04      12   231-242  4. konteringsverdi       K
+//                     FL   KB05      12   243-254  5. konteringsverdi       K
+//                     FL   KB06      12   255-266  6. konteringsverdi       K
+//                     FL   KB07      12   267-278  7. konteringsverdi       K
+//                     FL   KB08      12   279-290  8. konteringsverdi       K
+//                     FL   KB09      12   291-302  9. konteringsverdi       K
+//                     FL   KB10      12   303-314  10. konteringsverdi      K
+//                     FL   MVAKODE    3   315-317  Mva-kode                 K
+//                     FL   PROFIL    20   318-337  Profil                   K
+//                     FL   DERESREF  40   338-377  Kontaktinformasjon       K
+//                     FL   ORDREREF  20   378-397  Ordrereferanse           K
+//
+//
+//                     MERKNADER
+//                     =========
+//
+//                     ST01  -  Teksten i dette feltet kommer ut på 
kvitteringslisten og kan
+//                                      brukes som referanse på overføringen.
+//                                      (f.eks. hvilket system/dato etc...)
+//                     ST02  -  Ved bruk av nytt format, må verdien 'U' legges 
i feltet.
+//                     MRK01 -  BG = Bankgiro, PG = Postgiro.
+//                     MRK02 -  Må være opprettet i Visma Enterprise 
Fakturering.
+//                     MRK03 -  Fortløpende nummerering hvis flere forekomster 
av samme vare på kunden.
+//                     MRK04 -  De 2 nest siste posisjoner er desimaler, siste 
posisjon angir
+//                                      fortegn. (f.eks. 10000- er lik 100.00-)
+//                     MRK05 -  De 2 siste posisjoner er desimaler.
+//                     MRK06 -  Fortløpende nummerering av fritekst. Start på 
1 for hvert
+//                                      fakturagrunnlag.
+//                     MRK07 -  Internfaktura merkes ved verdi 1 i dette 
feltet.
+
+               }
+
+
                public function format_csv( array &$reservations, array 
$account_codes, $sequential_number_generator )
                {
                        $export_info = array();

Modified: 
branches/Version-2_0-branch/booking/inc/class.socompleted_reservation_export_file.inc.php
===================================================================
--- 
branches/Version-2_0-branch/booking/inc/class.socompleted_reservation_export_file.inc.php
   2017-10-16 18:25:35 UTC (rev 17157)
+++ 
branches/Version-2_0-branch/booking/inc/class.socompleted_reservation_export_file.inc.php
   2017-10-17 12:07:58 UTC (rev 17158)
@@ -52,6 +52,10 @@
                                {
                                        return 'txt';
                                }
+                               elseif ($config->config_data['internal_format'] 
== 'VISMA')
+                               {
+                                       return 'txt';
+                               }
                        }
                        elseif ($export_type === 'external')
                        {
@@ -67,6 +71,10 @@
                                {
                                        return 'txt';
                                }
+                               elseif ($config->config_data['external_format'] 
== 'VISMA')
+                               {
+                                       return 'txt';
+                               }
                        }
                        else
                        {

Copied: branches/Version-2_0-branch/booking/inc/class.sodelegate.inc.php (from 
rev 17157, trunk/booking/inc/class.sodelegate.inc.php)
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.sodelegate.inc.php            
                (rev 0)
+++ branches/Version-2_0-branch/booking/inc/class.sodelegate.inc.php    
2017-10-17 12:07:58 UTC (rev 17158)
@@ -0,0 +1,96 @@
+<?php
+       phpgw::import_class('booking.socommon');
+
+       class booking_sodelegate extends booking_socommon
+       {
+
+               function __construct()
+               {
+                       parent::__construct('bb_delegate', array(
+                               'id' => array('type' => 'int'),
+                               'active' => array('type' => 'int', 'required' 
=> true),
+                               'organization_id' => array('type' => 'int', 
'required' => true),
+                               'name' => array('type' => 'string', 'query' => 
true, 'required' => true),
+                               'email' => array('type' => 'string', 
'sf_validator' => createObject('booking.sfValidatorEmail', array(), array(
+                                               'invalid' => '%field% is 
invalid'))),
+                               'ssn' => array('type' => 'string', 'required' 
=> true),
+                               'phone' => array('type' => 'string', 'query' => 
true, 'required' => true),
+                               'organization_name' => array('type' => 'string',
+                                       'query' => true,
+                                       'join' => array(
+                                               'table' => 'bb_organization',
+                                               'fkey' => 'organization_id',
+                                               'key' => 'id',
+                                               'column' => 'name'
+                                       )),
+                               )
+                       );
+                       $this->account = 
$GLOBALS['phpgw_info']['user']['account_id'];
+               }
+
+               protected function preValidate( &$entity )
+               {
+                       $id = (int) $entity['id'];
+                       if (empty($entity['ssn']))
+                       {
+                               $this->db->query("SELECT ssn FROM bb_delegate 
WHERE id = {$id}", __LINE__, __FILE__);
+                               $this->db->next_record();
+                               $entity['ssn'] = $this->db->f('ssn');
+                       }
+               }
+
+
+               protected function doValidate( $entity, booking_errorstack 
$errors )
+               {
+
+                       $ssn= $entity['ssn'];
+
+                       if ( !preg_match('/^{(.*)}(.*)$/', $ssn, $m) || 
count($m) != 3  ) //full string, algorhythm, hash
+                       {
+                               //raw ssn
+                               try
+                               {
+                                       $sf_validator = 
createObject('booking.sfValidatorNorwegianSSN', array(), array(
+                                       'invalid' => '%field% is invalid'));
+                                       $sf_validator->setOption('required', 
false);
+                                       $sf_validator->clean($ssn);
+                               }
+                               catch (sfValidatorError $e)
+                               {
+                                       $errors['ssn'] = 
lang(strtr($e->getMessage(), array('%field%' => 'ssn')));
+                               }
+
+                               $hash = sha1($entity['ssn']);
+                               $ssn =  '{SHA1}' . base64_encode($hash);
+
+                               $cnt = 0;
+                               if(empty($entity['id']))
+                               {
+                                       $sql = "SELECT count(id) AS cnt FROM 
bb_delegate WHERE ssn = '{$ssn}' AND organization_id = " . (int) 
$entity['organization_id'];
+                               }
+                               else
+                               {
+                                       $id = (int) $entity['id'];
+                                       $sql = "SELECT count(id) AS cnt FROM 
bb_delegate WHERE id != {$id} AND ssn = '{$ssn}' AND organization_id = " . 
(int) $entity['organization_id'];
+                               }
+                               $this->db->query($sql, __LINE__, __FILE__);
+                               $this->db->next_record();
+                               $cnt = $this->db->f('cnt');
+                               if($cnt > 0)
+                               {
+                                       $errors['ssn'] = lang('duplicate ssn');
+                               }
+
+                               return;
+                       }
+
+                       $algo = $m[1];
+                       $hash = $m[2];
+
+                       if($algo != 'SHA1')
+                       {
+                               $errors['ssn'] = lang('the ssn hash is not 
correct');
+                       }
+               }
+
+       }
\ No newline at end of file

Copied: 
branches/Version-2_0-branch/booking/inc/class.sopermission_delegate.inc.php 
(from rev 17157, trunk/booking/inc/class.sopermission_delegate.inc.php)
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.sopermission_delegate.inc.php 
                        (rev 0)
+++ branches/Version-2_0-branch/booking/inc/class.sopermission_delegate.inc.php 
2017-10-17 12:07:58 UTC (rev 17158)
@@ -0,0 +1,7 @@
+<?php
+       phpgw::import_class('booking.sopermission');
+
+       class booking_sopermission_delegate extends booking_sopermission
+       {
+               
+       }
\ No newline at end of file

Copied: branches/Version-2_0-branch/booking/inc/class.uidelegate.inc.php (from 
rev 17157, trunk/booking/inc/class.uidelegate.inc.php)
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.uidelegate.inc.php            
                (rev 0)
+++ branches/Version-2_0-branch/booking/inc/class.uidelegate.inc.php    
2017-10-17 12:07:58 UTC (rev 17158)
@@ -0,0 +1,352 @@
+<?php
+       phpgw::import_class('booking.uicommon');
+
+       phpgw::import_class('booking.uidocument_building');
+       phpgw::import_class('booking.uipermission_building');
+
+//     phpgw::import_class('phpgwapi.uicommon_jquery');
+
+       class booking_uidelegate extends booking_uicommon
+       {
+
+               public $public_functions = array
+                       (
+                       'index' => true,
+                       'query' => true,
+                       'show' => true,
+                       'edit' => true,
+                       'toggle_show_inactive' => true,
+               );
+               protected $module;
+
+               public function __construct()
+               {
+                       parent::__construct();
+                       $this->bo = CreateObject('booking.bodelegate');
+                       $this->activity_bo = CreateObject('booking.boactivity');
+                       
self::set_active_menu('booking::organizations::delegates');
+
+                       $this->module = "booking";
+               }
+
+               public function link_to_parent_params( $action = 'show', 
$params = array() )
+               {
+                       return array_merge(array('menuaction' => 
sprintf($this->module . '.ui%s.%s', $this->get_current_parent_type(), $action),
+                               'id' => $this->get_parent_id()), $params);
+               }
+
+               public function link_to_parent( $action = 'show', $params = 
array() )
+               {
+                       return 
$this->link($this->link_to_parent_params($action, $params));
+               }
+
+               public function get_current_parent_type()
+               {
+                       if (!$this->is_inline())
+                       {
+                               return null;
+                       }
+                       $parts = explode('_', key($a = 
$this->get_inline_params()));
+                       return $parts[1];
+               }
+
+               public function get_parent_id()
+               {
+                       $inlineParams = $this->get_inline_params();
+                       return $inlineParams['filter_organization_id'];
+               }
+
+               public function get_parent_if_inline()
+               {
+                       if (!$this->is_inline())
+                               return null;
+                       return CreateObject('booking.bo' . 
$this->get_current_parent_type())->read_single($this->get_parent_id());
+               }
+
+               public function redirect_to_parent_if_inline()
+               {
+                       if ($this->is_inline())
+                       {
+                               $this->redirect($this->link_to_parent_params());
+                       }
+
+                       return false;
+               }
+
+               public function link_to( $action, $params = array() )
+               {
+                       return $this->link($this->link_to_params($action, 
$params));
+               }
+
+               public function link_to_params( $action, $params = array() )
+               {
+                       if (isset($params['ui']))
+                       {
+                               $ui = $params['ui'];
+                               unset($params['ui']);
+                       }
+                       else
+                       {
+                               $ui = 'delegate';
+                               $this->apply_inline_params($params);
+                       }
+
+                       $action = sprintf($this->module . '.ui%s.%s', $ui, 
$action);
+                       return array_merge(array('menuaction' => $action), 
$params);
+               }
+
+               public function apply_inline_params( &$params )
+               {
+                       if ($this->is_inline())
+                       {
+                               $params['filter_organization_id'] = 
intval(phpgw::get_var('filter_organization_id'));
+                       }
+                       return $params;
+               }
+
+               public function get_inline_params()
+               {
+                       return array('filter_organization_id' => 
phpgw::get_var('filter_organization_id', 'int', 'REQUEST'));
+               }
+
+               public function is_inline()
+               {
+                       return false != 
phpgw::get_var('filter_organization_id', 'int', 'REQUEST');
+               }
+
+               public function index()
+               {
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+
+                       $lang_delegate = lang('delegate');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('booking') . "::{$lang_delegate}";
+
+                       $data = array(
+                               'datatable_name'        => $lang_delegate,
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array(
+                                                               'type' => 
'link',
+                                                               'value' => 
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
+                                                               'href' => 
self::link(array('menuaction' => $this->url_prefix . '.toggle_show_inactive'))
+                                                       ),
+                                               )
+                                       ),
+                               ),
+                               'datatable' => array(
+                                       'source' => 
self::link(array('menuaction' => $this->module . '.uidelegate.index',
+                                               'phpgw_return_as' => 'json')),
+                                       'field' => array(
+                                               array(
+                                                       'key' => 
'organization_name',
+                                                       'label' => 
lang('Organization')
+                                               ),
+                                               array(
+                                                       'key' => 'name',
+                                                       'label' => 
lang('delegate'),
+                                                       'formatter' => 
'JqueryPortico.formatLink'
+                                               ),
+                                               array(
+                                                       'key' => 'phone',
+                                                       'label' => 
lang('Phone'),
+                                               ),
+                                               array(
+                                                       'key' => 'email',
+                                                       'label' => 
lang('Email'),
+                                               ),
+                                               array(
+                                                       'key' => 'active',
+                                                       'label' => 
lang('Active'),
+                                               ),
+                                               array(
+                                                       'key' => 'link',
+                                                       'hidden' => true
+                                               )
+                                       )
+                               )
+                       );
+                       $data['datatable']['actions'][] = array();
+                       $data['datatable']['new_item'] = 
self::link(array('menuaction' => $this->module . '.uidelegate.edit'));
+
+                       self::render_template_xsl('datatable_jquery', $data);
+               }
+
+               public function query()
+               {
+                       $delegates = $this->bo->read();
+
+                       $lang_yes = lang('yes');
+                       $lang_no = lang('no');
+
+                       array_walk($delegates["results"], array($this, 
"_add_links"), $this->module . ".uidelegate.show");
+                       foreach ($delegates["results"] as &$delegate)
+                       {
+                               $delegate['active'] = $delegate['active'] == 1 
? $lang_yes : $lang_no;
+                       }
+                       $results = $this->jquery_results($delegates);
+
+                       if (is_array($parent_entity = 
$this->get_parent_if_inline()))
+                       {
+                               if 
($this->bo->allow_create(array($this->get_current_parent_type() . '_id' => 
$parent_entity['id'])))
+                               {
+                                       $results['Actions']['add'] = 
array('text' => lang('Add Group'), 'href' => $this->link_to('edit'));
+                               }
+                       }
+
+                       return $results;
+               }
+
+               public function edit()
+               {
+                       $id = phpgw::get_var('id', 'int');
+
+
+                       if ($id)
+                       {
+                               $delegate = $this->bo->read_single($id);
+                               $delegate['id'] = $id;
+                               $delegate['organization_link'] = 
$this->link_to('show', array('ui' => 'organization',
+                                       'id' => $delegate['organization_id']));
+
+                               $delegate['cancel_link'] = 
$this->link_to('show', array('id' => $id));
+
+                               if ($this->is_inline())
+                               {
+                                       $delegate['cancel_link'] = 
$this->link_to_parent();
+                               }
+                       }
+                       else
+                       {
+                               $delegate = array();
+                               $delegate['cancel_link'] = 
$this->link_to('index', array('ui' => 'organization'));
+
+                               $organization_id = 
phpgw::get_var('organization_id', 'int');
+                               if($organization_id)
+                               {
+                                       $delegate['cancel_link'] = 
self::link(array('menuaction' => $this->module . '.uiorganization.show',
+                                               'id' => $organization_id));
+                                       $delegate['organization_id'] = 
$organization_id;
+                                       $organization = 
CreateObject('booking.boorganization')->read_single($organization_id);
+                                       $delegate['organization_name'] = 
$organization['name'];
+                               }
+
+                               if ($this->is_inline())
+                               {
+                                       $delegate['organization_link'] = 
$this->link_to_parent();
+                                       $delegate['cancel_link'] = 
$this->link_to_parent();
+                                       $this->apply_inline_params($delegate);
+                               }
+                       }
+
+                       $delegate['organizations_link'] = 
$this->link_to('index', array('ui' => 'organization'));
+
+                       $errors = array();
+                       if ($_SERVER['REQUEST_METHOD'] == 'POST')
+                       {
+                               $delegate = array_merge($delegate, 
extract_values($_POST, array(
+                                       'name' => 'string',
+                                       'ssn' => 'string',
+                                       'email' => 'string',
+                                       'phone' => 'string',
+                                       'organization_id' => 'string',
+                                       'organization_name' => 'string',
+                                       'active' => 'int',
+                               )));
+                               if (!isset($delegate["active"]))
+                               {
+                                       $delegate['active'] = '1';
+                               }
+
+                               $errors = $this->bo->validate($delegate);
+                               if (strlen($_POST['name']) > 50)
+                               {
+                                       $errors['name'] = lang('Lengt of name 
is to long, max 50 characters long');
+                               }
+                               if (strlen($_POST['shortname']) > 11)
+                               {
+                                       $errors['shortname'] = lang('Lengt of 
shortname is to long, max 11 characters long');
+                               }
+                               if (!$errors)
+                               {
+                                       if (empty($delegate['ssn']))
+                                       {
+                                               $_delegate = 
$this->bo->read_single($id);
+                                               $delegate['ssn'] = 
$_delegate['ssn'];
+                                       }
+                                       else
+                                       {
+                                               $hash = sha1($delegate['ssn']);
+                                               $delegate['ssn'] =  '{SHA1}' . 
base64_encode($hash);
+                                       }
+
+                                       if ($id)
+                                       {
+                                               $receipt = 
$this->bo->update($delegate);
+                                       }
+                                       else
+                                       {
+                                               $receipt = 
$this->bo->add($delegate);
+                                       }
+
+                                       $this->redirect_to_parent_if_inline();
+                                       
$this->redirect($this->link_to_params('show', array('id' => $receipt['id'])));
+                               }
+                       }
+                       $this->flash_form_errors($errors);
+
+                       if (is_array($parent_entity = 
$this->get_parent_if_inline()))
+                       {
+                               $delegate[$this->get_current_parent_type() . 
'_id'] = $parent_entity['id'];
+                               $delegate[$this->get_current_parent_type() . 
'_name'] = $parent_entity['name'];
+                       }
+
+                       phpgwapi_jquery::load_widget('autocomplete');
+                       self::rich_text_editor('field_description');
+
+                       $tabs = array();
+                       $tab_text = ($id) ? 'Delegate Edit' : 'Delegate New';
+                       if (id)
+                       {
+                               $tabs['generic'] = array('label' => 
lang($tab_text), 'link' => '#delegate_edit');
+                       }
+                       $active_tab = 'generic';
+                       $delegate['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
+                       $delegate['validator'] = 
phpgwapi_jquery::formvalidator_generate(array('location',
+                                       'date', 'security', 'file'));
+
+                       $delegate['ssn'] = '';//secret
+
+                       self::render_template_xsl('delegate_edit', 
array('delegate' => $delegate, 'module' => $this->module));
+               }
+
+               public function show()
+               {
+                       $delegate = $this->bo->read_single(phpgw::get_var('id', 
'int'));
+                       $delegate['organizations_link'] = 
self::link(array('menuaction' => $this->module . '.uiorganization.index'));
+                       $delegate['organization_link'] = 
self::link(array('menuaction' => $this->module . '.uiorganization.show',
+                                       'id' => $delegate['organization_id']));
+                       $delegate['edit_link'] = self::link(array('menuaction' 
=> $this->module . '.uidelegate.edit',
+                                       'id' => $delegate['id']));
+                       $delegate['cancel_link'] = 
self::link(array('menuaction' => $this->module . '.uidelegate.index'));
+
+                       $data = array(
+                               'delegate' => $delegate
+                       );
+                       $loggedin = (int)true; // FIXME: Some sort of 
authentication!
+                       $edit_self_link = self::link(array('menuaction' => 
'bookingfrontend.uidelegate.edit',
+                                       'id' => $delegate['id']));
+
+                       $tabs = array();
+                       $tabs['generic'] = array('label' => lang('delegate'), 
'link' => '#delegate');
+                       $active_tab = 'generic';
+
+                       $delegate['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
+
+                       self::render_template_xsl('delegate', array('delegate' 
=> $delegate, 'loggedin' => $loggedin,
+                               'edit_self_link' => $edit_self_link));
+               }
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/booking/inc/class.uigroup.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.uigroup.inc.php       
2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/booking/inc/class.uigroup.inc.php       
2017-10-17 12:07:58 UTC (rev 17158)
@@ -121,7 +121,10 @@
                                return $this->query();
                        }
 
+                       $lang_groups = lang('groups');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('booking') . "::{$lang_groups}";
                        $data = array(
+                               'datatable_name'        => $lang_groups,
                                'form' => array(
                                        'toolbar' => array(
                                                'item' => array(
@@ -244,6 +247,16 @@
                                $group = array();
                                $group['cancel_link'] = $this->link_to('index', 
array('ui' => 'organization'));
 
+                               $organization_id = 
phpgw::get_var('organization_id', 'int');
+                               if($organization_id)
+                               {
+                                       $group['cancel_link'] = 
self::link(array('menuaction' => $this->module . '.uiorganization.show',
+                                               'id' => $organization_id));
+                                       $group['organization_id'] = 
$organization_id;
+                                       $organization = 
CreateObject('booking.boorganization')->read_single($organization_id);
+                                       $group['organization_name'] = 
$organization['name'];
+                               }
+
                                if ($this->is_inline())
                                {
                                        $group['organization_link'] = 
$this->link_to_parent();

Modified: branches/Version-2_0-branch/booking/inc/class.uiorganization.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.uiorganization.inc.php        
2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/booking/inc/class.uiorganization.inc.php        
2017-10-17 12:07:58 UTC (rev 17158)
@@ -323,6 +323,8 @@
                                        'id' => $organization['id']));
                        $organization['new_group_link'] = 
self::link(array('menuaction' => $this->module . '.uigroup.edit',
                                        'organization_id' => 
$organization['id']));
+                       $organization['new_delegate_link'] = 
self::link(array('menuaction' => $this->module . '.uidelegate.edit',
+                                       'organization_id' => 
$organization['id']));
                        $organization['cancel_link'] = 
self::link(array('menuaction' => $this->module . '.uiorganization.index'));
                        $organization['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
                        $this->install_customer_identifier_ui($organization);

Copied: branches/Version-2_0-branch/booking/js/booking/delegate_new.js (from 
rev 17157, trunk/booking/js/booking/delegate_new.js)
===================================================================
--- branches/Version-2_0-branch/booking/js/booking/delegate_new.js              
                (rev 0)
+++ branches/Version-2_0-branch/booking/js/booking/delegate_new.js      
2017-10-17 12:07:58 UTC (rev 17158)
@@ -0,0 +1,5 @@
+$(document).ready(function ()
+{
+       
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.uiorganization.index&phpgw_return_as=json&',
+               'field_organization_name', 'field_organization_id', 
'organization_container');
+});

Modified: branches/Version-2_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/booking/setup/phpgw_no.lang     2017-10-16 
18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/booking/setup/phpgw_no.lang     2017-10-17 
12:07:58 UTC (rev 17158)
@@ -708,4 +708,12 @@
 toggle show inactive   booking no      Veklse på å vise inaktive
 season edit    booking no      Endre sesong
 season show    booking no      Vis sesong
-application edit       booking no      Rediger søknad
\ No newline at end of file
+application edit       booking no      Rediger søknad
+delegates      booking no      Delegater
+delegate       booking no      Delegert til
+new delegate   booking no      Ny delegert
+please enter a delegate        booking no      Angi navn på delegert til
+please enter an email  booking no      Angi en epost
+ssn is invalid booking no      Fødselsnummeret er ikke gyldig
+edit delegate  booking no      Endre delegert til
+duplicate ssn  booking no      Duplikat av f.nr for samme organisasjon
\ No newline at end of file

Modified: branches/Version-2_0-branch/booking/setup/setup.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/setup/setup.inc.php     2017-10-16 
18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/booking/setup/setup.inc.php     2017-10-17 
12:07:58 UTC (rev 17158)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['booking']['name'] = 'booking';
-       $setup_info['booking']['version'] = '0.2.27';
+       $setup_info['booking']['version'] = '0.2.28';
        $setup_info['booking']['app_order'] = 9;
        $setup_info['booking']['enable'] = 1;
        $setup_info['booking']['app_group'] = 'office';
@@ -16,6 +16,7 @@
                'bb_resource',
                'bb_building_resource',
                'bb_group',
+               'bb_delegate',
                'bb_season',
                'bb_season_boundary',
                'bb_application',

Modified: branches/Version-2_0-branch/booking/setup/tables_current.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/setup/tables_current.inc.php    
2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/booking/setup/tables_current.inc.php    
2017-10-17 12:07:58 UTC (rev 17158)
@@ -164,6 +164,21 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'bb_delegate' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
false),
+                               'active' => array('type' => 'int', 'nullable' 
=> False, 'precision' => 2, 'default' => 1),
+                               'organization_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                               'name' => array('type' => 'varchar', 
'precision' => '150', 'nullable' => False),
+                               'email' => array('type' => 'varchar', 
'precision' => '50', 'nullable' => True),
+                               'ssn' => array('type' => 'varchar', 'precision' 
=> '115', 'nullable' => True),
+                               'phone' => array('type' => 'varchar', 
'precision' => '50', 'nullable' => True),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array('bb_organization' => 
array('organization_id' => 'id')),
+                       'ix' => array(),
+                       'uc' => array('organization_id', 'ssn')
+               ),
                'bb_season' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto', 'nullable' => 
false),

Modified: branches/Version-2_0-branch/booking/setup/tables_update.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/setup/tables_update.inc.php     
2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/booking/setup/tables_update.inc.php     
2017-10-17 12:07:58 UTC (rev 17158)
@@ -3588,3 +3588,38 @@
                        return $GLOBALS['setup_info']['booking']['currentver'];
                }
        }
+
+
+       /**
+        * Update booking version from 0.2.27 to 0.2.28
+        *
+        */
+       $test[] = '0.2.27';
+       function booking_upgrade0_2_27()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'bb_delegate', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'nullable' => false),
+                                       'active' => array('type' => 'int', 
'nullable' => False, 'precision' => 2, 'default' => 1),
+                                       'organization_id' => array('type' => 
'int', 'precision' => '4', 'nullable' => False),
+                                       'name' => array('type' => 'varchar', 
'precision' => '150', 'nullable' => False),
+                                       'email' => array('type' => 'varchar', 
'precision' => '50', 'nullable' => True),
+                                       'ssn' => array('type' => 'varchar', 
'precision' => '115', 'nullable' => True),
+                                       'phone' => array('type' => 'varchar', 
'precision' => '50', 'nullable' => True),
+                       ),
+                               'pk' => array('id'),
+                               'fk' => array('bb_organization' => 
array('organization_id' => 'id')),
+                               'ix' => array(),
+                               'uc' => array('organization_id', 'ssn')
+                       )
+               );
+
+               if ($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['booking']['currentver'] = 
'0.2.28';
+                       return $GLOBALS['setup_info']['booking']['currentver'];
+               }
+       }

Modified: 
branches/Version-2_0-branch/booking/templates/base/account_code_dimension.xsl
===================================================================
--- 
branches/Version-2_0-branch/booking/templates/base/account_code_dimension.xsl   
    2017-10-16 18:25:35 UTC (rev 17157)
+++ 
branches/Version-2_0-branch/booking/templates/base/account_code_dimension.xsl   
    2017-10-17 12:07:58 UTC (rev 17158)
@@ -116,6 +116,12 @@
                                                        </xsl:if>
                                                        KOMMFAKT
                                                </option>
+                                               <option value="VISMA">
+                                                       <xsl:if 
test="config_data/external_format='VISMA'">
+                                                               <xsl:attribute 
name="selected">checked</xsl:attribute>
+                                                       </xsl:if>
+                                                       KOMMFAKT
+                                               </option>
                                        </select>
                                </div>
                                <div class="pure-control-group">
@@ -186,6 +192,12 @@
                                                        </xsl:if>
                                                        KOMMFAKT
                                                </option>
+                                               <option value="VISMA">
+                                                       <xsl:if 
test="config_data/internal_format='VISMA'">
+                                                               <xsl:attribute 
name="selected">checked</xsl:attribute>
+                                                       </xsl:if>
+                                                       KOMMFAKT
+                                               </option>
                                        </select>
                                </div>
                                <div class="pure-control-group">

Copied: branches/Version-2_0-branch/booking/templates/base/delegate.xsl (from 
rev 17157, trunk/booking/templates/base/delegate.xsl)
===================================================================
--- branches/Version-2_0-branch/booking/templates/base/delegate.xsl             
                (rev 0)
+++ branches/Version-2_0-branch/booking/templates/base/delegate.xsl     
2017-10-17 12:07:58 UTC (rev 17158)
@@ -0,0 +1,51 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+       <xsl:call-template name="msgbox"/>
+       <form action="" method="POST" id='form' class="pure-form 
pure-form-aligned" name="form">
+               <input type="hidden" name="tab" value=""/>
+               <div id="tab-content">
+                       <xsl:value-of disable-output-escaping="yes" 
select="delegate/tabs"/>
+                       <div id="delegate" class="booking-container">
+                               <fieldset>
+                                       <div class="pure-control-group">
+                                               <label>
+                                                       <xsl:value-of 
select="php:function('lang', 'Organization')" />
+                                               </label>
+                                               <xsl:value-of 
select="delegate/organization_name"/>
+                                       </div>
+                                       <div class="pure-control-group">
+                                               <label>
+                                                       <xsl:value-of 
select="php:function('lang', 'Name')" />
+                                               </label>
+                                               <xsl:value-of 
select="delegate/name"/>
+                                       </div>
+                                       <div class="pure-control-group">
+                                               <label>
+                                                       <xsl:value-of 
select="php:function('lang', 'email')" />
+                                               </label>
+                                               <xsl:value-of 
select="delegate/email"/>
+                                       </div>
+                                       <div class="pure-control-group">
+                                               <label>
+                                                       <xsl:value-of 
select="php:function('lang', 'phone')" />
+                                               </label>
+                                               <xsl:value-of 
select="delegate/phone" />
+                                       </div>
+                               </fieldset>
+                       </div>
+               </div>
+               <div class="form-buttons">
+                       <a class="button pure-button pure-button-primary">
+                               <xsl:attribute name="href">
+                                       <xsl:value-of 
select="delegate/edit_link"/>
+                               </xsl:attribute>
+                               <xsl:value-of select="php:function('lang', 
'Edit')" />
+                       </a>
+                       <input type="button" class="pure-button 
pure-button-primary" name="cencel">
+                               <xsl:attribute 
name="onclick">window.location.href="<xsl:value-of 
select="delegate/cancel_link"/>"</xsl:attribute>
+                               <xsl:attribute name="value">
+                                       <xsl:value-of 
select="php:function('lang', 'Cancel')" />
+                               </xsl:attribute>
+                       </input>
+               </div>
+       </form>
+</xsl:template>

Copied: branches/Version-2_0-branch/booking/templates/base/delegate_edit.xsl 
(from rev 17157, trunk/booking/templates/base/delegate_edit.xsl)
===================================================================
--- branches/Version-2_0-branch/booking/templates/base/delegate_edit.xsl        
                        (rev 0)
+++ branches/Version-2_0-branch/booking/templates/base/delegate_edit.xsl        
2017-10-17 12:07:58 UTC (rev 17158)
@@ -0,0 +1,126 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+       <xsl:call-template name="msgbox"/>
+       <form action="" method="POST" id='form' class="pure-form 
pure-form-aligned" name="form">
+               <input type="hidden" name="tab" value=""/>
+               <div id="tab-content">
+                       <xsl:value-of disable-output-escaping="yes" 
select="delegate/tabs"/>
+                       <div id="delegate_edit" class="booking-container">
+                               <fieldset>
+                                       <div class="heading">
+                                               <legend>
+                                                       <h3>
+                                                               <xsl:if 
test="not(delegate/id)">
+                                                                       
<xsl:value-of select="php:function('lang', 'New delegate')" />
+                                                               </xsl:if>
+                                                               <xsl:if 
test="delegate/id">
+                                                                       
<xsl:value-of select="php:function('lang', 'Edit delegate')" />
+                                                               </xsl:if>
+                                                       </h3>
+                                               </legend>
+                                       </div>
+                                       <div class="pure-control-group">
+                                               <label for="name">
+                                                       <xsl:value-of 
select="php:function('lang', 'name')" />
+                                               </label>
+                                               <input id="name" name="name" 
type="text" value="{delegate/name}" >
+                                                       <xsl:attribute 
name="data-validation">
+                                                               
<xsl:text>required</xsl:text>
+                                                       </xsl:attribute>
+                                                       <xsl:attribute 
name="data-validation-error-msg">
+                                                               <xsl:value-of 
select="php:function('lang', 'Please enter a name')" />
+                                                       </xsl:attribute>
+                                               </input>
+                                       </div>
+                                       <div class="pure-control-group">
+                                               <label for="field_ssn">
+                                                       <xsl:value-of 
select="php:function('lang', 'ssn')" />
+                                               </label>
+                                               <input type='text' 
id='field_ssn' name="ssn" value='{delegate/ssn}'/>
+                                       </div>
+                                       <div class="pure-control-group">
+                                               <label for="field_email">
+                                                       <xsl:value-of 
select="php:function('lang', 'Email')" />
+                                               </label>
+                                               <input type='text' 
id='field_email' name="email" value='{delegate/email}' data-validation="email">
+                                                       <xsl:attribute 
name="data-validation-optional">
+                                                               
<xsl:text>true</xsl:text>
+                                                       </xsl:attribute>
+                                                       <xsl:attribute 
name="data-validation-error-msg">
+                                                               <xsl:value-of 
select="php:function('lang', 'Please enter a valid contact email')" />
+                                                       </xsl:attribute>
+                                               </input>
+                                       </div>
+                                       <div class="pure-control-group">
+                                               <label for="field_phone">
+                                                       <xsl:value-of 
select="php:function('lang', 'Phone')" />
+                                               </label>
+                                               <input type='text' 
id='field_phone' name="phone" value='{delegate/phone}'/>
+                                       </div>
+       
+                                       <div class="pure-control-group">
+                                               <label 
for="field_organization_name">
+                                                       <xsl:value-of 
select="php:function('lang', 'Organization')" />
+                                               </label>
+                                               <input 
id="field_organization_id" name="organization_id" type="hidden" 
value="{delegate/organization_id}"/>
+                                               <input name="organization_name" 
type="text" id="field_organization_name" value="{delegate/organization_name}">
+                                                       <xsl:if 
test="delegate/organization_id">
+                                                               <xsl:attribute 
name='disabled'>disabled</xsl:attribute>
+                                                       </xsl:if>
+                                                       <xsl:attribute 
name="data-validation">
+                                                               
<xsl:text>required</xsl:text>
+                                                       </xsl:attribute>
+                                                       <xsl:attribute 
name="data-validation-error-msg">
+                                                               <xsl:value-of 
select="php:function('lang', 'Please enter an organization name')" />
+                                                       </xsl:attribute>
+                                               </input>
+                                               <div 
id="organization_container"></div>
+                                       </div>
+               
+
+                                       <div class="pure-control-group">
+                                               <xsl:if test="delegate/id">
+                                                       <label 
for="field_active">
+                                                               <xsl:value-of 
select="php:function('lang', 'Active')"/>
+                                                       </label>
+                                                       <select 
id="field_active" name="active">
+                                                               <option 
value="1">
+                                                                       <xsl:if 
test="delegate/active=1">
+                                                                               
<xsl:attribute name="selected">checked</xsl:attribute>
+                                                                       
</xsl:if>
+                                                                       
<xsl:value-of select="php:function('lang', 'Active')"/>
+                                                               </option>
+                                                               <option 
value="0">
+                                                                       <xsl:if 
test="delegate/active=0">
+                                                                               
<xsl:attribute name="selected">checked</xsl:attribute>
+                                                                       
</xsl:if>
+                                                                       
<xsl:value-of select="php:function('lang', 'Inactive')"/>
+                                                               </option>
+                                                       </select>
+                                               </xsl:if>
+                                       </div>
+
+                               </fieldset>
+                       </div>
+               </div>
+               <div class="form-buttons">
+                       <xsl:if test="not(delegate/id)">
+                               <input type="submit" 
value="{php:function('lang', 'Add')}" class="button pure-button 
pure-button-primary" />
+                       </xsl:if>
+                       <xsl:if test="delegate/id">
+                               <input type="submit" 
value="{php:function('lang', 'Save')}" class="button pure-button 
pure-button-primary"/>
+                       </xsl:if>
+                       <a class="cancel pure-button pure-button-primary" 
href="{delegate/cancel_link}">
+                               <xsl:value-of select="php:function('lang', 
'Cancel')" />
+                       </a>
+               </div>
+       </form>
+       <script type="text/javascript">
+               var endpoint = '<xsl:value-of select="module" />';
+        <![CDATA[
+            $(document).ready(function() {
+                JqueryPortico.autocompleteHelper('index.php?menuaction=' + 
endpoint + '.uiorganization.index&phpgw_return_as=json&',
+                                                 'field_organization_name', 
'field_organization_id', 'organization_container');
+            });
+        ]]>
+       </script>
+</xsl:template>

Index: branches/Version-2_0-branch/bookingfrontend
===================================================================
--- branches/Version-2_0-branch/bookingfrontend 2017-10-16 18:25:35 UTC (rev 
17157)
+++ branches/Version-2_0-branch/bookingfrontend 2017-10-17 12:07:58 UTC (rev 
17158)

Property changes on: branches/Version-2_0-branch/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
## -1,3 +1,3 ##
 /branches/dev-syncromind-2/bookingfrontend:14933-16846
 /branches/stavangerkommune/bookingfrontend:9468-12740,12986
-/trunk/bookingfrontend:14721-14732,14770-14783,14794-14808,14824-14825,14838,14886-14894,14906-14909,14917-14919,14924-14978,14980-15258,15297,15312-15335,15585-15617,15621-15630,15714-15764,15813-15814,15820-15849,15889-15900,15902-16046,16101-16130,16144-16212,16297-16305,16307-16314,16316-16318,16385,16387,16393-16395,16399-16402,16586-16588,16603-16608,16734-16739,16752-16755,16785-16788,16796-16802,16835-16836,16846-16847,16908-16909,16946,16948,16988-16999,17126-17132,17134-17143
\ No newline at end of property
+/trunk/bookingfrontend:14721-14732,14770-14783,14794-14808,14824-14825,14838,14886-14894,14906-14909,14917-14919,14924-14978,14980-15258,15297,15312-15335,15585-15617,15621-15630,15714-15764,15813-15814,15820-15849,15889-15900,15902-16046,16101-16130,16144-16212,16297-16305,16307-16314,16316-16318,16385,16387,16393-16395,16399-16402,16586-16588,16603-16608,16734-16739,16752-16755,16785-16788,16796-16802,16835-16836,16846-16847,16908-16909,16946,16948,16988-16999,17126-17132,17134-17143,17152-17157
\ No newline at end of property
Modified: branches/Version-2_0-branch/bookingfrontend/inc/class.bouser.inc.php
===================================================================
--- branches/Version-2_0-branch/bookingfrontend/inc/class.bouser.inc.php        
2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/bookingfrontend/inc/class.bouser.inc.php        
2017-10-17 12:07:58 UTC (rev 17158)
@@ -22,6 +22,7 @@
 
                public function __construct()
                {
+                       $this->db = & $GLOBALS['phpgw']->db;
                        $this->set_module();
                        $this->orgnr = $this->get_user_orgnr_from_session();
                        $this->orgname = 
$this->get_orgname_from_db($this->get_user_orgnr_from_session());
@@ -31,7 +32,6 @@
 
                protected function get_orgname_from_db( $orgnr )
                {
-                       $this->db = & $GLOBALS['phpgw']->db;
                        $this->db->limit_query("select name from 
bb_organization where organization_number ='" . $orgnr . "'", 0, __LINE__, 
__FILE__, 1);
                        if (!$this->db->next_record())
                        {

Copied: 
branches/Version-2_0-branch/bookingfrontend/inc/class.uidelegate.inc.php (from 
rev 17157, trunk/bookingfrontend/inc/class.uidelegate.inc.php)
===================================================================
--- branches/Version-2_0-branch/bookingfrontend/inc/class.uidelegate.inc.php    
                        (rev 0)
+++ branches/Version-2_0-branch/bookingfrontend/inc/class.uidelegate.inc.php    
2017-10-17 12:07:58 UTC (rev 17158)
@@ -0,0 +1,48 @@
+<?php
+       phpgw::import_class('booking.uidelegate');
+
+       class bookingfrontend_uidelegate extends booking_uidelegate
+       {
+
+               public $public_functions = array
+                       (
+                       'index' => true,
+                       'edit' => true,
+                       'show' => true,
+                       'toggle_show_inactive' => true,
+               );
+               protected $module;
+
+               public function __construct()
+               {
+                       parent::__construct();
+                       $this->module = "bookingfrontend";
+               }
+
+               public function show()
+               {
+                       $delegate = $this->bo->read_single(phpgw::get_var('id', 
'int'));
+                       $delegate['organizations_link'] = 
self::link(array('menuaction' => $this->module . '.uiorganization.index'));
+                       $delegate['organization_link'] = 
self::link(array('menuaction' => $this->module . '.uiorganization.show',
+                                       'id' => $delegate['organization_id']));
+                       $delegate['edit_link'] = self::link(array('menuaction' 
=> $this->module . '.uidelegate.edit',
+                                       'id' => $delegate['id']));
+
+                       $data = array(
+                               'delegate' => $delegate
+                       );
+
+                       $edit_self_link = self::link(array('menuaction' => 
'bookingfrontend.uidelegate.edit',
+                                       'id' => $delegate['id']));
+
+                       $bouser = CreateObject('bookingfrontend.bouser');
+                       $auth_forward = 
"?redirect_menuaction={$this->module}.uidelegate.show&redirect_id={$delegate['id']}";
+                       $delegate['login_link'] = 'login.php' . $auth_forward;
+                       $delegate['logoff_link'] = 'logoff.php' . $auth_forward;
+                       if ($bouser->is_organization_admin())
+                               $delegate['logged_on'] = true;
+
+                       self::render_template_xsl('delegate', array('delegate' 
=> $delegate, 'loggedin' => $loggedin,
+                               'edit_self_link' => $edit_self_link));
+               }
+       }
\ No newline at end of file

Modified: 
branches/Version-2_0-branch/bookingfrontend/inc/class.uiorganization.inc.php
===================================================================
--- 
branches/Version-2_0-branch/bookingfrontend/inc/class.uiorganization.inc.php    
    2017-10-16 18:25:35 UTC (rev 17157)
+++ 
branches/Version-2_0-branch/bookingfrontend/inc/class.uiorganization.inc.php    
    2017-10-17 12:07:58 UTC (rev 17158)
@@ -68,6 +68,8 @@
                        $organization['logoff_link'] = 'logoff.php' . 
$auth_forward;
                        $organization['new_group_link'] = 
self::link(array('menuaction' => $this->module . '.uigroup.edit',
                                        'organization_id' => 
$organization['id']));
+                       $organization['new_delegate_link'] = 
self::link(array('menuaction' => $this->module . '.uidelegate.edit',
+                                       'organization_id' => 
$organization['id']));
                        if ($bouser->is_organization_admin($organization['id']))
                                $organization['logged_on'] = true;
 

Modified: 
branches/Version-2_0-branch/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
===================================================================
--- 
branches/Version-2_0-branch/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
   2017-10-16 18:25:35 UTC (rev 17157)
+++ 
branches/Version-2_0-branch/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
   2017-10-17 12:07:58 UTC (rev 17158)
@@ -129,9 +129,36 @@
                                        'name' => 'Bølleball',
                                );
                                $orgs_validate[] = 994239929;
-                               $fodsels_nr = 1;
+                               if(!$fodsels_nr)
+                               {
+                                       $fodsels_nr = 1;
+                               }
                        }
 
+                       $hash = sha1($fodsels_nr);
+                       $ssn =  '{SHA1}' . base64_encode($hash);
+
+                       $this->db->query("SELECT 
bb_organization.organization_number, bb_organization.name AS organization_name"
+                               . " FROM bb_delegate"
+                               . " JOIN  bb_organization ON 
bb_delegate.organization_id = bb_organization.id"
+                               . " WHERE bb_delegate.ssn = '{$ssn}'", 
__LINE__, __FILE__);
+
+                       while($this->db->next_record())
+                       {
+                               $organization_number = 
$this->db->f('organization_number');
+                               if(in_array($organization_number, 
$orgs_validate))
+                               {
+                                       continue;
+                               }
+
+                               $orgs[] = array(
+                                       'id' => $organization_number,
+                                       'name' => 
$this->db->f('organization_name', true),
+                               );
+                               $orgs_validate[] = $organization_number;
+
+                       }
+
                        if ($stage == 2 && $fodsels_nr && in_array($org_id, 
$orgs_validate))
                        {
                                try

Modified: 
branches/Version-2_0-branch/bookingfrontend/inc/custom/default/MinId.php
===================================================================
--- branches/Version-2_0-branch/bookingfrontend/inc/custom/default/MinId.php    
2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/bookingfrontend/inc/custom/default/MinId.php    
2017-10-17 12:07:58 UTC (rev 17158)
@@ -126,16 +126,44 @@
                        }
 
                        $sql = "SELECT DISTINCT orgnr FROM breg.personcurrent 
WHERE fodselsnr ='{$fodselsnr}'";
+
+                       $orgs_validate = array();
                        $results = array();
                        $db->query($sql, __LINE__, __FILE__);
                        while ($db->next_record())
                        {
+                               $organization_number = $db->f('orgnr', true);
                                $results[] = array
                                (
-                                       'orgnr' => $db->f('orgnr', true)
+                                       'orgnr' => $organization_number
                                );
+                               $orgs_validate[] = $organization_number;
                        }
 
+                       $hash = sha1($fodselsnr);
+                       $ssn =  '{SHA1}' . base64_encode($hash);
+
+                       $this->db->query("SELECT 
bb_organization.organization_number, bb_organization.name AS organization_name"
+                               . " FROM bb_delegate"
+                               . " JOIN  bb_organization ON 
bb_delegate.organization_id = bb_organization.id"
+                               . " WHERE bb_delegate.ssn = '{$ssn}'", 
__LINE__, __FILE__);
+
+                       while($this->db->next_record())
+                       {
+                               $organization_number = 
$this->db->f('organization_number');
+                               if(in_array($organization_number, 
$orgs_validate))
+                               {
+                                       continue;
+                               }
+                               $results[] = array
+                               (
+                                       'orgnr' => $organization_number
+                               );
+
+                               $orgs_validate[] = $organization_number;
+
+                       }
+
                //Testvalues
                /*
                        $results[] = array

Copied: branches/Version-2_0-branch/bookingfrontend/templates/base/delegate.xsl 
(from rev 17157, trunk/bookingfrontend/templates/base/delegate.xsl)
===================================================================
--- branches/Version-2_0-branch/bookingfrontend/templates/base/delegate.xsl     
                        (rev 0)
+++ branches/Version-2_0-branch/bookingfrontend/templates/base/delegate.xsl     
2017-10-17 12:07:58 UTC (rev 17158)
@@ -0,0 +1,58 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+       
+       <div class="content">
+               <ul class="pathway">
+                       <li>
+                               <a 
href="index.php?menuaction=bookingfrontend.uisearch.index">
+                                       <xsl:value-of 
select="php:function('lang', 'Home')" />
+                               </a>
+                       </li>
+                       <li>
+                               <a href="{delegate/organization_link}">
+                                       <xsl:value-of 
select="delegate/organization_name"/>
+                               </a>
+                       </li>
+                       <li>
+                               <xsl:value-of select="delegate/name"/>
+                       </li>
+               </ul>
+
+               <xsl:if test="delegate/permission/write">
+                       <span class="loggedin">
+                               <button 
onclick="window.location.href='{edit_self_link}'">
+                                       <xsl:value-of 
select="php:function('lang', 'edit')" />
+                               </button>
+                       </span>
+               </xsl:if>
+               <xsl:call-template name="msgbox"/>
+
+               <dl class="proplist">
+                       <dt>
+                               <xsl:value-of select="php:function('lang', 
'name')" />
+                       </dt>
+                       <dd>
+                               <xsl:value-of select="delegate/name"/>
+                       </dd>
+
+                       <dt>
+                               <xsl:value-of select="php:function('lang', 
'Organization')" />
+                       </dt>
+                       <dd>
+                               <xsl:value-of 
select="delegate/organization_name"/>
+                       </dd>
+                       <dt>
+                               <xsl:value-of select="php:function('lang', 
'email')" />
+                       </dt>
+                       <dd>
+                               <xsl:value-of select="delegate/email"/>
+                       </dd>
+                       <dt>
+                               <xsl:value-of select="php:function('lang', 
'phone')" />
+                       </dt>
+                       <dd>
+                               <xsl:value-of select="delegate/phone"/>
+                       </dd>
+
+               </dl>
+       </div>
+</xsl:template>

Copied: 
branches/Version-2_0-branch/bookingfrontend/templates/base/delegate_edit.xsl 
(from rev 17157, trunk/bookingfrontend/templates/base/delegate_edit.xsl)
===================================================================
--- 
branches/Version-2_0-branch/bookingfrontend/templates/base/delegate_edit.xsl    
                            (rev 0)
+++ 
branches/Version-2_0-branch/bookingfrontend/templates/base/delegate_edit.xsl    
    2017-10-17 12:07:58 UTC (rev 17158)
@@ -0,0 +1,165 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+       <div class="content">
+        
+               <div class="pure-g">
+                       <div class="pure-u-1">
+                               <dl class="form-col">
+                                       <dt class="heading">
+                                               <xsl:if test="not(delegate/id)">
+                                                       <xsl:value-of 
select="php:function('lang', 'New delegate')" />
+                                               </xsl:if>
+                                               <xsl:if test="delegate/id">
+                                                       <xsl:value-of 
select="php:function('lang', 'Edit delegate')" />
+                                               </xsl:if>
+                                       </dt>
+                               </dl>
+                       </div>
+               </div>
+
+               <dl class="form">
+                
+               </dl>
+
+               <xsl:call-template name="msgbox"/>
+
+               <form action="" method="POST" id="form" name="form">
+                       <div class="pure-g">
+                               <div class="pure-u-1 pure-u-md-1-3">
+                                       <dl class="form-col">
+                                               <dt>
+                                                       <label for="field_name">
+                                                               <xsl:value-of 
select="php:function('lang', 'name')" />
+                                                       </label>
+                                               </dt>
+                                               <dd>
+                                                       <input name="name" 
type="text" value="{delegate/name}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                                       
<xsl:value-of select="php:function('lang', 'Please enter a delegate')" />
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </dd>
+                                               <dt>
+                                                       <label for="field_ssn">
+                                                               <xsl:value-of 
select="php:function('lang', 'ssn')" />
+                                                       </label>
+                                               </dt>
+                                               <dd>
+                                                       <input name="ssn" 
type="text" value="{delegate/ssn}">
+                                                               
<!--xsl:attribute name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               
</xsl:attribute-->
+                                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                                       
<xsl:value-of select="php:function('lang', 'Please enter a ssn')" />
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </dd>
+                                               <dt>
+                                                       <label 
for="field_email">
+                                                               <xsl:value-of 
select="php:function('lang', 'Email')" />
+                                                       </label>
+                                               </dt>
+                                               <dd>
+                                                       <input name="email" 
type="text" value="{delegate/email}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                                       
<xsl:value-of select="php:function('lang', 'Please enter an email')" />
+                                                               </xsl:attribute>
+                                                       </input>
+                                               </dd>
+                                               <dt>
+                                                       <label 
for="field_phone">
+                                                               <xsl:value-of 
select="php:function('lang', 'Phone')" />
+                                                       </label>
+                                               </dt>
+                                               <dd>
+                                                       <input type='text' 
id='field_phone' name="phone" value='{delegate/phone}'/>
+                                               </dd>
+                                               <dt>
+                                                       <label 
for="field_organization">
+                                                               <xsl:value-of 
select="php:function('lang', 'Organization')" />
+                                                       </label>
+                                               </dt>
+                                               <dd>
+                                                       <div 
class="autocomplete">
+                                                               <input 
id="field_organization_id" name="organization_id" type="hidden" 
value="{delegate/organization_id}">
+                                                                       
<xsl:attribute name="data-validation">
+                                                                               
<xsl:text>required</xsl:text>
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="php:function('lang', 'Please enter an organization')" />
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                               <input 
name="organization_name" type="text" id="field_organization_name" 
value="{delegate/organization_name}">
+                                                                       
<xsl:attribute name="data-validation">
+                                                                               
<xsl:text>required</xsl:text>
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="php:function('lang', 'Please enter an organization')" />
+                                                                       
</xsl:attribute>
+                                                                       <xsl:if 
test="delegate/organization_id">
+                                                                               
<xsl:attribute name='disabled'>disabled</xsl:attribute>
+                                                                       
</xsl:if>
+                                                               </input>
+                                                               <div 
id="organization_container"/>
+                                                       </div>
+                                               </dd>
+                                               
+                                       </dl>
+                               </div>
+                               <div class="pure-u-1 pure-u-md-1-3">
+                                       <dl class="form-col">
+                                               <xsl:if test="delegate/id">
+                                                       <dt>
+                                                               <label 
for="field_active">
+                                                                       
<xsl:value-of select="php:function('lang', 'Active')"/>
+                                                               </label>
+                                                       </dt>
+                                                       <dd>
+                                                               <select 
id="field_active" name="active">
+                                                                       <option 
value="1">
+                                                                               
<xsl:if test="delegate/active=1">
+                                                                               
        <xsl:attribute name="selected">checked</xsl:attribute>
+                                                                               
</xsl:if>
+                                                                               
<xsl:value-of select="php:function('lang', 'Active')"/>
+                                                                       
</option>
+                                                                       <option 
value="0">
+                                                                               
<xsl:if test="delegate/active=0">
+                                                                               
        <xsl:attribute name="selected">checked</xsl:attribute>
+                                                                               
</xsl:if>
+                                                                               
<xsl:value-of select="php:function('lang', 'Inactive')"/>
+                                                                       
</option>
+                                                               </select>
+                                                       </dd>
+                                               </xsl:if>
+                                       </dl>
+                               </div>
+                       </div>
+                        
+                       <div class="form-buttons">
+                               <xsl:if test="not(delegate/id)">
+                                       <input type="submit" 
value="{php:function('lang', 'Add')}"/>
+                               </xsl:if>
+                               <xsl:if test="delegate/id">
+                                       <input type="submit" 
value="{php:function('lang', 'Save')}"/>
+                               </xsl:if>
+                               <a class="cancel" href="{delegate/cancel_link}">
+                                       <xsl:value-of 
select="php:function('lang', 'Cancel')" />
+                               </a>
+                       </div>
+               </form>
+       </div>
+       <script type="text/javascript">
+               var endpoint = '<xsl:value-of select="module" />';
+        <![CDATA[
+            $(document).ready(function(){
+                JqueryPortico.autocompleteHelper(phpGWLink('bookingfrontend/', 
{menuaction: endpoint+'.uiorganization.index', phpgw_return_as: 'json'} ), 
'field_organization_name', 'field_organization_id', 'organization_container');
+                
//JqueryPortico.autocompleteHelper('index.php?menuaction='+endpoint+'.uiorganization.index&phpgw_return_as=json&','field_organization_name',
 'field_organization_id','organization_container');
+            });
+        ]]>
+       </script>
+</xsl:template>

Modified: 
branches/Version-2_0-branch/bookingfrontend/templates/base/organization.xsl
===================================================================
--- branches/Version-2_0-branch/bookingfrontend/templates/base/organization.xsl 
2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/bookingfrontend/templates/base/organization.xsl 
2017-10-17 12:07:58 UTC (rev 17158)
@@ -99,6 +99,15 @@
                </a>
 
                <h3>
+                       <xsl:value-of select="php:function('lang', 
'delegates')" />
+               </h3>
+               <div id="delegates_container"/>
+
+               <a href="{organization/new_delegate_link}">
+                       <xsl:value-of select="php:function('lang', 'new 
delegate')" />
+               </a>
+
+               <h3>
                        <xsl:value-of select="php:function('lang', 'Used 
buildings')" />
                </h3>
                <div id="buildings_used_by_container"/>
@@ -106,10 +115,11 @@
 
        <script type="text/javascript">
                var organization_id = <xsl:value-of select="organization/id"/>;
-               var lang = <xsl:value-of select="php:function('js_lang', 
'Name', 'Activity', 'Contact 1', 'Contact 2')"/>;
+               var lang = <xsl:value-of select="php:function('js_lang', 
'Name', 'Activity', 'Contact 1', 'Contact 2', 'email','phone', 'active')"/>;
        
                <![CDATA[
                 var groupURL = 
'index.php?menuaction=bookingfrontend.uigroup.index&sort=name&filter_organization_id='
 + organization_id + '&phpgw_return_as=json&';
+                var delegateURL = 
'index.php?menuaction=bookingfrontend.uidelegate.index&sort=name&filter_organization_id='
 + organization_id + '&phpgw_return_as=json&filter_active=-1&';
                 var buildingURL = 
'index.php?menuaction=bookingfrontend.uibuilding.find_buildings_used_by&sort=name&organization_id='
 + organization_id + '&phpgw_return_as=json&';
                 ]]>
                 
@@ -122,9 +132,18 @@
                {key: 'primary_contact_name', label: lang['Contact 1']},
                {key: 'secondary_contact_name', label: lang['Contact 2']}
                ];
+
+               var colDefsDelegate = [
+               {key: 'name', label: lang['Name'], formatter: genericLink},
+               {key: 'email', label: lang['email']},
+               {key: 'phone', label: lang['phone']},
+               {key: 'active', label: lang['active']}
+               ];
+
                var colDefsBuilding = [{key: 'name', label: lang['Name'], 
formatter: genericLink}];
                 
                createTable('groups_container', groupURL, colDefsGroup);
+               createTable('delegates_container', delegateURL, 
colDefsDelegate);
                createTable('buildings_used_by_container', buildingURL, 
colDefsBuilding, rBuilding);
                        
        </script>

Modified: 
branches/Version-2_0-branch/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.uicontrol_group.inc.php    
2017-10-16 18:25:35 UTC (rev 17157)
+++ branches/Version-2_0-branch/controller/inc/class.uicontrol_group.inc.php    
2017-10-17 12:07:58 UTC (rev 17158)
@@ -193,7 +193,20 @@
                {
                        $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uicontrol_group.edit'));
                }
+               
+               /*
+                * Method for deleting control groups
+                */
+               public function delete_group_list()
+               {
+                       $control_id = phpgw::get_var('control_id');
+                       $control_group_id = phpgw::get_var('control_group_id');
 
+                       $status = false; 
//$this->so_control_item_list->delete($control_id, $control_item_id);
+
+                       return status;
+               }
+
                public function edit()
                {
        //              
phpgwapi_jquery::formvalidator_generate(array('location','date', 'security', 
'file'));




reply via email to

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