mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge pull request #32624 from aspangaro/19fix32339
FIX #32339 Delete a loan settlement is partial
This commit is contained in:
commit
ee8dbf225b
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015-2023 Frederic France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
|
||||
/* Copyright (C) 2014-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2015-2023 Frederic France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -102,6 +102,10 @@ class PaymentLoan extends CommonObject
|
|||
public $label;
|
||||
public $paymenttype;
|
||||
public $bank_account;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $bank_line;
|
||||
|
||||
|
||||
|
|
@ -386,20 +390,17 @@ class PaymentLoan extends CommonObject
|
|||
*/
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url";
|
||||
$sql .= " WHERE type='payment_loan' AND url_id=".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
if ($this->bank_line > 0) {
|
||||
$accline = new AccountLine($this->db);
|
||||
$accline->fetch($this->bank_line);
|
||||
$result = $accline->delete($user);
|
||||
if ($result < 0) {
|
||||
$this->errors[] = $accline->error;
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -430,22 +431,6 @@ class PaymentLoan extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
//if (! $error)
|
||||
//{
|
||||
// if (! $notrigger)
|
||||
// {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
// }
|
||||
//}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user