Skip to content

Commit

Permalink
Merge branch 'develop' of [email protected]:Dolibarr/dolibarr.git into
Browse files Browse the repository at this point in the history
develop
  • Loading branch information
eldy committed Feb 19, 2025
2 parents 2049d56 + 0afd34e commit 1ee468c
Show file tree
Hide file tree
Showing 10 changed files with 522 additions and 132 deletions.
108 changes: 0 additions & 108 deletions dev/build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -26256,12 +26256,6 @@ parameters:
count: 4
path: ../../../htdocs/societe/website.php

-
message: '#^Parameter \#1 \$params of static method Stripe\\Terminal\\Location\:\:all\(\) expects array\|null, string given\.$#'
identifier: argument.type
count: 1
path: ../../../htdocs/stripe/admin/stripe.php

-
message: '#^Call to function is_object\(\) with Facture will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
Expand Down Expand Up @@ -26448,24 +26442,6 @@ parameters:
count: 6
path: ../../../htdocs/supplier_proposal/class/supplier_proposal.class.php

-
message: '#^Parameter \#3 \$remise_percent_ligne of function calcul_price_total expects float, string given\.$#'
identifier: argument.type
count: 2
path: ../../../htdocs/supplier_proposal/class/supplier_proposal.class.php

-
message: '#^Parameter \#5 \$uselocaltax1_rate of function calcul_price_total expects float, string given\.$#'
identifier: argument.type
count: 2
path: ../../../htdocs/supplier_proposal/class/supplier_proposal.class.php

-
message: '#^Parameter \#6 \$uselocaltax2_rate of function calcul_price_total expects float, string given\.$#'
identifier: argument.type
count: 2
path: ../../../htdocs/supplier_proposal/class/supplier_proposal.class.php

-
message: '#^Property SupplierProposal\:\:\$statut \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -26604,12 +26580,6 @@ parameters:
count: 1
path: ../../../htdocs/takepos/admin/terminal.php

-
message: '#^Parameter \#1 \$params of static method Stripe\\Terminal\\Reader\:\:all\(\) expects array\|null, string given\.$#'
identifier: argument.type
count: 2
path: ../../../htdocs/takepos/admin/terminal.php

-
message: '#^Right side of && is always true\.$#'
identifier: booleanAnd.rightAlwaysTrue
Expand Down Expand Up @@ -26664,18 +26634,6 @@ parameters:
count: 1
path: ../../../htdocs/takepos/index.php

-
message: '#^Variable \$CUSTOMER_DISPLAY_line1 might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$CUSTOMER_DISPLAY_line2 might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$batch might not be defined\.$#'
identifier: variable.undefined
Expand All @@ -26688,30 +26646,12 @@ parameters:
count: 1
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$creditnote might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$fk_source might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$footer_ticket might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$footerorder might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$header_soc might not be defined\.$#'
identifier: variable.undefined
Expand All @@ -26724,42 +26664,12 @@ parameters:
count: 1
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$headerorder might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$idoflineadded might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$printer might not be defined\.$#'
identifier: variable.undefined
count: 6
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$sectionwithinvoicelink might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$ticket_total might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$tva_npr might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/takepos/invoice.php

-
message: '#^Variable \$warehouseid might not be defined\.$#'
identifier: variable.undefined
Expand All @@ -26784,12 +26694,6 @@ parameters:
count: 3
path: ../../../htdocs/takepos/pay.php

-
message: '#^Variable \$stripeacc might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/takepos/pay.php

-
message: '#^Variable \$user might not be defined\.$#'
identifier: variable.undefined
Expand All @@ -26814,18 +26718,6 @@ parameters:
count: 1
path: ../../../htdocs/takepos/split.php

-
message: '#^Variable \$invoice might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../../htdocs/takepos/split.php

-
message: '#^Variable \$placeid might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/takepos/split.php

-
message: '#^Variable \$fontlist might not be defined\.$#'
identifier: variable.undefined
Expand Down
38 changes: 35 additions & 3 deletions htdocs/accountancy/admin/fiscalyear.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2025 Alexandre Spangaro <[email protected]>
* Copyright (C) 2024 Frédéric France <[email protected]>
/* Copyright (C) 2013-2025 Alexandre Spangaro <[email protected]>
* Copyright (C) 2024 Frédéric France <[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 All @@ -24,6 +24,8 @@

// Load Dolibarr environment
require '../../main.inc.php';

require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';

Expand Down Expand Up @@ -83,7 +85,25 @@
/*
* Actions
*/
if ($action == 'setdefault') {
// Set a fiscal year as default
$error = 0;

$defaultFiscalYear = GETPOSTINT('value');
$defaultFiscalYearLabel = GETPOST('label', 'alpha');

if (!empty($defaultFiscalYear)) {
dolibarr_set_const($db, 'ACCOUNTANCY_FISCALYEAR_DEFAULT', $defaultFiscalYear, 'chaine', 0, '', $conf->entity);
} else {
$error++;
}

if (!$error) {
setEventMessages($langs->trans("FiscalYearSetAsDefault", $defaultFiscalYearLabel), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}


/*
Expand Down Expand Up @@ -148,6 +168,7 @@
print '<td>'.$langs->trans("DateEnd").'</td>';
print '<td class="center">'.$langs->trans("NumberOfAccountancyEntries").'</td>';
print '<td class="center">'.$langs->trans("NumberOfAccountancyMovements").'</td>';
print '<td class="center">'.$langs->trans("Default").'</td>';
print '<td class="right">'.$langs->trans("Status").'</td>';
print '</tr>';

Expand All @@ -160,6 +181,7 @@

$fiscalyearstatic->ref = $obj->rowid;
$fiscalyearstatic->id = $obj->rowid;
$fiscalyearstatic->label = $obj->label;
$fiscalyearstatic->date_start = $obj->date_start;
$fiscalyearstatic->date_end = $obj->date_end;
$fiscalyearstatic->statut = $obj->status;
Expand All @@ -174,12 +196,22 @@
print '<td class="left">'.dol_print_date($db->jdate($obj->date_end), 'day').'</td>';
print '<td class="center">'.$object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end).'</td>';
print '<td class="center">'.$object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end).'</td>';

// Default
print '<td class="center">';
if (getDolGlobalString('ACCOUNTANCY_FISCALYEAR_DEFAULT') == (int) $fiscalyearstatic->ref) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdefault&token='.newToken().'&value='.urlencode($fiscalyearstatic->ref).'&label='.urlencode($fiscalyearstatic->label).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').'</a>';
}
print '</td>';

print '<td class="right">'.$fiscalyearstatic->LibStatut($obj->status, 5).'</td>';
print '</tr>';
$i++;
}
} else {
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
print '<tr class="oddeven"><td colspan="8"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>';
print '</div>';
Expand Down
11 changes: 8 additions & 3 deletions htdocs/accountancy/bookkeeping/balance.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2016 Olivier Geffroy <[email protected]>
* Copyright (C) 2016 Florian Henry <[email protected]>
* Copyright (C) 2016-2024 Alexandre Spangaro <[email protected]>
* Copyright (C) 2016-2025 Alexandre Spangaro <[email protected]>
* Copyright (C) 2018-2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
Expand Down Expand Up @@ -101,8 +101,13 @@
$form = new Form($db);

if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('formfilteraction')) {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
$sql = "SELECT date_start, date_end";
$sql .=" FROM ".MAIN_DB_PREFIX."accounting_fiscalyear ";
if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) {
$sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT');
} else {
$sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'";
}
$sql .= $db->plimit(1);
$res = $db->query($sql);

Expand Down
14 changes: 10 additions & 4 deletions htdocs/accountancy/bookkeeping/export.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <[email protected]>
* Copyright (C) 2013-2016 Florian Henry <[email protected]>
* Copyright (C) 2013-2024 Alexandre Spangaro <[email protected]>
* Copyright (C) 2013-2025 Alexandre Spangaro <[email protected]>
* Copyright (C) 2022 Lionel Vessiller <[email protected]>
* Copyright (C) 2016-2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2018-2024 Frédéric France <[email protected]>
Expand Down Expand Up @@ -170,9 +170,15 @@

if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOSTINT('page') == '' && !GETPOSTINT('noreset') && $user->hasRight('accounting', 'mouvements', 'export')) {
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) {
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
$res = $db->query($query);
$sql = "SELECT date_start, date_end";
$sql .=" FROM ".MAIN_DB_PREFIX."accounting_fiscalyear ";
if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) {
$sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT');
} else {
$sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'";
}
$sql .= $db->plimit(1);
$res = $db->query($sql);

if ($db->num_rows($res) > 0) {
$fiscalYear = $db->fetch_object($res);
Expand Down
29 changes: 18 additions & 11 deletions htdocs/accountancy/bookkeeping/list.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <[email protected]>
* Copyright (C) 2013-2016 Florian Henry <[email protected]>
* Copyright (C) 2013-2024 Alexandre Spangaro <alexandre@inoveasya.solutions>
* Copyright (C) 2022 Lionel Vessiller <[email protected]>
* Copyright (C) 2016-2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2018-2024 Frédéric France <[email protected]>
* Copyright (C) 2022 Progiseize <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
/* Copyright (C) 2013-2016 Olivier Geffroy <[email protected]>
* Copyright (C) 2013-2016 Florian Henry <[email protected]>
* Copyright (C) 2013-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2022 Lionel Vessiller <[email protected]>
* Copyright (C) 2016-2017 Laurent Destailleur <[email protected]>
* Copyright (C) 2018-2024 Frédéric France <[email protected]>
* Copyright (C) 2022 Progiseize <[email protected]>
* Copyright (C) 2024 MDW <[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 @@ -149,14 +149,21 @@
$object = new BookKeeping($db);
$hookmanager->initHooks(array('bookkeepinglist'));

$formfiscalyear = new FormFiscalYear($db);
$formaccounting = new FormAccounting($db);
$form = new Form($db);

if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'alpha') == '' && !GETPOSTINT('noreset') && $user->hasRight('accounting', 'mouvements', 'export')) {
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) {
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
$res = $db->query($query);
$sql = "SELECT date_start, date_end";
$sql .=" FROM ".MAIN_DB_PREFIX."accounting_fiscalyear ";
if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) {
$sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT');
} else {
$sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'";
}
$sql .= $db->plimit(1);
$res = $db->query($sql);

if ($db->num_rows($res) > 0) {
$fiscalYear = $db->fetch_object($res);
Expand Down
11 changes: 8 additions & 3 deletions htdocs/accountancy/bookkeeping/listbyaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* Copyright (C) 2016 Neil Orley <[email protected]>
* Copyright (C) 2013-2016 Olivier Geffroy <[email protected]>
* Copyright (C) 2013-2020 Florian Henry <[email protected]>
* Copyright (C) 2013-2024 Alexandre Spangaro <[email protected]>
* Copyright (C) 2013-2025 Alexandre Spangaro <[email protected]>
* Copyright (C) 2018-2024 Frédéric France <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
Expand Down Expand Up @@ -162,8 +162,13 @@
$form = new Form($db);

if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('search_date_startday') && !GETPOSTISSET('search_date_startmonth') && !GETPOSTISSET('search_date_starthour')) {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
$sql = "SELECT date_start, date_end";
$sql .=" FROM ".MAIN_DB_PREFIX."accounting_fiscalyear ";
if (getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT')) {
$sql .= " WHERE rowid = " . getDolGlobalInt('ACCOUNTANCY_FISCALYEAR_DEFAULT');
} else {
$sql .= " WHERE date_start < '" . $db->idate(dol_now()) . "' and date_end > '" . $db->idate(dol_now()) . "'";
}
$sql .= $db->plimit(1);
$res = $db->query($sql);

Expand Down
Loading

0 comments on commit 1ee468c

Please sign in to comment.