diff options
| -rw-r--r-- | list_stock.php | 23 | ||||
| -rw-r--r-- | templates/list_stock.tpl | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/list_stock.php b/list_stock.php index 3de65e4..850b024 100644 --- a/list_stock.php +++ b/list_stock.php @@ -6,6 +6,8 @@ namespace Bitweaver\Stock; +use Bitweaver\BitBase; + require_once '../kernel/includes/setup_inc.php'; global $gBitSystem, $gBitSmarty, $gBitDb; @@ -31,6 +33,16 @@ if( $filterUserId ) { $X = BIT_DB_PREFIX; +$listHash = $_REQUEST; +if( !$assemblyContentId ) { + if( empty( $listHash['max_records'] ) ) { + $listHash['max_records'] = 20; + } + BitBase::prepGetList( $listHash ); +} +$maxRecords = $listHash['max_records'] ?? 20; +$offset = $listHash['offset'] ?? 0; + $bindVars = []; if( $assemblyContentId ) { @@ -203,6 +215,17 @@ if( $showShortages && isset( $_REQUEST['format'] ) && $_REQUEST['format'] === 'c exit; } +if( !$assemblyContentId ) { + $listHash['cant'] = count( $stockList ); + $stockList = array_slice( $stockList, $offset, $maxRecords, true ); + $listHash['page_records'] = count( $stockList ); + if( $filterUserId ) $listHash['listInfo']['parameters']['user_id'] = $filterUserId; + if( $find !== '' ) $listHash['listInfo']['parameters']['find'] = $find; + if( $showShortages ) $listHash['listInfo']['parameters']['shortages'] = 1; + BitBase::postGetList( $listHash ); + $gBitSmarty->assign( 'listInfo', $listHash['listInfo'] ); +} + $gBitSmarty->assign( 'stockList', $stockList ); $gBitSmarty->assign( 'assemblyListJson', $assemblyListJson ); $gBitSmarty->assign( 'assemblyContentId', $assemblyContentId ); diff --git a/templates/list_stock.tpl b/templates/list_stock.tpl index 5a992f3..71b7c88 100644 --- a/templates/list_stock.tpl +++ b/templates/list_stock.tpl @@ -106,6 +106,7 @@ {else} <p class="muted">{tr}No stock records found.{/tr}</p> {/if} + {if $listInfo}{include file="bitpackage:kernel/pagination.tpl"}{/if} </section> </div> |
