Management with OOo

March 5th, 2011 1 comment

There are often requests for information on the Italian forum for the creation of management on OOo. I state that OOo is not suitable for management to create, because its function is to office automation, and provides no function to those wishing to engage in this particular field of application.
But … There will be something of managerial galore, now you do it with whatever happens to your hands, then what harm is there in trying? I do not do it for sure, even though I put my hands for a while, and I realized that OOo is convenient for very specific uses, I mean for those who need to use 5% of the functionality of a management (there are still many companies in this condition, since on average companies in Italy have 4 employees).
So, for those who want to try, put down a bit ‘of ideas and opinions, as well as a bit’ code.

For starters, the extension Toools (you know that OOo can install a very simple, the additional programs, right? Look at the site of extensions if you have not already seen it) allows you to manage master data (customers, suppliers, payments, etc..) and to create documents (invoices and credit notes), except for a gantt programming activities, which now do not care .
It ‘so much as a basic management (there are not even DDT), but someone could do so, and that’s fine as an example.

The first step is to develop the database, I would say that it is useful to consider how to structure a database, and a text which I found very useful was this:

Categories: Base, Extensions, Macros Tags:

From MySQL to PostgreSQL: why?

December 15th, 2010 1 comment

I migrated the last database created from MySQL to PostgreSQL for one reason only, but enough to prove the correctness of the claim of PGSQL: “The most advanced open source database exists” is not possible in MySQL to create a trigger (ie a function that is made every insert / update / delete a record) that changes the outcome of the executed query (at least I did not succeed and I have found artifacts at several sites that say you can not do that, for a long time).
The function of this trigger is inserted rows numbered from 1 onwards, given that it is a sub-form, so the id of the record is not useful.

The trigger on PGSQL is as follows:
CREATE OR REPLACE FUNCTION edil.incr_pos ()
RETURNS trigger AS
$ BODY $
DECLARE
v_pos RECORD;
rec integer;
BEGIN
SELECT INTO can v_pos FROM edil.prev_articoli
WHERE id_prev_prodotti = NEW.id_prev_prodotti
ORDER BY pos DESC LIMIT 1;
rec: = v_pos.pos +1;
IF rec IS NULL THEN
rec = 1;
END IF;
NEW.pos: = rec;
RETURN NEW;
END

and runs quietly.
While no equivalent in MySQL:
CREATE TRIGGER `edil`.`pos_prod`
BEFORE INSERT ON `edil`.`prev_prodotti`
FOR EACH ROW
BEGIN
SET NEW.pos = (SELECT MAX(prev_prodotti.pos) FROM edil.prev_prodotti AS prev_prodotti )+ 1;
END

(of course it looks a bit 'different ;-) )

This could shows that MySQL does not have development updates, only maintenance.

Categories: Uncategorized Tags:

How-to FastMailMerge

November 20th, 2010 No comments

The first part of the video is for a “circular” mail (not a real mail-merge), while the second is for a mail-merge.

Categories: Extensions Tags:

Innovation project

October 15th, 2010 No comments

Stumble this site www.innosupport.net that speaks of innovation companies (not related to OOo / Libo, but is subject to the site :D ) and is really good.

Categories: Uncategorized Tags:

Managing documents and images

October 11th, 2010 No comments

A database model for managing documents and images.
It works like this:
1. select a default directory where files will be saved programmatically;
2. save the file you want;
3. open the file with the function key from the saved route.

Download qui.

Categories: Modelli Tags:

Un componente in Python per OOo

October 11th, 2010 No comments

For those delights with Python, I’m experimenting with the creation of add-ons for OOo, as explained in some guides like this, and I must say that it is a process as complex as it seems at first sight.

Python meanwhile was gorgeous and rich, I hope to have more time to use it in future. Create services at will is also very useful. For example, the following script sendMail.py (bold steps leading to the creation of the service) can be implemented in OOo as a service:

import smtplib
import uno
import unohelper
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from it.icstools.fastmailmerge import XFMM

# Open a plain text file for reading. For this example, assume that
# the text file contains only ASCII characters.
class MailImpl( unohelper.Base, XFMM ):
def __init__( self, ctx ):
self.ctx = ctx

def sendMimeMail(self, fileUrl):
textfile = fileUrl
fp = open(textfile, ‘rb’)
# Create a text/plain message
msg = MIMEMultipart()
mimetext = MIMEText(fp.read())
msg.attach(mimetext)
fp.close()
me = ‘sergiocorato at gmail.com’
you = ‘icstools at icstools.it’
# me == the sender’s email address
# you == the recipient’s email address
msg['Subject'] = ‘subject’
msg['From'] = me
msg['To'] = you

# Send the message via our own SMTP server, but don’t include the
# envelope header.
s = smtplib.SMTP(‘smtp.tre.it’,’25′)
s.sendmail(me, you, msg.as_string())
s.quit()
return None

#g_exportedScripts = sendMimeMail,
def createInstance( ctx ):
return MailImpl( ctx )

g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation( \
createInstance,”it.icstools.fastmailmerge.python.MailImpl”,
(“it.icstools.fastmailmerge.acaso”,),)

Creating a configuration file from a .idl file (plain text):

#include

module it { module icstools { module fastmailmerge {

interface XFMM
{
any sendMimeMail([in] string fileUrl);
};

}; }; };

With the following two commands (the links should be updated of course):

/opt/openoffice.org3/basis-link/sdk/bin/idlc -w -I /opt/openoffice.org3/basis-link/sdk/idl/ /home/sergio/…/idl/XFMM.idl

/opt/openoffice.org3/basis-link/ure-link/bin/regmerge /home/sergio/…/XFMM.rdb /UCR /home/sergio/…/idl/XFMM.urd

and packaged all in an extension.

The file manifest.xml dell’extension must contain the following lines (the names of the files must be updated):

manifest:full-path="XFMM.rdb"/>
manifest:full-path="sendMail.py"/>

To access the new service OOoBasic just use this macro:

mgr = getProcessServiceManager()
oTI = mgr.createInstance(“it.icstools.fastmailmerge.python.MailImpl”)

Categories: Macros Tags:

Effetti speciali in Base 2

August 4th, 2010 1 comment

After a looong absence (not due to holiday reasons, I precise), I hope that the result is interesting.

Categories: Base Tags:

(Italiano) OOo per la Confindustria di Vicenza

July 16th, 2010 No comments

There was an interesting event to Confindustria Vicenza about free software, which was taken for example, guess who? OpenOffice.org!
To which the Confindustria Vicenza has migrated, from 2009, in almost complete autonomy, and of which it is proud.
This makes you realize how far from reality Microsoft executives are when they say that they would not use OOo even for hobby, and instead simply are not able to face the new advancing.
At this link are the videos of the event and slides of the speakers, including -our- Robert Galoppini ( here the link to the article on his blog).
Enjoy!

Categories: Uncategorized Tags:

Special Effects by Base

July 6th, 2010 1 comment

Have you ever had no longer any place in a form, or did not know how to keep us all? It’s possible with a little macro, use the same space several times in a simple and convenient way.

How? Putting several overlapping controls and using the keys that show only the controls they need, particularly by exploiting the property EnableVisible tables.

The macro used (for tables) is basically the following:
oForm = ThisComponent.DrawPage.Forms.getByName("MainForm")
oSubProjectsForm = oForm.getByName("SubProjects")
oSubProjectsGrid = oSubProjectsForm.getByName("SubProjects")
oSubProjectsGrid.EnableVisible = False '(or true)

and the result can be seen below.

The full macro is as follows (the object names must be changed of course):
Sub hideShowField(oEv)
sLabel = oEv.Source.Model.Label
sGridName = Right(sLabel, len(sLabel)-1 )
oForm = ThisComponent.DrawPage.Forms.getByName("MainForm")
oSubProjectsForm = oForm.getByName("SubProjects")
oSubProjectsGrid = oSubProjectsForm.getByName("SubProjects")
If sGridName = "SubProjects" Then
oSubProjectsGrid.EnableVisible = True
oSubProjectsForm.getByName("Jobs").getByName("Jobs").EnableVisible = False
oSubProjectsForm.getByName("MatJobs").getByName("MatJobs").EnableVisible = False
ElseIf sGridName = "Jobs" Then
oSubProjectsGrid.EnableVisible = False
oSubProjectsForm.getByName("Jobs").getByName("Jobs").EnableVisible = True
oSubProjectsForm.getByName("MatJobs").getByName("MatJobs").EnableVisible = False
ElseIf sGridName = "MatJobs" Then
oSubProjectsGrid.EnableVisible = False
oSubProjectsForm.getByName("Jobs").getByName("Jobs").EnableVisible = False
oSubProjectsForm.getByName("MatJobs").getByName("MatJobs").EnableVisible = True
ElseIf sGridName = "Gantt" Then
oSubProjectsGrid.EnableVisible = False
oSubProjectsForm.getByName("Jobs").getByName("Jobs").EnableVisible = False
oSubProjectsForm.getByName("MatJobs").getByName("MatJobs").EnableVisible = False
oChart = ThisComponent.getEmbeddedObjects.getByName("Project").getEmbeddedObject
Endif
End Sub

Categories: Base Tags:

Visual guide to Toools

July 6th, 2010 No comments

Categories: Extensions Tags: