Skip to content

Commit 8557687

Browse files
committed
Improved orderdetails input fields on edit_part_info.php
This fixes issue #37.
1 parent 8a8cff8 commit 8557687

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

edit_part_info.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,8 @@
882882
$html->setVariable('max_upload_filesize', ini_get('upload_max_filesize'), 'string');
883883
$html->setVariable('downloads_enable', $config['allow_server_downloads'], "boolean");
884884

885+
$html->setVariable("currency_symbol", getCurrencySymbol(), "string");
886+
885887
$html->setVariable("back_link", $_SESSION["part_delete_last_link"], "string");
886888
} catch (Exception $e) {
887889
$messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');

inc/lib.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,23 @@ function floatToMoneyString($number, $language = '')
508508
return $result;
509509
}
510510

511+
/**
512+
* Returns the Currency symbol for the configured locale.
513+
* @return string The currency symbol.
514+
*/
515+
function getCurrencySymbol()
516+
{
517+
global $config;
518+
$language = $config['language'];
519+
520+
//User can override the currency symbol in config, we need to respect that...
521+
if(isset($config['money_format'][$language])) {
522+
return $config['money_format'][$language];
523+
}
524+
525+
return localeconv()['currency_symbol'];
526+
}
527+
511528
/**
512529
* Download a file from the internet (with "curl")
513530
*

templates/nextgen/edit_part_info.php/smarty_orderdetails.tpl

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
{t}Einkaufsinformationen{/t}
66
</div>
77
<form action="{$relative_path}edit_part_info.php" method="post" class="table-responsive no-progbar" id="orderdetails">
8-
<table class="table table-striped table-condensed table-hover">
8+
<table class="table table-striped table-sm table-hover">
99
<thead>
1010
<tr>
1111
<th></th>
1212
<th>{t}Lieferant{/t}<br>{t}Bestellnummer{/t}</th>
1313
<th>{t}Eigenschaften{/t}</th>
1414
<th>{t}Preise{/t}</th>
15-
<th></th>
1615
</tr>
1716
</thead>
1817

@@ -49,15 +48,14 @@
4948
{else}
5049
<button class="btn btn-success" type="submit" name="orderdetails_apply" value="{$detail.orderdetails_id}"
5150
{if !$can_orderdetails_edit}disabled{/if}>{t}Übernehmen{/t}</button>
52-
<p></p>
53-
<button class="btn btn-danger" type="submit" name="orderdetails_delete" value="{$detail.orderdetails_id}"
51+
<button class="btn btn-danger mt-2" type="submit" name="orderdetails_delete" value="{$detail.orderdetails_id}"
5452
{if !$can_orderdetails_delete}disabled{/if}>{t}Löschen{/t}</button>
5553
{/if}
5654
</td>
5755

5856
<td>
5957
{if $detail.orderdetails_id != "new"}
60-
<table class="table table-striped table-bordered table-condensed">
58+
<table class="table table-striped table-bordered table-sm">
6159
<thead>
6260
<tr class="trcat">
6361
<th></th>
@@ -82,17 +80,19 @@
8280

8381
<td >
8482
<div class="input-group">
85-
<input type="number" min="0" step="any" class="form-control"
83+
<input type="number" min="0" step="0.00001" max="999999.99999" class="form-control"
8684
name="price_{if $price.pricedetails_id == "new"}{$detail.orderdetails_id}_{/if}{$price.pricedetails_id}"
87-
value="{$price.price}"
85+
value="{$price.price}" placeholder="3.55"
8886
{if !($can_prices_edit || ($can_prices_create && $price.pricedetails_id == "new"))}disabled{/if}>
8987
<div class="input-group-append">
90-
<span class="input-group-text">{t}pro{/t}</span>
88+
<span class="input-group-text">{$currency_symbol}</span>
9189
</div>
90+
</div>
91+
<div class="input-group mt-2">
9292
<input type="number" min="0" class="form-control"
9393
name="price_related_quantity_{if $price.pricedetails_id == "new"}{$detail.orderdetails_id}_{/if}{$price.pricedetails_id}"
9494
value="{$price.price_related_quantity}"
95-
{if !($can_prices_edit || ($can_prices_create && $price.pricedetails_id == "new"))}disabled{/if}>
95+
{if !($can_prices_edit || ($can_prices_create && $price.pricedetails_id == "new"))}disabled{/if} placeholder="1">
9696
<div class="input-group-append">
9797
<span class="input-group-text">{t}Stk.{/t}</span>
9898
</div>
@@ -112,8 +112,7 @@
112112
<button class="btn btn-secondary" type="submit" name="pricedetails_apply"
113113
{if !$can_prices_edit}disabled{/if}
114114
value="{$price.pricedetails_id}">{t}Übernehmen{/t}</button>
115-
<p></p>
116-
<button class="btn btn-secondary" type="submit" name="pricedetails_delete"
115+
<button class="btn btn-secondary mt-2" type="submit" name="pricedetails_delete"
117116
{if !$can_prices_delete}disabled{/if}
118117
value="{$price.pricedetails_id}">{t}Löschen{/t}</button>
119118
{/if}

0 commit comments

Comments
 (0)