Edit Bank Details format and layout

I think there are several possible methods - one would be to make a configuration page somewhere, but another could be to have a global configuration constant on this page /admin/const.php - or:
Top menu home
Left menu Setup, sub left menu other

If this would get included into Dolibarr then I think it would be a part of each version, and thus not a problem during upgrade

Understood.

Here are a few other concerns.

To get the required format for the India region, I have also disabled some of the codes in the ~/htdocs/core/lib/pdf.lib.php file. This isn’t an ideal way to go, especially for @eldy to accept and merge the pull request into the final main branch.

If I can find a conditional logic for the India region only, then pull requests would be in the right order, as per good code practice.

You have 2 choices to add the logic specific to india:

  • Add a test
    if getDolGlobalString('PDF_INDIA_MY_OPTION') {
    You will have to enable the option into home - setup - other. And this is kept at each upgrade.
  • or add a test on country
    if ($mysoc->country_code == 'IN') { if condition is for the company
    or
    if ($account->getCountryCode() == 'IN') { if condition is on the country of the bank account (i think this is more this case to use)

A PR with one of this 2 way is welcome…

Would it be possible to put this choice on the bank account? because imagine a company that have bank accounts in multiple countries, or has home base out side india, but has an indian bank account?

Would all bank accounts in such a company need this change?

Would all bank accounts in such a company need this change?

I think the way the ban is show depends on the country of the bank. That’s the reason why i suggest to make the test on the country of bank and not the country of company, so
if ($account->getCountryCode() == 'IN') {

sorry, Missed that part, it’s a good idea

How about using this portion of the code where I see a test on country is already captured.

// Use correct name of bank id according to country
	$bickey = "BICNumber";
	if ($account->getCountryCode() == 'IN') {
		$bickey = "SWIFT";
	}

Maybe changing it to something like this

// Use correct name of bank id according to country
	$bickey = "BICNumber";
	if ($account->getCountryCode() == 'IN') {
        
        // Add a blank line/space
        $cury += 3; // Adjust this value as needed for the desired space
		
		// Account owner name
	    $pdf->SetFont('', 'B', $default_font_size - $diffsizecontent);
		$pdf->SetXY($curx, $cury);
		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("A/C Name").': '.$outputlangs->convToOutputCharset($account->proprio), 0, 'L', 0);
		$cury += 4;
	    
	    // Account Number
	    $pdf->SetFont('', 'B', $default_font_size - $diffsizecontent);
		$pdf->SetXY($curx, $cury);
		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("BankAccountNumber").': '.$outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
		$cury += 4;
		
		// Bank Name
		$pdf->SetFont('', 'B', $default_font_size - $diffsizecontent);
		$pdf->SetXY($curx, $cury);
		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank").': '.$outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
		$cury += 4;
		
		// Bank IFSC
		$pdf->SetFont('', 'B', $default_font_size - $diffsizecontent);
		$pdf->SetXY($curx, $cury);
		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("IFSC").': '.$outputlangs->convToOutputCharset($account->iban), 0, 'L', 0);
		$cury += 4;
		
		// Bank SWIFT
		$pdf->SetFont('', 'B', $default_font_size - $diffsizecontent);
		$pdf->SetXY($curx, $cury);
		$pdf->MultiCell(100, 3, $outputlangs->transnoentities("SWIFT").': '.$outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
		$cury += 4;
}

If goal is just to rename the field, a better way is to do like it is done for BICNumber renamed into SWIFT for India.
Use a variable and set a different value for India.
Then replace the
$pdf->MultiCell(100, 3, $outputlangs->transnoentities(“HardcodedKey”)
with
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($variable)

Hmm… interesting :thinking: You mean like this

$bickey = "BICNumber";
	if ($account->getCountryCode() == 'IN') {
            $BankAccountOwner = "A/C Name";
            $BankAccountNumber = "A/C No.";
            $Bank = "Bank Name";
            $ibankey = "IFSC";
            $bickey = "SWIFT";
	}

But what about the following:

  1. Font Size (which is inconsistent for bank details as shown in my initial post)
  2. Format (Bold, Italic, None)
  3. Position/Sequence Lineup (Account Name, Bank Name, Account No., IFSC, SWIFT)

Yes like this for translation.
Is the format really important ? Bold/Not bold is really a legal requirement of indian governement ? Same for font size and position of fields ?

Awesome.

Format is important in regards to how beneficiaries are registered into internet banking in India. The flow is redefined and standard as mentioned below:

  1. Company Name
  2. Bank Account No.
  3. Bank Name.
  4. IFSC No. (Bank Branch Location)
  5. SWIFT No. (Overseas Transfers)

It is not a legal requirement, but right formatting helps in having accurate readability while avoiding typos. Accountants in Indian companies are used to this format.

So i suggest to make a PR that duplicate the block with a

if ($account->getCountryCode() == 'IN') {
  // code to define field in positionn/label for india
} else {
// default code
}