Fix: Affiche message erreur sur creation prelevement
This commit is contained in:
parent
de3b7d3df7
commit
27c1c42eea
@ -590,9 +590,11 @@ class BonPrelevement
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
/**
|
||||
* \brief Renvoi nombre de factures a prélever
|
||||
* \param banque bank
|
||||
* \param agence agence
|
||||
* \return int <O si erreur, sinon nbre de factures
|
||||
*/
|
||||
function NbFactureAPrelever($banque=0,$agence=0)
|
||||
{
|
||||
@ -625,21 +627,21 @@ class BonPrelevement
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
|
||||
return $row[0];
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
return $row[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = 1;
|
||||
dolibarr_syslog("BonPrelevement::SommeAPrelever Erreur -1");
|
||||
dolibarr_syslog($this->db->error());
|
||||
$this->error="BonPrelevement::SommeAPrelever Erreur -1 sql=".$this->db->error();
|
||||
dolibarr_syslog($this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Cree prelevement
|
||||
*
|
||||
* \return int <0 si ko, nbre de facture prélevé sinon
|
||||
*/
|
||||
function Create($banque=0, $guichet=0)
|
||||
{
|
||||
@ -666,8 +668,9 @@ class BonPrelevement
|
||||
*/
|
||||
$factures = array();
|
||||
$factures_prev = array();
|
||||
$factures_result = array();
|
||||
|
||||
if (!$error)
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
$sql = "SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc";
|
||||
@ -742,10 +745,10 @@ class BonPrelevement
|
||||
{
|
||||
$fact = new Facture($this->db);
|
||||
|
||||
if ($fact->fetch($fac[0]) == 1)
|
||||
if ($fact->fetch($fac[0]) >= 0)
|
||||
{
|
||||
$soc = new Societe($this->db);
|
||||
if ($soc->fetch($fact->socidp) == 1)
|
||||
if ($soc->fetch($fact->socidp) >= 0)
|
||||
{
|
||||
if ($soc->verif_rib() == 1)
|
||||
{
|
||||
@ -757,6 +760,7 @@ class BonPrelevement
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Erreur de RIB societe $fact->socidp $soc->nom");
|
||||
$facture_errors[$fac[0]]="Erreur de RIB societe $fact->socidp $soc->nom";
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -776,6 +780,7 @@ class BonPrelevement
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
@ -996,6 +1001,12 @@ class BonPrelevement
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("ROLLBACK");
|
||||
}
|
||||
|
||||
return sizeof($factures_prev);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,8 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
|
||||
$user->getrights('facture');
|
||||
if (!$user->rights->facture->lire)
|
||||
@ -38,8 +40,6 @@ $langs->load("bills");
|
||||
$langs->load("banks");
|
||||
$langs->load("withdrawals");
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
|
||||
// Sécurité accés client
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
@ -61,6 +61,7 @@ if ($_GET["action"] == "new")
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: prelevement.php?facid=".$fact->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -99,56 +100,34 @@ if ($_GET["facid"] > 0)
|
||||
$fac = New Facture($db);
|
||||
if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0)
|
||||
{
|
||||
|
||||
if ($mesg) print $mesg.'<br>';
|
||||
|
||||
$soc = new Societe($db, $fac->socidp);
|
||||
$soc->fetch($fac->socidp);
|
||||
|
||||
$author = new User($db);
|
||||
$author->id = $fac->user_author;
|
||||
$author->fetch();
|
||||
|
||||
$h = 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("CardBill");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans('Contact');
|
||||
$h++;
|
||||
|
||||
if ($conf->use_preview_tabs)
|
||||
if ($fac->user_author)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Preview");
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($fac->mode_reglement_code == 'PRE')
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("StandingOrders");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
$author->id = $fac->user_author;
|
||||
$author->fetch();
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Note");
|
||||
$h++;
|
||||
$head = facture_prepare_head($fac);
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$fac->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Bill")." : $fac->ref");
|
||||
dolibarr_fiche_head($head, 2, $langs->trans('Bill').' : '.$fac->ref);
|
||||
|
||||
/*
|
||||
* Facture
|
||||
*/
|
||||
* Facture
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference du facture
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $fac->ref;
|
||||
print "</td></tr>";
|
||||
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<tr><td width="20%">'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="5">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1524,18 +1524,18 @@ class Facture
|
||||
|
||||
|
||||
/**
|
||||
* \brief Créé une demande de prélèvement
|
||||
* \brief Créé une demande de prélèvement
|
||||
* \param user Utilisateur créant la demande
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function demande_prelevement($user)
|
||||
{
|
||||
dolibarr_syslog("Facture::demande_prelevement");
|
||||
dolibarr_syslog("Facture::demande_prelevement $this->statut $this->paye $this->mode_reglement_id");
|
||||
|
||||
$soc = new Societe($this->db);
|
||||
$soc->id = $this->socidp;
|
||||
$soc->rib();
|
||||
if ($this->statut > 0 && $this->paye == 0 && $this->mode_reglement_id == 3)
|
||||
if ($this->statut > 0 && $this->paye == 0 && $this->mode_reglement_id == 3)
|
||||
{
|
||||
$sql = 'SELECT count(*) FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
$sql .= ' WHERE fk_facture='.$this->id;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user