Merge pull request #12469 from frederic34/patch-6

Update bookkeeping.class.php
This commit is contained in:
Laurent Destailleur 2019-11-19 10:55:11 +01:00 committed by GitHub
commit ebd1f74b3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -32,16 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/ */
class BookKeeping extends CommonObject class BookKeeping extends CommonObject
{ {
/**
* @var string Error code (or message)
*/
public $error;
/**
* @var string[] Array of Error codes (or messages)
*/
public $errors = array();
/** /**
* @var string Id to identify managed objects * @var string Id to identify managed objects
*/ */
@ -235,13 +225,13 @@ class BookKeeping extends CommonObject
$this->label_operation = trim($this->label_operation); $this->label_operation = trim($this->label_operation);
} }
if (isset($this->debit)) { if (isset($this->debit)) {
$this->debit = trim($this->debit); $this->debit = (float) $this->debit;
} }
if (isset($this->credit)) { if (isset($this->credit)) {
$this->credit = trim($this->credit); $this->credit = (float) $this->credit;
} }
if (isset($this->montant)) { if (isset($this->montant)) {
$this->montant = trim($this->montant); $this->montant = (float) $this->montant;
} }
if (isset($this->sens)) { if (isset($this->sens)) {
$this->sens = trim($this->sens); $this->sens = trim($this->sens);
@ -258,8 +248,8 @@ class BookKeeping extends CommonObject
if (isset($this->piece_num)) { if (isset($this->piece_num)) {
$this->piece_num = trim($this->piece_num); $this->piece_num = trim($this->piece_num);
} }
if (empty($this->debit)) $this->debit = 0; if (empty($this->debit)) $this->debit = 0.0;
if (empty($this->credit)) $this->credit = 0; if (empty($this->credit)) $this->credit = 0.0;
// Check parameters // Check parameters
if (($this->numero_compte == "") || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined') if (($this->numero_compte == "") || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined')