Error in credit invoice creation

In modal_create_credit.php file, at this point:

            <select name="invoice_group_id" id="invoice_group_id">
                <option value=""></option>
                <?php foreach ($invoice_groups as $invoice_group) {?>
                    <option value="<?php echo $invoice_group->invoice_group_id; ?>"
                        <?php if ($this->mdl_settings->setting('default_invoice_group') == $invoice_group->invoice_group_id) {
                            echo 'selected="selected"';
                            $credit_invoice_group = $invoice_group->invoice_group_name;
                        } ?>>
                        <?php echo $invoice_group->invoice_group_name; ?>
                <?php } ?>

this condition:

if ($this->mdl_settings->setting('default_invoice_group') == $invoice_group->invoice_group_id)

is never verified, because variable $this->mdl_settings->setting('default_invoice_group') at this point is empty.

I check his default value in file mdl_setup.php and is set to 1.

I’ve a single invoice group in my db, width invoice_group_id column value set to 1.
My invoice, in db, have invoice_group_id column value set to 1.

Can you help me?

Did you set the default invoice group in your system settings?

Thank you Kovah!

I would like to compliment you for this project. Simple and complete.