Skip to content

Commit

Permalink
Merge branch 'fixes/ref-sdl'
Browse files Browse the repository at this point in the history
Fixes following user testing of Manufacturing updates introduced in 1.16
  • Loading branch information
steveblamey committed Nov 22, 2019
2 parents 074ddce + e4cd556 commit 50fa6a4
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 84 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@

All notable changes to this project will be documented in this file.

[Unreleased]

### Fixed

- SO product prices missing from 'related items' sidebar on Stock Items
- Return to Stock Item Work Orders view after adding Work Order from sidebar
- Completely hide 'print' column in work order list unless enabled in MF module settings

## [1.18.2] 2019-10-21

### Fixed

- Fix holiday calendar UI interactions
- Fix holiday requests calendar UI interactions
- Click a day or select a range of dates to add holiday request
- Right click to approve, cancel or decline a request

### Added

- Enable switching to list view from calendar
- Enable switching to list view from holiday requests calendar

## [1.18.1] 2019-11-12

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,10 @@ public function save()
}
else
{
// sendTo('STItems'
// ,'viewWorkorders'
// ,$this->_modules
// ,array('id'=>$data->stitem_id));
sendTo('mfworkorders', 'index', 'manufacturing');
sendTo('STItems',
'viewWorkorders',
$this->_modules,
array('id'=>$data->stitem_id));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ public function view()
'purchase_invoices',
'sales_orders',
'sales_invoices',
'so_products_prices',
'so_product_prices',
'po_product_prices',
'so_products',
'po_products'
Expand Down Expand Up @@ -1552,7 +1552,7 @@ function viewWorkorders()
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);

$this->view->set('page_title', $this->getPageName('', 'View'));
$this->view->set('page_title', 'Viewing Work Orders for Stock Item: ' . $stitem->item_code);
}

public function where_Used()
Expand Down
152 changes: 81 additions & 71 deletions modules/public_pages/erp/manufacturing/models/STBalance.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

/**
* (c) 2017 uzERP LLP (support#uzerp.com). All rights reserved.
*
* Released under GPLv3 license; see LICENSE.

/**
* (c) 2017 uzERP LLP (support#uzerp.com). All rights reserved.
*
* Released under GPLv3 license; see LICENSE.
**/


class STBalance extends DataObject
{

protected $version = '$Revision: 1.22 $';

protected $defaultDisplayFields = array('stitem' => 'Stock Item'
,'whbin' => 'Bin'
protected $defaultDisplayFields = array('stitem' => 'Stock Item'
,'whbin' => 'Bin'
,'balance' => 'Balance'
,'uom_name' => 'UoM'
,'supply_demand' => 'Supply/Demand'
,'whlocation_id'
);

,'uom_name' => 'UoM'
,'supply_demand' => 'Supply/Demand'
,'whlocation_id'
);

function __construct($tablename = 'st_balances')
{
parent::__construct($tablename);
Expand All @@ -28,8 +28,8 @@ function __construct($tablename = 'st_balances')
$this->belongsTo('WHLocation', 'whlocation_id', 'whlocation');
$this->belongsTo('WHBin', 'whbin_id', 'whbin');
$this->belongsTo('STItem', 'stitem_id', 'stitem');

$this->hasOne('STItem', 'stitem_id', 'stock_item');

$this->hasOne('STItem', 'stitem_id', 'stock_item');
}

public function getBalance()
Expand All @@ -40,7 +40,7 @@ public function getBalance()
public function getBalances($field)
{
$balance = DataObjectFactory::Factory('STBalance');


return $balance->getSum('balance', $field, 'st_balancesoverview');
}

Expand All @@ -58,30 +58,40 @@ public function save(&$errors)

static function getStockList($whlocation_id='')
{
$db = &DB::Instance();

//Get the obsolete items
$stitems = new STItem();
$sc = new ConstraintChain;
$sc->add(new Constraint('obsolete_date', 'is not', 'NULL'));
$obs_items = $stitems->getAll($sc);
$obs_ids = array_keys($obs_items);
$obsolete_ids = '(' . implode('),(', $obs_ids) . ')';

$stbalance = DataObjectFactory::Factory('STBalance');

$cc = new ConstraintChain();


if (!is_array($whlocation_id))
{
$whlocation_id = array($whlocation_id);
{
$whlocation_id = array($whlocation_id);
}

if ( count($whlocation_id)>0 )
{
$cc->add(new Constraint('whlocation_id', 'in', '('.implode($whlocation_id, ',').')'));
$cc->add(new Constraint('whlocation_id', 'in', '('.implode($whlocation_id, ',').')'));
}

if (count($obsolete_ids) > 0) {
$cc->add(new Constraint('stitem_id','<> ANY', "(VALUES {$obsolete_ids})"));
}

$cc->add(new Constraint('balance', '>', 0));

$stbalance->idField = 'stitem_id';

$stbalance->idField = 'stitem_id';
$stbalance->identifierField = 'stitem';


$stbalance->orderby = 'stitem';

return $stbalance->getAll($cc);

return $stbalance->getAll($cc, false, true);
}

static function getBinList($stitem_id, $whlocation_id)
Expand All @@ -90,17 +100,17 @@ static function getBinList($stitem_id, $whlocation_id)
$db = &DB::Instance();

$criteria = " WHERE balance>0" ;


if (!is_array($stitem_id))
{
$stitem_id = array($stitem_id);
{
$stitem_id = array($stitem_id);
}

if (!is_array($whlocation_id))
{
$whlocation_id = array($whlocation_id);
{
$whlocation_id = array($whlocation_id);
}


$criteria .= " AND whlocation_id IN (".implode(',', $whlocation_id).')';

$criteria .= " AND stitem_id IN (".implode(',', $stitem_id).')';
Expand Down Expand Up @@ -144,7 +154,7 @@ function getBinListNew($_stitem_id, $_whlocation_id)
return $this->getAll($cc, TRUE, TRUE);

}


public function getLocationList($_stitem_id, $_cc = '')
{

Expand Down Expand Up @@ -172,65 +182,65 @@ public function getLocationList($_stitem_id, $_cc = '')
}

public static function getTotalBalance()
{
{
$db = DB::Instance();

// Change this to use parent getSum
$query = "SELECT SUM(balance)
FROM st_balances
// Change this to use parent getSum
$query = "SELECT SUM(balance)
FROM st_balances
WHERE usercompanyid = ".EGS_COMPANY_ID;

return $db->GetOne($query);
}


return $db->GetOne($query);
}

public static function getTotalValuation()
{
{
$db = DB::Instance();

// Change this to use parent getSum
$query = "SELECT SUM(valuation)
FROM st_balancesoverview
$query = "SELECT SUM(valuation)
FROM st_balancesoverview
WHERE usercompanyid = ".EGS_COMPANY_ID;

return $db->GetOne($query);
}


return $db->GetOne($query);
}

public function getUoM ()
{
{
$stitem = DataObjectFactory::Factory('STItem');


$stitem->load($this->stitem_id);


if ($stitem)
{
return $stitem->uom_name;
{
return $stitem->uom_name;
}
else
{
return '';
}

}

{
return '';
}

}

public function getStockBalance ($stitem, $locations=null)
{
{
$cc = new ConstraintChain();


$cc->add(new Constraint('stitem_id', '=', $stitem));


if (!empty($locations))
{
{
if (is_array($locations))
{
$cc->add(new Constraint('whlocation_id', 'in', '('.implode(',', $locations).')'));
{
$cc->add(new Constraint('whlocation_id', 'in', '('.implode(',', $locations).')'));
}
else
{
$cc->add(new Constraint('whlocation_id', '=', $locations));
}
{
$cc->add(new Constraint('whlocation_id', '=', $locations));
}
}

return $this->getSum('balance', $cc);

return $this->getSum('balance', $cc);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@
{/if}
{/if}
</td>
<td>
{if (($model->status == 'N') && in_array($module_prefs['allow-wo-print'], ['A', 'N']))
|| (($model->status == 'R') && in_array($module_prefs['allow-wo-print'], ['A', 'R']))}
<input title='Print documents to default printer' type="checkbox" name="print[{$model->id}]" id="print{$model->id}" class="checkbox" />
{else}-
<td>
<input title='Print documents to default printer' type="checkbox" name="print[{$model->id}]" id="print{$model->id}" class="checkbox" />
</td>
{/if}
</td>
{/grid_row}
{foreachelse}
<tr>
Expand Down

0 comments on commit 50fa6a4

Please sign in to comment.