Fix debug sepa module
This commit is contained in:
parent
abb8cd260f
commit
2d5c35b12a
@ -3981,7 +3981,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Create a withdrawal request for a standing order.
|
* Create a withdrawal request for a direct debit order or a credit transfer order.
|
||||||
* Use the remain to pay excluding all existing open direct debit requests.
|
* Use the remain to pay excluding all existing open direct debit requests.
|
||||||
*
|
*
|
||||||
* @param User $fuser User asking the direct debit transfer
|
* @param User $fuser User asking the direct debit transfer
|
||||||
@ -3993,6 +3993,7 @@ class Facture extends CommonInvoice
|
|||||||
public function demande_prelevement($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'facture')
|
public function demande_prelevement($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'facture')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
@ -4011,6 +4012,7 @@ class Facture extends CommonInvoice
|
|||||||
} else {
|
} else {
|
||||||
$sql .= ' WHERE fk_facture = '.$this->id;
|
$sql .= ' WHERE fk_facture = '.$this->id;
|
||||||
}
|
}
|
||||||
|
$sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments
|
||||||
$sql .= ' AND traite = 0';
|
$sql .= ' AND traite = 0';
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||||
@ -4041,7 +4043,7 @@ class Facture extends CommonInvoice
|
|||||||
} else {
|
} else {
|
||||||
$sql .= 'fk_facture, ';
|
$sql .= 'fk_facture, ';
|
||||||
}
|
}
|
||||||
$sql .= ' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype)';
|
$sql .= ' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, entity)';
|
||||||
$sql .= ' VALUES ('.$this->id;
|
$sql .= ' VALUES ('.$this->id;
|
||||||
$sql .= ",'".price2num($amount)."'";
|
$sql .= ",'".price2num($amount)."'";
|
||||||
$sql .= ",'".$this->db->idate($now)."'";
|
$sql .= ",'".$this->db->idate($now)."'";
|
||||||
@ -4051,6 +4053,7 @@ class Facture extends CommonInvoice
|
|||||||
$sql .= ",'".$this->db->escape($bac->number)."'";
|
$sql .= ",'".$this->db->escape($bac->number)."'";
|
||||||
$sql .= ",'".$this->db->escape($bac->cle_rib)."'";
|
$sql .= ",'".$this->db->escape($bac->cle_rib)."'";
|
||||||
$sql .= ",'".$this->db->escape($sourcetype)."'";
|
$sql .= ",'".$this->db->escape($sourcetype)."'";
|
||||||
|
$sql .= ",".$conf->entity;
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||||
|
|||||||
@ -376,7 +376,7 @@ if ($massaction == 'makepayment'){
|
|||||||
foreach ($listofbills as $aBill)
|
foreach ($listofbills as $aBill)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
$result = $aBill->demande_prelevement($user, $aBill->resteapayer);
|
$result = $aBill->demande_prelevement($user, $aBill->resteapayer, 'direct-debit', 'facture');
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|||||||
@ -84,12 +84,12 @@ if (empty($reshook))
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$newtype = $type;
|
$newtype = $type;
|
||||||
$source_type = 'facture';
|
$sourcetype = 'facture';
|
||||||
if ($type == 'bank-transfer') {
|
if ($type == 'bank-transfer') {
|
||||||
$source_type = 'supplier_invoice';
|
$sourcetype = 'supplier_invoice';
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $source_type);
|
$result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -497,6 +497,7 @@ if ($object->id > 0)
|
|||||||
$sql .= " WHERE fk_facture = ".$object->id;
|
$sql .= " WHERE fk_facture = ".$object->id;
|
||||||
}
|
}
|
||||||
$sql .= " AND pfd.traite = 0";
|
$sql .= " AND pfd.traite = 0";
|
||||||
|
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||||
|
|
||||||
$result_sql = $db->query($sql);
|
$result_sql = $db->query($sql);
|
||||||
@ -518,6 +519,7 @@ if ($object->id > 0)
|
|||||||
$sql .= " WHERE fk_facture = ".$object->id;
|
$sql .= " WHERE fk_facture = ".$object->id;
|
||||||
}
|
}
|
||||||
$sql .= " AND pfd.traite = 0";
|
$sql .= " AND pfd.traite = 0";
|
||||||
|
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||||
|
|
||||||
$result_sql = $db->query($sql);
|
$result_sql = $db->query($sql);
|
||||||
if ($result_sql)
|
if ($result_sql)
|
||||||
@ -601,6 +603,7 @@ if ($object->id > 0)
|
|||||||
$sql .= " WHERE fk_facture = ".$object->id;
|
$sql .= " WHERE fk_facture = ".$object->id;
|
||||||
}
|
}
|
||||||
$sql .= " AND pfd.traite = 0";
|
$sql .= " AND pfd.traite = 0";
|
||||||
|
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||||
|
|
||||||
$result_sql = $db->query($sql);
|
$result_sql = $db->query($sql);
|
||||||
@ -653,6 +656,7 @@ if ($object->id > 0)
|
|||||||
$sql .= " WHERE fk_facture = ".$object->id;
|
$sql .= " WHERE fk_facture = ".$object->id;
|
||||||
}
|
}
|
||||||
$sql .= " AND pfd.traite = 1";
|
$sql .= " AND pfd.traite = 1";
|
||||||
|
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||||
$sql .= " ORDER BY pfd.date_demande DESC";
|
$sql .= " ORDER BY pfd.date_demande DESC";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|||||||
@ -62,6 +62,7 @@ function facture_prepare_head($object)
|
|||||||
$sql = "SELECT COUNT(pfd.rowid) as nb";
|
$sql = "SELECT COUNT(pfd.rowid) as nb";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||||
$sql .= " WHERE pfd.fk_facture = ".$object->id;
|
$sql .= " WHERE pfd.fk_facture = ".$object->id;
|
||||||
|
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -308,4 +308,8 @@ ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN hostcharset varchar(16)
|
|||||||
ALTER TABLE llx_adherent_type MODIFY subscription varchar(3) NOT NULL DEFAULT '1';
|
ALTER TABLE llx_adherent_type MODIFY subscription varchar(3) NOT NULL DEFAULT '1';
|
||||||
ALTER TABLE llx_adherent_type MODIFY vote varchar(3) NOT NULL DEFAULT '1';
|
ALTER TABLE llx_adherent_type MODIFY vote varchar(3) NOT NULL DEFAULT '1';
|
||||||
|
|
||||||
|
UPDATE llx_prelevement_facture_demande SET entity = 1 WHERE entity IS NULL;
|
||||||
|
|
||||||
|
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture);
|
||||||
|
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn);
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-order';
|
ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-order';
|
||||||
|
|
||||||
|
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture);
|
||||||
|
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn);
|
||||||
|
|
||||||
|
|
||||||
-- For v13
|
-- For v13
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
-- ===================================================================
|
||||||
|
-- Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
--
|
||||||
|
-- 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
|
||||||
|
-- the Free Software Foundation; either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
--
|
||||||
|
-- ===================================================================
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture);
|
||||||
|
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn);
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user