PHP isn't parsing the code. Is it really installed?

I'm no accountant, but I just use journal entries for those.

28

(5 replies, posted in Reporting)

seahawk wrote:

where do I upload the snapshot?

If you click the "Post reply" or "quote" links, rather than using the "quick reply" textfiield, you'll be able to add attachments to your post.

Change $date to "SIN / $date" and you're done. Or "$var / $date", if "SIN" is some other variable.

30

(18 replies, posted in Reporting)

OK. I figured that the script either fails to read some library/font etc. or it can't write the pdf data to disk. File permissions would have explained those.

What else could cause it to fail? Faulty code or faulty data. Unless you've messed with the code, I would look at the data. Does it get read as it should? Is it in the expected format (encoding)? Did you by any chance import the data from a previous install? Like, say, the 2.4 beta? The one which is supposed to be strictly UTF?

31

(18 replies, posted in Reporting)

I suspect a permissions problem. Does the web server user own the directory you installed FA into?

32

(6 replies, posted in Setup)

I had a similar problem once, but then that was on a ridiculously slow server. Back then I suspected that the backup queries were quite inefficient, but it made more sense to move to decent hardware than messing with the SQL. And the backups have worked ever since.

Perhaps someone with a better understanding of SQL and the FA database tables can shed some light on the issue, but until then you could always do a database dump from phpmyadmin (or the command line). It wouldn't (shouldn't!) be an option for regular users, and you'd have to restore the data using the same method. But you would have a backup, and that sure beats not having one.

If you can recreate the printed form as a pdf, you can load it as a "background" and use the report as it is. Just design the form in any word processor and export/print it to pdf.

https://frontaccounting.com/fawiki/index.php?n=Devel.ReportWatermarking

34

(9 replies, posted in Setup)

Restoring a backup inserts data into the database. It's not a major security issue. It's how things work.

I guess you could prevent your users from uploading/downloading backups, but that won't stop them from overwriting each other’s data. That's why you don't want to give users access to the backups on a multi-user system in the first place.

35

(9 replies, posted in Setup)

What you are describing is not a backup. It is, at best, an "undo" feature for your users. And a dangerous one, if you have more than one user.

There is no way to restore the data on a fresh system using these "backups" because, just like incremental backups, they require a "base" backup to start from.

Whatever it is you are trying to achieve, this is not the way to do it.

Hmm... But that still puts the "S" into stock_master.

My idea was adding

if ($mb_flag == "S")
  $mb_flag ="D";

after

 
$mb_flag = strtoupper($mb_flag);

Well... D it is, then.

Looking at the import_items extension, it seems to insert and update tables with whatever $mb_flag it gets from the CSV. And the documentation suggests using S, which means service items will be stored as inventory items. (Or, rather, read back as such when retrieved from the database later.)

So it's broken. People already have items in their databases with an invalid mb_flag, which can be easily corrected by the upgrade script. But to prevent such data from being written in the future, the extension has to handle both cases, rewriting S to D before feeding anything to the database. It's not ideal, but there will be other scripts preparing the data for import, which have been written according to the instructions in the readme file. At least we don't need to put THAT in the core...

Found this. Do imported items actually get stored with an S? Then I guess they will be treated as inventory items.

includes/db/inventory_db.inc:

function is_inventory_item($stock_id)
{
$sql = "SELECT stock_id FROM ".TB_PREF."stock_master
WHERE stock_id=".db_escape($stock_id)." AND mb_flag <> 'D'";
$result = db_query($sql, "Cannot query is inventory item or not");
return db_num_rows($result) > 0;
}


If we have data stored with an S, it is already broken. If not, changing the core will not break anything. But we can't have two different representations for the same thing and only test for one. It should be simple enough for an upgrade script to change the database values.

Probably a typo, then. The question is which one is correct. The S certainly makes more sense.

Generally, modules should adapt to the core. Not the other way around.

But if there are no other occurrences, I would change the core here.

setSourceFile() loads an existing pdf as a "background", onto which all output is "printed". I use it elsewhere for generating invoices, but here it's probably used to include a company letterhead.

Even if it did work - and I have no idea if it does - it would still send one message to each recipient.

Message creation (in reporting/includes/pdf_report.inc) needs to be moved out of the foreach loop, with the approriate headers ("to" and/or "cc") being added as the script loops over the contacts array.

It's probably cleaner to have separate functions for single and multiple contacts. In particular, it will establish which contact is the "primary" one and future developers won't have to guess.

Fair enough. But then you'd have a problem if there were ONLY "CC" recipients...

Fortunately, in a small business it should be obvious to those concerned why they got the message. And it's quite clear who else got it, so they can always work it out between themselves if necessary.

About Bob's second question,

When I looked at the code, it seemed that the mail was generated and sent to each recipient (which was of course of little consequence, as there was never more than one).

I would suggest reorganising that bit to first create the message and then loop over the recipients while adding the "To" headers.

(CC is probably best avoided here, as it implies "FYI" rather than "Here's a message for you. Please do something with it". So, who is the "real" recipient, and who gets CC'ed?)

Aha. I see. You don't want PDFs at all. Well, that's a different matter.

(While you COULD print PDFs on a dot matrix printer, I can certainly see why you don't want to.)

You can modify the script which generates the PDF (as it has all the data you need) to write the data into a text file (or string) instead. Just add spaces to format the output, align columns etc. For any "fancy" features (like bold text) you have to insert control characters, which will depend on your printer.

Once you have the data in a file or string, you can output it to the printer port. From the command line, you can probably still do something like "copy file.txt lpt1:", and that's the device you need to send the string to. I have no idea if PHP can write to a printer port, but you could certainly write it to a file and exec() a copy command.

That's a bit tricky. If the printer is on the network, and the server is on the same network, you could print the file from there. Otherwise it has to go through the client. I have seen browser plugins to achieve this, but have not actually tried any of them.

I've been thinking about the problem in a slightly different context, and my best idea so far is to have the browser automatically save files of a particular type and monitor the destination directory to send print jobs to different printers based on file name.

47

(44 replies, posted in Reporting)

A sales account, yes. Of course. But his 2206 looks more like a liabilities account.

48

(44 replies, posted in Reporting)

Do you really need an account for 0-VAT? Wouldn't it make more sense with a separate sales account for those items? 4000-something.

49

(48 replies, posted in Setup)

I see the extension repo in 2.4 still points to the old 2.3 files. Could we get a 2.4 directory on the repo server with UTF versions of the charts, translations etc?

I don't use FA to keep track of products, but I suspect it has something to do with the product's unit of measure.