Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Field - List Box v.3.4.0 fail? #2516

Closed
2 tasks done
philknab opened this issue Aug 29, 2016 · 17 comments
Closed
2 tasks done

Custom Field - List Box v.3.4.0 fail? #2516

philknab opened this issue Aug 29, 2016 · 17 comments
Labels
✋ bug Confirmed bug
Milestone

Comments

@philknab
Copy link

philknab commented Aug 29, 2016

Expected Behavior (or desired behavior if a feature request)

When i create an asset it should show my asset modell with custom fields.


Actual Behavior

After setting up a custom field list box for my asset modell it doesn't show the custom fields in asset-create. After i deleted my custom field list box it shows the custom fields in asset-create


Please confirm you have done the following before posting your bug report:


Please provide answers to these questions before posting your bug report:

  • Version of Snipe-IT you're running -v.3.4.0 alpha
  • What OS and web server you're running Snipe-IT on -Windows 7 / xampp
  • What method you used to install Snipe-IT (install.sh, manual installation, docker, etc)-manual
  • If you're getting an error in your browser, include that error
  • What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error - asset create
  • If a stacktrace is provided in the error, include that too.
  • Any errors that appear in your browser's error console. LOG.error: ErrorException: undefined variable: asset in C:\xampp\htdocs\snipeit\storage\framework\views\957bb22ab9d4f68dff4136ab7edfe68ba9a0d8bb.php:10
  • Confirm whether the error is reproduceable on the demo.
  • Include any additional information you can find in app/storage/logs and your webserver's logs.
  • Include what you've done so far in the installation, and if you got any error messages along the way.
  • Indicate whether or not you've manually edited any data directly in the database
@snipe
Copy link
Owner

snipe commented Aug 29, 2016

LOG.error: ErrorException: undefined variable: asset in C:\xampp\htdocs\snipeit\storage\framework\views\957bb22ab9d4f68dff4136ab7edfe68ba9a0d8bb.php:10

That looks like your laravel logs, not your browser console. Can you please tell me if there are any errors in your browser console?

@philknab
Copy link
Author

https://localhost/hardware/models/3/custom_fields?_token=3nnTfmfgM1IOgB3cfuFqJwiVJyjMUfudBAPsPt6L Failed to load resource: the server responded with a status of 500 (Internal Server Error)

this is the error in the console

@snipe
Copy link
Owner

snipe commented Aug 30, 2016

Please paste me the first 20 lines of C:\xampp\htdocs\snipeit\storage\framework\views\957bb22ab9d4f68dff4136ab7edfe68ba9a0d8bb.php

@philknab
Copy link
Author

philknab commented Aug 30, 2016

<?php if($model->fieldset): ?>
  <?php foreach($model->fieldset->fields AS $field): ?>
    <div class="form-group<?php echo e($errors->has($field->db_column_name()) ? ' has-error' : ''); ?>">
      <label for="<?php echo e($field->db_column_name()); ?>" class="col-md-3 control-label"><?php echo e($field->name); ?> </label>
      <div class="col-md-7 col-sm-12<?php echo e(($field->pivot->required=='1') ? ' required' : ''); ?>">

          <?php if($field->element!='text'): ?>
              <!-- Listbox -->
              <?php if($field->element=='listbox'): ?>
                  <?php echo e(Form::select($field->db_column_name(), $field->formatFieldValuesAsArray(), Input::old($field->db_column_name(), $asset->{$field->db_column_name()}), ['class'=>'format select2 form-control'])); ?>


              <?php elseif($field->element=='checkbox'): ?>
                    <!-- Checkboxes -->
                  <?php foreach($field->formatFieldValuesAsArray() as $key => $value): ?>

                      <div>
                          <label>
                              <input type="checkbox" value="1" name="<?php echo e($field->db_column_name()); ?>[]" class="minimal" <?php echo e(Input::old($field->db_column_name()) != '' ? ' checked="checked"' : ''); ?>> key: <?php echo e($key); ?> value: <?php echo e($value); ?>

                          </label>
                      </div>
                  <?php endforeach; ?>

              <?php endif; ?>

@snipe
Copy link
Owner

snipe commented Aug 30, 2016

First 20 lines please.

@snipe
Copy link
Owner

snipe commented Aug 30, 2016

Ah, I see - you didn't comment them as code, so they were invisible.

@snipe
Copy link
Owner

snipe commented Aug 30, 2016

What's actually on line 20 in that file?

@philknab
Copy link
Author

nothing..

@philknab
Copy link
Author

<input type="checkbox" value="1" name="<?php echo e($field->db_column_name()); ?>[]" class="minimal" <?php echo e(Input::old($field->db_column_name()) != '' ? ' checked="checked"' : ''); ?>> key: <?php echo e($key); ?> value: <?php echo e($value); ?>

this is in line 19

@snipe
Copy link
Owner

snipe commented Aug 30, 2016

Can you show me the value in the custom_fields table for that custom field?

@philknab
Copy link
Author

where can i look for it? sorry i am not so familiar with everything

@snipe
Copy link
Owner

snipe commented Aug 30, 2016

In your database.

@philknab
Copy link
Author

unbenannt

this the value of the field?

@philknab
Copy link
Author

the asdfgghghg thing is just some random name haha because i wanted to test it first

@snipe
Copy link
Owner

snipe commented Aug 30, 2016

If that were true, it shouldn't be erroring on the checkbox code. It would never trigger that branch in the if/else logic.

snipe added a commit that referenced this issue Aug 30, 2016
@snipe
Copy link
Owner

snipe commented Aug 30, 2016

Should be fixed on current dev

@snipe snipe closed this as completed Aug 30, 2016
@philknab
Copy link
Author

it's working - nice one

@snipe snipe added the ✋ bug Confirmed bug label Aug 31, 2016
@snipe snipe modified the milestone: v3.4.0 Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✋ bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

2 participants