Topic: Package 'Payroll' is incompatible with current application version

I  have recently developed a new module and tried to install it on 2.4 RC1. It's not working here.  but its working fine with earlier version of  Frontaccounting. 

here is the warning message, when i try to actvate it.

 Package 'Payroll' is incompatible with current application version and cannot be activated. Check Install/Activate page for newer package version.

.

Help me to fix it.

Subscription service based on FA
HRM CRM POS batch Themes

2 (edited by apmuthu 09/06/2016 09:39:09 am)

Re: Package 'Payroll' is incompatible with current application version

You must make the version of your package 2.4.something....

includes/packages.inc has at it's last function check_src_ext_version($ext_v) which has lines 725-741:

/*
    Check basic extension source compatibility.
*/
function check_src_ext_version($ext_v)
{
    global $src_version;

    $compat_levels = 2;    // current policy is keeping compatibility on major version level.
    $app = explode('.', strspn($src_version, "0123456789."));
    $pkg = explode('.', strspn($ext_v, "0123456789."));

    for ($i=0; $i < min($compat_levels, count($app)); $i++)
        if ($pkg[$i] < $app[$i])
            return false;

    return true;
}

This function returns true only if the package version (at major level 2) is greater than or equal to that of the FA version.

The $SysPrefs->version (or if absent, the $src_version) in version.php is used as the FA version.

The admin/inst_module.php at line 215 checks the above before the said warning / error arises:

            if (check_value('Active'.$i) && !check_src_ext_version($ext['version']))

This must be borne in mind when developing / updating modules in FA v2.4.

In FA v2.3, only a check for previous version < current version of the module was done.

Re: Package 'Payroll' is incompatible with current application version

There was a bug in above procedure, just fixed in FA repo here.
To install your module you have to set Version variable in your _init/config file to be compatible with current FA version, i.e. the version string have to begin with '2.4'

Thank you for pointing out the problem.
Janusz

Re: Package 'Payroll' is incompatible with current application version

@itronics: Actually I was puzzled by how a length of a string returned by strspn() could be used though the logic was clear. Thanks for the fix.

Re: Package 'Payroll' is incompatible with current application version

Thank you
Janusz  and Apmuthu. I thought to change it in my _init/config  file.

Subscription service based on FA
HRM CRM POS batch Themes

6 (edited by kvvaradha 09/07/2016 04:53:50 am)

Re: Package 'Payroll' is incompatible with current application version

@Janusz - I have tried it by making the `_init` folder and `config` file and put the following things. but its not even working.

   

 Package: Payroll
Version: 2.4
Name: Payroll And HRM 
Description: Payroll system for generating paychecks
 and tax forms, and administrating employees.
Author: Varadha <admin@kvcodes.com>
Maintenance: Varadha <admin@kvcodes.com>
Homepage: kvcodes.com
Type: extension
InstallPath: modules/Payroll  

.

it creates an entry here in `installed_extensions.php` It will be like this.  Version is not getting here.

  array (
    'package' => 'Payroll',
    'name' => 'Payroll',
    'version' => '-',     // if i change here 2.4, it works fine. 
    'available' => '',
    'type' => 'extension',
    'path' => 'modules/Payroll',
    'active' => false,
  ),

EDIT:

It doesn't check _init/config folder i think. Do something to fix it.

Every time i have to change it manually to take effect of it.

Subscription service based on FA
HRM CRM POS batch Themes