[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [17136] template for getting OrganizationNumber
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [17136] template for getting OrganizationNumber |
Date: |
Wed, 4 Oct 2017 09:19:36 -0400 (EDT) |
Revision: 17136
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17136
Author: sigurdne
Date: 2017-10-04 09:19:36 -0400 (Wed, 04 Oct 2017)
Log Message:
-----------
template for getting OrganizationNumber
Added Paths:
-----------
trunk/bookingfrontend/inc/custom/default/MinId2.php
Added: trunk/bookingfrontend/inc/custom/default/MinId2.php
===================================================================
--- trunk/bookingfrontend/inc/custom/default/MinId2.php
(rev 0)
+++ trunk/bookingfrontend/inc/custom/default/MinId2.php 2017-10-04 13:19:36 UTC
(rev 17136)
@@ -0,0 +1,122 @@
+<?php
+ /**
+ * phpGroupWare
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2010 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package phpgroupware
+ * @subpackage communication
+ * @category core
+ * @version $Id: Altinn_Bergen_kommune.php 4887 2010-02-23 10:33:44Z
sigurd $
+ */
+ /*
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ /**
+ * Wrapper for custom methods
+ *
+ * @package phpgroupware
+ * @subpackage bookingfrontend
+ */
+
+ /**
+ * START WRAPPER
+ */
+ class bookingfrontend_external_user extends bookingfrontend_bouser
+ {
+
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
+ protected function get_user_org_id()
+ {
+ $ipdp = sha1($_SERVER['HTTP_UID']);
+ $bregorgs = $this->get_breg_orgs($ipdp);
+ $myorgnr = array();
+ if ($bregorgs == array())
+ {
+ $external_user = (object)'ciao';
+ $external_user->login = '000000000';
+ }
+ else
+ {
+ foreach ($bregorgs as $org)
+ {
+ $myorgnr[] = $org['orgnr'];
+ }
+ if (count($myorgnr) > 1)
+ {
+ $external_user = (object)'ciao';
+ $external_user->login = $myorgnr[0];
+ $orgs = array();
+ foreach ($myorgnr as $org)
+ {
+ $orgs[] = array('orgnumber' =>
$org, 'orgname' => $this->get_orgname_from_db($org));
+ }
+
phpgwapi_cache::session_set($this->get_module(), self::ORGARRAY_SESSION_KEY,
$orgs);
+ }
+ elseif (count($myorgnr) > 0)
+ {
+
phpgwapi_cache::session_set($this->get_module(), self::ORGARRAY_SESSION_KEY,
NULL);
+ $external_user = (object)'ciao';
+ $external_user->login = $myorgnr[0];
+ }
+ }
+
+
+ if ($this->debug)
+ {
+ echo 'External user:<br>';
+ _debug_array($external_user);
+ }
+ try
+ {
+ return
createObject('booking.sfValidatorNorwegianOrganizationNumber')->clean($external_user->login);
+ }
+ catch (sfValidatorError $e)
+ {
+ if ($this->debug)
+ {
+ echo $e->getMessage();
+ die();
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Henter organisasjonsnummer som personen har en rolle i
+ * @param type $fodselsnr
+ * @return array $results organisasjonsnr
+ */
+ private function get_breg_orgs( $fodselsnr )
+ {
+ $results = array();
+
+ if ($this->debug)
+ {
+ $results[] = array
+ (
+ 'orgnr' => 964965226
+ );
+ }
+
+ return $results;
+ }
+ }
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [17136] template for getting OrganizationNumber,
sigurdne <=