Fix: We try to create bank link record twice
Fix: Bad url
This commit is contained in:
parent
81f8de8266
commit
6961a82dbf
@ -376,32 +376,32 @@ class Paiement
|
||||
if (! $error)
|
||||
{
|
||||
$linkaddedforthirdparty=array();
|
||||
foreach ($this->amounts as $key => $value)
|
||||
foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of.
|
||||
{
|
||||
if ($mode == 'payment')
|
||||
{
|
||||
$fac = new Facture($this->db);
|
||||
$fac->fetch($key);
|
||||
$fac->fetch_thirdparty(); // This should be always same third party but we loop in case of.
|
||||
if (! in_array($fac->client->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
|
||||
$fac->fetch_thirdparty();
|
||||
if (! in_array($fac->thirdparty->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
|
||||
{
|
||||
$result=$acc->add_url_line($bank_line_id, $fac->client->id,
|
||||
DOL_URL_ROOT.'/compta/fiche.php?socid=', $fac->client->nom, 'company');
|
||||
$result=$acc->add_url_line($bank_line_id, $fac->thirdparty->id,
|
||||
DOL_URL_ROOT.'/compta/fiche.php?socid=', $fac->thirdparty->nom, 'company');
|
||||
if ($result <= 0) dol_print_error($this->db);
|
||||
$linkaddedforthirdparty[$fac->client->id]=$fac->client->id; // Mark as done for this thirdparty
|
||||
$linkaddedforthirdparty[$fac->thirdparty->id]=$fac->thirdparty->id; // Mark as done for this thirdparty
|
||||
}
|
||||
}
|
||||
if ($mode == 'payment_supplier')
|
||||
{
|
||||
$fac = new FactureFournisseur($this->db);
|
||||
$fac->fetch($key);
|
||||
$fac->fetch_fournisseur(); // This should be always same third party but we loop in case of.
|
||||
if (! in_array($fac->client->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
|
||||
$fac->fetch_thirdparty();
|
||||
if (! in_array($fac->thirdparty->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
|
||||
{
|
||||
$result=$acc->add_url_line($bank_line_id, $fac->fournisseur->id,
|
||||
DOL_URL_ROOT.'/fourn/fiche.php?socid=', $fac->fournisseur->nom, 'company');
|
||||
$result=$acc->add_url_line($bank_line_id, $fac->thirdparty->id,
|
||||
DOL_URL_ROOT.'/fourn/fiche.php?socid=', $fac->thirdparty->nom, 'company');
|
||||
if ($result <= 0) dol_print_error($this->db);
|
||||
$linkaddedforthirdparty[$fac->fournisseur->id]=$fac->fournisseur->id; // Mark as done for this thirdparty
|
||||
$linkaddedforthirdparty[$fac->thirdparty->id]=$fac->thirdparty->id; // Mark as done for this thirdparty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
@ -22,8 +22,8 @@
|
||||
/**
|
||||
* \file htdocs/compta/paiement/fiche.php
|
||||
* \ingroup facture
|
||||
* \brief Onglet paiement d'un paiement client
|
||||
* \remarks Fichier presque identique a fournisseur/paiement/fiche.php
|
||||
* \brief Page of a customer payment
|
||||
* \remarks Nearly same file than fournisseur/paiement/fiche.php
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
@ -114,6 +114,8 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
|
||||
|
||||
llxHeader();
|
||||
|
||||
$thirdpartystatic=new Societe($db);
|
||||
|
||||
$paiement = new Paiement($db);
|
||||
$result=$paiement->fetch($_GET['id']);
|
||||
if ($result <= 0)
|
||||
@ -254,7 +256,11 @@ if ($resql)
|
||||
print "</td>\n";
|
||||
|
||||
// Third party
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>';
|
||||
print '<td>';
|
||||
$thirdpartystatic->id=$objp->socid;
|
||||
$thirdpartystatic->nom=$objp->nom;
|
||||
print $thirdpartystatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Expected to pay
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
||||
|
||||
@ -381,19 +381,9 @@ class FactureFournisseur extends Facture
|
||||
|
||||
|
||||
/**
|
||||
* \brief Load supplier
|
||||
*/
|
||||
function fetch_fournisseur()
|
||||
{
|
||||
$fournisseur = new Fournisseur($this->db);
|
||||
$fournisseur->fetch($this->socid);
|
||||
$this->fournisseur = $fournisseur;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Delete invoice in database
|
||||
* \param rowid Id of invoice to delete
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* Delete invoice from database
|
||||
* @param rowid Id of invoice to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($rowid)
|
||||
{
|
||||
|
||||
@ -128,7 +128,7 @@ if ($facid > 0)
|
||||
$facture = new FactureFournisseur($db);
|
||||
if ($facture->fetch($facid))
|
||||
{
|
||||
$facture->fetch_fournisseur();
|
||||
$facture->fetch_thirdparty();
|
||||
|
||||
$upload_dir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($facture->id,2).$facture->id;
|
||||
|
||||
@ -158,7 +158,7 @@ if ($facid > 0)
|
||||
print "</tr>\n";
|
||||
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$facture->fournisseur->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$facture->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('NbOfAttachedFiles').'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ llxHeader();
|
||||
|
||||
if ($_GET["facid"])
|
||||
{
|
||||
$fac->fetch_fournisseur();
|
||||
$fac->fetch_thirdparty();
|
||||
|
||||
$head = facturefourn_prepare_head($fac);
|
||||
$titre=$langs->trans('SupplierInvoice');
|
||||
@ -112,7 +112,7 @@ if ($_GET["facid"])
|
||||
print "</tr>\n";
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$fac->fournisseur->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$fac->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Note publique
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user