Jump to content

Weekly update – 8 March 2024 – New invoices site profile


Recommended Posts

This week the new ProcessWire Invoices site profile has been released on GitHub here: Invoice Application Site Profile. This particular profile is much broader in scope than the others I've developed for ProcessWire, so will benefit from more descriptive information about what it includes, how to use it and modify it, and how you might build further from it. That info will all be coming next week in a new blog post. But feel free to download and install the site profile sooner if you'd like. If you are already familiar with ProcessWire, then perhaps most of it will be self explanatory. 

While this site profile doesn't cover everything that you might do with an invoicing application, it does cover everything that I've needed over the last year of using it with my clients. Though admittedly, I don't have a lot of clients, nor do I send a lot of invoices. Given that, when my existing invoicing service raised the monthly rate from $3/month to $20/month (a year or so ago), that's what motivated me to build this site profile. And it does everything my previous invoicing service did, and in fact does it better. While much of it was built several months ago, major improvements have been made to it over the last couple of weeks, preparing for it for release as a ProcessWire site profile. 

My hope is that you'll find this site profile easy to work with, and easy to build out further where needed. For instance, I imagine some may want to add in the ability to pay an invoice. It would be relatively simple to add in FormBuilder with its Stripe Processor plugin, or perhaps some other payment solution. But all my clients pay by check, whether physically or digitally, so I've not needed to add payment ability to the application yet. In any case, I hope that you find this site profile useful, and please let me know if you run into any issues with it or have suggestions for future upgrades to it. Thanks for reading and have a great weekend!

  • Like 18
  • Thanks 7
Link to comment
Share on other sites

Wow so much to discover from.... also some little things. I wanted to ask how some here deal with repeated translation strings, and then I got my answer in this site profile ^^

Thank you for sharing!

  • Like 1
Link to comment
Share on other sites

Thanks for releasing this Ryan.

Although I've been using ProcessWire daily for over a decade at this point, it's nice to compare my version of "The ProcessWire Way" with that of the creator himself and learn any tips and tricks along the way.  This is probably going to be very helpful for beginners.

When I was researching Tailwind a while ago, the creator (Adam Wathan) spoke about how he made many demo videos of himself replicating websites with his CSS framework so developers could get an idea of how the creator of the tool himself would approach using it.  I feel like these site profiles provide a similar and more realistic learning experience in addition to ProcessWire's great documentation.

  • Like 9
Link to comment
Share on other sites

On 3/8/2024 at 10:46 PM, Denis Schultz said:

I wanted to ask how some here deal with repeated translation strings, and then I got my answer in this site profile ^^

Just this week had to deal with the same thing on a site with 100+ translatable strings, many views reusing same translations, and three languages.

Ended up splitting translations into a (static utility) class that has a string() method that returns the translation. So basically the same thing that Ryan has done here. Biggest difference is that since many of those strings in my case also exist in the admin as field labels, I added a fallback that first checks if a translation for current language exists, and then falls back to the field label if possible.

I guess this confirms that I'm not doing anything too silly ?

... but on a loosely related note, if anyone has a good idea how to check if a string has been translated, I'd be happy to hear. I'm currently just comparing the source value to the return value and if it has not been changed I'll assume that a translation wasn't found. That's obviously a bit crude. Would be nice to have some way to check if the returned value from the translation method in core is indeed a translated version ?

  • Like 5
Link to comment
Share on other sites

@teppo Not very straightforward, but here's a function that would tell you whether or not a translation exists for the given phrase in the given file, in the current language.  Maybe we need a dedicated core function for it?

function isTranslated($text, $textdomain) {
  $translator = wire()->user->language->translator();
  $translations = $translator->getTranslations($textdomain);
  $hash = $translator->getTextHash($text);
  return isset($translations[$hash]) ? $translations[$hash]['text'] : false;
}

Example

$text1 = 'About Us';
$text2 = isTranslated($text1, '/site/templates/about-us.php');
if($text2 === false) {
  echo "Not translated: '$text1'";
} else {
  echo "Translation of '$text1' is '$text2'";
}

 

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, ryan said:

@teppo Not very straightforward, but here's a function that would tell you whether or not a translation exists for the given phrase in the given file, in the current language.

Awesome — thank you! I'll definitely put this into use ?

3 hours ago, ryan said:

Maybe we need a dedicated core function for it?

Hard to say how common of a need this would be, but I wouldn't be against it (obviously).

  • Like 2
Link to comment
Share on other sites

On 3/8/2024 at 10:37 PM, Jonathan Lahijani said:

I feel like these site profiles provide a similar and more realistic learning experience in addition to ProcessWire's great documentation.

I can only agree with that 100%.

Right from the start, the Skyscraper profile helped me a lot to understand the basics - from fields to templates, queries, and so on.

With the Invoice profile, I'm really starting to realize how much I don't know or use at all.

It's so much fun to play with the profile and take it apart. It's absolutely impressive what can be done with just the core.

It's insane and genius at the same time.

Thank you, Ryan!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...