Skip to content

Commit

Permalink
Added button to scan barcode in mobile view (only on android using ZX…
Browse files Browse the repository at this point in the history
…ing).
  • Loading branch information
jbtronics committed Dec 28, 2016
1 parent b2f43b0 commit a565ab9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions show_part_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@
$n_more = isset($_REQUEST['n_more']) ? (integer)$_REQUEST['n_more'] : 0;
$order_quantity = isset($_REQUEST['order_quantity']) ? (integer)$_REQUEST['order_quantity'] : 0;

//Parse Barcode scan
if(isset($_REQUEST['barcode']))
{
$barcode = $_REQUEST['barcode'];
if(is_numeric($barcode) && (mb_strlen($barcode) == 7 || mb_strlen($barcode) == 8))
{
if(mb_strlen($barcode) == 8)
{
//Remove parity
$barcode = substr($barcode, 0, -1);
}
$part_id = (integer) $barcode;
}
else
{
$messages[] = $messages[] = array('text' => nl2br(_("Barcode input is not valid!")), 'strong' => true, 'color' => 'red');
$fatal_error = true;
}
}

$action = 'default';
if (isset($_REQUEST["dec"])) {$action = 'dec';}
if (isset($_REQUEST["inc"])) {$action = 'inc';}
Expand All @@ -60,6 +80,7 @@

$html = new HTML($config['html']['theme'], $config['html']['custom_css'], _('Detailinfo'));


try
{
$database = new Database();
Expand Down
4 changes: 4 additions & 0 deletions templates/nextgen/smarty_head.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@
<span class="sr-only">{t}Toggle Navigation{/t}</span>
<span class="glyphicon glyphicon-search"></span>
</button>
<a class="navbar-toggle link-anchor" href="zxing://scan/?ret={if isset($smarty.server.HTTPS)}https{else}http{/if}%3A%2F%2F{$smarty.server.HTTP_HOST|escape:'url'}{$relative_path|escape:'url'}show_part_info.php%3Fbarcode%3D%7BCODE%7D&SCAN_FORMATS=EAN_8">
<i class="fa fa-barcode" aria-hidden="true"></i>
<span class="sr-only">{t}Scanne Barcode{/t}</span>
</a>
<a class="navbar-brand" href="{$relative_path}startup.php"><i class="fa fa-microchip" aria-hidden="true"></i> Part-DB</a>
</div>

Expand Down
3 changes: 3 additions & 0 deletions templates/nextgen/startup.php/smarty_startup.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<h3>{t}Version:{/t} {$system_version_full}{if !empty($git_branch)}, Git: {$git_branch}{if isset($git_commit)}/{$git_commit}{/if}{/if}</h3>
{/if}
<h4><i>"NextGen"</i></h4>
<!--
<a href="zxing://scan/?ret={if isset($smarty.server.HTTPS)}https{else}http{/if}%3A%2F%2F{$smarty.server.HTTP_HOST|escape:'url'}{$relative_path|escape:'url'}show_part_info.php%3Fbarcode%3D%7BCODE%7D&SCAN_FORMATS=EAN_8" class="link-anchor">Barcode Scan</a>
-->
</div>

{if isset($database_update) && $database_update}
Expand Down

0 comments on commit a565ab9

Please sign in to comment.