Topic: Adding Assets Classes fails

I have a fresh install, logged in as "System administrator". In "Access Setup" all the rows are marked.

If I add a "Fixed Asset classes" with:
Parent class: rr
Fixed asset clarr: tt
Description: fafasdf
Log description: dfsdfsjkljkjlfsdsf
Basic Depreciation Rate: 20

No class is created.
With "$show_sql               = 1;" and "$go_debug               = 1;" it gives:

DATABASE ERROR : The fixed asset class could not be added
error code : 1265
error message : Data truncated for column 'depreciation_rate' at row 1
sql that failed was : INSERT INTO 0_stock_fa_class (fa_class_id, parent_id, description, long_description, depreciation_rate) VALUES ('tt', 'rr', 'fafasdf', 'dfsdfsjkljkjlfsdsf', '20,0')

Note the quotes arond 20.0.
In the database (mariadb), the table "0_stock_fa_class", row name "depreciation_rate" has type "double". If I change this to "text" I can add an "Assets class".

Is this a bug, or is there a CEBKAC?

Re: Adding Assets Classes fails

Have you changed the character used for a decimal point?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Adding Assets Classes fails

No.
But..... When I open the preferences, click on "update" without changing something, it works.

Thanks for pointing me to the right direction!

Re: Adding Assets Classes fails

You still may have a problem - the error warning states 20,0 not 20.0

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Adding Assets Classes fails

I can confirm now the above
If under preferences the "Decimal Separator" is set to a comma, I cannot add a class
Changing the "Decimal Separator" to a point, I can add a class.

Looks like a bug to me.

Re: Adding Assets Classes fails

Looks like the input_num function issue.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Adding Assets Classes fails

kvvaradha wrote:

Looks like the input_num function issue.

@joe Update this on fixed_asset_classes.php

$input_error = 0;
if(input_num('depreciation_rate') > 100){
    display_error(_("The depreciation rate can't be greater than 100%"));
    $input_error = 1;
}

and also in the update_fixed_asset_class,add_fixed_asset_class last parameter change it to input_num from $_POST.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Adding Assets Classes fails

Fixed and committed to stable repo.

A fixed file can be downloaded here.

/Joe