1

(1 replies, posted in Translations)

Hi I will simplify how to use the fa-pot.php file that way you can understand how it works, if something is not working go to my previous post

In this example I will be using Windows and Xampp so all the paths will follow that logic (use your paths depending on how you installed PHP)
Also for this particular example I will use FrontHrm module

1) Download and copy fa-pot.php into your FrontAccounting root
C:\xampp\htdocs\frontaccounting\fa-pot.php

2) Make sure your module has (or create) a lang folder
C:\xampp\htdocs\frontaccounting\modules\FrontHrm\lang

3) Run it to generate the .pot file
    3.1) Open Command Prompt.
        (Win+R  cmd)
    3.2) Change to your FA folder:
            cd /d C:\xampp\htdocs\frontaccounting

4) Run the script with XAMPP’s PHP (C:\xampp\php\php.exe or where you have PHP installed) and point it at the module folder.
   Redirect the output into a POT file inside the module’s lang folder: (if you want to use the same example copy and paste the following)

"C:\xampp\php\php.exe" fa-pot.php modules\FrontHrm > modules\FrontHrm\lang\FrontHrm.pot

(Note.- In your prompt you'll see something like this:    C:\xampp\htdocs\frontaccounting>"C:\xampp\php\php.exe" fa-pot.php modules\FrontHrm > modules\FrontHrm\lang\FrontHrm.pot   then hit enter)

5) You should now have a file called FrontHrm.pot:

C:\xampp\htdocs\frontaccounting\modules\FrontHrm\lang\FrontHrm.pot

Once you have the file follow the next steps

6) Translate

Open FrontHrm.pot in Poedit (or your gettext tool).
When Poedit asks, choose the language (e.g., es_MX).
Save to:
modules\FrontHrm\lang\es_MX\LC_MESSAGES\FrontHrm.po
Once you translate the file compile to get the es_MX.mo file

Thats it

2

(1 replies, posted in Translations)

Hi, I don't know if this post should be placed here, but if someone find this useful (PHP PO File extractor) to build a .pot / .po for your custom FrontAccounting module.

1) Put the extractor in your FA tree fa-pot.php at the FrontAccounting root (same folder that has index.php).
Example path when using XAMPP: C:\xampp\htdocs\frontaccounting\fa-pot.php

2) Run it against your custom module
You pass the module folder as the argument and redirect output to a .pot file.

Windows (XAMPP)
Open CMD
cd C:\xampp\htdocs\frontaccounting
C:\xampp\php\php.exe fa-pot.php modules\YourModule > modules\YourModule\lang\new_language_template\LC_MESSAGES\yourmodule.pot  Note:This will create the clean PO file without translations

Linux / macOS
open console
cd /var/www/html/frontaccounting
php fa-pot.php modules/YourModule > modules/YourModule/lang/new_language_template/LC_MESSAGES/yourmodule.pot  Note:This will create the clean PO file without translations

Make sure the lang/new_language_template/LC_MESSAGES folders exists inside your module (create it if not).

3) What the script actually extracts
By default it scans files with extensions:
.php .inc .tpl .phtml .db  and pulls strings from these gettext calls:
_("msg") / gettext("msg")
ngettext("singular","plural", $n)
pgettext("context","msg") / _p("context","msg")
Only literal strings are captured (that’s how gettext tools work).
If you have code like _("Hello ".$name), rewrite it to:
sprintf(_("Hello %s"), $name)
so the constant part is extractable.

4) Customizing (if your code uses other wrappers or file types)
Open fa-pot.php and edit:
Recognized functions (near the top, $KEYS):
'_'        => ['type'=>'simple','args'=>[1]],
'gettext'  => ['type'=>'simple','args'=>[1]],
'ngettext' => ['type'=>'plural','args'=>[1,2]],
'pgettext' => ['type'=>'context','args'=>[1,2]],
'_p'       => ['type'=>'context','args'=>[1,2]],
// add your own, e.g.
// 'N_' => ['type'=>'simple','args'=>[1]],

Scanned extensions ($EXTS):
$EXTS = ['php','inc','tpl','phtml', 'db']; // add 'module' or others if you need

5) Create a locale .po from the .pot
If you have GNU gettext tools, this is easiest:
# Example for Spanish (Spain)
msginit --no-translator \
  --input=modules/YourModule/lang/new_language_template/LC_MESSAGES/yourmodule.pot \
  --locale=es_ES.UTF-8 \
  --output-file=modules/YourModule/lang/new_language_template/LC_MESSAGES/es_ES.po
No gettext tools? Just copy the .pot to .po and edit the header:
# in modules/YourModule/lang/new_language_template/LC_MESSAGES/es_ES.po
"Language: es_ES\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
Common plural forms:
Spanish/English: nplurals=2; plural=(n != 1);
French: nplurals=2; plural=(n > 1);
Portuguese (pt_BR): nplurals=2; plural=(n > 1);
Keep files UTF-8 (no BOM).

6) Where to keep the files in a FA module
A simple, module-local layout works fine:
modules/YourModule/
lang/
    yourmodule.pot
    es_ES.po
    fr_FR.po
FrontAccounting typically uses its own PO loader (not PHP’s gettext() extension), so you don’t need .mo unless your code explicitly uses native gettext. If you do, compile with:
msgfmt -o modules/YourModule/lang/es_ES.mo modules/YourModule/lang/es_ES.po

7) Quick sanity check
Open the generated .pot — you should see blocks like:
#: modules/YourModule/somefile.php:42
msgid "Customer"
msgstr ""
If it’s empty:
Your strings might be dynamic/concatenated.
File extensions not in $EXTS.
Wrapper names not listed in $KEYS.
Wrong path passed to the script.

8) Tiny example
Source:
echo _("Customer");
echo sprintf(_("Open %s invoice"), $ref);
echo ngettext("%d item","%d items", $n);
echo pgettext("button","Save");
Extracted (snippet):
msgid "Customer"
msgstr ""
msgid "Open %s invoice"
msgstr ""
msgid "%d item"
msgid_plural "%d items"
msgstr[0] ""
msgstr[1] ""
msgctxt "button"
msgid "Save"
msgstr ""

9) Typical errors & fixes
Path not found: modules/YourModule
→ Check the path you pass to the script; use quotes if there are spaces.
'php' is not recognized on Windows
→ Use full path to php.exe: C:\xampp\php\php.exe.
Empty POT or missing lines
→ Strings are not literal or wrappers/EXTS not configured.
Encoding/accents look broken
→ Ensure source files and PO are UTF-8 and header has charset=UTF-8.

I would love if someone do this more "user friendly" so an average person can translate the system and modules to any language

Hi alex1452.
The system is trying to reach the files from the default language which is coded as 'C', the reason why you are having such issue I don`t know, but the simpliest way to fix that error is coping the files in the 'lang/en_US' folder and rename that folder as 'lang/C' also all the contents in the folder LC_MESSAGES to C.po, C.mo let us know how it went.

Hi, can you upload a image of your problem?, if the option is grayed , did you check the "Access setup" option in Setup tab  to allow access to the user's role?

Hi.

I found kvcodes as one of the best theme developers, you'll find youtube videos of his themes.

I remember he had a simple explanation of how to modify themes, the best approach to modify themes is opening the standard themes and modify them so you can understand how it works.

Hi,

Hope someone can help me, I'm trying to manage a Customer Debit note in the system (in my country a debit note must be a different type of transaction and a different type of document), the concept behind it is the opossite of a credit note allowing to debit the customer´s account, increasing the accounts receivable amount.

What I've done so far is a copy of the credit notes applications and scripts changing those files to debit, creating a new transaction type 14 (ST_CUSTDEBIT), but when I want to create the journal entries I must modify the sales_credit_db.inc (this is the file I suppose create the GL transactions), I copy the file and renamed as sales_debit_db.inc, but I still get the same result as the credit note.

My questions are how the credit note creates the journal entries? and Which functions are used in the creation of GL lines when process credit notes?

Thanks for your help

7

(1 replies, posted in FA Modifications)

Hi

If someone find this useful

I was needing radio buttons to work dinamically in frontaccounting and I could't find anything, so I decide to create a function to do so:

function dynamic_radio_row(
                            $label,
                            $name,
                            $options = [],
                            $selected,
                            $orientation = 'vertical',
                            $default = null
                            )
                                {
                                    $current = ($selected == null || $selected == ' ') ? $default : $selected;

                                    $separator = $orientation === 'horizontal' ? "   " : "<br><br>";

                                    echo "<tr><td class='label'>".htmlspecialchars($label, ENT_QUOTES)."</td><td>";

                                    foreach ($options as $value => $text)
                                                {
                                                    $checked = ($value === $current) ? " checked" : "";
                                                    echo "<input type='radio' "
                                                       . "name='" . htmlspecialchars($name, ENT_QUOTES) . "' "
                                                       . "value='" . htmlspecialchars($value, ENT_QUOTES) . "'"
                                                       . $checked
                                                       . "> " . htmlspecialchars($text, ENT_QUOTES)
                                                       . $separator;
                                                }

                                    echo "</td></tr>";
                                }
                               
How you call it:

/**
* @param string $label
* @param string $name
* @param array  $options
* @param string $selected    Selected value (could be POST)
* @param string $orientation 'vertical' | 'horizontal' depending how you want to display the values
* @param string $default     Default value if $selected is null, empty or a blank space.
*/

// Array with the neccesary options for the radio Button
$opts = [
              'ONE'   => _('First'),
              'TWO'   => _('Second'),
              'THREE' => _('Third'),
              'FOUR'  => _('Fourth'),   
        ];

dynamic_radio_row(_('Select Option:'), 'my_field', $opts, get_post('my_field'), 'vertical', 'ONE');

8

(3 replies, posted in Reporting)

Did you integrate it as a FrontAccounting module?

9

(3 replies, posted in Reporting)

I was trying to find an alternative to the old RepGen module and I came across Reportico, finding it really interesting and powerful.

Does anyone ever consider reportico as a integrated module to build frontaccounting reports?

10

(2 replies, posted in Setup)

Change the user's theme in users table (0_users) modifing the field 'theme' setting the value 'default' using phpmyadmin or any other database application, clear the web browser history and try to log in again.

Hi

I have a non complete module, I need help with someone who can finish it. is a localization an I need to include electronic documents.