dolibarr/htdocs/core/class/fiscalyear.class.php

528 lines
14 KiB
PHP
Raw Permalink Normal View History

2014-05-28 05:34:10 +02:00
<?php
/* Copyright (C) 2014-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2020 OScss-Shop <support@oscss-shop.fr>
* Copyright (C) 2023-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
2014-05-28 05:34:10 +02:00
*
* 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
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2014-05-28 05:34:10 +02:00
*/
/**
2018-09-01 09:40:50 +02:00
* \file htdocs/core/class/fiscalyear.class.php
2014-05-28 05:34:10 +02:00
* \ingroup fiscal year
2014-06-29 05:41:24 +02:00
* \brief File of class to manage fiscal years
2014-05-28 05:34:10 +02:00
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
2014-05-28 05:34:10 +02:00
/**
* Class to manage fiscal year
*/
2015-03-17 10:47:20 +01:00
class Fiscalyear extends CommonObject
2014-05-28 05:34:10 +02:00
{
2018-08-23 18:17:09 +02:00
/**
* @var string ID to identify managed object
*/
public $element = 'fiscalyear';
2018-09-01 09:40:50 +02:00
2020-12-05 23:53:55 +01:00
/**
* @var string picto
*/
2023-10-11 14:40:02 +02:00
public $picto = 'calendar';
2020-08-16 23:33:50 +02:00
2018-08-22 18:34:50 +02:00
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element = 'accounting_fiscalyear';
2018-09-01 09:40:50 +02:00
2018-09-02 11:08:41 +02:00
/**
2020-12-05 23:53:55 +01:00
* @var string Name of subtable line
2018-09-02 11:08:41 +02:00
*/
2014-05-28 05:34:10 +02:00
public $table_element_line = '';
2018-09-01 15:13:59 +02:00
/**
2020-12-05 23:53:55 +01:00
* @var string Field with ID of parent key if this field has a parent
2018-09-01 15:13:59 +02:00
*/
2014-05-28 05:34:10 +02:00
public $fk_element = '';
2018-09-01 15:13:59 +02:00
2018-09-01 22:55:10 +02:00
/**
* @var int ID
*/
2018-09-01 15:13:59 +02:00
public $rowid;
2014-05-28 05:34:10 +02:00
2018-08-22 11:39:37 +02:00
/**
2018-12-03 21:25:44 +01:00
* @var string fiscal year label
*/
public $label;
2019-09-06 19:12:43 +02:00
2019-03-21 15:06:14 +01:00
/**
* Date start (date_start)
*
* @var integer
*/
2018-09-01 15:13:59 +02:00
public $date_start;
2019-09-06 19:12:43 +02:00
2019-03-21 15:06:14 +01:00
/**
* Date end (date_end)
*
* @var integer
*/
2018-09-01 15:13:59 +02:00
public $date_end;
2019-09-06 19:12:43 +02:00
2019-03-21 15:06:14 +01:00
/**
* Date creation record (datec)
*
* @var integer
*/
public $datec;
2019-09-06 19:12:43 +02:00
2023-04-24 10:22:05 +02:00
/**
* @var int status 0=open, 1=closed
* @deprecated
* @see $status
*/
public $statut;
/**
* @var int status 0=open, 1=closed
*/
public $status;
2018-10-05 15:44:57 +02:00
/**
* @var int Entity
*/
2018-09-01 15:13:59 +02:00
public $entity;
2014-05-28 05:34:10 +02:00
2023-04-24 10:22:05 +02:00
const STATUS_OPEN = 0;
const STATUS_CLOSED = 1;
2020-08-16 23:33:50 +02:00
2014-05-28 05:34:10 +02:00
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
2019-02-26 23:15:28 +01:00
public function __construct(DoliDB $db)
2014-05-28 05:34:10 +02:00
{
$this->db = $db;
2014-09-09 09:46:57 +02:00
$this->ismultientitymanaged = 1;
2023-10-11 14:40:02 +02:00
$this->labelStatusShort = array(self::STATUS_OPEN => 'Opened', self::STATUS_CLOSED => 'Closed');
$this->labelStatus = array(self::STATUS_OPEN => 'Opened', self::STATUS_CLOSED => 'Closed');
2014-05-28 05:34:10 +02:00
}
/**
2014-07-05 21:58:39 +02:00
* Create object in database
2014-05-28 05:34:10 +02:00
*
2014-07-05 21:58:39 +02:00
* @param User $user User making creation
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2014-05-28 05:34:10 +02:00
*/
2019-02-26 23:15:28 +01:00
public function create($user)
2014-05-28 05:34:10 +02:00
{
global $conf;
2014-09-09 09:46:57 +02:00
2014-06-29 05:41:24 +02:00
$error = 0;
2014-09-09 09:46:57 +02:00
$now = dol_now();
2014-05-28 05:34:10 +02:00
$this->db->begin();
2022-01-27 10:19:35 +01:00
$sql = "INSERT INTO ".$this->db->prefix()."accounting_fiscalyear (";
$sql .= "label";
$sql .= ", date_start";
$sql .= ", date_end";
$sql .= ", statut";
$sql .= ", entity";
$sql .= ", datec";
$sql .= ", fk_user_author";
$sql .= ") VALUES (";
$sql .= " '".$this->db->escape($this->label)."'";
$sql .= ", '".$this->db->idate($this->date_start)."'";
$sql .= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null");
$sql .= ", 0";
2021-09-03 21:25:17 +02:00
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->idate($now)."'";
2021-09-03 21:25:17 +02:00
$sql .= ", ".((int) $user->id);
$sql .= ")";
2014-05-28 05:34:10 +02:00
2014-07-05 08:47:01 +02:00
dol_syslog(get_class($this)."::create", LOG_DEBUG);
2014-05-28 05:34:10 +02:00
$result = $this->db->query($sql);
2021-02-23 22:03:23 +01:00
if ($result) {
2022-01-27 10:19:35 +01:00
$this->id = $this->db->last_insert_id($this->db->prefix()."accounting_fiscalyear");
2014-05-28 05:34:10 +02:00
$result = $this->update($user);
2021-02-23 22:03:23 +01:00
if ($result > 0) {
2014-05-28 05:34:10 +02:00
$this->db->commit();
2014-07-05 21:58:39 +02:00
return $this->id;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->lasterror();
2014-05-28 05:34:10 +02:00
$this->db->rollback();
return $result;
}
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->lasterror()." sql=".$sql;
2014-05-28 05:34:10 +02:00
$this->db->rollback();
return -1;
}
}
2014-09-09 09:46:57 +02:00
2014-05-28 05:34:10 +02:00
/**
* Update record
*
* @param User $user User making update
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2014-05-28 05:34:10 +02:00
*/
2019-02-26 23:15:28 +01:00
public function update($user)
2014-05-28 05:34:10 +02:00
{
// Check parameters
2021-02-23 22:03:23 +01:00
if (empty($this->date_start) && empty($this->date_end)) {
$this->error = 'ErrorBadParameter';
2018-12-03 21:25:44 +01:00
return -1;
}
2014-09-09 09:46:57 +02:00
2014-05-28 05:34:10 +02:00
$this->db->begin();
2022-01-27 10:19:35 +01:00
$sql = "UPDATE ".$this->db->prefix()."accounting_fiscalyear";
$sql .= " SET label = '".$this->db->escape($this->label)."'";
2014-07-05 08:47:01 +02:00
$sql .= ", date_start = '".$this->db->idate($this->date_start)."'";
2014-09-09 09:46:57 +02:00
$sql .= ", date_end = ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null");
2023-10-07 08:17:26 +02:00
$sql .= ", statut = '".$this->db->escape($this->status ? $this->status : 0)."'";
$sql .= ", fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id);
2014-05-28 05:34:10 +02:00
2014-07-05 08:47:01 +02:00
dol_syslog(get_class($this)."::update", LOG_DEBUG);
2014-05-28 05:34:10 +02:00
$result = $this->db->query($sql);
2021-02-23 22:03:23 +01:00
if ($result) {
2014-05-28 05:34:10 +02:00
$this->db->commit();
return 1;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->lasterror();
2014-09-09 09:46:57 +02:00
dol_syslog($this->error, LOG_ERR);
2014-05-28 05:34:10 +02:00
$this->db->rollback();
return -1;
}
}
2014-09-09 09:46:57 +02:00
2014-05-28 05:34:10 +02:00
/**
* Load an object from database
*
* @param int $id Id of record to load
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
*/
2019-02-26 23:15:28 +01:00
public function fetch($id)
2014-05-28 05:34:10 +02:00
{
2023-04-24 10:22:05 +02:00
$sql = "SELECT rowid, label, date_start, date_end, statut as status";
2022-01-27 10:19:35 +01:00
$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2021-03-14 11:48:39 +01:00
$sql .= " WHERE rowid = ".((int) $id);
2014-05-28 05:34:10 +02:00
2014-07-05 08:47:01 +02:00
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
2014-05-28 05:34:10 +02:00
$result = $this->db->query($sql);
2021-02-23 22:03:23 +01:00
if ($result) {
2014-05-28 05:34:10 +02:00
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
2014-07-05 08:47:01 +02:00
$this->date_start = $this->db->jdate($obj->date_start);
$this->date_end = $this->db->jdate($obj->date_end);
$this->label = $obj->label;
2023-04-24 10:22:05 +02:00
$this->statut = $obj->status;
$this->status = $obj->status;
2014-05-28 05:34:10 +02:00
return 1;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->lasterror();
2014-05-28 05:34:10 +02:00
return -1;
}
}
2014-09-09 09:46:57 +02:00
/**
2019-10-27 11:18:36 +01:00
* Delete record
*
* @param User $user User that delete
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2019-10-27 11:18:36 +01:00
*/
public function delete($user)
2014-06-29 05:41:24 +02:00
{
$this->db->begin();
$sql = "DELETE FROM ".$this->db->prefix()."accounting_fiscalyear";
$sql .= " WHERE rowid = ".((int) $this->id);
2014-06-29 05:41:24 +02:00
$result = $this->db->query($sql);
2021-02-23 22:03:23 +01:00
if ($result) {
2014-06-29 05:41:24 +02:00
$this->db->commit();
return 1;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->lasterror();
2014-06-29 05:41:24 +02:00
$this->db->rollback();
return -1;
}
}
2014-09-09 09:46:57 +02:00
2023-04-24 10:00:45 +02:00
/**
* getTooltipContentArray
* @param array<string,mixed> $params params to construct tooltip data
2023-04-24 10:00:45 +02:00
* @since v18
* @return array{picto?:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string}|array{optimize:string}
2023-04-24 10:00:45 +02:00
*/
public function getTooltipContentArray($params)
{
global $langs;
$langs->load('compta');
$datas = [];
$datas['picto'] = img_picto('', $this->picto).' <b><u>'.$langs->trans("FiscalPeriod").'</u></b>';
2023-04-24 10:22:05 +02:00
if (isset($this->status)) {
2023-04-24 10:00:45 +02:00
$datas['picto'] .= ' '.$this->getLibStatut(5);
}
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (isset($this->date_start)) {
2023-10-11 14:40:02 +02:00
$datas['date_start'] = '<br><b>'.$langs->trans('DateStart').':</b> '.dol_print_date($this->date_start, 'day');
2023-04-24 10:00:45 +02:00
}
if (isset($this->date_start)) {
2023-10-11 14:40:02 +02:00
$datas['date_end'] = '<br><b>'.$langs->trans('DateEnd').':</b> '.dol_print_date($this->date_end, 'day');
2023-04-24 10:00:45 +02:00
}
return $datas;
}
2014-05-28 05:34:10 +02:00
/**
* Return clickable link of object (with eventually picto)
2020-08-16 23:33:50 +02:00
*
* @param int $withpicto Add picto into link
* @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
{
global $conf, $langs, $user;
2021-02-23 22:03:23 +01:00
if (empty($this->ref)) {
$this->ref = (string) $this->id;
2021-02-23 22:03:23 +01:00
}
2020-08-16 23:33:50 +02:00
2021-02-23 22:03:23 +01:00
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
}
2023-04-24 10:00:45 +02:00
$option = '';
if (!$user->hasRight('accounting', 'fiscalyear', 'write')) {
2020-08-16 23:33:50 +02:00
$option = 'nolink';
2021-02-23 22:03:23 +01:00
}
2023-04-24 10:00:45 +02:00
$result = '';
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
2023-04-24 10:00:45 +02:00
'nofetch' => 1,
];
$classfortooltip = 'classfortooltip';
$dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"';
$label = 'ToComplete';
} else {
$label = implode($this->getTooltipContentArray($params));
}
$url = DOL_URL_ROOT.'/accountancy/admin/fiscalyear_card.php?id='.$this->id;
2020-08-16 23:33:50 +02:00
2021-02-23 22:03:23 +01:00
if ($option !== 'nolink') {
2020-08-16 23:33:50 +02:00
// Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
2023-09-10 17:41:22 +02:00
if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
2021-02-23 22:03:23 +01:00
$add_save_lastsearch_values = 1;
}
if ($add_save_lastsearch_values) {
$url .= '&save_lastsearch_values=1';
}
2020-08-16 23:33:50 +02:00
}
$linkclose = '';
2023-04-24 10:00:45 +02:00
if (empty($notooltip) && $user->hasRight('accounting', 'fiscalyear', 'write')) {
2023-11-27 11:24:19 +01:00
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
2024-04-04 15:15:04 +02:00
$label = $langs->trans("FiscalPeriod");
2025-01-09 01:41:24 +01:00
$linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
2020-08-16 23:33:50 +02:00
}
2025-01-09 01:41:24 +01:00
$linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
2023-04-24 10:00:45 +02:00
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
2020-08-16 23:33:50 +02:00
}
$linkstart = '<a href="'.$url.'"';
$linkstart .= $linkclose.'>';
$linkend = '</a>';
if ($option === 'nolink') {
$linkstart = '';
$linkend = '';
}
$result .= $linkstart;
2021-02-23 22:03:23 +01:00
if ($withpicto) {
2023-04-24 10:00:45 +02:00
$result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
2021-02-23 22:03:23 +01:00
}
if ($withpicto != 2) {
$result .= $this->ref;
}
2020-08-16 23:33:50 +02:00
$result .= $linkend;
return $result;
}
/**
2014-05-28 05:34:10 +02:00
* Give a label from a status
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
2019-02-26 23:15:28 +01:00
public function getLibStatut($mode = 0)
2014-05-28 05:34:10 +02:00
{
2023-04-24 10:22:05 +02:00
return $this->LibStatut($this->status, $mode);
2014-05-28 05:34:10 +02:00
}
2019-02-26 23:15:28 +01:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2014-05-28 05:34:10 +02:00
/**
2014-09-09 09:46:57 +02:00
* Give a label from a status
2014-05-28 05:34:10 +02:00
*
2019-11-01 23:58:14 +01:00
* @param int $status Id status
2014-05-28 05:34:10 +02:00
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
*/
2019-11-01 23:58:14 +01:00
public function LibStatut($status, $mode = 0)
2014-05-28 05:34:10 +02:00
{
2018-12-03 21:25:44 +01:00
// phpcs:enable
2023-10-11 14:40:02 +02:00
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs;
$this->labelStatus[self::STATUS_OPEN] = $langs->transnoentitiesnoconv('FiscalYearOpened');
$this->labelStatus[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('FiscalYearClosed');
$this->labelStatusShort[self::STATUS_OPEN] = $langs->transnoentitiesnoconv('FiscalYearOpenedShort');
$this->labelStatusShort[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('FiscalYearClosedShort');
2023-10-11 14:40:02 +02:00
}
2014-05-28 05:34:10 +02:00
2023-10-11 14:40:02 +02:00
$statusType = 'status4';
//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
if ($status == self::STATUS_CLOSED) {
$statusType = 'status6';
2014-05-28 05:34:10 +02:00
}
2023-10-11 14:40:02 +02:00
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
2014-05-28 05:34:10 +02:00
}
2014-09-09 09:46:57 +02:00
2014-07-05 08:47:01 +02:00
/**
* Information on record
*
* @param int $id Id of record
* @return void
*/
2019-02-26 23:15:28 +01:00
public function info($id)
2014-07-05 08:47:01 +02:00
{
$sql = "SELECT fy.rowid, fy.datec, fy.fk_user_author, fy.fk_user_modif,";
2022-06-28 13:09:53 +02:00
$sql .= " fy.tms as datem";
$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear as fy";
$sql .= " WHERE fy.rowid = ".((int) $id);
2014-07-05 08:47:01 +02:00
dol_syslog(get_class($this)."::fetch info", LOG_DEBUG);
$result = $this->db->query($sql);
2021-02-23 22:03:23 +01:00
if ($result) {
if ($this->db->num_rows($result)) {
2014-07-05 08:47:01 +02:00
$obj = $this->db->fetch_object($result);
2014-07-05 08:47:01 +02:00
$this->id = $obj->rowid;
2022-06-28 13:09:53 +02:00
$this->user_creation_id = $obj->fk_user_author;
$this->user_modification_id = $obj->fk_user_modif;
2014-07-05 08:47:01 +02:00
$this->date_creation = $this->db->jdate($obj->datec);
2022-06-28 13:09:53 +02:00
$this->date_modification = $this->db->jdate($obj->datem);
2014-07-05 08:47:01 +02:00
}
$this->db->free($result);
2020-05-21 15:05:19 +02:00
} else {
2014-07-05 08:47:01 +02:00
dol_print_error($this->db);
}
}
/**
* Return the number of entries by fiscal year
*
2023-12-22 16:10:14 +01:00
* @param int|string $datestart Date start to scan
* @param int|string $dateend Date end to scan
* @return int Number of entries
*/
public function getAccountancyEntriesByFiscalYear($datestart = '', $dateend = '')
{
global $conf;
2021-02-23 22:03:23 +01:00
if (empty($datestart)) {
$datestart = $this->date_start;
2021-02-23 22:03:23 +01:00
}
if (empty($dateend)) {
$dateend = $this->date_end;
2021-02-23 22:03:23 +01:00
}
$sql = "SELECT count(DISTINCT piece_num) as nb";
2022-01-27 10:19:35 +01:00
$sql .= " FROM ".$this->db->prefix()."accounting_bookkeeping";
$sql .= " WHERE entity IN (".getEntity('bookkeeping', 0).")";
$sql .= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'";
$nb = 0;
$resql = $this->db->query($sql);
2021-02-23 22:03:23 +01:00
if ($resql) {
$obj = $this->db->fetch_object($resql);
$nb = (int) $obj->nb;
2021-02-23 22:03:23 +01:00
} else {
dol_print_error($this->db);
}
return $nb;
}
/**
* Return the number of movements by fiscal year
*
2023-12-22 16:10:14 +01:00
* @param int|string $datestart Date start to scan
* @param int|string $dateend Date end to scan
* @return int Number of movements
*/
public function getAccountancyMovementsByFiscalYear($datestart = '', $dateend = '')
{
global $conf;
2021-02-23 22:03:23 +01:00
if (empty($datestart)) {
$datestart = $this->date_start;
2021-02-23 22:03:23 +01:00
}
if (empty($dateend)) {
$dateend = $this->date_end;
2021-02-23 22:03:23 +01:00
}
$sql = "SELECT count(rowid) as nb";
2022-01-27 10:19:35 +01:00
$sql .= " FROM ".$this->db->prefix()."accounting_bookkeeping ";
$sql .= " WHERE entity IN (".getEntity('bookkeeping', 0).")";
$sql .= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'";
$nb = 0;
$resql = $this->db->query($sql);
2021-02-23 22:03:23 +01:00
if ($resql) {
$obj = $this->db->fetch_object($resql);
$nb = (int) $obj->nb;
2021-02-23 22:03:23 +01:00
} else {
dol_print_error($this->db);
}
return $nb;
}
}