fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11263] property: bulk


From: Sigurd Nes
Subject: [Fmsystem-commits] [11263] property: bulk
Date: Mon, 12 Aug 2013 13:30:32 +0000

Revision: 11263
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11263
Author:   sigurdne
Date:     2013-08-12 13:30:30 +0000 (Mon, 12 Aug 2013)
Log Message:
-----------
property: bulk

Modified Paths:
--------------
    trunk/property/inc/class.soentity.inc.php
    trunk/property/inc/class.uientity.inc.php
    trunk/property/js/yahoo/entity.edit.js

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2013-08-11 13:24:14 UTC (rev 
11262)
+++ trunk/property/inc/class.soentity.inc.php   2013-08-12 13:30:30 UTC (rev 
11263)
@@ -2433,6 +2433,7 @@
                                (
                                        'inventory_id'  => $this->db->f('id'),
                                        'inventory'             => 
$this->db->f('inventory'),
+                                       'allocated'             => 0,
                                        'unit_id'               => 
$this->db->f('unit_id'),
                                        'unit'                  => 
$this->db->f('unit', true),
                                        'remark'                => 
$this->db->f('remark', true),
@@ -2445,6 +2446,28 @@
                                );
                        }
 
+
+                       
if(isset($GLOBALS['phpgw_info']['user']['apps']['logistic']))
+                       {
+                               $start_date     = time();
+                               $end_date       = time();
+
+                               foreach ($inventory as &$entry)
+                               {
+                                       $sql = "SELECT 
SUM(item_inventory_amount) AS allocated"
+                                       . " FROM lg_calendar"
+                                       . " WHERE location_id = {$location_id}"
+                                       . " AND lg_calendar.item_id = {$id}"
+                                       . " AND item_inventory_id = 
{$entry['inventory_id']}"
+                                       . " AND lg_calendar.end_date >= 
{$start_date} AND lg_calendar.start_date <= {$end_date}";
+
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+                       
+                                       $this->db->next_record();
+                                       $entry['allocated'] = (int) 
$this->db->f('allocated');
+                               }
+                       }
+
                        return $inventory;
                }
 

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2013-08-11 13:24:14 UTC (rev 
11262)
+++ trunk/property/inc/class.uientity.inc.php   2013-08-12 13:30:30 UTC (rev 
11263)
@@ -68,7 +68,8 @@
                                'get_files'                     => true,
                                'get_inventory'         => true,
                                'add_inventory'         => true,
-                               'edit_inventory'        => true
+                               'edit_inventory'        => true,
+                               'inventory_calendar'=> true
                        );
 
                function property_uientity()
@@ -2297,8 +2298,9 @@
                                                        //      array('key' => 
'delete','label'=>lang('delete'),'sortable'=>false,'resizeable'=>true, 
'formatter' => 'FormatterCenter'),
                                                                array('key' => 
'unit','label'=>lang('unit'),'sortable'=>false,'resizeable'=>true),
                                                                array('key' => 
'inventory','label'=>lang('count'),'sortable'=>false,'resizeable'=>true, 
'formatter' => 'FormatterAmount0'),
+                                                               array('key' => 
'allocated','label'=>lang('allocated'),'sortable'=>false,'resizeable'=>true, 
'formatter' => 'FormatterAmount0'),
                                                                array('key' => 
'bookable','label'=>lang('bookable'),'sortable'=>false,'resizeable'=>true, 
'formatter' => 'FormatterCenter'),
-                                                               array('key' => 
'calendar','label'=>lang('calendar'),'sortable'=>false,'resizeable'=>true),
+                                                               array('key' => 
'calendar','label'=>lang('calendar'),'sortable'=>false,'resizeable'=>true, 
'formatter' => 'FormatterCalendar'),
                                                                array('key' => 
'remark','label'=>lang('remark'),'sortable'=>false,'resizeable'=>true),
                                                                array('key' => 
'location_id','hidden'=>true),
                                                                array('key' => 
'id','hidden'=>true),
@@ -3279,6 +3281,24 @@
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
$system_location['appname'] . '::' . $system_location['descr'] . '::' . 
$function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add_inventory' => $data));
 
+               }
 
+               public function inventory_calendar()
+               {
+                       $location_id    = phpgw::get_var('location_id', 'int');
+                       $id                             = phpgw::get_var('id', 
'int');
+                       $inventory_id   = phpgw::get_var('inventory_id', 'int');
+
+                       $system_location = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+
+                       $this->acl_add  = 
$this->acl->check($system_location['location'], PHPGW_ACL_ADD, 
$system_location['appname']);
+
+                       if(!$this->acl_add)
+                       {
+                               echo lang('No Access');
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+                       echo "Planlagt: Visning av kalenderoppføringer for 
ressursen";
+                       $GLOBALS['phpgw']->common->phpgw_exit();
                }
        }

Modified: trunk/property/js/yahoo/entity.edit.js
===================================================================
--- trunk/property/js/yahoo/entity.edit.js      2013-08-11 13:24:14 UTC (rev 
11262)
+++ trunk/property/js/yahoo/entity.edit.js      2013-08-12 13:30:30 UTC (rev 
11263)
@@ -21,9 +21,17 @@
                var location_id = oRecord.getData('location_id');
                var id = oRecord.getData('id');
                var inventory_id = oRecord.getData('inventory_id');
-               elCell.innerHTML = "<a 
href=\"javascript:showlightbox_edit_inventory(" + location_id + ',' + id + ',' 
+ inventory_id + ')">' + 'Editer' + "</a>";
+               elCell.innerHTML = "<a 
href=\"javascript:showlightbox_edit_inventory(" + location_id + ',' + id + ',' 
+ inventory_id + ')">' + oColumn.label + "</a>";
        }       
 
+       var FormatterCalendar = function(elCell, oRecord, oColumn, oData)
+       {
+               var location_id = oRecord.getData('location_id');
+               var id = oRecord.getData('id');
+               var inventory_id = oRecord.getData('inventory_id');
+               elCell.innerHTML = "<a 
href=\"javascript:showlightbox_show_calendar(" + location_id + ',' + id + ',' + 
inventory_id + ')">' + oColumn.label + "</a>";
+       }       
+
        var FormatterCenter = function(elCell, oRecord, oColumn, oData)
        {
                var amount = YAHOO.util.Number.format(oData, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
@@ -108,6 +116,18 @@
                });
        }
 
+       this.showlightbox_show_calendar = function(location_id, id, 
inventory_id)
+       {
+               var oArgs = {menuaction:'property.uientity.inventory_calendar', 
location_id:location_id, id: id, inventory_id: inventory_id};
+               var sUrl = phpGWLink('index.php', oArgs);
+
+               TINY.box.show({iframe:sUrl, 
boxid:'frameless',width:750,height:550,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true,
+               close: true,
+               closejs:function(){refresh_inventory(location_id, id)}
+               });
+       }
+
+
        this.refresh_inventory = function(location_id, id)
        {
                var oArgs = {menuaction:'property.uientity.get_inventory', 
location_id:location_id, id: id};




reply via email to

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