Download - 2011 January « Fugo Consulting
-
8/12/2019 2011 January Fugo Consulting
1/12
-
8/12/2019 2011 January Fugo Consulting
2/12
19/01/13 2011 January Fugo Consulting
fugoconsulting.wordpress.com/2011/01/ 2/12
The crudeness of the solution shows up, as the number of columns in TABLE-2 increases. SQR packs a beautiful technique for dynamic column
references. With this technique, the UPDATE-TABLE-2 procedure is compressed and light-weighted as show below:
Any variable surrounded by square brackets [] is treated as database column in a SQL statement.
Filed under PeopleSoftTagged with column, dynamic, SQR
Connecting to postgres database in java code
January 10, 2011 by Shankar BalachandranLeave a comment
To connect your Java program with Postgresql driver, add the Postgresql library jar (postgresql-jdbc3-8.2.jar or any current jar file) file in the
libraries. Then the following code can be modified for your particular database and table.
Filed under OpenbravoTagged with Postgres JDBC Connection
Email Validation using Callouts in Openbravo
10 end-if11
12 IF &FIELD = 'DEPTID'13 Begin-SQL
14 UPDATETABLE-2
15 SETDEPTID = &VALUE16 WHEREEMPLID = &EMPLID
17 ANDEFFDT = &EFFDT18 End-SQL
19 end-if20
21 !...andcontinuetocreatean IF condition each forCOMPANY, JOBCODE, COMPRATE etc.22
23 END-PROCEDURE
01 BEGIN-PROCEDUREUPDATE-TABLE-202
03 Begin-SQL04 UPDATETABLE-2
05 SET[&FIELD] = &VALUE
06 WHEREEMPLID = &EMPLID07 ANDEFFDT = &EFFDT
08 End-SQL09
10 END-PROCEDURE
01 packagejavaapplication1;
02 importjava.sql.*;03 /**
04 *
05 * @author shankar06 */07 publicclassMain {
08 09 /**
10 * @param args the command line arguments11 */
12 publicstaticvoidmain(String[] args) {13 // TODO code application logic here
14 System.out.println("-------- PostgreSQL JDBC Connection Testing ------------");
15 16 try{
17 Class.forName("org.postgresql.Driver");18 Connection connection = null;
19 connection = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/sample","postgres", "postgres");20 if(connection != null)
21 {22
23 24
25 String query="select ad_alert_id from ad_alert";26 ResultSet rs=s.executeQuery(query);
27 while(rs.next())28 {
29 System.out.print(" "+rs.getString(1));
30 }31
32 33 }
34 else
35 System.out.println("Connection Failed!");
36 }37 catch(Exception e){
38 e.printStackTrace();39 }
40
41 }42 }
http://postgresql//127.0.0.1:5432/samplehttp://fugoconsulting.wordpress.com/2011/01/10/email-validation-using-callouts-in-openbravo/http://fugoconsulting.wordpress.com/tag/postgres-jdbc-connection/http://fugoconsulting.wordpress.com/category/openbravo/http://fugoconsulting.wordpress.com/2011/01/10/connecting-to-postgres-database-in-java-code/#respondhttp://fugoconsulting.wordpress.com/author/shaanjus4u/http://fugoconsulting.wordpress.com/2011/01/10/connecting-to-postgres-database-in-java-code/http://fugoconsulting.wordpress.com/tag/sqr/http://fugoconsulting.wordpress.com/tag/dynamic/http://fugoconsulting.wordpress.com/tag/column/http://fugoconsulting.wordpress.com/category/peoplesoft/ -
8/12/2019 2011 January Fugo Consulting
3/12
-
8/12/2019 2011 January Fugo Consulting
4/12
19/01/13 2011 January Fugo Consulting
fugoconsulting.wordpress.com/2011/01/ 4/12
decided to go through that route..:)
I went through a lot of hardships, but nevertheless the result was satisfying and i wanted to bring you that. There is a Eclipse installation Manual
(http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Development_Environment/Setting_up_Development_Environment_with_Eclipse_IDE ),
but I can assure you that with that link, its bound to take you at least 2 days to complete the installation. So am I going to provide something better
than what the Openbravo guys did? Na Na..:) I am just going to shrink and stay up to the point, so that you can have it up and running in a single day.
Importing Openbravo in Eclipse can be subdivided into the following sections.
1. Eclipse setup and configuration
2. Openbravo import and setup
3. Tomcat server and setup
1. Eclipse Setup and configuration:
We can download eclipse from, http://www.eclipse.org/downloads/packages/release/galileo/sr2. Make sure you download the EE version so that
most packages are already available. The following are the architectural elements that are needed for Openbravo to run.
1. Subclipse
2. Mercurial
3. Openarchitectureware (for template changes in core)
So once you have downloaded and installed eclipse (its just a click and choose process), you will have the IDE that resembles something like this..:)
Now we have installed eclipse successfully. First hurdle crossed. Next to add the above listed elements(plugins), go to Help -> Install New Software.
Here click the Add Button and provide the following link in the Location Field. http://subclipse.tigris.org/update_1.4.x. In the Name field Provide
subclipseor anything for your reference. Then give Next, next and choose finish to install it. Once this is complete eclipse will be restarted. Next lets
install Mercurial. For this Use the same Install New Software under Help and use the Add Button to add the Following URL in the Location Field,
http://subclipse.tigris.org/update_1.4.x.
Once you provide that, you will get a window similar to that.
If you are installing in ubuntu you can uncheck the windows binaries. Then click next and give finish. The same is to be followed for installing
Openarchitectureware, using the following URL, http://www.openarchitectureware.org/updatesite/milestone/site.xml. Once Eclipse is installed, our
next step is to import Openbravo.
2. Openbravo import and setup
Go to File -> New -> Other and in the window thatpops out choose Mercurial and the sub option as Clone from Existing Repository. Provide the
URL from which you want to clone. If there is no repository, use File -> Import and choose the source folder of Openbravo. Then right click the
Project folder and choose Properties. In the source tab add the following folders.
1. src folders of your modules and openbravo src folder
2. src-test folders of your modules and openbravo src-test folder
3. src-gen folder
4. src-core->src5. src-wad->src
6. src-wad->build->javasqlc->src
7. src-trl->src
8. src-trl->build->javasqlc->src
http://www.openarchitectureware.org/updatesite/milestone/site.xmlhttp://subclipse.tigris.org/update_1.4.xhttp://subclipse.tigris.org/update_1.4.xhttp://www.eclipse.org/downloads/packages/release/galileo/sr2http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Development_Environment/Setting_up_Development_Environment_with_Eclipse_IDE -
8/12/2019 2011 January Fugo Consulting
5/12
19/01/13 2011 January Fugo Consulting
fugoconsulting.wordpress.com/2011/01/ 5/12
Add the following libraries in the library tab.
1. lib->runtime
2. lib->build
3. src-db->database->lib
Refresh the project. Next step is to compile this application.
To add ant commands go to Run-> External Tools -> External Tools Configurations. Then double click, Ant Build and then you can find a screen
as follows.
-
8/12/2019 2011 January Fugo Consulting
6/12
19/01/13 2011 January Fugo Consulting
fugoconsulting.wordpress.com/2011/01/ 6/12
So you can add new tasks using the small new button and add as many tasks as you want. You just have to give path as provided in Main Tab. And
tick the appropriate task in the Targets Tab. Openbravo is configured..:)
3. Tomcat server and setup
To add tomcat 6.-0 server, go to File -> New -> Other and choose tomcat 6.0 as the server and map the corresponding tomcat folder. And then
add openbravo to it and give finish.
The eclipse would now appear as follows.
-
8/12/2019 2011 January Fugo Consulting
7/12
19/01/13 2011 January Fugo Consulting
fugoconsulting.wordpress.com/2011/01/ 7/12
Note Openbravo attached to tomcat server. Now you can right click the project and choose Run -> run on server to deploy Openbravo. Done.
Openbravo will be up and running..:)
Happy working..:)
Filed under OpenbravoTagged with Eclipse Configuration for Openbravo, Openbravo 3.0, Openbravo in Eclipse
Displaying Images in Openbravo
January 5, 2011 by Shankar Balachandran4 Comments
A picture speaks thousand words. Images are one of the key features of any ERP System. Specially in a feature rich application like Openbravo,
images would add more beauty to the window..:) Openbravo provides a table called ad_image that saved image in the form of binary data or in the
form of URL. Now in general when you want the reference data from some other table in Openbravo, we use the tabledir to provide direct table
mapping or table reference to reference data. For basics on References, refer here. Also for creating external references, refer [1]and [2]. But in the
case of ad_image table if you reference it as tabledir, it just comes as a dropdown as attached below.
But that does not show the true power of the image table. To display an image in the grid view and pen view, the reference type of the respectivecolumn should be set as Image BLOB. Then the image will be displayed as shown in the screen-shot below. Whatever the features an application
has, User Interface is the main factor that decides the success of it, and I guess subtle things like this will enhance the look and feel of the application a
little more..:)
Attached below is the screen shot of the column where image is mapped. Size of the image can be anything..:) since it stores binary data, I gave such
high values
http://fugoconsulting.wordpress.com/2011/06/17/htmlarea-in-openbravo/http://fugoconsulting.wordpress.com/2011/03/24/radio-button-reference-for-openbravo/http://fugoconsulting.wordpress.com/2011/06/29/reference-types-in-openbravo/http://fugoconsulting.wordpress.com/2011/01/05/displaying-images-in-openbravo/#commentshttp://fugoconsulting.wordpress.com/author/shaanjus4u/http://fugoconsulting.wordpress.com/2011/01/05/displaying-images-in-openbravo/http://fugoconsulting.wordpress.com/tag/openbravo-in-eclipse/http://fugoconsulting.wordpress.com/tag/openbravo-3-0/http://fugoconsulting.wordpress.com/tag/eclipse-configuration-for-openbravo/http://fugoconsulting.wordpress.com/category/openbravo/ -
8/12/2019 2011 January Fugo Consulting
8/12
19/01/13 2011 January Fugo Consulting
fugoconsulting.wordpress.com/2011/01/ 8/12
Filed under OpenbravoTagged with BLOB type in Openbravo, Images in Openbravo
Restoration of Openbravo Environment
January 5, 2011 by Shankar BalachandranLeave a comment
All of us depend on backup most of the time. Thats one side-effect of innovative product development. Sometimes when our imagination unfolds in
the form of thousands of ideas, the first thing that suffers is the application coz its new for it and the last thing is you got to restore it..:) Sometimes we
do development in one environment and recreate the environment elsewhere. I will present how I did it for Openbravo in ubuntu. Openbravo in
ubuntu has two parts. One if the folder structure and the other of course is the database. I use postgres as database because of the simple reason that
its free. So the first step is i need a backup or a dump of the database. If you have pgadmin installed this is a easier task. Just right click on your
database, and choose backup. In the options that present before you, choose the plain option. This option is to create a backup in plain text format
that you can see. You can almost sense whats there in that dump with the plain format backup.
Now if you dont use pgadmin then use the command
pg_dump -U postgres dbname > nameofbackupfile for more doubts in this, visit this link http://www.postgresql.org/docs/8.1/static/app-
pgdump.html.
We have our database copy now. Next step is copy your current folder structure and transfer it to the destination machine. Next step is restoring the
database. This command is really simple..:)
psql -U postgres -d newdb_name -f path_of_backupfile . Note that you need to create an empty database before restoring into that..:) i forgot
his once, so only added this. Next thing there is option restore in Pgadmin but sadly that does not work for plain type database dump that we took.
So we now have a database and folder structure. next step is modify the openbravo properties file and set the source directory and database name
accordingly(refer obwiki for these stuffs if u have doubts, or i ll put another blog about openberavo properties..:) ). So after modifying the
properties file, just go ahead and do a complete build and you have the openbravo ready in your new environmentrevert back with questions if youhave any, in fact i am waiting for many:)
Filed under OpenbravoTagged with Openbravo Migration, Openbravo Restoration, Postgres Restore
Getting window and menu details from table name
January 5, 2011 by Shankar BalachandranLeave a comment
Hi Folks,
Its quite a tedious task in Openbravo to find a table associated with a window and to find the window , tab and menu for a given table. I have written
a small function to provide the window name and menu names given a table name.
01 CREATEORREPLACEFUNCTIONget_details(tab_name charactervarying)02 RETURNSvoid AS
03 $BODY$ DECLARE
04 window_id varchar(32);
05 window_name varchar(100);06 menu_id varchar(32);
07 tmp_men varchar(100);
http://fugoconsulting.wordpress.com/2011/01/05/getting-window-and-menu-details-from-table-name/#respondhttp://fugoconsulting.wordpress.com/author/shaanjus4u/http://fugoconsulting.wordpress.com/2011/01/05/getting-window-and-menu-details-from-table-name/http://fugoconsulting.wordpress.com/tag/postgres-restore/http://fugoconsulting.wordpress.com/tag/openbravo-restoration/http://fugoconsulting.wordpress.com/tag/openbravo-migration/http://fugoconsulting.wordpress.com/category/openbravo/http://www.postgresql.org/docs/8.1/static/app-pgdump.htmlhttp://fugoconsulting.wordpress.com/2011/01/05/restoration-of-openbravo-environment/#respondhttp://fugoconsulting.wordpress.com/author/shaanjus4u/http://fugoconsulting.wordpress.com/2011/01/05/restoration-of-openbravo-environment/http://fugoconsulting.wordpress.com/tag/images-in-openbravo/http://fugoconsulting.wordpress.com/tag/blob-type-in-openbravo/http://fugoconsulting.wordpress.com/category/openbravo/ -
8/12/2019 2011 January Fugo Consulting
9/12
19/01/13 2011 January Fugo Consulting
fugoconsulting.wordpress.com/2011/01/ 9/12
provide the table name as argument for the function and run it in pgadmin using select.
eg. select get_details(c_order)
Hope its helpful to you. We will soon publish a way to integrate it within the application itself..:)
Happy Working
Filed under OpenbravoTagged with openbravo menu information from table name, window details from table
Openbravo ERP 2.50 installation steps in ubuntu (default installation)
January 5, 2011 by Shankar Balachandran3 Comments
Hi Folks,
There are n number of ways presented in Openbravo community to try or work with Openbravo ERP. But I felt most of them were too big for
08 menu_name varchar(100)[];09 par_id varchar(32);10 i numeric;
11 j numeric;12 Menu varchar(250);
13
14 BEGIN
15 i:=0;
16 j:=0;17 Menu:='Menu : Openbravo';
18 19 ---- get window corresponding to table
20 21 Raise Notice '----------------------Table Details----------------------';
22 Raise Notice 'Table Name : %',tab_name;23
24 selecta.ad_window_id,b.nameintowindow_id,window_name25 fromad_table a,ad_window b wherea.tablename=tab_name anda.ad_window_id=b.ad_window_id;
26 27 Raise Notice '----------------------Window Details----------------------';
28 Raise Notice 'Window Id Mapped : %',window_id;
29 Raise Notice 'Window Mapped : %',window_name;30
31 selectad_menu_id,nameintomenu_id,tmp_men32 fromad_menu wheread_window_id=window_id;
33 menu_name[i]=tmp_men;34
35 Raise Notice '----------------------Menu Details----------------------';36 Raise Notice 'Menu Id : % ',menu_id;
37 Raise Notice 'Menu Name : % ',menu_name[i];38
39 selectparent_id intopar_id fromad_treenode wherenode_id=menu_id;
40 41 while notpar_id='0'loop
42 i:=i+1;43 Raise Notice '';
44 45 Raise Notice '----------------------Parent Menu Details----------------------';
46 Raise Notice '';47 Raise Notice 'Above Parent id %',par_id;
48 49 selectad_menu_id,nameintomenu_id,tmp_men fromad_menu wheread_menu_id=par_id;
50 menu_name[i]=tmp_men;51
52 Raise Notice 'Level % Menu Name %',i,menu_name[i];53 selectparent_id intopar_id fromad_treenode wherenode_id=menu_id;
54 --Raise Notice 'Above Parent id %',par_id;55 endloop;
56
57 Raise Notice '----------------------Results----------------------';
58 Raise Notice '';59 --Raise Notice 'Level % is the summary level menu and its name is %',i,menu_name[i];60 Raise Notice 'Reqiured Menu is %',menu_name[0];
61 Raise Notice '';62
63 while noti