fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10016] Initial add of logistic module


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [10016] Initial add of logistic module
Date: Fri, 21 Sep 2012 08:40:30 +0000

Revision: 10016
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10016
Author:   erikhl
Date:     2012-09-21 08:40:27 +0000 (Fri, 21 Sep 2012)
Log Message:
-----------
Initial add of logistic module

Added Paths:
-----------
    trunk/logistic/
    trunk/logistic/inc/
    trunk/logistic/inc/class.menu.inc.php
    trunk/logistic/inc/model/
    trunk/logistic/inc/model/class.model.inc.php
    trunk/logistic/inc/model/class.project.inc.php
    trunk/logistic/index.php
    trunk/logistic/js/
    trunk/logistic/setup/
    trunk/logistic/setup/default_records.inc.php
    trunk/logistic/setup/phpgw_no.lang
    trunk/logistic/setup/setup.inc.php
    trunk/logistic/setup/tables_current.inc.php
    trunk/logistic/sonar-project.properties
    trunk/logistic/templates/
    trunk/logistic/templates/base/

Added: trunk/logistic/inc/class.menu.inc.php
===================================================================
--- trunk/logistic/inc/class.menu.inc.php                               (rev 0)
+++ trunk/logistic/inc/class.menu.inc.php       2012-09-21 08:40:27 UTC (rev 
10016)
@@ -0,0 +1,86 @@
+<?php
+       /**
+       * phpGroupWare - logistic: a part of a Facilities Management System.
+       *
+       * @author Erik Holm-Larsen <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage logistic
+       * @version $Id$
+       */
+
+       class logistic_menu
+       {
+               function get_menu()
+               {
+                       $incoming_app = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
'logistic';
+                       $menus = array();
+
+                       $menus['navbar'] = array
+                       (
+                               'logistic' => array
+                               (
+                                       'text'  => lang('logistic'),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'logistic.uiproject.index') ),
+          'image'      => array('property', 'location'),
+                                       'order' => 10,
+                                       'group' => 'office'
+                               )
+                       );
+
+                       $menus['navigation'] =  array
+                       (
+                               'project' => array
+                               (
+                                       'text'  => lang('project'),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'logistic.uiproject.index') ),
+          'image'      => array('property', 'location_tenant'),
+                                       'children'      => array(
+                                                       'activity' => array
+                                                               (
+                                                                               
'text'  => lang('activity'),
+                                                                               
'url'   => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'logistic.uiactivity.index') ),
+                                                                               
'image' => array('property', 'location_tenant')
+                                                               ),
+                                                               'requirement' 
=> array
+                                                               (
+                                                                               
'text'  => lang('requirement'),
+                                                                               
'url'   => $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'logistic.uirequirement.index') ),
+                                                                               
'image' => array('property', 'location_tenant'),
+                                                               ),
+                                                               'booking' => 
array
+                                                               (
+                                                                               
'text'  => lang('booking'),
+                                                                               
'url'   => $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'logistic.uibooking.index') ),
+                                                                               
'image' => array('property', 'location_tenant'),
+                                                               ),
+                                               )
+                               )     
+                       );
+                       
+                       $menus['folders'] = 
phpgwapi_menu::get_categories('bergen');
+
+                       $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$incoming_app;
+
+                       return $menus;
+               }
+       }
\ No newline at end of file

Added: trunk/logistic/inc/model/class.model.inc.php
===================================================================
--- trunk/logistic/inc/model/class.model.inc.php                                
(rev 0)
+++ trunk/logistic/inc/model/class.model.inc.php        2012-09-21 08:40:27 UTC 
(rev 10016)
@@ -0,0 +1,121 @@
+<?php
+       /**
+       * phpGroupWare - logistic: a part of a Facilities Management System.
+       *
+       * @author Erik Holm-Larsen <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage logistic
+       * @version $Id$
+       */
+
+       abstract class logistic_model
+       {
+               protected $validation_errors = array();
+               protected $validation_warnings = array();
+
+               protected $consistency_warnings = array();
+
+               protected $field_of_responsibility_id;
+               protected $field_of_responsibility_name;
+               protected $permission_array;
+
+               public function __construct(int $id)
+               {
+                       $this->id = (int)$id;
+               }
+
+               public function get_id()
+               {
+                       return $this->id;
+               }
+
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+
+               /**
+                * Gets the value of the class attribute with the given name.  
As such this function translates from
+                * string to variable.
+                *
+                * @param $field the name of the class attribute to get
+                * @return mixed the value of the attribute
+                */
+               public function get_field($field)
+               {
+                       return $this->{"$field"};
+               }
+
+               /**
+                * Sets the value of the class attribute with the given name.  
As such this function translates from
+                * string to variable name.
+                *
+                * @param $field the name of the class attribute to set
+                * @param $value the value to set
+                */
+               public function set_field($field, $value)
+               {
+                       $this->{"$field"} = $value;
+               }
+
+               /**
+                * Validate the object according to the database setup and 
custom rules.  This function
+                * can be overridden in subclasses.  It is then up to the 
subclasses to call this parent method
+                * in order to validate against the standard database rules.  
The subclasses can in addition
+                * add their own specific validation logic.
+                *
+                * @return boolean true if the object is valid, false otherwise
+                */
+               public function validates()
+               {
+                       return true;
+               }
+
+               public function toArray()
+               {
+
+       // Alternative 1
+       //                      return get_object_vars($this);
+
+       // Alternative 2
+                               $exclude = array
+                               (
+                                       'get_field', // feiler (foreldreklassen)
+                                       'get_so',//unødvendig 
+                               );
+
+                               $class_methods = get_class_methods($this);
+                               $control_item_arr = array();
+                               foreach ($class_methods as $class_method)
+                               {
+                                       if( stripos($class_method , 'get_' ) 
=== 0  && !in_array($class_method, $exclude))
+                                       {
+                                               $_class_method_part = 
explode('get_', $class_method);
+                                               
$control_item_arr[$_class_method_part[1]] = $this->$class_method();
+                                       }
+                               }
+
+       //                      _debug_array($control_item_arr);
+                               return $control_item_arr;
+                       }
+
+       }

Added: trunk/logistic/inc/model/class.project.inc.php
===================================================================
--- trunk/logistic/inc/model/class.project.inc.php                              
(rev 0)
+++ trunk/logistic/inc/model/class.project.inc.php      2012-09-21 08:40:27 UTC 
(rev 10016)
@@ -0,0 +1,32 @@
+<?php
+       /**
+       * phpGroupWare - logistic: a part of a Facilities Management System.
+       *
+       * @author Erik Holm-Larsen <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage logistic
+       * @version $Id$
+       */
+
+ include_class('logistic', 'model' , 'inc/model')
+
+?>

Added: trunk/logistic/index.php
===================================================================
--- trunk/logistic/index.php                            (rev 0)
+++ trunk/logistic/index.php    2012-09-21 08:40:27 UTC (rev 10016)
@@ -0,0 +1,25 @@
+<?php
+       DEFINE('APP_NAME', 'logistic');
+
+       $GLOBALS['phpgw_info']['flags'] = array
+       (
+               'noheader'      => true,
+               'nonavbar'      => true,
+               'currentapp'    => APP_NAME,
+               'enable_vfs_class' => True,
+       );
+
+       include('../header.inc.php');
+
+       // Start page is set
+       
if(isset($GLOBALS['phpgw_info']['user']['preferences'][APP_NAME]['default_start_page']))
+       {
+               $start_page = array('menuaction'=> 
APP_NAME.'.ui'.$GLOBALS['phpgw_info']['user']['preferences'][APP_NAME]['default_start_page'].'.index');
+       }
+       else
+       {
+               $start_page = array('menuaction'=> 
APP_NAME.'.uifrontpage.index');
+       }
+       $GLOBALS['phpgw']->redirect_link('/index.php',$start_page);
+       
+?>

Added: trunk/logistic/setup/default_records.inc.php
===================================================================
--- trunk/logistic/setup/default_records.inc.php                                
(rev 0)
+++ trunk/logistic/setup/default_records.inc.php        2012-09-21 08:40:27 UTC 
(rev 10016)
@@ -0,0 +1,7 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+?>

Added: trunk/logistic/setup/phpgw_no.lang
===================================================================
--- trunk/logistic/setup/phpgw_no.lang                          (rev 0)
+++ trunk/logistic/setup/phpgw_no.lang  2012-09-21 08:40:27 UTC (rev 10016)
@@ -0,0 +1,6 @@
+logistic       common  no      Logistikk
+Logistic       common  no      Logistikk
+project        logistic        no      Prosjekt
+activity       logistic        no      Aktivitet
+booking        logistic        no      Booking
+requirement    logistic        no      Behov
\ No newline at end of file

Added: trunk/logistic/setup/setup.inc.php
===================================================================
--- trunk/logistic/setup/setup.inc.php                          (rev 0)
+++ trunk/logistic/setup/setup.inc.php  2012-09-21 08:40:27 UTC (rev 10016)
@@ -0,0 +1,44 @@
+<?php
+       $setup_info['logistic']['name'] = 'logistic';
+       $setup_info['logistic']['version'] = '0.0.1';
+       $setup_info['logistic']['app_order'] = 70;
+       $setup_info['logistic']['enable'] = 1;
+       $setup_info['logistic']['app_group']    = 'office';
+       
+       $setup_info['logistic']['tables'] = array 
+       (
+                       'lg_project',
+                       'lg_project_type',
+                       'lg_activity',
+                       'lg_requirement',
+                       'lg_requirement_resource_type',
+                       'lg_requirement_resource_allocation',
+                       'lg_bim_item_type_requirement',
+                       'lg_requirement_value',
+                       'lg_calendar'
+       );
+
+       $setup_info['logistic']['description'] = 'Bergen kommune logistics 
module';
+
+       $setup_info['logistic']['author'][] = array
+       (
+               'name'  => 'Bouvet ASA',
+               'email' => 'address@hidden'
+       );
+
+       /* Dependencies for this app to work */
+       $setup_info['logistic']['depends'][] = array(
+               'appname' => 'phpgwapi',
+               'versions' => array('0.9.17', '0.9.18','0.9.19')
+       );
+
+       $setup_info['logistic']['depends'][] = array(
+               'appname' => 'property',
+               'versions' => array('0.9.17')
+       );
+
+       /* The hooks this app includes, needed for hooks registration */
+       $setup_info['logistic']['hooks'] = array
+       (
+               'menu'  => 'logistic.menu.get_menu'
+       );

Added: trunk/logistic/setup/tables_current.inc.php
===================================================================
--- trunk/logistic/setup/tables_current.inc.php                         (rev 0)
+++ trunk/logistic/setup/tables_current.inc.php 2012-09-21 08:40:27 UTC (rev 
10016)
@@ -0,0 +1,128 @@
+<?php
+
+$phpgw_baseline = array(
+               'lg_project_type' => array(
+                               'fd' => array(
+                                               'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
+                                               'name' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+               ),
+               'lg_project' => array(
+                               'fd' => array(
+                                               'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
+                                               'name' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false),
+                                               'project_type_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+                                               'description' => array('type' 
=> 'text', 'nullable' => false)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array('lg_project_type' => 
array('project_type_id' => 'id')),
+                               'ix' => array(),
+                               'uc' => array()
+               ),
+               'lg_activity' => array(
+                               'fd' => array(
+                                               'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
+                                               'parent_activity_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => true),
+                                               'name' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false),
+                                               'project_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
+                                               'start_date' => array('type' => 
'int', 'precision' => 4, 'nullable' => true),
+                                               'end_date' => array('type' => 
'int', 'precision' => 4, 'nullable' => true),
+                                               'responsible_user_id' => 
array('type' => 'int', 'precision' => 4, 'nullable'=> false),
+                                               'update_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'update_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(
+                                               'lg_project' => 
array('project_id' => 'id'),
+                                               'lg_activity' => 
array('parent_activity_id' => 'id')
+                               ),
+                               'ix' => array('name'),
+                               'uc' => array()
+               ),
+               'lg_requirement' => array(
+                               'fd' => array(
+                                               'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
+                                               'activity_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'date_from' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
+                                               'date_to' => array('type' => 
'int', 'precision' => 4, 'nullable' => false)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array('lg_activity' => 
array('activity_id' => 'id')),
+                               'ix' => array(),
+                               'uc' => array()
+               ),
+               'lg_requirement_resource_type' => array(
+                               'fd' => array(
+                                               'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
+                                               'requirement_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+                                               'resource_type_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+                                               'no_of_elements' => 
array('type' => 'int', 'precision' => 4, 'nullable' => true)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(
+                                               'lg_requirement' => 
array('requirement_id' => 'id'),
+                                               'fm_bim_type' => 
array('resource_type_id' => 'id')
+                               ),
+                               'ix' => array(),
+                               'uc' => array()
+               ),
+               'lg_requirement_resource_allocation' => array(
+                               'fd' => array(
+                                               'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
+                                               'requirement_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+                                               'article_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
+                                               'type' => array('type' => 
'int', 'precision' => 4, 'nullable' => false)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(
+                                               'lg_requirement' => 
array('requirement_id' => 'id'),
+                                               'fm_bim_item' => 
array('article_id' => 'id', 'type' => 'type')
+                               ),
+                               'ix' => array(),
+                               'uc' => array()
+               ),
+               'lg_bim_item_type_requirement' => array(
+                               'fd' => array(
+                                               'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
+                                               'location_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'attribute_name' => 
array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
+                                               'attribute_type' => 
array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
+                                               'project_type_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => true)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(
+                                               'lg_project_type' => 
array('project_type_id' => 'id'),
+                                               'phpgw_locations' => 
array('location_id' => 'location_id')
+                               ),
+                               'ix' => array(),
+                               'uc' => array()
+               ),
+               'lg_requirement_value' => array(
+                               'fd' => array(
+                                               'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
+                                               'type_requirement_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+                                               'value' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => true)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array('lg_bim_item_type_requirement' => 
array('type_requirement_id' => 'id')),
+                               'ix' => array(),
+                               'uc' => array()
+               ),
+               'lg_calendar' => array(
+                               'fd' => array(
+                                               'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
+                                               'location_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'item_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
+                                               'type' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
+                                               'tracking' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => true)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array('fm_bim_item' => array('item_id' 
=> 'id', 'type' => 'type')),
+                               'ix' => array(),
+                               'uc' => array()
+               )
+);

Added: trunk/logistic/sonar-project.properties
===================================================================
--- trunk/logistic/sonar-project.properties                             (rev 0)
+++ trunk/logistic/sonar-project.properties     2012-09-21 08:40:27 UTC (rev 
10016)
@@ -0,0 +1,24 @@
+#Project-file used by Sonar. Added by Erik Holm-Larsen, Bouvet AS
+# required metadata
+sonar.projectKey=no.bouvet.portico:logistic
+sonar.projectName=PorticoEstate Logistikkmodul
+sonar.projectVersion=1.0-SNAPSHOT
+  
+# path to source directories (required)
+#sources=jenkins_checkout/pe/controller,jenkins_checkout/pe/rental,jenkins_checkout/pe/activitycalendar
+sources=.
+tests=../tests
+ 
+sonar.language=php
+ 
+#sonar.scm.url=scm:svn:http://svn.codehaus.org/sonar-plugins/trunk/php/math-php-test
+sonar.scm.url=scm:svn:http://svn.savannah.nongnu.org/svn/fmsystem/trunk/
+ 
+#sonar.phpUnit.mainTestClass=source/tests/AllTests2.php
+sonar.phpUnit.mainTestClass=../tests.php
+sonar.phpcpd.excludes=../tests.php
+ 
+# Example of properties that can be uncommented to enable reuse of existing 
PHP Code Sniffer reports
+#sonar.phpCodesniffer.analyzeOnly=true
+#sonar.phpCodesniffer.reportFileRelativePath=../../logs
+#sonar.phpCodesniffer.reportFileName=cs-report.xml
\ No newline at end of file




reply via email to

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