1 (edited by miltonberle 07/24/2010 04:09:03 am)

Topic: cURL?

Hi Everyone, I wanted to ask a question to make sure that this isn't a horrible idea before I get started.

We would like to create some data entry forms. We are not going to modify or change the underlying structure of FA in any way, we are simply interested in data entry.

The rationale for this is to maximize efficiency. For example, we would like to  create a "point of sale" form where a user could do the following:
-create a new customer
-create the purchase of this customer
-create an invoice and
-make a payment on that newly created invoice.

This would all be accomplished in one fell swoop (in one screen). We believe we can accomplish this using cURL. The method is going to be to post data (cURL, etc.) to the appropriate FA pages pages and allow FA to do the processing. I have already accomplished an FA login using PHP and cURL (which admittedly is a small feat).

My question is, would this best be done in the no-javascript-mode? For example, I noticed a posted variable called "_random" with a value of "811931.0167524144". It seems like this is being created by javascript...

As an example, this is a form that was sent in order add a vendor:


Which was posted to:


I plan on turning off javascript and digging into this tomorrow. Anything else I should know about? Is this a really bad idea? We are only going to implement this for a few vital functions and use the default FA interface for everything else...

2 (edited by e-prast 07/24/2010 05:18:28 am)

Re: cURL?

-create a new customer
-create the purchase of this customer
-create an invoice and
-make a payment on that newly created invoice.

is'n that you can use the direct invoice tho achieve this at once?

3 (edited by bruzergear 07/24/2010 05:39:22 am)

Re: cURL?

If I were you, I would just create a new module for front accounting by copying the direct invoice module and then adding the necessary features you need for your new POS module to be complete.
When you finish it, we would love it if you shared it with the community that is really in need of a good POS feature in FA.

That way you don't have to mess with curl or worry about being outside of the frontaccounting system for compatibility, security, and future upgrades.

Re: cURL?

My thinking...

I like the idea of using modules as object to do a specific task.

If the code of a module is simply copied in another module and adapted to do more or something else, it could be a nightmare for those who have to maintain the code, having then many places to change code because a part a the functionality is spread in many places.

Related to jscript, cURL FAQ states that

3.14 Does curl support Javascript or PAC (automated proxy config)?
Many web pages do magic stuff using embedded Javascript. Curl and libcurl 
have no built-in support for that, so it will be treated just like any other 

.pac files are a netscape invention and are sometimes used by organizations 
to allow them to differentiate which proxies to use. The .pac contents is 
just a Javascript program that gets invoked by the browser and that returns 
the name of the proxy to connect to. Since curl doesn't support Javascript, 
it can't support .pac proxy configuration either. 

Some workarounds usually suggested to overcome this Javascript dependency: 
- Depending on the Javascript complexity, write up a script that 
translates it to another language and execute that. 
- Read the Javascript code and rewrite the same logic in another language. 
- Implement a Javascript interpreter, people have successfully used the 
Mozilla Javascript engine in the past. 
- Ask your admins to stop this, for a static proxy setup or similar.

That being said, I don't know what is the best way of reusing the code without copying it. cURL is certainly one of these ways.


5 (edited by miltonberle 07/25/2010 05:34:46 am)

Re: cURL?

e-prast and bruzergear: I might have to take a closer look at the direct sale feature. It may be exactly what we need for our POS needs.

huotg01: Yes, as you have noted, curl is a good way to reuse the existing code without any alterations. In that sense, curl is simply a novel way of interacting with the FA system.

For instance, I've used curl in the past to log in to sites and perform automated data entry tasks. The same thing would be going on here... it would be kind of like a data entry "macro."

I am going to have to dig a little deeper on the javascript issue and I'll report my findings. I also need to see if FA validates their form submissions with any types of token variables, although this should be a minor issue. I have seen this type of validation strategy in some aspx pages.

Re: cURL?

I think Direct Invoice is what you are looking for. Keep in mind that in case of need for entering new customer during invoice entry you can access customers editor by F4 key, then you can return to continue invoice editing.
The curl usage  idea looks interesting, but this seems to be complex way to achieve the effects. To emulate invoice entry with curl you have to call the page a couple of times, once for every item entered (items are stored in session variable on server side and not send back and forth from browser). But yes, you can use nearly all FA without javascript in fall back ui mode. To switch to non-javascript mode: switch off javascript in browser, logout and login to FA again.


Re: cURL?

Wow. Thanks for the great information itronics. That really gives me a better understanding of what is going on...