Fixed several bugs:
- product creation/update was broken since adding the brand field - template suggestions and loading was broken since changing datalist names - discard and service buttons were not hidden when creating new products
This commit is contained in:
parent
282d19ee2c
commit
5f7ee5ff45
@ -172,13 +172,19 @@ class Ajax extends Responder {
|
||||
$info = $_POST;
|
||||
$id = $info['id'];
|
||||
$name = $info['name'];
|
||||
$brand = $info['brand'];
|
||||
$serial = $info['serial'];
|
||||
$invoice = $info['invoice'];
|
||||
$tags = array();
|
||||
if(isset($info['tag'])) {
|
||||
$tags = $this->unescape_tags($info['tag']);
|
||||
}
|
||||
foreach(array('id', 'name', 'serial', 'invoice', 'tag') as $key) {
|
||||
foreach(array('id',
|
||||
'name',
|
||||
'brand',
|
||||
'serial',
|
||||
'invoice',
|
||||
'tag') as $key) {
|
||||
unset($info[$key]);
|
||||
}
|
||||
if(!$name) {
|
||||
@ -198,7 +204,8 @@ class Ajax extends Responder {
|
||||
'Det angivna serienumret finns redan på en annan artikel.');
|
||||
} catch(Exception $e) {}
|
||||
try {
|
||||
$product = Product::create_product($name,
|
||||
$product = Product::create_product($brand,
|
||||
$name,
|
||||
$invoice,
|
||||
$serial,
|
||||
$info,
|
||||
@ -286,7 +293,8 @@ class Ajax extends Responder {
|
||||
'name',
|
||||
'serial',
|
||||
'invoice',
|
||||
'tags') as $key) {
|
||||
'brand',
|
||||
'tag') as $key) {
|
||||
unset($info[$key]);
|
||||
}
|
||||
if(!$name) {
|
||||
|
@ -132,7 +132,7 @@ class ProductPage extends Page {
|
||||
'tags' => $tags,
|
||||
'info' => $fields,
|
||||
'label' => '',
|
||||
'hidden' => ''),
|
||||
'hidden' => 'hidden'),
|
||||
$this->fragments['product_details']);
|
||||
return $out;
|
||||
}
|
||||
|
@ -336,11 +336,15 @@ function removeTag(event) {
|
||||
|
||||
function loadTemplate(event) {
|
||||
var form = event.currentTarget
|
||||
var template = form.template.value
|
||||
var input = form.template
|
||||
var template = ucfirst(input.value.toLowerCase())
|
||||
if(template === '') {
|
||||
return
|
||||
}
|
||||
var options = form.querySelector('#templatelist').options
|
||||
var options = input.list.childNodes
|
||||
if(options.length == 0) {
|
||||
return
|
||||
}
|
||||
for(var i = 0; i < options.length; i++) {
|
||||
if(options[i].value == template) {
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user