Skip to content

Commit

Permalink
Merge branch 'develop' into loan_schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 authored Jan 15, 2025
2 parents af9efd8 + 9ee4a03 commit b5aa5d7
Show file tree
Hide file tree
Showing 579 changed files with 3,750 additions and 3,036 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The following changes may create regressions for some external modules, but were
For users:
----------
NEW: NEW Module - help to setup OpenID Connect (#30317)
NEW: Module AI moved from experimental to stable
NEW: Add hidden option CONTRACT_HIDE_MYCOMPANY_SIGNATURE_SECTION_PDF
NEW: Add a tab on recurring invoice card to see the list of invoices generated from this recurring invoice (customer and supplier invoices) (#31463)
NEW: #28871 signed_status to commande (#30359)
Expand Down
762 changes: 177 additions & 585 deletions dev/build/phpstan/phpstan-baseline.neon

Large diffs are not rendered by default.

94 changes: 0 additions & 94 deletions dev/initdemo/mysqldump_dolibarr_3.5.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -393,100 +393,6 @@ LOCK TABLES `llx_adherent_type_extrafields` WRITE;
/*!40000 ALTER TABLE `llx_adherent_type_extrafields` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `llx_advanced_extrafields`
--

DROP TABLE IF EXISTS `llx_advanced_extrafields`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_advanced_extrafields` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`entity` int(11) NOT NULL DEFAULT '1',
`elementtype` varchar(64) NOT NULL,
`name` varchar(64) NOT NULL,
`label` varchar(64) NOT NULL,
`format` varchar(8) NOT NULL,
`fieldsize` int(11) DEFAULT NULL,
`maxlength` int(11) DEFAULT NULL,
`options` varchar(255) DEFAULT NULL,
`rang` int(11) DEFAULT NULL,
PRIMARY KEY (`rowid`),
UNIQUE KEY `idx_advanced_extrafields_name` (`elementtype`,`entity`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `llx_advanced_extrafields`
--

LOCK TABLES `llx_advanced_extrafields` WRITE;
/*!40000 ALTER TABLE `llx_advanced_extrafields` DISABLE KEYS */;
/*!40000 ALTER TABLE `llx_advanced_extrafields` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `llx_advanced_extrafields_options`
--

DROP TABLE IF EXISTS `llx_advanced_extrafields_options`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_advanced_extrafields_options` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`fk_extrafields` int(11) NOT NULL,
`value` varchar(255) NOT NULL,
`rang` int(11) DEFAULT NULL,
PRIMARY KEY (`rowid`),
KEY `idx_advanced_extrafields_options_fk_advanced_extrafields` (`fk_extrafields`),
CONSTRAINT `fk_advanced_extrafields_options_fk_advanced_extrafields` FOREIGN KEY (`fk_extrafields`) REFERENCES `llx_advanced_extrafields` (`rowid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `llx_advanced_extrafields_options`
--

LOCK TABLES `llx_advanced_extrafields_options` WRITE;
/*!40000 ALTER TABLE `llx_advanced_extrafields_options` DISABLE KEYS */;
/*!40000 ALTER TABLE `llx_advanced_extrafields_options` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `llx_advanced_extrafields_values`
--

DROP TABLE IF EXISTS `llx_advanced_extrafields_values`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_advanced_extrafields_values` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`entity` int(11) NOT NULL DEFAULT '1',
`datec` datetime DEFAULT NULL,
`datem` datetime DEFAULT NULL,
`fk_element` int(11) NOT NULL,
`fk_extrafields` int(11) NOT NULL,
`value` varchar(255) DEFAULT NULL,
`fk_user_create` int(11) DEFAULT NULL,
`fk_user_modif` int(11) DEFAULT NULL,
PRIMARY KEY (`rowid`),
KEY `idx_advanced_extrafields_values_fk_advanced_extrafields` (`fk_extrafields`,`entity`),
CONSTRAINT `fk_advanced_extrafields_values_fk_advanced_extrafields` FOREIGN KEY (`fk_extrafields`) REFERENCES `llx_advanced_extrafields` (`rowid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `llx_advanced_extrafields_values`
--

LOCK TABLES `llx_advanced_extrafields_values` WRITE;
/*!40000 ALTER TABLE `llx_advanced_extrafields_values` DISABLE KEYS */;
/*!40000 ALTER TABLE `llx_advanced_extrafields_values` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `llx_bank`
--
Expand Down
4 changes: 4 additions & 0 deletions dev/tools/codespell/codespell-ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ espace
methode
datee

# Some string found because part of a text the is html entities escaped into file
tre
activ

# Translation keys
addin
amountin
Expand Down
1 change: 1 addition & 0 deletions dev/tools/codespell/codespell-lines-ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,4 @@ print '<td class="right">'.$langs->trans("NbOfMembers").' <span class="opacityme
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "cs.periode", "", $param, '', $sortfield, $sortorder, 'center ');
select#date_startday, select#date_startmonth, select#date_endday, select#date_endmonth, select#reday, select#remonth
select#date_startday, select#date_startmonth, select#date_endday, select#date_endmonth, select#reday, select#remonth,
$sql = "SELECT id_users, nom as name, id_sondage, reponses, tms, date_creation";
2 changes: 1 addition & 1 deletion dev/tools/phan/baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ return [
'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/modules_facture.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/modules/fichinter/mod_pacific.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'],
'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanTypeMismatchProperty'],
Expand Down
4 changes: 4 additions & 0 deletions htdocs/accountancy/admin/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@

print '<br>';

$parameters = array('chartofaccounts' => $chartofaccounts, 'permissiontoadd' => $permissiontoadd, 'permissiontodelete' => $permissiontodelete);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $accounting, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/bookkeeping/listbyaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
$sql .= $db->plimit(1);
$res = $db->query($sql);

if ($res->num_rows > 0) {
if ($res !== false && $db->num_rows($res) > 0) {
$fiscalYear = $db->fetch_object($res);
$search_date_start = strtotime($fiscalYear->date_start);
$search_date_end = strtotime($fiscalYear->date_end);
Expand Down
49 changes: 47 additions & 2 deletions htdocs/accountancy/class/accountingjournal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2017-2022 OpenDSI <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2024 Alexandre Janniaux <[email protected]>
*
* 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 @@ -103,6 +104,50 @@ public function __construct($db)
$this->ismultientitymanaged = 0;
}

/**
* Create a new Accounting Journal.
*
* @param User $user the user that created the journal, currently unused
* @return int Return integer <0 on error, or the ID of the created object
*/
public function create($user)
{
$valid_nature = array(1, 2, 3, 4, 5, 8, 9);
if (!in_array((int) $this->nature, $valid_nature)) {
$this->error = get_class($this)."::Create Error invalid field nature '" . strval($this->nature) . "'";
dol_syslog($this->error, LOG_ERR);
return -1;
}

$sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_journal";
$sql .= " (entity, code, label, nature, active)";
$sql .= " VALUES ("
. ((int) $this->entity) .",'"
. $this->db->escape($this->code) ."','"
. $this->db->escape($this->label) ."',"
. ((int) $this->nature) .","
. ((int) $this->active) .")";

dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = get_class($this)."::Create Error: " . $this->db->lasterror();
dol_syslog($this->error, LOG_ERR);
return -1;
}

$id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_journal");
if ($id <= 0) {
$this->error = get_class($this)."::Create Error " . $id . ": " . $this->db->lasterror();
dol_syslog($this->error, LOG_ERR);
return -2;
}

$this->id = $id;
$this->rowid = $id;
return $id;
}

/**
* Load an object from database
*
Expand Down Expand Up @@ -189,9 +234,9 @@ public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowAccountingJournal");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
$linkclose .= ' class="classfortooltip"';
}

Expand Down
4 changes: 2 additions & 2 deletions htdocs/accountancy/class/bookkeeping.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,9 @@ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowTransaction");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHTMLForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
Expand Down
11 changes: 6 additions & 5 deletions htdocs/accountancy/closure/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2019-2023 Open-DSI <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
/* Copyright (C) 2019-2023 Open-DSI <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
* Copyright (C) 2025 Alexandre Spangaro <[email protected]>
*
* 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 @@ -39,7 +40,7 @@
*/

// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
$langs->loadLangs(array("accountancy", "bills", "compta", "exports", "other"));

$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'aZ09');
Expand Down Expand Up @@ -410,7 +411,7 @@
// Step 2
$head = array();
$head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id'];
$head[0][1] = $langs->trans("Step").(getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE") ? '1' : '2').' - '.$langs->trans("AccountancyClosureStep2");
$head[0][1] = $langs->trans("Step"). ' ' . (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE") ? '1' : '2').' - '.$langs->trans("AccountancyClosureStep2");
$head[0][2] = 'step2';
print dol_get_fiche_head($head, 'step2', '', -1, '');

Expand All @@ -433,7 +434,7 @@
// Step 3
$head = array();
$head[0][0] = DOL_URL_ROOT . '/accountancy/closure/index.php?fiscal_period_id=' . $current_fiscal_period['id'];
$head[0][1] = $langs->trans("Step").(getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE") ? '2' : '3').' - '.$langs->trans("AccountancyClosureStep3");
$head[0][1] = $langs->trans("Step"). ' ' . (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE") ? '2' : '3').' - '.$langs->trans("AccountancyClosureStep3");
$head[0][2] = 'step3';
print dol_get_fiche_head($head, 'step3', '', -1, '');

Expand Down
32 changes: 17 additions & 15 deletions htdocs/accountancy/journal/expensereportsjournal.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,22 +253,24 @@
}

// Load all unbound lines
$sql = "SELECT fk_expensereport, COUNT(erd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql .= " WHERE erd.fk_code_ventilation <= 0";
$sql .= " AND erd.total_ttc <> 0";
$sql .= " AND fk_expensereport IN (".$db->sanitize(implode(",", array_keys($taber))).")";
$sql .= " GROUP BY fk_expensereport";
$resql = $db->query($sql);

$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj->nb > 0) {
$errorforinvoice[$obj->fk_expensereport] = 'somelinesarenotbound';
if (!empty($taber)) {
$sql = "SELECT fk_expensereport, COUNT(erd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql .= " WHERE erd.fk_code_ventilation <= 0";
$sql .= " AND erd.total_ttc <> 0";
$sql .= " AND fk_expensereport IN (".$db->sanitize(implode(",", array_keys($taber))).")";
$sql .= " GROUP BY fk_expensereport";
$resql = $db->query($sql);

$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj->nb > 0) {
$errorforinvoice[$obj->fk_expensereport] = 'somelinesarenotbound';
}
$i++;
}
$i++;
}

// Bookkeeping Write
Expand Down
50 changes: 25 additions & 25 deletions htdocs/accountancy/journal/purchasesjournal.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,34 +399,34 @@
}
}
*/

// New way, single query, load all unbound lines
$sql = "
SELECT
fk_facture_fourn,
COUNT(fd.rowid) as nb
FROM
" . MAIN_DB_PREFIX . "facture_fourn_det as fd
WHERE
fd.product_type <= 2
AND fd.fk_code_ventilation <= 0
AND fd.total_ttc <> 0
AND fk_facture_fourn IN (".$db->sanitize(implode(",", array_keys($tabfac))).")
GROUP BY fk_facture_fourn
";
$resql = $db->query($sql);

$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj->nb > 0) {
$errorforinvoice[$obj->fk_facture_fourn] = 'somelinesarenotbound';
if (!empty($tabfac)) {
$sql = "
SELECT
fk_facture_fourn,
COUNT(fd.rowid) as nb
FROM
" . MAIN_DB_PREFIX . "facture_fourn_det as fd
WHERE
fd.product_type <= 2
AND fd.fk_code_ventilation <= 0
AND fd.total_ttc <> 0
AND fk_facture_fourn IN (".$db->sanitize(implode(",", array_keys($tabfac))).")
GROUP BY fk_facture_fourn
";
$resql = $db->query($sql);

$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj->nb > 0) {
$errorforinvoice[$obj->fk_facture_fourn] = 'somelinesarenotbound';
}
$i++;
}
$i++;
}
//var_dump($errorforinvoice);exit;



// Bookkeeping Write
if ($action == 'writebookkeeping' && !$error && $user->hasRight('accounting', 'bind', 'write')) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/adherents/admin/member.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@
if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
}
print '</td>';

Expand Down
Loading

0 comments on commit b5aa5d7

Please sign in to comment.