FIX Entry from stripe intent were reported into SEPA payments

FIX Label of popup on thirdparty
FIX Missing the tooltip when creating bank account
This commit is contained in:
Laurent Destailleur 2020-07-01 19:42:28 +02:00
parent 92a36dbeee
commit ae0c738980
6 changed files with 155 additions and 81 deletions

View File

@ -106,7 +106,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
{
$sql .= " AND f.fk_statut = ".FactureFournisseur::STATUS_VALIDATED;
}
$sql .= " AND pfd.traite = 0 AND pfd.fk_facture_fourn = f.rowid";
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " AND pfd.fk_facture_fourn = f.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
@ -195,7 +197,8 @@ if ($result)
print"\n<!-- debut table -->\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th>'.$langs->trans("LatestBankTransferReceipts", $limit).'</th>';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("LatestBankTransferReceipts", $limit).'</th>';
print '<th>'.$langs->trans("Date").'</th>';
print '<th class="right">'.$langs->trans("Amount").'</th>';
print '<th class="right">'.$langs->trans("Status").'</th>';
@ -222,7 +225,7 @@ if ($result)
$i++;
}
} else {
print '<tr><td class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("None").'</td></tr>';
}
print "</table></div><br>";

View File

@ -28,6 +28,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
@ -118,7 +119,7 @@ class BonPrelevement extends CommonObject
/**
* Add invoice to withdrawal
*
* @param int $facture_id id invoice to add
* @param int $invoice_id id invoice to add
* @param int $client_id id invoice customer
* @param string $client_nom customer name
* @param int $amount amount of invoice
@ -126,14 +127,16 @@ class BonPrelevement extends CommonObject
* @param string $code_guichet code of bank's office
* @param string $number bank account number
* @param string $number_key number key of account number
* @param string $type 'debit-order' or 'bank-transfer'
* @return int >0 if OK, <0 if KO
*/
public function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key)
public function AddFacture($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order')
{
// phpcs:enable
$result = 0;
$line_id = 0;
// Add lines
$result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key);
if ($result == 0)
@ -141,10 +144,14 @@ class BonPrelevement extends CommonObject
if ($line_id > 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture (";
$sql .= "fk_facture";
if ($type != 'bank-transfer') {
$sql .= "fk_facture";
} else {
$sql .= "fk_facture_fourn";
}
$sql .= ",fk_prelevement_lignes";
$sql .= ") VALUES (";
$sql .= $facture_id;
$sql .= $invoice_id;
$sql .= ", ".$line_id;
$sql .= ")";
@ -155,19 +162,19 @@ class BonPrelevement extends CommonObject
else
{
$result = -1;
dol_syslog(get_class($this)."::AddFacture Erreur $result");
dol_syslog(get_class($this)."::AddFacture Error $result");
}
}
else
{
$result = -2;
dol_syslog(get_class($this)."::AddFacture Erreur $result");
dol_syslog(get_class($this)."::AddFacture Error $result");
}
}
else
{
$result = -3;
dol_syslog(get_class($this)."::AddFacture Erreur $result");
dol_syslog(get_class($this)."::AddFacture Error $result");
}
return $result;
@ -686,7 +693,7 @@ class BonPrelevement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns amount of withdrawal
* Returns amount waiting for direct debit payment or credit transfer payment
*
* @param string $mode 'direct-debit' or 'bank-transfer'
* @return double <O if KO, Total amount
@ -715,6 +722,7 @@ class BonPrelevement extends CommonObject
}
$sql .= " AND f.paye = 0";
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " AND f.total_ttc > 0";
$resql = $this->db->query($sql);
@ -749,7 +757,7 @@ class BonPrelevement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get number of invoices to withdrawal
* Get number of invoices to pay
*
* @param string $type 'direct-debit' or 'bank-transfer'
* @return int <O if KO, number of invoices if OK
@ -777,6 +785,7 @@ class BonPrelevement extends CommonObject
$sql .= " AND f.rowid = pfd.fk_facture";
}
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " AND f.total_ttc > 0";
dol_syslog(get_class($this)."::NbFactureAPrelever");
@ -800,18 +809,19 @@ class BonPrelevement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a withdraw
* TODO delete params banque and agence when not necesary
* Create a direct debit order or a credit transfer order
* TODO delete params banque and agence when not necessary
*
* @param int $banque dolibarr mysoc bank
* @param int $agence dolibarr mysoc bank office (guichet)
* @param string $mode real=do action, simu=test only
* @param string $format FRST, RCUR or ALL
* @param int $banque dolibarr mysoc bank
* @param int $agence dolibarr mysoc bank office (guichet)
* @param string $mode real=do action, simu=test only
* @param string $format FRST, RCUR or ALL
* @param string $executiondate Date to execute the transfer
* @param int $notrigger Disable triggers
* @return int <0 if KO, nbre of invoice withdrawed if OK
* @param string $type 'direct-debit' or 'bank-transfer'
* @return int <0 if KO, nbre of invoice withdrawed if OK
*/
public function Create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '', $notrigger = 0)
public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '', $notrigger = 0, $type = 'direct-debit')
{
// phpcs:enable
global $conf, $langs, $user;
@ -848,17 +858,26 @@ class BonPrelevement extends CommonObject
$sql .= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib";
$sql .= ", pfd.amount";
$sql .= ", s.nom as name";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
if ($type != 'bank-transfer') {
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
} else {
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
}
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE f.rowid = pfd.fk_facture";
$sql .= " AND f.entity IN (".getEntity('invoice').')';
$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
if ($type != 'bank-transfer') {
$sql .= " AND f.rowid = pfd.fk_facture";
} else {
$sql .= " AND f.rowid = pfd.fk_facture_fourn";
}
$sql .= " AND s.rowid = f.fk_soc";
//if ($banque || $agence) $sql.= " AND s.rowid = sr.fk_soc";
$sql .= " AND f.fk_statut = 1";
$sql .= " AND f.paye = 0";
$sql .= " AND pfd.traite = 0";
$sql .= " AND f.total_ttc > 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
//if ($banque) $sql.= " AND sr.code_banque = '".$conf->global->PRELEVEMENT_CODE_BANQUE."'";
//if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'";
@ -874,6 +893,12 @@ class BonPrelevement extends CommonObject
{
$row = $this->db->fetch_row($resql);
$factures[$i] = $row; // All fields
if ($row[7] == 0) {
$error++;
dol_syslog(__METHOD__."::Read invoices error Found a null invoice", LOG_ERR);
$this->invoice_in_error[$row[0]] = "Error for invoice id ".$row[0].", found a null amount";
break;
}
$i++;
}
$this->db->free($resql);
@ -891,15 +916,19 @@ class BonPrelevement extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
$soc = new Societe($this->db);
// Check RIB
// Check BAN
$i = 0;
dol_syslog(__METHOD__."::Check RIB", LOG_DEBUG);
dol_syslog(__METHOD__."::Check BAN", LOG_DEBUG);
if (count($factures) > 0)
{
foreach ($factures as $key => $fac)
{
$fact = new Facture($this->db);
if ($type != 'bank-transfer') {
$fact = new Facture($this->db);
} else {
$fact = new FactureFournisseur($this->db);
}
$resfetch = $fact->fetch($fac[0]);
if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice
{
@ -908,13 +937,15 @@ class BonPrelevement extends CommonObject
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $soc->id);
if ($format == 'FRST' && $bac->frstrecur != 'FRST')
{
continue;
}
if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR'))
{
continue;
if ($type != 'bank-transfer') {
if ($format == 'FRST' && $bac->frstrecur != 'FRST')
{
continue;
}
if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR'))
{
continue;
}
}
if ($bac->verif() >= 1)
@ -927,32 +958,32 @@ class BonPrelevement extends CommonObject
}
else
{
dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING);
dol_syslog(__METHOD__."::Check BAN Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING);
$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
$this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
}
}
else
{
dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING);
dol_syslog(__METHOD__."::Check BAN Failed to read company", LOG_WARNING);
}
}
else
{
dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING);
dol_syslog(__METHOD__."::Check BAN Failed to read invoice", LOG_WARNING);
}
}
}
else
{
dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING);
dol_syslog(__METHOD__."::Check BAN No invoice to process", LOG_WARNING);
}
}
$ok = 0;
// Withdraw invoices in factures_prev array
$out = count($factures_prev)." invoices will be withdrawn.";
$out = count($factures_prev)." invoices will be included.";
//print $out."\n";
dol_syslog($out);
@ -982,14 +1013,14 @@ class BonPrelevement extends CommonObject
{
/*
* We are in real mode.
* We create withdraw receipt and build withdraw into disk
* We create order and build file into disk
*/
$this->db->begin();
$now = dol_now();
/*
* Traitements
* Process order generation
*/
if (!$error)
{
@ -1001,7 +1032,7 @@ class BonPrelevement extends CommonObject
$sql .= " AND entity = ".$conf->entity;
$sql .= " ORDER BY ref DESC LIMIT 1";
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
@ -1009,18 +1040,23 @@ class BonPrelevement extends CommonObject
$row = $this->db->fetch_row($resql);
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0]) + 1, 0, 2), 2, "0", STR_PAD_LEFT);
$dir = $conf->prelevement->dir_output.'/receipts';
if ($type != 'bank-transfer') {
$dir = $conf->prelevement->dir_output.'/receipts';
} else {
$dir = $conf->paymentbybanktransfer->dir_output.'/receipts';
}
if (!is_dir($dir)) dol_mkdir($dir);
$this->filename = $dir.'/'.$ref.'.xml';
// Create withdraw receipt in database
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
$sql .= " ref, entity, datec";
$sql .= " ref, entity, datec, type";
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($ref)."'";
$sql .= ", ".$conf->entity;
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'";
$sql .= ")";
$resql = $this->db->query($sql);
@ -1058,7 +1094,9 @@ class BonPrelevement extends CommonObject
/*
* Add standing order
*
*
* $fac[0] : invoice_id
* $fac[1] : ???
* $fac[2] : third party id
* $fac[3] : banque
* $fac[4] : guichet
* $fac[5] : number
@ -1067,7 +1105,8 @@ class BonPrelevement extends CommonObject
* $fac[8] : client nom
* $fac[2] : client id
*/
$ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6]);
$ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6], $type);
if ($ri <> 0)
{
$error++;
@ -1080,13 +1119,12 @@ class BonPrelevement extends CommonObject
$sql .= ", fk_prelevement_bons = ".$this->id;
$sql .= " WHERE rowid = ".$fac[1];
dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql)
{
$error++;
dol_syslog(__METHOD__."::Update Orders::Error=".$this->db->error(), LOG_ERR);
dol_syslog(__METHOD__."::Update Error=".$this->db->error(), LOG_ERR);
}
}
}
@ -1095,11 +1133,10 @@ class BonPrelevement extends CommonObject
if (!$error)
{
/*
* Create direct debit order in a XML file
* Create file of direct debit order or credit transfer into a XML file
*/
dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG);
dol_syslog(__METHOD__."::Init direct debit file for ".count($factures_prev)." invoices", LOG_DEBUG);
if (count($factures_prev) > 0)
{
@ -1126,7 +1163,7 @@ class BonPrelevement extends CommonObject
$this->context['factures_prev'] = $factures_prev;
// Generation of SEPA file $this->filename
$this->generate($format, $executiondate);
$result = $this->generate($format, $executiondate);
}
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
}
@ -1149,8 +1186,13 @@ class BonPrelevement extends CommonObject
if (!$error && !$notrigger)
{
$triggername = 'DIRECT_DEBIT_ORDER_CREATE';
if ($type != 'bank-transfer') {
$triggername = 'CREDIT_TRANSFER_ORDER_CREATE';
}
// Call trigger
$result = $this->call_trigger('DIRECT_DEBIT_ORDER_CREATE', $user);
$result = $this->call_trigger($triggername, $user);
if ($result < 0) $error++;
// End call triggers
}
@ -1419,9 +1461,9 @@ class BonPrelevement extends CommonObject
* - Others countries: Warning message
* File is generated with name this->filename
*
* @param string $format FRST, RCUR or ALL
* @param string $executiondate Date to execute transfer
* @return int 0 if OK, <0 if KO
* @param string $format FRST, RCUR or ALL
* @param string $executiondate Date to execute transfer
* @return int >=0 if OK, <0 if KO
*/
public function generate($format = 'ALL', $executiondate = '')
{
@ -1468,7 +1510,7 @@ class BonPrelevement extends CommonObject
$this->total = 0;
/*
* section Debiteur (sepa Debiteurs bloc lines)
* Section Debitor (sepa Debiteurs bloc lines)
*/
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
@ -1593,13 +1635,15 @@ class BonPrelevement extends CommonObject
$langs->load('withdrawals');
// TODO Add here code to generate a generic file
fputs($this->file, $langs->trans('WithdrawalFileNotCapable', $mysoc->country_code));
fputs($this->file, $langs->transnoentitiesnoconv('WithdrawalFileNotCapable', $mysoc->country_code));
}
fclose($this->file);
if (!empty($conf->global->MAIN_UMASK))
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($this->file, octdec($conf->global->MAIN_UMASK));
return $result;
}
return $result;
}

View File

@ -5,7 +5,7 @@
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Markus Welters <markus@welters.de>
* Copyright (C) 2019 Markus Welters <markus@welters.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,7 +24,7 @@
/**
* \file htdocs/compta/prelevement/create.php
* \ingroup prelevement
* \brief Prelevement creation page
* \brief Page to create a direct debit order or a credit transfer order
*/
require '../../main.inc.php';
@ -77,11 +77,17 @@ if (empty($reshook))
}
if ($action == 'create')
{
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty
$delayindays = 0;
if ($type != 'bank-transfer') {
$conf->global->PRELEVEMENT_ADDDAYS;
} else {
$conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS;
}
$bprev = new BonPrelevement($db);
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday') + $conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear'));
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), (GETPOST('reday', 'int') + $delayindays), GETPOST('reyear', 'int'));
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate);
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
if ($result < 0)
{
setEventMessages($bprev->error, $bprev->errors, 'errors');
@ -257,8 +263,10 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
{
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
}
$sql .= " AND f.total_ttc > 0";
//$sql .= " AND pfd.amount > 0";
$sql .= " AND f.total_ttc > 0"; // Avoid credit notes
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
if ($type == 'bank-transfer') {
$sql .= " AND pfd.fk_facture_fourn = f.rowid";
} else {

View File

@ -22,7 +22,7 @@
/**
* \file htdocs/compta/prelevement/index.php
* \ingroup prelevement
* \brief Prelevement index page
* \brief Home page for direct debit orders
*/
@ -106,7 +106,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
{
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
}
$sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " AND pfd.fk_facture = f.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
@ -176,8 +178,9 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
* Withdraw receipts
* Direct debit orders
*/
$limit = 5;
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
@ -194,7 +197,8 @@ if ($result)
print"\n<!-- debut table -->\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th>'.$langs->trans("LastWithdrawalReceipt", $limit).'</th>';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("LastWithdrawalReceipt", $limit).'</th>';
print '<th>'.$langs->trans("Date").'</th>';
print '<th class="right">'.$langs->trans("Amount").'</th>';
print '<th class="right">'.$langs->trans("Status").'</th>';
@ -222,7 +226,7 @@ if ($result)
$i++;
}
} else {
print '<tr><td class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("None").'</td></tr>';
}
print "</table></div><br>";

View File

@ -2388,44 +2388,44 @@ class Societe extends CommonObject
$label .= '<div class="centpercent">';
if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier')
if ($option == 'customer' || $option == 'compta' || $option == 'category')
{
$label .= '<u>'.$langs->trans("ShowCustomer").'</u>';
$label .= '<u>'.$langs->trans("Customer").'</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id;
}
elseif ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{
$label .= '<u>'.$langs->trans("ShowProspect").'</u>';
$label .= '<u>'.$langs->trans("Prospect").'</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id;
}
elseif ($option == 'supplier')
elseif ($option == 'supplier' || $option == 'category_supplier')
{
$label .= '<u>'.$langs->trans("ShowSupplier").'</u>';
$label .= '<u>'.$langs->trans("Supplier").'</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id;
}
elseif ($option == 'agenda')
{
$label .= '<u>'.$langs->trans("ShowAgenda").'</u>';
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/agenda.php?socid='.$this->id;
}
elseif ($option == 'project')
{
$label .= '<u>'.$langs->trans("ShowProject").'</u>';
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/project.php?socid='.$this->id;
}
elseif ($option == 'margin')
{
$label .= '<u>'.$langs->trans("ShowMargin").'</u>';
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/margin/tabs/thirdpartyMargins.php?socid='.$this->id.'&type=1';
}
elseif ($option == 'contact')
{
$label .= '<u>'.$langs->trans("ShowContacts").'</u>';
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/contact.php?socid='.$this->id;
}
elseif ($option == 'ban')
{
$label .= '<u>'.$langs->trans("ShowBan").'</u>';
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$this->id;
}

View File

@ -1825,29 +1825,44 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
// Show fields of bank account
foreach ($companybankaccount->getFieldsToShow(1) as $val) {
$require = false;
$tooltip = '';
if ($val == 'BankCode') {
$name = 'code_banque';
$size = 8;
$content = $companybankaccount->code_banque;
} elseif ($val == 'DeskCode') {
$name = 'code_guichet';
$size = 8;
$content = $companybankaccount->code_guichet;
} elseif ($val == 'BankAccountNumber') {
$name = 'number';
$size = 18;
$content = $companybankaccount->number;
} elseif ($val == 'BankAccountNumberKey') {
$name = 'cle_rib';
$size = 3;
$content = $companybankaccount->cle_rib;
} elseif ($val == 'IBAN') {
$name = 'iban';
$size = 30;
$content = $companybankaccount->iban;
if ($companybankaccount->needIBAN()) $require = true;
$tooltip = $langs->trans("Example").':<br>LT12 1000 0111 0100 1000<br>FR14 2004 1010 0505 0001 3M02 606<br>LU28 0019 4006 4475 0000<br>DE89 3704 0044 0532 0130 00';
} elseif ($val == 'BIC') {
$name = 'bic';
$size = 12;
$content = $companybankaccount->bic;
if ($companybankaccount->needIBAN()) $require = true;
$tooltip = $langs->trans("Example").': LIABLT2XXXX';
}
print '<tr><td'.($require ? ' class="fieldrequired" ' : '').'>'.$langs->trans($val).'</td>';
print '<tr><td'.($require ? ' class="fieldrequired" ' : '').'>';
if ($tooltip) {
print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name);
} else {
print $langs->trans($val);
}
print '</td>';
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.GETPOST($name).'"></td>';
print '</tr>';
}