本文整理汇总了PHP中Account::getCountryCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::getCountryCode方法的具体用法?PHP Account::getCountryCode怎么用?PHP Account::getCountryCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::getCountryCode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pdf_bank
/**
* Show bank informations for PDF generation
*
* @param PDF $pdf Object PDF
* @param Translate $outputlangs Object lang
* @param int $curx X
* @param int $cury Y
* @param Account $account Bank account object
* @param int $onlynumber Output only number (bank+desk+key+number according to country, but without name of bank and domiciliation)
* @param int $default_font_size Default font size
* @return float The Y PDF position
*/
function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10)
{
global $mysoc, $conf;
$diffsizetitle = empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE;
$diffsizecontent = empty($conf->global->PDF_DIFFSIZE_CONTENT) ? 4 : $conf->global->PDF_DIFFSIZE_CONTENT;
$pdf->SetXY($curx, $cury);
if (empty($onlynumber)) {
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount') . ':', 0, 'L', 0);
$cury += 4;
}
$outputlangs->load("banks");
// Use correct name of bank id according to country
$bickey = "BICNumber";
if ($account->getCountryCode() == 'IN') {
$bickey = "SWIFT";
}
// Get format of bank account according to its country
$usedetailedbban = $account->useDetailedBBAN();
//$onlynumber=0; $usedetailedbban=1; // For tests
if ($usedetailedbban) {
$savcurx = $curx;
if (empty($onlynumber)) {
$pdf->SetFont('', '', $default_font_size - $diffsizecontent);
$pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank") . ': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
$cury += 3;
}
if (empty($conf->global->PDF_BANK_HIDE_NUMBER_SHOW_ONLY_BICIBAN)) {
// Note:
// bank = code_banque (FR), sort code (GB, IR. Example: 12-34-56)
// desk = code guichet (FR), used only when $usedetailedbban = 1
// number = account number
// key = check control key used only when $usedetailedbban = 1
if (empty($onlynumber)) {
$pdf->line($curx + 1, $cury + 1, $curx + 1, $cury + 6);
}
if ($usedetailedbban == 1) {
$fieldstoshow = array('bank', 'desk', 'number', 'key');
if ($conf->global->BANK_SHOW_ORDER_OPTION == 1) {
$fieldstoshow = array('bank', 'desk', 'key', 'number');
}
} else {
if ($usedetailedbban == 2) {
$fieldstoshow = array('bank', 'number');
} else {
dol_print_error('', 'Value returned by function useDetailedBBAN not managed');
}
}
foreach ($fieldstoshow as $val) {
if ($val == 'bank') {
// Bank code
$tmplength = 18;
$pdf->SetXY($curx, $cury + 4);
$pdf->SetFont('', '', $default_font_size - 3);
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
$pdf->SetXY($curx, $cury + 1);
$curx += $tmplength;
$pdf->SetFont('', 'B', $default_font_size - 4);
$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
if (empty($onlynumber)) {
$pdf->line($curx, $cury + 1, $curx, $cury + 7);
}
}
if ($val == 'desk') {
// Desk
$tmplength = 18;
$pdf->SetXY($curx, $cury + 4);
$pdf->SetFont('', '', $default_font_size - 3);
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
$pdf->SetXY($curx, $cury + 1);
$curx += $tmplength;
$pdf->SetFont('', 'B', $default_font_size - 4);
$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
if (empty($onlynumber)) {
$pdf->line($curx, $cury + 1, $curx, $cury + 7);
}
}
if ($val == 'number') {
// Number
$tmplength = 24;
$pdf->SetXY($curx, $cury + 4);
$pdf->SetFont('', '', $default_font_size - 3);
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
$pdf->SetXY($curx, $cury + 1);
$curx += $tmplength;
$pdf->SetFont('', 'B', $default_font_size - 4);
$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
//.........这里部分代码省略.........
示例2: checkBanForAccount
/**
* Check account number informations for a bank account
*
* @param Account $account A bank account
* @return boolean True if informations are valid, false otherwise
*/
function checkBanForAccount($account)
{
$country_code = $account->getCountryCode();
// For compatibility between
// account of type CompanyBankAccount class (we use number, cle_rib)
// account of type Account class (we use num_compte, cle)
if (empty($account->number)) {
$account->number = $account->num_compte;
}
if (empty($account->cle)) {
$account->cle = $account->cle_rib;
}
dol_syslog("bank.lib::checkBanForAccount account->code_banque=" . $account->code_banque . " account->code_guichet=" . $account->code_guichet . " account->number=" . $account->number . " account->cle=" . $account->cle . " account->iban=" . $account->iban . " country_code=" . $country_code, LOG_DEBUG);
if ($country_code == 'FR') {
// France rules
$coef = array(62, 34, 3);
// Concatenation des differents codes.
$rib = strtolower(trim($account->code_banque) . trim($account->code_guichet) . trim($account->number) . trim($account->cle));
// On remplace les eventuelles lettres par des chiffres.
//$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678912345678"); //Ne marche pas
$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz", "12345678912345678923456789");
// Separation du rib en 3 groupes de 7 + 1 groupe de 2.
// Multiplication de chaque groupe par les coef du tableau
for ($i = 0, $s = 0; $i < 3; $i++) {
$code = substr($rib, 7 * $i, 7);
$s += (0 + $code) * $coef[$i];
}
// Soustraction du modulo 97 de $s a 97 pour obtenir la cle
$cle_rib = 97 - $s % 97;
if ($cle_rib == $account->cle) {
return true;
}
return false;
}
if ($country_code == 'BE') {
// Belgium rules
}
if ($country_code == 'ES') {
// Spanish rules
$CCC = strtolower(trim($account->number));
$rib = strtolower(trim($account->code_banque) . trim($account->code_guichet));
$cle_rib = strtolower(checkES($rib, $CCC));
if ($cle_rib == strtolower($account->cle)) {
return true;
}
return false;
}
if ($country_code == 'AU') {
// Australian
if (strlen($account->code_banque) > 7) {
return false;
} else {
if (strlen($account->code_banque) < 6) {
return false;
} else {
return true;
}
}
}
// No particular rule
// If account is CompanyBankAccount class, we use number
// If account is Account class, we use num_compte
if (empty($account->number)) {
return false;
}
return true;
}
示例3: pdf_bank
//.........这里部分代码省略.........
}
}
foreach ($fieldstoshow as $val) {
if ($val == 'bank') {
// Bank code
$tmplength = 18;
$pdf->SetXY($curx, $cury + 5);
$pdf->SetFont('', '', $default_font_size - 3);
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
$pdf->SetXY($curx, $cury + 1);
$curx += $tmplength;
$pdf->SetFont('', 'B', $default_font_size - 4);
$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
if (empty($onlynumber)) {
$pdf->line($curx, $cury + 1, $curx, $cury + 8);
}
}
if ($val == 'desk') {
// Desk
$tmplength = 18;
$pdf->SetXY($curx, $cury + 5);
$pdf->SetFont('', '', $default_font_size - 3);
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
$pdf->SetXY($curx, $cury + 1);
$curx += $tmplength;
$pdf->SetFont('', 'B', $default_font_size - 4);
$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
if (empty($onlynumber)) {
$pdf->line($curx, $cury + 1, $curx, $cury + 8);
}
}
if ($val == 'number') {
// Number
$tmplength = 24;
$pdf->SetXY($curx, $cury + 5);
$pdf->SetFont('', '', $default_font_size - 3);
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
$pdf->SetXY($curx, $cury + 1);
$curx += $tmplength;
$pdf->SetFont('', 'B', $default_font_size - 4);
$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
if (empty($onlynumber)) {
$pdf->line($curx, $cury + 1, $curx, $cury + 8);
}
}
if ($val == 'key') {
// Key
$tmplength = 13;
$pdf->SetXY($curx, $cury + 5);
$pdf->SetFont('', '', $default_font_size - 3);
$pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
$pdf->SetXY($curx, $cury + 1);
$curx += $tmplength;
$pdf->SetFont('', 'B', $default_font_size - 4);
$pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
if (empty($onlynumber)) {
$pdf->line($curx, $cury + 1, $curx, $cury + 8);
}
}
}
$curx = $savcurx;
$cury += 10;
} else {
$pdf->SetFont('', 'B', 6);
$pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank") . ': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
$cury += 3;
$pdf->SetFont('', 'B', 6);
$pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("BankAccountNumber") . ': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
$cury += 3;
}
// Use correct name of bank id according to country
$ibankey = "IBANNumber";
$bickey = "BICNumber";
if ($account->getCountryCode() == 'IN') {
$ibankey = "IFSC";
}
if ($account->getCountryCode() == 'IN') {
$bickey = "SWIFT";
}
$pdf->SetFont('', '', 6);
if (empty($onlynumber) && !empty($account->domiciliation)) {
$pdf->SetXY($curx, $cury);
$val = $outputlangs->transnoentities("Residence") . ': ' . $outputlangs->convToOutputCharset($account->domiciliation);
$pdf->MultiCell(100, 3, $val, 0, 'L', 0);
$nboflines = dol_nboflines_bis($val, 120);
//print $nboflines;exit;
$cury += $nboflines * 2 + 2;
} else {
if (!$usedetailedbban) {
$cury += 1;
}
}
$pdf->SetXY($curx, $cury);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey) . ': ' . $outputlangs->convToOutputCharset($account->iban), 0, 'L', 0);
$pdf->SetXY($curx, $cury + 3);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey) . ': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
return $pdf->getY();
}
示例4:
}
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
print '</tr>';
if ($account->useDetailedBBAN() == 1)
{
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
print '</tr>';
}
$ibankey="IBANNumber";
$bickey="BICNumber";
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
// IBAN
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
print '<td colspan="3"><input size="26" type="text" class="flat" name="iban_prefix" value="'.$account->iban_prefix.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
print '<td colspan="3"><input size="12" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
print $account->domiciliation;
print "</textarea></td></tr>";
print '<tr><td valign="top">'.$langs->trans("BankAccountCountry").'</td><td colspan="3">';
示例5: getCountry
print '<td colspan="3">';
$selectedcode = $account->account_currency_code;
if (!$selectedcode) {
$selectedcode = $conf->currency;
}
print $langs->trans("Currency" . $selectedcode);
print '</td></tr>';
// Status
print '<tr><td valign="top">' . $langs->trans("Status") . '</td>';
print '<td colspan="3">' . $account->getLibStatut(4);
print '</td></tr>';
if ($account->type == 0 || $account->type == 1) {
print '<tr><td valign="top">' . $langs->trans("BankAccountCountry") . '</td><td colspan="3">';
$img = picto_from_langcode($account->country_code);
print $img ? $img . ' ' : '';
print getCountry($account->getCountryCode(), 0, $db);
print "</td></tr>\n";
// If bank account
print '<tr><td valign="top">' . $langs->trans("BankName") . '</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="' . $account->bank . '"></td>';
print '</tr>';
// Show fields of bank account
$fieldlists = 'BankCode DeskCode AccountNumber BankAccountNumberKey';
if (!empty($conf->global->BANK_SHOW_ORDER_OPTION)) {
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) {
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') {
$fieldlists = 'BankCode DeskCode BankAccountNumberKey AccountNumber';
}
} else {
$fieldlists = $conf->global->BANK_SHOW_ORDER_OPTION;
}
示例6:
if ($account->useDetailedBBAN() == 2) {
print '<tr><td>' . $langs->trans("BankCode") . '</td>';
print '<td><input size="8" type="text" class="flat" name="code_banque" value="' . $account->code_banque . '"></td>';
print '</tr>';
}
print '<td>' . $langs->trans("BankAccountNumber") . '</td>';
print '<td><input size="18" type="text" class="flat" name="number" value="' . $account->number . '"></td>';
print '</tr>';
if ($account->useDetailedBBAN() == 1) {
print '<td>' . $langs->trans("BankAccountNumberKey") . '</td>';
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="' . $account->cle_rib . '"></td>';
print '</tr>';
}
$ibankey = "IBANNumber";
$bickey = "BICNumber";
if ($account->getCountryCode() == 'IN') {
$ibankey = "IFSC";
}
if ($account->getCountryCode() == 'IN') {
$bickey = "SWIFT";
}
// IBAN
print '<tr><td valign="top">' . $langs->trans($ibankey) . '</td>';
print '<td colspan="3"><input size="26" type="text" class="flat" name="iban_prefix" value="' . $account->iban_prefix . '"></td></tr>';
print '<tr><td valign="top">' . $langs->trans($bickey) . '</td>';
print '<td colspan="3"><input size="12" maxlength="11" type="text" class="flat" name="bic" value="' . $account->bic . '"></td></tr>';
print '<tr><td valign="top">' . $langs->trans("BankAccountDomiciliation") . '</td><td colspan="3">';
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
print $account->domiciliation;
print "</textarea></td></tr>";
print '<tr><td valign="top">' . $langs->trans("BankAccountCountry") . '</td><td colspan="3">';