Blog

Blesta 3.0: Tangible Invoices

June 14, 2012 | Posted by Paul


If you’ve been following us for long, you know we talk a lot about invoices. Most recently we did a video about Invoice Customization, and our amazing Invoice Auto-Save feature.

From the beginning Blesta has supported paper invoices. Some clients, typically business clients, want to receive their invoices in the mail. For those clients, Blesta can queue up invoices for print. A staff member logs in, prints them out, stuffs them in envelopes, applies postage and drops them in the mail.

v3 has this ability too, but can optionally do so much more. What if your billing staff didn’t have to print out anything? What if Blesta printed, stuffed, and mailed the invoice by itself? In v3, it essentially can, through Postal Methods. Automating the tangible.

Of course invoices by email have long been widely accepted. However, some companies still prefer to receive invoices in the mail — and, if it means you get paid on time, it’s worth just mailing them the invoice. It’s about meeting them where they are. Whether email, postal mail, or fax, Blesta can send out invoices automatically or with just a couple of clicks.

Yet another reason Blesta is the professional choice.

Isn’t that invoice beautiful? It looks great, and it was sent automatically. Did I mention you can include a return envelope too?

Even though more than 95% of our own invoices are sent out via email, this is a feature I’m personally looking forward to in v3.

On another note, we’re getting close to an alpha release. It’s a private release intended for developers only. If you want to build an extension for v3 for your own use to prepare for the upcoming release, or to sell, you might qualify. Extensions include modules, gateways, plugins, and widgets. If you think you should be included in the alpha, email sales at blesta.com and let’s chat.

Blesta 3.0: Developer Docs

June 8, 2012 | Posted by Cody


With a private alpha release due out soon, we’re gearing up to help developers take full advantage of the 3.0 platform. Our goal is to make it as easy as possible to build really advanced plugins, widgets, gateways, and modules. To facilitate that we’ve written some detailed interfaces and libraries, as well as put together a pretty in-depth developer manual. And while the v3 source is almost entirely open, I figured what the heck, how about some source code documentation? So I created Doctorate.

Doctorate is a simple plugin for minPHP that documents source code using Reflection. Being able to read the source documentation without actually having to open the source code is a huge advantage. But because the Blesta API is just a simple access wrapper for the Models it’s a huge time saver for us. It would take months to document every API request (there are hundreds and hundreds), but Doctorate does it automatically.

Here is a sneak peak of the source code documentation from Doctorate…

Doctorate - Source Code Documentor

Here is a sneak peak at the developer manual…

So when can you expect to get your hands on the developer manual and source documentation? If you’ve made it onto our developer list you can take advantage of these resources as soon as alpha is released. When 3.0 goes into beta we’ll make the documentation public.

Blesta 3.0: Payment Handling

June 1, 2012 | Posted by Paul


We’ve talked about payments before, but this week I wanted to go a little more in depth. The way payments are handled and applied by a billing system is important, things need to be accounted for.

Some popular billing systems do really strange things, like..

  1. Create a new invoice when someone attempts to pay multiple open invoices for the sum of those invoices, and when that invoice is paid mark the others as paid.
  2. Allow staff to mark an invoice as paid without recording a transaction.

Simply put, this leads to an accounting nightmare. If an invoice is marked paid, surely there should be a history of how and when that invoice was paid, right? Absolutely! Blesta handles this well in v3, but that’s not a new feature!.. We’ve been accounting for everything since the beginning.

Good billing software will let you pay a single invoice with multiple payments, and pay multiple invoices with a single payment. It should keep track of how much of which payments were applied to which invoices.

In this screenshot you can see that 2 payments were made to a single invoice, and the invoice still isn’t paid in full yet. (Click image to see full size)

It all comes down to this: We want to do things right, and we spend the extra time to do it right when others don’t. It’s this way with everything we do. We engage every feature with purpose and forethought. It’s about creating great software whether we sell a thousand copies or a million copies.

Blesta 3.0: Efficiency

May 18, 2012 | Posted by Cody


As lead developer, my primary focus has been on designing an efficient system. Since our primary data store (where we make the most reads/writes) is the database, naturally this is where the smallest change can have the biggest impact. I’ve already discussed a number of changes we’ve made to the database system including switching to InnoDB and the use of PDO. The last is the use of unbuffered queries.

Buffered Queries

Buffered queries fetch (e.g. buffer) all records into memory from the database server and automatically close the cursor, allowing other queries to be executed. You might take this for granted. For example, you may have something like:

<?php
// What looks like 'nested' queries...
$statment = mysql_query($sql);
while ($data = mysql_fetch_assoc($statment)) {
    $statment2 = mysql_query($sql2);
    while ($data2 = mysql_fetch_assoc($statment2)) {
        ...
    }
}

This might be all fine and dandy, but assume that the first query finds 1,000,000 rows. If each row contained just 1 KB of data, that’s 976 MB of memory consumed! Keep in mind that the memory is consumed at mysql_query(), so it doesn’t matter how many rows you actually fetch (using mysql_fetch_*). Moreover, the memory isn’t freed until the program terminates or you explicitly invoke mysql_free_result().

Unbuffered Queries

Unbuffered queries, on the other hand, are not buffered into memory. Each row remains on the database server until fetched. This can drastically reduce memory consumption on the web server.

The only downside is that you can’t create what look like “nested” queries (as in my example above). But that really isn’t a downside at all, because it forces you to look at better methods for fetching or querying data. Like limiting your result set and fetching all results.

The Record component in Blesta, in conjunction with PDO, make unbuffered query support almost seamless. You really only need to be concerned about closing the cursorif you’re explicitly working with PDOStatement objects.

<?php
// Manually work with the statement...
$users = array();
$user_stmt = $this->Record->select()->from("users")->getStatement();
foreach ($user_stmt as $user) {
    $users[] = $user;
}
$user_stmt->closeCursor();
 
// Or just let the Record component to handle it all...
$users = $this->Record->select()->from("users")->fetchAll();

While the benefit of unbuffered queries may not be entirely evident on small data sets, there’s no doubting it improves efficiency. And that’s what creating an enterprise-level application is all about.

Blesta 3.0: Currencies (video)

May 4, 2012 | Posted by Paul


I came into work this morning with literally no idea what the video was going to be about today. I have a list of topics, but nothing felt right and then I realized we haven’t really talked about currencies much. It’s part of a larger topic, Internationalization, and with what we’re doing with language support and the translator it only makes sense that we should discuss currencies.

Of course, a big part of currencies is multi-currency support and v2.5 has it, but it’s much improved in v3. In v2.5, multi-currency has to be explicitly enabled and everything revolves around the default currency. While v2.5 can accept payments in many currencies, clients are billed based on the exchange rate to the default currency. So, the biggest difference between v2.5 and v3 is that prices can be specified at the package level for each individual currency, effectively fixing prices. Only when a price is not available for the currency does the exchange rate come into play.

  1. Prices can be set for each currency at the package level, which overrides the exchange rate.
  2. Multi-currency doesn’t need to be enabled, just use it if you want to use it.
  3. Exchange rates can be fetched from Foxrate, Yahoo Finance, or Google Finance.
  4. Exchange rate updates can be disabled and exchange rates manually updated.
  5. New package period options Day, Week, and Year in addition to Monthly and One Time.
  6. Cancellation fees can be assessed and configured at the package level.

Interesting fact! With Day, Week, Month, and Year package period options now available, terms can range between 1 and 65535 (216 – 1) which equates to 65535 * 4 + 1, or 262,141 possible service terms available. So much for just monthly, quarterly, semi-annual, and annual huh? Do your own thing.

The video is below, as usual you can make the video full screen, and be sure to turn on your sound.