fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10984] property: inventory


From: Sigurd Nes
Subject: [Fmsystem-commits] [10984] property: inventory
Date: Wed, 13 Mar 2013 14:33:58 +0000

Revision: 10984
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10984
Author:   sigurdne
Date:     2013-03-13 14:33:56 +0000 (Wed, 13 Mar 2013)
Log Message:
-----------
property: inventory

Modified Paths:
--------------
    trunk/phpgwapi/setup/tables_current.inc.php
    trunk/phpgwapi/setup/tables_update.inc.php
    trunk/property/inc/class.bocommon.inc.php
    trunk/property/inc/class.boentity.inc.php
    trunk/property/inc/class.soentity.inc.php
    trunk/property/inc/class.uientity.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/entity.xsl

Modified: trunk/phpgwapi/setup/tables_current.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_current.inc.php 2013-03-13 09:39:12 UTC (rev 
10983)
+++ trunk/phpgwapi/setup/tables_current.inc.php 2013-03-13 14:33:56 UTC (rev 
10984)
@@ -560,9 +560,9 @@
                (
                        'fd' => array
                        (
-                               'location_id' => array('type' => 
'int','precision' => 2,'nullable' => false),
-                               'group_id' => array('type' => 'int','precision' 
=> 2,'nullable' => true, 'default' => 0),
-                               'id' => array('type' => 'int','precision' => 
2,'nullable' => false),
+                               'location_id' => array('type' => 
'int','precision' => 4,'nullable' => false),
+                               'group_id' => array('type' => 'int','precision' 
=> 4,'nullable' => true, 'default' => 0),
+                               'id' => array('type' => 'int','precision' => 
4,'nullable' => false),
                                'column_name' => array('type' => 
'varchar','precision' => 50,'nullable' => false),
                                'input_text' => array('type' => 
'varchar','precision' => 255,'nullable' => false),
                                'statustext' => array('type' => 
'varchar','precision' => '255','nullable' => false),

Modified: trunk/phpgwapi/setup/tables_update.inc.php
===================================================================
--- trunk/phpgwapi/setup/tables_update.inc.php  2013-03-13 09:39:12 UTC (rev 
10983)
+++ trunk/phpgwapi/setup/tables_update.inc.php  2013-03-13 14:33:56 UTC (rev 
10984)
@@ -3155,4 +3155,36 @@
                }
        }
 
+/*
+       $test[] = '0.9.17.542';
+       function phpgwapi_upgrade0_9_17_542()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
 
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_cust_attribute','location_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => false,
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_cust_attribute','id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => false,
+               ));
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_cust_attribute','group_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => true,
+                       'default' => 0
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['phpgwapi']['currentver'] = 
'0.9.17.543';
+                       return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+               }
+       }
+
+*/
+

Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php   2013-03-13 09:39:12 UTC (rev 
10983)
+++ trunk/property/inc/class.bocommon.inc.php   2013-03-13 14:33:56 UTC (rev 
10984)
@@ -1048,7 +1048,7 @@
                {
                        $datatype_text = array(
                                'V' => 'varchar',
-                               'I' => 'number',
+                               'I' => 'integer',
                                'C' => 'char',
                                'N' => 'float',
                                'D' => 'date',

Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php   2013-03-13 09:39:12 UTC (rev 
10983)
+++ trunk/property/inc/class.boentity.inc.php   2013-03-13 14:33:56 UTC (rev 
10984)
@@ -680,4 +680,10 @@
                        return $this->so->read_entity_to_link($data);
                }
 
+               public function get_inventory($id = 0)
+               {
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$this->entity_id}.{$this->cat_id}");
+                       return $this->so->get_inventory( array('id' => $id, 
'location_id' => $location_id) );
+               }
+
        }

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2013-03-13 09:39:12 UTC (rev 
10983)
+++ trunk/property/inc/class.soentity.inc.php   2013-03-13 14:33:56 UTC (rev 
10984)
@@ -2349,4 +2349,63 @@
 
                        return $entity;
                }
+
+               /**
+                * Method for retreiving inventory of bulk items.
+                * 
+                * @param $data array array holding input parametres
+                * @return array of entities
+                */
+
+               public function get_inventory($data = array())
+               {
+
+                       $location_id    = isset($data['location_id']) && 
$data['location_id'] ? (int)$data['location_id'] : 0;
+                       $id                             = (int)$data['id'];
+
+                       if(!$location_id || ! $id)
+                       {
+                               return array();
+                       }
+
+                       $sql = "SELECT * FROM fm_bim_item_inventory WHERE 
location_id = {$location_id} AND id = {$id}";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $inventory = array();
+                       while ($this->db->next_record())
+                       {
+                               $inventory[] = array
+                               (
+                                       'inventory'     => 
$this->db->f('inventory'),
+                                       'unit_id'       => 
$this->db->f('unit_id'),
+                                       'remark'                => 
$this->db->f('remark', true),
+                                       'descr'         => 
$this->db->f('descr', true),
+                                       'is_eav'        => 
$this->db->f('is_eav')
+                               );
+                       }
+
+                       return $inventory;
+/*
+  id integer NOT NULL DEFAULT nextval('seq_fm_bim_item_inventory'::regclass),
+  location_id integer NOT NULL,
+  item_id integer NOT NULL,
+  p_location_id integer,
+  p_id integer,
+  unit_id integer NOT NULL,
+  inventory integer NOT NULL,
+  write_off integer NOT NULL,
+  bookable smallint NOT NULL,
+  active_from bigint,
+  active_to bigint,
+  created_on bigint NOT NULL,
+  created_by integer NOT NULL,
+  expired_on bigint,
+  expired_by bigint,
+  remark text,
+ 
+*/
+
+
+
+
+               }
        }

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2013-03-13 09:39:12 UTC (rev 
10983)
+++ trunk/property/inc/class.uientity.inc.php   2013-03-13 14:33:56 UTC (rev 
10984)
@@ -2123,6 +2123,41 @@
                                                )
                                        )
                                );
+
+
+                               if($category['enable_bulk'])
+                               {
+                                       $tabs['inventory']      = array('label' 
=> lang('inventory'), 'link' => '#inventory');
+
+                                       $_inventory = $this->get_inventory($id);
+
+                                       $datavalues[3] = array
+                                       (
+                                               'name'                          
        => "3",
+                                               'values'                        
        => json_encode($_inventory),
+                                               'total_records'                 
=> count($_inventory),
+                                               'edit_action'                   
=> "''",
+                                               'is_paginator'                  
=> 1,
+                                               'footer'                        
        => 0
+                                       );
+
+       
+                                       $myColumnDefs[3] = array
+                                       (
+                                               'name'          => "3",
+                                               'values'        =>      
json_encode(array(      
+                                                               array('key' => 
'url','label'=>lang('where'),'sortable'=>false,'resizeable'=>true),
+                                                               array('key' => 
'unit','label'=>lang('unit'),'sortable'=>false,'resizeable'=>true),
+                                                               array('key' => 
'count','label'=>lang('count'),'sortable'=>false,'resizeable'=>true),
+                                                               array('key' => 
'bookable','label'=>lang('bookable'),'sortable'=>false,'resizeable'=>true),
+                                                               array('key' => 
'calendar','label'=>lang('calendar'),'sortable'=>false,'resizeable'=>true),
+                                                               array('key' => 
'remark','label'=>lang('remark'),'sortable'=>false,'resizeable'=>true),
+                                                       )
+                                               )
+                                       );
+                               
+                               }
+
                        }
 
                        $data = array
@@ -2130,7 +2165,7 @@
                                        'property_js'                           
        => 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
                                        'datatable'                             
                => $datavalues,
                                        'myColumnDefs'                          
        => $myColumnDefs,       
-//                                     'related_link'                          
        => $related_link,                       
+                                       'enable_bulk'                           
        => $category['enable_bulk'],
                                        'link_pdf'                              
                => $GLOBALS['phpgw']->link('/index.php',$pdf_data),
                                        'start_project'                         
        => $category['start_project'],
                                        'lang_start_project'                    
=> lang('start project'),
@@ -2810,4 +2845,9 @@
                        $document = $pdf->ezOutput();
                        $pdf->print_pdf($document,$entity['name'] . '_' . 
str_replace(' ','_',$GLOBALS['phpgw']->accounts->id2name($this->account)));
                }
+
+               public function get_inventory($id = 0)
+               {
+                       return $this->bo->get_inventory($id);
+               }
        }

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2013-03-13 09:39:12 UTC (rev 
10983)
+++ trunk/property/setup/tables_update.inc.php  2013-03-13 14:33:56 UTC (rev 
10984)
@@ -7510,3 +7510,33 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+       /**
+       * Update property version from 0.9.17.667 to 0.9.17.668
+       * Add inventory for bulk items
+       */
+       $test[] = '0.9.17.667';
+       function property_upgrade0_9_17_667()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_bim_item_inventory',  array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'int','precision' => 4,'nullable' => False),
+                                       'name' => array('type' => 
'varchar','precision' => 50,'nullable' => False),
+                                       'descr' => array('type' => 
'text','nullable' => True)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.667';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: trunk/property/templates/base/entity.xsl
===================================================================
--- trunk/property/templates/base/entity.xsl    2013-03-13 09:39:12 UTC (rev 
10983)
+++ trunk/property/templates/base/entity.xsl    2013-03-13 14:33:56 UTC (rev 
10984)
@@ -310,6 +310,29 @@
                                                        </div>
                                                </xsl:when>
                                        </xsl:choose>
+
+                                       <xsl:choose>
+                                               <xsl:when test="enable_bulk = 
1">
+                                                       <div id="inventory">
+                                                               <table 
cellpadding="2" cellspacing="2" width="80%" align="center">
+                                                                       <tr>
+                                                                               
<td align="left" valign="top">
+                                                                               
        <xsl:value-of select="php:function('lang', 'inventory')"/>
+                                                                               
</td>
+                                                                               
<td>
+                                                                               
        <div id="datatable-container_3"/>
+                                                                               
</td>
+                                                                       </tr>
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="value_id!='' and mode = 'edit'">
+
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+                                                               </table>
+                                                       </div>
+                                               </xsl:when>
+                                       </xsl:choose>
+
                                </div>
                                <xsl:choose>
                                        <xsl:when test="mode = 'edit'">




reply via email to

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