2,376

(1 replies, posted in Modules Add-on's)

This is what a REST API does. Check out forum posts and wiki articles on Slim 2 REST API for FA.

2,377

(3 replies, posted in Report Bugs here)

You have merged what should have been 2 separate vouchers. One for the invoice of 995/- and another for expenses of 5/-. Since you issued only 1 cheque for payment of 1000/- you should have got a Pay Instrument (Draft, TT, etc) for 995 and the bank would have debited you 5/- for bank charges. Hence the vouchers should have been:

Purchase Invoice:
=============
Credit AP (Supplier) - 995
Debit COGS: 995

Payment Voucher:
=============
Credit Bank - 1000/-
Debit AP (Supplier) - 995/- (Payment Allocation)
Debit Bank Charges - 5/- (Payment Allocation)

Now the Supplier Payments Report should show 995/- only.

The following fixes it:

--- admin/inst_chart.php    Thu Nov 12 03:19:51 2015
+++ admin/inst_chart.php    Sun Nov 19 12:15:49 2017
@@ -42,6 +42,10 @@
     install_extension($id);
 
 //---------------------------------------------------------------------------------------------
+function sortByOption($a, $b) {
+    return strcmp($a['name'], $b['name']);
+}
+
 start_form(true);
 
     div_start('ext_tbl');
@@ -52,6 +56,8 @@
         display_note(_("No optional chart of accounts is currently available."));
     else
     {
+        uasort($mods, 'sortByOption');
+
         $th = array(_("Chart"),  _("Installed"), _("Available"), _("Encoding"), "", "");
         $k = 0;
 

@joe: would you like to commit it?

2,379

(86 replies, posted in Modules Add-on's)

Create a Sales Invoice and use the Slim API to GET that invoice - you will get the json value. Form your new Invoice in json accordingly and use the PUT endpoint to inject your invoice. Putting in such an invoice will not have the Sales Order, Sales Delivery and Customer Payment that would need to have their own PUT requests in place (or does it?).

I'm sure you can now parse the code and determine what you need. The community has put in sufficient effort in double quick time to assist you among others. Hopefully you too will contribute tested code to it once you get familiar.

This is what makes Open Source tick.

When we are installing Charts of Accounts, as the list is long and many non standard custom ones with numerical indices will be available in the array of charts details that countries with a set of charts will be far apart making searching difficult.

Unlike languages which must start with the lang code, the charts can pretty much be anything, the name comes in handy when it denotes the country primarily though some start with number of digits in the account code.

2,381

(9 replies, posted in Announcements)

@itronics: The official release of FA 2.4.3 in SourceForge in it's tar.gz and .zip formats have CRLF DOS Style line endings. Kindly re-package the release.

Packages stand re-packaged with proper LF line endings as of 2017-12-11.

Those on the debian linux platform can do the following (alter path as required) if you have already installed it:

apt-get install dos2unix

find /var/www/frontac -type f \
     -name "*.php" \
     -o -name "*.css" \
     -o -name "*.js" \
     -o -name "*.txt" \
     -o -name "*.inc" \
     -o -name "*.sql" \
    | xargs dos2unix

In the meanwhile, users can get the official release from the GitHub commit here or from the SourceForge commit here..

The upgrade was done from official release but a patch was needed for the del tag to work. It has been submitted to their project with additional changes for their master branch of v1.4.4.

One Open Source project assisting another!

For the record, even the latest master branch of the PunBB code as on date does not officially sport the del tag. Attached is the patch for the PunBB v1.4.4 release version to enable the said tag which has been implemented here like so: del

Since the FA Forum relies on this script, a separate repo on GitHub has been created to track the changes.

2,384

(1 replies, posted in Fixed Assets)

Enable the Fixed Assets configuration in the Setup -> Roles for your role. Logout and Login again. You will find newly enable menu entries to configure your depreciation settings for the various fixed assets. Only then will it "depreciate".

2,385

(86 replies, posted in Modules Add-on's)

I took the easier way out by renaming the class and file to WLog and WSet instead as the original method gets used everywhere. I use Slim 2.64 and have it fully updated in my repo to manage without composer. Expect that Slim 2.x is not going to get updated very much in future, having been last updated on 2017-01-07 and FA dependant coding here will not need to rely on these low level methods at all.

All my Fixes to Slim 2.6.4 are in this commit.

2,386

(86 replies, posted in Modules Add-on's)

Take the latest FA 2.4 API from this post. It sports the latest Slim v2.64 and does not rely on composer.

The output of a json_decode to array using the API24 can be obtained after setting the test credentials in util.php and browsing to:

http://www.yourdomain.comt/FA24PATH/modules/api24/sales/5/13

This should retrieve Sales Invoice (type=13) #5.

Attached is the text output.

The Slim2 REST API integration for FA 2.4.3 is now attached herein. This is based on Slim v2.64 with all bugfixes included.

A fully working non-composer-ised version of the Slim2 REST Framework customised for FA 2.4.x is now available.

@joe: Attachements don't work for this version of the forum as yet.- Now done.

2,390

(86 replies, posted in Modules Add-on's)

Here are some quaint errors:

0::Set.php:72:[before upgrade] Redefining already defined constructor for class Slim\Helper\Set

0::Log.php:304:[before upgrade] Redefining already defined constructor for class Slim\Log

Whilst the Slim framework files use the newer function __construct(), the presence of function names (even if case is different) bearing the class name will be construed as being a re-declaration of the class constructor!. See Set.php and Log.php for functions set() and log() respectively atleast in earlier versions of PHP like 5.3.1. Renaming the class file names and their class names like WSet and WLog and altering them in files they are used alleviates these errors.

Line 163 of vendor/slim/slim/Slim/Helper/Set.php should not have any return value.

Line 309 of vendor/slim/slim/Slim/Log.php simply returns the string value even if it is an passed to it. In it's earlier avatar, it was replaced by:

            if (is_array($object) || (is_object($object) && !method_exists($object, "__toString"))) {
                $message = print_r($object, true);
            } else {
                $message = (string) $object;
            }

Is line 111 of vendor/slim/slim/Slim/View.php okay?
Should Closure be preceded by a slash?

Line 18 of src/Purchases.php should be like all the others:

$body = array();

@joe / @itronics:

From the PHP Manual Comments:

Using the 'set_exception_handler' function within a class, the defined 'exception_handler' method must be declared as 'public' (preferrable 'public static' if you use the "array('example', 'exception_handler')" syntax). It should be in an array as below:

<?php
class example {
    public function __construct() {
        @set_exception_handler(array('example', 'exception_handler'));
        throw new Exception('DOH!!');
    }

    public static function exception_handler($exception) {
        print "Exception Caught: ". $exception->getMessage() ."\n";
    }
}

$example = new example;

echo "Not Executed\n";
?>

Declaring the 'exception_handler' function as 'private' causes a FATAL ERROR.

Looks like every instance of exception handling within a class should be so coded for PHP 5.6 / 7.1.

Place the 3 files one by one and see which one is faulty.

I am unable to simulate your error. Please state what steps were necessary to trigger it. Make sure your tmp folder is writeable by your webserver process.

2,393

(86 replies, posted in Modules Add-on's)

Make the session_utils.inc file part of the API code. Will test and let you know.

Yes.

@itronics: please commit fixes in post #6 here.

There are 2 corrections in my post above.

The function exception_handler() is defined in includes/errors.inc file and is included in line 372 (before function usage) in includes/session.inc. So all are okay here.

Typo  - missing comma - in commit.

Alter line 76 in the file sales/includes/db/sales_delivery_db.inc:

            $delivery_line->price*$qty, 0, $delivery->tax_included

to:

            $delivery_line->price*$qty, 0, $delivery->tax_included,

Also terminate line 80 with a semicolon.

@itronics: please commit it.
@Alaa: Nice catch.

2,397

(86 replies, posted in Modules Add-on's)

@cambell: please provide one that is stripped of composer and unit tests so that the end user can deploy and extend without a steep learning / confusing curve. As Slim v2.x can be used without composer by using it's internal AutoLoad feature, all vendor dependencies can be eliminated.

Your release does not work.

You have removed the class SessionManager() in the session-custom.php (not updated to reflect this core commit) but referred to it in the code at line 46.

Also you are referring to a hardcoded non-existent file/folder name in the config_api.php file: _frontaccounting

You are referring to $rootPath but have initialised $rootpath in config_api.php - in fact it is sufficient for it to have just:

define('API_ROOT', '.');
define('FA_ROOT', './../..');

irrespective of whether it is hosted on Windows or on Linux to alleviate the effect of the DIRECTORY_SEPARATOR.

You will want to add in the following into an .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

Your api module just does not work. Tested in FA 2.4.3+, PHP 5.3.1.

So now we will have it uniformly as 11.905 in both Sales Delivery and Sales Invoice!

A search for the string "FIXME" in the entire codebase will popup several files!

2,399

(86 replies, posted in Modules Add-on's)

A tutorial on Slim REST API in general is attached.

@joe: Committed