Skip to content

Commit

Permalink
FIX Dolibarr#32339 Delete a loan settlement is partial
Browse files Browse the repository at this point in the history
  • Loading branch information
aspangaro committed Jan 11, 2025
1 parent 8a7fdd0 commit 39fe6c2
Showing 1 changed file with 13 additions and 28 deletions.
41 changes: 13 additions & 28 deletions htdocs/loan/class/paymentloan.class.php
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -102,6 +102,10 @@ class PaymentLoan extends CommonObject
public $label;
public $paymenttype;
public $bank_account;

/**
* @var int
*/
public $bank_line;


Expand Down Expand Up @@ -386,20 +390,17 @@ public function update($user = null, $notrigger = 0)
*/
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();
}
}

Expand Down Expand Up @@ -430,22 +431,6 @@ public function delete($user, $notrigger = 0)
}
}

//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) {
Expand Down

0 comments on commit 39fe6c2

Please sign in to comment.