|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
Trying To Use The APII actually have a real life use for using webERP's API. We now have a
webshop, run by an external service company. Presently I look at the orders from the admin interface of the shop, and manually enter them into webERP. Not a long term solution. Hence, my interest in using the API to automate this. But I am having problems. First attempts are entirely just to have it display the manual entry for the API, just as the demo server at weberp.org does. This is using the CVS snapshot of a few hours ago - about 0600 GMT on 30 Oct 09. First error is with the file api_errorcodes.php. The following log entry happens: [Fri Oct 30 20:23:48 2009] [error] [client 192.168.9.17] PHP Fatal error: Call to undefined function _() in /srv/CVS/webERP-3.11/api/api_errorcodes.php on line 164 Line 164 in api_errorcodes.php is $ErrorDescription['1'] = _('No Authorisation'); It seems that the _(...) notation is not being understood. Removing those characters from line 164 moves the error to line 165. Removing all of them in that file, THAT specific error goes away, and things get further. IIRC, teh _(...) identifies strings for translation. Now, the problem is that it is attempting to connect to the weberpdemo database. Which I don't have installed. [The database is an older copy of the production database.] Looking in the code, the database name is hard coded. This is the file api/api_php.php, which includes the comment "Include session.inc, to allow database connection, and access to miscfunctions, and datefunctions." So, is this (hardwired database) just indicative of work in progress, or is there a "correct" version waiting to be added to CVS? Not a complaint, just a question. If there isn't, I'll start work on fixing it. Placing my database name in the script makes it all work happily! Lindsay P.S. I have file a bug in the Tracker relating to selecting the API manual page; it's a minor fix, and has been applied to my system before the above was done. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Web-erp-developers mailing list Web-erp-developers@... https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
|
|
Re: Trying To Use The APIHi Lindsay,
Yes the database has to be hard coded into api_php.php. It needs a better solution. Its one of those cases where hard coding it was good enough for the purposes I needed at the time. You are the second person to tell me recently that the gettext function doesn't work for them on the api. I take it that gettext is installed on that machine - It must be for webERP to work. Your solution was what I advised the other person to do. Thanks Tim 2009/10/30 Lindsay Harris <lindsay@...>: > I actually have a real life use for using webERP's API. We now have a > webshop, run by an external service company. Presently I look at > the orders from the admin interface of the shop, and manually enter > them into webERP. Not a long term solution. Hence, my interest in > using the API to automate this. > > But I am having problems. First attempts are entirely just to have it > display the manual entry for the API, just as the demo server at > weberp.org does. > > This is using the CVS snapshot of a few hours ago - about 0600 GMT on > 30 Oct 09. > > First error is with the file api_errorcodes.php. The following log > entry happens: > > [Fri Oct 30 20:23:48 2009] [error] [client 192.168.9.17] PHP Fatal > error: Call to undefined function _() > in /srv/CVS/webERP-3.11/api/api_errorcodes.php on line 164 > > Line 164 in api_errorcodes.php is > > $ErrorDescription['1'] = _('No Authorisation'); > > It seems that the _(...) notation is not being understood. Removing > those characters from line 164 moves the error to line 165. Removing > all of them in that file, THAT specific error goes away, and things > get further. IIRC, teh _(...) identifies strings for translation. > > Now, the problem is that it is attempting to connect to the weberpdemo > database. Which I don't have installed. [The database is an older > copy of the production database.] Looking in the code, the > database name is hard coded. This is the file api/api_php.php, which > includes the comment "Include session.inc, to allow database > connection, and access to miscfunctions, and datefunctions." > > So, is this (hardwired database) just indicative of work in progress, > or is there a "correct" version waiting to be added to CVS? Not a > complaint, just a question. If there isn't, I'll start work on > fixing it. Placing my database name in the script makes it all work > happily! > > Lindsay > > P.S. I have file a bug in the Tracker relating to selecting the API > manual page; it's a minor fix, and has been applied to my system > before the above was done. > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Web-erp-developers mailing list > Web-erp-developers@... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Web-erp-developers mailing list Web-erp-developers@... https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
|
|
Re: Trying To Use The APITim,
For my present purposes, both temporary solutions are fine. I may have some time over the weekend to look into a proper fix for the database name. Also on the agenda is figuring out how to use the API. My initial thoughts were to have a command line program (oh the humanity!) to read the CVS formatted file we are supposedly going to be receiving with all the transaction data. Under those circumstances, there might need to be an API call to specify the DB name and user credentials. I haven't given this much thought yet, so think of this as very preliminary planning. I have remained blissfully ignorant of gettext(), but now is probably a reasonable time to find out more. Thanks for the prompt response, Lindsay On Fri, 30 Oct 2009 21:25:16 Tim Schofield wrote: > Hi Lindsay, > > Yes the database has to be hard coded into api_php.php. It needs a > better solution. Its one of those cases where hard coding it was > good enough for the purposes I needed at the time. > > You are the second person to tell me recently that the gettext > function doesn't work for them on the api. I take it that gettext > is installed on that machine - It must be for webERP to work. Your > solution was what I advised the other person to do. > > Thanks > Tim > > 2009/10/30 Lindsay Harris <lindsay@...>: > > I actually have a real life use for using webERP's API. We now > > have a webshop, run by an external service company. Presently > > I look at the orders from the admin interface of the shop, and > > manually enter them into webERP. Not a long term solution. > > Hence, my interest in using the API to automate this. > > > > But I am having problems. First attempts are entirely just to > > have it display the manual entry for the API, just as the demo > > server at weberp.org does. > > > > This is using the CVS snapshot of a few hours ago - about 0600 > > GMT on 30 Oct 09. > > > > First error is with the file api_errorcodes.php. The following > > log entry happens: > > > > [Fri Oct 30 20:23:48 2009] [error] [client 192.168.9.17] PHP > > Fatal error: Call to undefined function _() > > in /srv/CVS/webERP-3.11/api/api_errorcodes.php on line 164 > > > > Line 164 in api_errorcodes.php is > > > > $ErrorDescription['1'] = _('No Authorisation'); > > > > It seems that the _(...) notation is not being understood. > > Removing those characters from line 164 moves the error to line > > 165. Removing all of them in that file, THAT specific error > > goes away, and things get further. IIRC, teh _(...) identifies > > strings for translation. > > > > Now, the problem is that it is attempting to connect to the > > weberpdemo database. Which I don't have installed. [The > > database is an older copy of the production database.] Looking > > in the code, the database name is hard coded. This is the file > > api/api_php.php, which includes the comment "Include session.inc, > > to allow database connection, and access to miscfunctions, and > > datefunctions." > > > > So, is this (hardwired database) just indicative of work in > > progress, or is there a "correct" version waiting to be added to > > CVS? Not a complaint, just a question. If there isn't, I'll > > start work on fixing it. Placing my database name in the script > > makes it all work happily! > > > > Lindsay > > > > P.S. I have file a bug in the Tracker relating to selecting the > > API manual page; it's a minor fix, and has been applied to my > > system before the above was done. > > > > ----------------------------------------------------------------- > >------------- Come build with us! The BlackBerry(R) Developer > > Conference in SF, CA is the only developer event you need to > > attend this year. Jumpstart your developing skills, take > > BlackBerry mobile applications to market and stay ahead of the > > curve. Join us from November 9 - 12, 2009. Register now! > > http://p.sf.net/sfu/devconference > > _______________________________________________ > > Web-erp-developers mailing list > > Web-erp-developers@... > > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > ------------------------------------------------------------------- >----------- Come build with us! The BlackBerry(R) Developer > Conference in SF, CA is the only developer event you need to attend > this year. Jumpstart your developing skills, take BlackBerry mobile > applications to market and stay ahead of the curve. Join us from > November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Web-erp-developers mailing list > Web-erp-developers@... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Web-erp-developers mailing list Web-erp-developers@... https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
|
|
Re: Trying To Use The APIYou got a lot further than I did! I tried to use the API's from the regular distribution (not the CVS) and it failed with SQL errors (bad column name in the www_users table). After I 'fixed' that - by dropping the offending column, I couldnt get past the database authorization stuff.
Is the trick to use the CVS version of the API? Does that work with the API sample programs? Our goal is to automate as much of the day to day work as we can via the API and only use the online portion of the system for individual lookups, error corrections, etc. Is that viable? |
|
|
Re: Trying To Use The APIHi, I am using the api in a number of "live" implementations around
the world. However getting it working can be something of a black art. :) I tend to add functionality to it either when I need it, or someone specifically asks for it. I can always help with problems if you need it. Thanks Tim 2009/10/30 royce <royce@...>: > > You got a lot further than I did! I tried to use the API's from the regular > distribution (not the CVS) and it failed with SQL errors (bad column name in > the www_users table). After I 'fixed' that - by dropping the offending > column, I couldnt get past the database authorization stuff. > > Is the trick to use the CVS version of the API? Does that work with the API > sample programs? > > Our goal is to automate as much of the day to day work as we can via the API > and only use the online portion of the system for individual lookups, error > corrections, etc. Is that viable? > > > -- > View this message in context: http://old.nabble.com/Trying-To-Use-The-API-tp26127650p26128802.html > Sent from the web-erp-developers mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Web-erp-developers mailing list > Web-erp-developers@... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Web-erp-developers mailing list Web-erp-developers@... https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
|
|
Re: Trying To Use The APIHi there, thanks for your quick response! We would really like to be able to use the API, I guess our only other alternative would be to do manual INSERT's to the db, but we would rather use the API if it is stable. As I said in my initial post, my 1st error was an incorrect column ,accesslevel, int the www_users table in api_php.php:
$sql = "SELECT userid, accesslevel FROM www_users WHERE userid='" . DB_escape_string($user) . "' AND (password='" . CryptPass(DB_escape_string($password)) . "' OR password='" . DB_escape_string($password) . "')"; That column doesn't exist in my version of the db - I downloaded webERP for the 1st time this week, so I'm not sure which is correct (the table or the program). After I deleted the accesslevel column from the query, I still couldn't get anything to work - I think it is related to not having correct values in the $_SESSION array because I was getting NoAuthorisation messages in the debug. I am using the default db/pw values for our intranet testing. I tried to follow the example in the wiki but not having any luck so far, ;-( Also, assuming I can get the API to work, we will need a SupplierInvoice function - I don't see such a call, or did I miss it? Thanks for any help and a great product! royce
|
|
|
Re: Trying To Use The APIFixed the _() missing function issue!
In api/api_php.php, move the line include 'api_errorcodes.php'; to AFTER include($PathPrefix.'includes/session.inc'); That's about line 11 (in the official 3.11 release, not the CVS, though I think this file is identical between the two). I haven't really explored WHY that fixes things, but it seems some of the gettext() stuff needs to be included and/or defined before using the _(...) notation. Lindsay On Fri, 30 Oct 2009 21:13:29 Lindsay Harris wrote: > I actually have a real life use for using webERP's API. We now > have a webshop, run by an external service company. Presently I > look at the orders from the admin interface of the shop, and > manually enter them into webERP. Not a long term solution. Hence, > my interest in using the API to automate this. > > But I am having problems. First attempts are entirely just to have > it display the manual entry for the API, just as the demo server > at weberp.org does. > > This is using the CVS snapshot of a few hours ago - about 0600 GMT > on 30 Oct 09. > > First error is with the file api_errorcodes.php. The following log > entry happens: > > [Fri Oct 30 20:23:48 2009] [error] [client 192.168.9.17] PHP Fatal > error: Call to undefined function _() > in /srv/CVS/webERP-3.11/api/api_errorcodes.php on line 164 > > Line 164 in api_errorcodes.php is > > $ErrorDescription['1'] = _('No Authorisation'); > > It seems that the _(...) notation is not being understood. > Removing those characters from line 164 moves the error to line > 165. Removing all of them in that file, THAT specific error goes > away, and things get further. IIRC, teh _(...) identifies > strings for translation. > > Now, the problem is that it is attempting to connect to the > weberpdemo database. Which I don't have installed. [The database > is an older copy of the production database.] Looking in the > code, the database name is hard coded. This is the file > api/api_php.php, which includes the comment "Include session.inc, > to allow database connection, and access to miscfunctions, and > datefunctions." > > So, is this (hardwired database) just indicative of work in > progress, or is there a "correct" version waiting to be added to > CVS? Not a complaint, just a question. If there isn't, I'll > start work on fixing it. Placing my database name in the script > makes it all work happily! > > Lindsay > > P.S. I have file a bug in the Tracker relating to selecting the > API manual page; it's a minor fix, and has been applied to my > system before the above was done. > > ------------------------------------------------------------------- >----------- Come build with us! The BlackBerry(R) Developer > Conference in SF, CA is the only developer event you need to attend > this year. Jumpstart your developing skills, take BlackBerry mobile > applications to market and stay ahead of the curve. Join us from > November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Web-erp-developers mailing list > Web-erp-developers@... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Web-erp-developers mailing list Web-erp-developers@... https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
|
|
Re: Trying To Use The APIMuch progress to report. I was trying to get GetStockBalance API to
work. After much probing and comparing, it transpires that the "db" function in api_php.php is broken, in several ways. The initial SQL to lookup the user failed as the name of the column with access codes was incorrect. Then the allowed security tokens lookup also failed as the database variable was invalid. All fixed now, and I've attached the modified function to this email. I'm presuming this list allows attachments :) Lindsay On Fri, 30 Oct 2009 21:13:29 Lindsay Harris wrote: > I actually have a real life use for using webERP's API. We now > have a webshop, run by an external service company. Presently I > look at the orders from the admin interface of the shop, and > manually enter them into webERP. Not a long term solution. Hence, > my interest in using the API to automate this. > > But I am having problems. First attempts are entirely just to have > it display the manual entry for the API, just as the demo server > at weberp.org does. > > This is using the CVS snapshot of a few hours ago - about 0600 GMT > on 30 Oct 09. > > First error is with the file api_errorcodes.php. The following log > entry happens: > > [Fri Oct 30 20:23:48 2009] [error] [client 192.168.9.17] PHP Fatal > error: Call to undefined function _() > in /srv/CVS/webERP-3.11/api/api_errorcodes.php on line 164 > > Line 164 in api_errorcodes.php is > > $ErrorDescription['1'] = _('No Authorisation'); > > It seems that the _(...) notation is not being understood. > Removing those characters from line 164 moves the error to line > 165. Removing all of them in that file, THAT specific error goes > away, and things get further. IIRC, teh _(...) identifies > strings for translation. > > Now, the problem is that it is attempting to connect to the > weberpdemo database. Which I don't have installed. [The database > is an older copy of the production database.] Looking in the > code, the database name is hard coded. This is the file > api/api_php.php, which includes the comment "Include session.inc, > to allow database connection, and access to miscfunctions, and > datefunctions." > > So, is this (hardwired database) just indicative of work in > progress, or is there a "correct" version waiting to be added to > CVS? Not a complaint, just a question. If there isn't, I'll > start work on fixing it. Placing my database name in the script > makes it all work happily! > > Lindsay > > P.S. I have file a bug in the Tracker relating to selecting the > API manual page; it's a minor fix, and has been applied to my > system before the above was done. > > ------------------------------------------------------------------- >----------- Come build with us! The BlackBerry(R) Developer > Conference in SF, CA is the only developer event you need to attend > this year. Jumpstart your developing skills, take BlackBerry mobile > applications to market and stay ahead of the curve. Join us from > November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Web-erp-developers mailing list > Web-erp-developers@... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers /* Get weberp authentication, and return a valid database connection */ function db($user, $password) { $_SESSION['UserID'] = $user; $sql = "SELECT fullaccess FROM www_users WHERE userid='" . DB_escape_string($user) . "' AND (password='" . CryptPass(DB_escape_string($password)) . "' OR password='" . DB_escape_string($password) . "')"; $Auth_Result = DB_query($sql, $_SESSION['db']); $myrow=DB_fetch_row($Auth_Result); if (DB_num_rows($Auth_Result) > 0) { $_SESSION['AccessLevel'] = $myrow[0]; $sql = 'SELECT tokenid FROM securitygroups WHERE secroleid = ' . $_SESSION['AccessLevel']; $Sec_Result = DB_query($sql, $_SESSION['db']); $_SESSION['AllowedPageSecurityTokens'] = array(); if (DB_num_rows($Sec_Result)==0){ return NoAuthorisation; } else { $i=0; while ($myrow = DB_fetch_row($Sec_Result)){ $_SESSION['AllowedPageSecurityTokens'][$i] = $myrow[0]; $i++; } } return $_SESSION['db']; } else { return NoAuthorisation; } } ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Web-erp-developers mailing list Web-erp-developers@... https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
|
|
Re: Trying To Use The APIThanks Lindsay, I have updated cvs with both of your fixes.
Tim 2009/10/31 Lindsay Harris <lindsay@...>: > Much progress to report. I was trying to get GetStockBalance API to > work. After much probing and comparing, it transpires that the "db" > function in api_php.php is broken, in several ways. > > The initial SQL to lookup the user failed as the name of the column > with access codes was incorrect. Then the allowed security tokens > lookup also failed as the database variable was invalid. All fixed > now, and I've attached the modified function to this email. I'm > presuming this list allows attachments :) > > Lindsay > > On Fri, 30 Oct 2009 21:13:29 Lindsay Harris wrote: >> I actually have a real life use for using webERP's API. We now >> have a webshop, run by an external service company. Presently I >> look at the orders from the admin interface of the shop, and >> manually enter them into webERP. Not a long term solution. Hence, >> my interest in using the API to automate this. >> >> But I am having problems. First attempts are entirely just to have >> it display the manual entry for the API, just as the demo server >> at weberp.org does. >> >> This is using the CVS snapshot of a few hours ago - about 0600 GMT >> on 30 Oct 09. >> >> First error is with the file api_errorcodes.php. The following log >> entry happens: >> >> [Fri Oct 30 20:23:48 2009] [error] [client 192.168.9.17] PHP Fatal >> error: Call to undefined function _() >> in /srv/CVS/webERP-3.11/api/api_errorcodes.php on line 164 >> >> Line 164 in api_errorcodes.php is >> >> $ErrorDescription['1'] = _('No Authorisation'); >> >> It seems that the _(...) notation is not being understood. >> Removing those characters from line 164 moves the error to line >> 165. Removing all of them in that file, THAT specific error goes >> away, and things get further. IIRC, teh _(...) identifies >> strings for translation. >> >> Now, the problem is that it is attempting to connect to the >> weberpdemo database. Which I don't have installed. [The database >> is an older copy of the production database.] Looking in the >> code, the database name is hard coded. This is the file >> api/api_php.php, which includes the comment "Include session.inc, >> to allow database connection, and access to miscfunctions, and >> datefunctions." >> >> So, is this (hardwired database) just indicative of work in >> progress, or is there a "correct" version waiting to be added to >> CVS? Not a complaint, just a question. If there isn't, I'll >> start work on fixing it. Placing my database name in the script >> makes it all work happily! >> >> Lindsay >> >> P.S. I have file a bug in the Tracker relating to selecting the >> API manual page; it's a minor fix, and has been applied to my >> system before the above was done. >> >> ------------------------------------------------------------------- >>----------- Come build with us! The BlackBerry(R) Developer >> Conference in SF, CA is the only developer event you need to attend >> this year. Jumpstart your developing skills, take BlackBerry mobile >> applications to market and stay ahead of the curve. Join us from >> November 9 - 12, 2009. Register now! >> http://p.sf.net/sfu/devconference >> _______________________________________________ >> Web-erp-developers mailing list >> Web-erp-developers@... >> https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > Web-erp-developers mailing list > Web-erp-developers@... > https://lists.sourceforge.net/lists/listinfo/web-erp-developers > > ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Web-erp-developers mailing list Web-erp-developers@... https://lists.sourceforge.net/lists/listinfo/web-erp-developers |
| Free embeddable forum powered by Nabble | Forum Help |