dolibarr/htdocs/core/lib/accounting.lib.php

412 lines
12 KiB
PHP
Raw Permalink Normal View History

2014-08-27 07:03:42 +02:00
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2019 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
2014-08-27 07:03:42 +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-08-27 07:03:42 +02:00
*/
/**
* \file htdocs/core/lib/accounting.lib.php
2019-06-18 22:38:52 +02:00
* \ingroup Accountancy (Double entries)
* \brief Library of accountancy functions
2014-08-27 07:03:42 +02:00
*/
2019-06-20 13:39:29 +02:00
2019-06-20 13:59:53 +02:00
/**
* Check if a value is empty with some options
*
* @author Michael - https://www.php.net/manual/fr/function.empty.php#90767
* @param ?mixed $var Value to test
2024-01-18 22:43:17 +01:00
* @param boolean $allow_false Setting this to true will make the function consider a boolean value of false as NOT empty. This parameter is false by default.
* @param boolean $allow_ws Setting this to true will make the function consider a string with nothing but white space as NOT empty. This parameter is false by default.
2019-06-20 13:59:53 +02:00
* @return boolean True of False
*/
2019-06-20 13:39:29 +02:00
function is_empty($var, $allow_false = false, $allow_ws = false)
{
Qual: Enable Phan Simplify rule and fix notices (#30537) * Qual: Phan - Enable Simplyfy expression * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Update functions2.lib.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-08-07 03:05:02 +02:00
if (is_null($var) || !isset($var) || ($allow_ws == false && trim($var) == "" && !is_bool($var)) || ($allow_false === false && $var === false) || (is_array($var) && empty($var))) {
2019-06-20 13:39:29 +02:00
return true;
}
2019-06-20 13:39:29 +02:00
return false;
}
2014-08-27 07:03:42 +02:00
/**
2014-08-30 05:44:12 +02:00
* Prepare array with list of tabs
2014-08-27 07:03:42 +02:00
*
* @param AccountingAccount $object Accounting account
* @return array<array{0:string,1:string,2:string}> Array of tabs to show
2014-08-27 07:03:42 +02:00
*/
function accounting_prepare_head(AccountingAccount $object)
2014-08-30 05:44:12 +02:00
{
2014-08-27 07:03:42 +02:00
global $langs, $conf;
2014-11-15 15:19:37 +01:00
2014-08-27 07:03:42 +02:00
$h = 0;
$head = array();
2014-11-15 15:19:37 +01:00
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/card.php?id='.$object->id;
2020-09-08 04:58:42 +02:00
$head[$h][1] = $langs->trans("AccountAccounting");
2014-08-27 07:03:42 +02:00
$head[$h][2] = 'card';
$h++;
2014-11-15 15:19:37 +01:00
2014-08-27 07:03:42 +02:00
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account');
2014-11-15 15:19:37 +01:00
2014-08-27 07:03:42 +02:00
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account', 'remove');
2014-11-15 15:19:37 +01:00
2014-08-27 07:03:42 +02:00
return $head;
}
/**
* Return accounting account without zero on the right
*
* @param string $account Accounting account
* @return string String without zero on the right
*/
function clean_account($account)
{
$account = rtrim($account, "0");
2017-05-25 05:32:13 +02:00
return $account;
}
2014-08-27 07:03:42 +02:00
/**
2016-10-14 13:05:01 +02:00
* Return General accounting account with defined length (used for product and miscellaneous)
2014-08-27 07:03:42 +02:00
*
2014-08-30 06:05:02 +02:00
* @param string $account General accounting account
2014-11-15 15:19:37 +01:00
* @return string String with defined length
2014-08-27 07:03:42 +02:00
*/
2014-08-30 05:44:12 +02:00
function length_accountg($account)
{
2021-02-23 22:03:23 +01:00
if ($account < 0 || is_empty($account)) {
return '';
}
2017-05-25 05:32:13 +02:00
2023-11-27 11:39:32 +01:00
if (getDolGlobalString('ACCOUNTING_MANAGE_ZERO')) {
2021-02-23 22:03:23 +01:00
return $account;
}
2017-05-25 05:32:13 +02:00
2021-10-20 12:37:49 +02:00
$g = getDolGlobalInt('ACCOUNTING_LENGTH_GACCOUNT');
if (!is_empty($g)) {
2014-08-27 07:03:42 +02:00
// Clean parameters
$i = strlen($account);
2014-11-15 15:19:37 +01:00
if ($i >= 1) {
while ($i < $g) {
2014-08-27 07:03:42 +02:00
$account .= '0';
2014-11-15 15:19:37 +01:00
$i++;
2014-08-27 07:03:42 +02:00
}
2014-11-15 15:19:37 +01:00
2014-08-27 07:03:42 +02:00
return $account;
} else {
return $account;
}
} else {
return $account;
}
}
/**
2016-10-14 13:05:01 +02:00
* Return Auxiliary accounting account of thirdparties with defined length
2014-08-27 07:03:42 +02:00
*
2014-08-30 06:05:02 +02:00
* @param string $accounta Auxiliary accounting account
2014-11-15 15:19:37 +01:00
* @return string String with defined length
2014-08-27 07:03:42 +02:00
*/
2014-08-30 05:44:12 +02:00
function length_accounta($accounta)
{
2019-04-23 10:24:16 +02:00
global $conf;
2014-11-15 15:19:37 +01:00
2021-02-23 22:03:23 +01:00
if ($accounta < 0 || is_empty($accounta)) {
return '';
}
2017-05-25 05:32:13 +02:00
2023-11-27 11:39:32 +01:00
if (getDolGlobalString('ACCOUNTING_MANAGE_ZERO')) {
2021-02-23 22:03:23 +01:00
return $accounta;
}
2017-05-25 05:32:13 +02:00
2021-10-20 12:37:49 +02:00
$a = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT');
if (!is_empty($a)) {
2014-08-27 07:03:42 +02:00
// Clean parameters
$i = strlen($accounta);
2014-11-15 15:19:37 +01:00
if ($i >= 1) {
while ($i < $a) {
2014-08-27 07:03:42 +02:00
$accounta .= '0';
2014-11-15 15:19:37 +01:00
$i++;
2014-08-27 07:03:42 +02:00
}
2014-11-15 15:19:37 +01:00
2014-08-27 07:03:42 +02:00
return $accounta;
} else {
return $accounta;
}
} else {
return $accounta;
}
}
/**
2019-08-28 10:22:40 +02:00
* Show header of a page used to transfer/dispatch data in accounting
*
* @param string $nom Name of report
Fix #28071 - New branch to fix bad merge (#28083) * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Qual: Introduce getDataToShowPhoto to prepare generic code * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Fix missing trans * Fix langs * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Remove useless files in web templates * Clean code * Fix duplicate translation key * Fix duplicate translation key * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Fix duplicate key * Fix $object * Debug v19 * WIP SMSing * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * WIP EMAILINGS_SUPPORT_ALSO_SMS * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * WIP SMSing * Debug the "validate" feature * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Clean code * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Enhance rector to fix empty($user->rights->modulex->perm1) * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Fix template to use v19 dev rules * Fix use v19 dev rules * Fix phpunit * Debug v19 * Clean code * Use rector to convert user->rights into user->hasRight * Clean code * Use rector to convert user->rights into user->hasRight * Use rector to convert user->rights into user->hasRight * Clean code * Fix phpcs * add editorconfig for sql files (#27999) Co-authored-by: Laurent Destailleur <eldy@destailleur.fr> * add model_pdf field in llx_ticket-ticket.sql (#27996) * add model_pdf field in llx_ticket-ticket.sql * Update 19.0.0-20.0.0.sql * Update 19.0.0-20.0.0.sql * Improve wording in README (#27994) * fix phpstan (#27989) * fix phpstan * Update UserRightsToFunction.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr> * Qual: Fix spelling/working in datapolicy translations (#28006) # Qual: Fix spelling/wording in datapolicy translations Fixed some spelling and wording in datapolicy translations. * qual: phpstan for htdocs/ticket/class/ticketstats.class.php (#27986) htdocs/ticket/class/ticketstats.class.php 98 Parameter #1 $year (string) of method TicketStats::getNbByMonth() should be compatible with parameter $year (int) of method Stats::getNbByMonth() * Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop * Fix user with readonly perm on email template must be able to read. * Fix doc * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Better message * Add missing fields in merge of thirdparty * Debug v19 selection of ticket printer per terminal * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Use constant * NEW: Adding a recipient on emails sent, change status to sent partialy. * fix travis (#28052) * fix travis * Update partnership.class.php * fix php doc (#28047) * fix undefined array key (#28048) * Add region and departament for Cuba (#28046) * Update llx_10_c_regions.sql Add Cuba Regions (id_country=77) * Update llx_20_c_departements.sql Add Provinces Cuba (id country=77) * Find the typo (#28050) * Find the typo * clean code * add last_main_doc field to product (#28045) * add las_main_doc field to product * add field fetch * NEW Add Categorie filter for ActionComm (#28041) * New Add Categorie filter for ActionComm New Add Categorie filter for ActionComm * Fix space errors Fix space errors * Fix space errors 2 Fix space errors 2 * Update cunits.class.php (#28056) FIX: error SQL when creating a Cunit * Update codespell-lines-ignore.txt to avoid PR merge conflict --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr> Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com> Co-authored-by: thibdrev <thibault.drevet@gmail.com> Co-authored-by: sonikf <93765174+sonikf@users.noreply.github.com> Co-authored-by: Ikarus <44511582+LeKarSol@users.noreply.github.com> Co-authored-by: Anthony Damhet <73399671+EchoLoGeek@users.noreply.github.com> Co-authored-by: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com>
2024-02-09 15:58:49 +01:00
* @param string $variant Link for alternate report
* @param string $period Period of report
* @param string $periodlink Link to switch period
* @param string $description Description
2019-03-11 01:01:15 +01:00
* @param integer $builddate Date of generation
* @param string $exportlink Link for export or ''
* @param array<string,mixed> $moreparam Array with list of params to add into hidden fields of form
* @param string $calcmode Calculation mode
* @param string $varlink Add a variable into the address of the page
* @param array<string,mixed> $moreoptions Array with list of params to add to table
* @return void
*/
function journalHead($nom, $variant, $period, $periodlink, $description, $builddate, $exportlink = '', $moreparam = array(), $calcmode = '', $varlink = '', $moreoptions = array())
{
global $langs;
print "\n\n<!-- start banner journal -->\n";
2021-02-23 22:03:23 +01:00
if (!is_empty($varlink)) {
$varlink = '?'.$varlink;
}
$head = array();
$h = 0;
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
$head[$h][1] = $langs->trans("Journalization");
$head[$h][2] = 'journal';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
2020-10-22 22:50:03 +02:00
print dol_get_fiche_head($head, 'journal');
2021-02-23 22:03:23 +01:00
foreach ($moreparam as $key => $value) {
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
}
2021-02-28 11:48:35 +01:00
print '<table class="border centpercent tableforfield">';
// Ligne de titre
print '<tr>';
2021-02-28 11:48:35 +01:00
print '<td class="titlefieldcreate">'.$langs->trans("Name").'</td>';
print '<td colspan="3">';
print $nom;
print '</td>';
print '</tr>';
// Calculation mode
2021-02-23 22:03:23 +01:00
if ($calcmode) {
print '<tr>';
2021-02-28 11:48:35 +01:00
print '<td>'.$langs->trans("CalculationMode").'</td>';
Fix #28071 - New branch to fix bad merge (#28083) * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Qual: Introduce getDataToShowPhoto to prepare generic code * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Fix missing trans * Fix langs * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Remove useless files in web templates * Clean code * Fix duplicate translation key * Fix duplicate translation key * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Fix duplicate key * Fix $object * Debug v19 * WIP SMSing * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * WIP EMAILINGS_SUPPORT_ALSO_SMS * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * WIP SMSing * Debug the "validate" feature * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Clean code * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Enhance rector to fix empty($user->rights->modulex->perm1) * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Fix template to use v19 dev rules * Fix use v19 dev rules * Fix phpunit * Debug v19 * Clean code * Use rector to convert user->rights into user->hasRight * Clean code * Use rector to convert user->rights into user->hasRight * Use rector to convert user->rights into user->hasRight * Clean code * Fix phpcs * add editorconfig for sql files (#27999) Co-authored-by: Laurent Destailleur <eldy@destailleur.fr> * add model_pdf field in llx_ticket-ticket.sql (#27996) * add model_pdf field in llx_ticket-ticket.sql * Update 19.0.0-20.0.0.sql * Update 19.0.0-20.0.0.sql * Improve wording in README (#27994) * fix phpstan (#27989) * fix phpstan * Update UserRightsToFunction.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr> * Qual: Fix spelling/working in datapolicy translations (#28006) # Qual: Fix spelling/wording in datapolicy translations Fixed some spelling and wording in datapolicy translations. * qual: phpstan for htdocs/ticket/class/ticketstats.class.php (#27986) htdocs/ticket/class/ticketstats.class.php 98 Parameter #1 $year (string) of method TicketStats::getNbByMonth() should be compatible with parameter $year (int) of method Stats::getNbByMonth() * Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop * Fix user with readonly perm on email template must be able to read. * Fix doc * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Better message * Add missing fields in merge of thirdparty * Debug v19 selection of ticket printer per terminal * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Use constant * NEW: Adding a recipient on emails sent, change status to sent partialy. * fix travis (#28052) * fix travis * Update partnership.class.php * fix php doc (#28047) * fix undefined array key (#28048) * Add region and departament for Cuba (#28046) * Update llx_10_c_regions.sql Add Cuba Regions (id_country=77) * Update llx_20_c_departements.sql Add Provinces Cuba (id country=77) * Find the typo (#28050) * Find the typo * clean code * add last_main_doc field to product (#28045) * add las_main_doc field to product * add field fetch * NEW Add Categorie filter for ActionComm (#28041) * New Add Categorie filter for ActionComm New Add Categorie filter for ActionComm * Fix space errors Fix space errors * Fix space errors 2 Fix space errors 2 * Update cunits.class.php (#28056) FIX: error SQL when creating a Cunit * Update codespell-lines-ignore.txt to avoid PR merge conflict --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr> Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com> Co-authored-by: thibdrev <thibault.drevet@gmail.com> Co-authored-by: sonikf <93765174+sonikf@users.noreply.github.com> Co-authored-by: Ikarus <44511582+LeKarSol@users.noreply.github.com> Co-authored-by: Anthony Damhet <73399671+EchoLoGeek@users.noreply.github.com> Co-authored-by: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com>
2024-02-09 15:58:49 +01:00
if (!$variant) {
2021-02-23 22:03:23 +01:00
print '<td colspan="3">';
} else {
print '<td>';
}
print $calcmode;
Fix #28071 - New branch to fix bad merge (#28083) * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Qual: Introduce getDataToShowPhoto to prepare generic code * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Fix missing trans * Fix langs * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Remove useless files in web templates * Clean code * Fix duplicate translation key * Fix duplicate translation key * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Fix duplicate key * Fix $object * Debug v19 * WIP SMSing * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * WIP EMAILINGS_SUPPORT_ALSO_SMS * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * WIP SMSing * Debug the "validate" feature * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Clean code * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Move rights->x->y into hasRight('x', 'y') * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Enhance rector to fix empty($user->rights->modulex->perm1) * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Fix template to use v19 dev rules * Fix use v19 dev rules * Fix phpunit * Debug v19 * Clean code * Use rector to convert user->rights into user->hasRight * Clean code * Use rector to convert user->rights into user->hasRight * Use rector to convert user->rights into user->hasRight * Clean code * Fix phpcs * add editorconfig for sql files (#27999) Co-authored-by: Laurent Destailleur <eldy@destailleur.fr> * add model_pdf field in llx_ticket-ticket.sql (#27996) * add model_pdf field in llx_ticket-ticket.sql * Update 19.0.0-20.0.0.sql * Update 19.0.0-20.0.0.sql * Improve wording in README (#27994) * fix phpstan (#27989) * fix phpstan * Update UserRightsToFunction.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr> * Qual: Fix spelling/working in datapolicy translations (#28006) # Qual: Fix spelling/wording in datapolicy translations Fixed some spelling and wording in datapolicy translations. * qual: phpstan for htdocs/ticket/class/ticketstats.class.php (#27986) htdocs/ticket/class/ticketstats.class.php 98 Parameter #1 $year (string) of method TicketStats::getNbByMonth() should be compatible with parameter $year (int) of method Stats::getNbByMonth() * Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop * Fix user with readonly perm on email template must be able to read. * Fix doc * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Better message * Add missing fields in merge of thirdparty * Debug v19 selection of ticket printer per terminal * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Use constant * NEW: Adding a recipient on emails sent, change status to sent partialy. * fix travis (#28052) * fix travis * Update partnership.class.php * fix php doc (#28047) * fix undefined array key (#28048) * Add region and departament for Cuba (#28046) * Update llx_10_c_regions.sql Add Cuba Regions (id_country=77) * Update llx_20_c_departements.sql Add Provinces Cuba (id country=77) * Find the typo (#28050) * Find the typo * clean code * add last_main_doc field to product (#28045) * add las_main_doc field to product * add field fetch * NEW Add Categorie filter for ActionComm (#28041) * New Add Categorie filter for ActionComm New Add Categorie filter for ActionComm * Fix space errors Fix space errors * Fix space errors 2 Fix space errors 2 * Update cunits.class.php (#28056) FIX: error SQL when creating a Cunit * Update codespell-lines-ignore.txt to avoid PR merge conflict --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr> Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com> Co-authored-by: thibdrev <thibault.drevet@gmail.com> Co-authored-by: sonikf <93765174+sonikf@users.noreply.github.com> Co-authored-by: Ikarus <44511582+LeKarSol@users.noreply.github.com> Co-authored-by: Anthony Damhet <73399671+EchoLoGeek@users.noreply.github.com> Co-authored-by: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com>
2024-02-09 15:58:49 +01:00
if ($variant) {
print '</td><td colspan="2">'.$variant;
2021-02-23 22:03:23 +01:00
}
print '</td>';
print '</tr>';
}
// Ligne de la periode d'analyse du rapport
print '<tr>';
print '<td>'.$langs->trans("ReportPeriod").'</td>';
2021-02-23 22:03:23 +01:00
if (!$periodlink) {
print '<td colspan="3">';
} else {
print '<td>';
}
if ($period) {
print $period;
}
if ($periodlink) {
print '</td><td colspan="2">'.$periodlink;
}
print '</td>';
print '</tr>';
// Ligne de description
print '<tr>';
print '<td>'.$langs->trans("ReportDescription").'</td>';
print '<td colspan="3">'.$description.'</td>';
print '</tr>';
// more options
foreach ($moreoptions as $key => $value) {
print '<tr>';
print '<td>'.$langs->trans($key).'</td>';
print '<td colspan="3">'.$value.'</td>';
print '</tr>';
}
print '</table>';
2020-10-27 18:19:31 +01:00
print dol_get_fiche_end();
print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
print '</form>';
print "\n<!-- end banner journal -->\n\n";
}
2020-09-07 21:38:39 +02:00
/**
* Return Default dates for transfer based on periodicity option in accountancy setup
*
* @return array{date_start:int,date_end:int,pastmonthyear:int,pastmonth:int} Dates of periodicity by default
2020-09-07 21:38:39 +02:00
*/
function getDefaultDatesForTransfer()
{
global $db, $conf;
2022-12-09 16:51:06 +01:00
$date_start = '';
$date_end = '';
2022-09-15 06:33:43 +02:00
$pastmonth = 0;
$pastmonthyear = 0;
2020-09-07 21:38:39 +02:00
// Period by default on transfer (0: previous month | 1: current month | 2: fiscal year)
2023-11-11 15:33:15 +01:00
$periodbydefaultontransfer = getDolGlobalInt('ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0);
2022-12-09 16:51:06 +01:00
if ($periodbydefaultontransfer == 2) { // fiscal year
$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())."'";
2020-09-07 21:38:39 +02:00
$sql .= $db->plimit(1);
$res = $db->query($sql);
if ($db->num_rows($res) > 0) {
2022-12-09 16:51:06 +01:00
$obj = $db->fetch_object($res);
$date_start = $db->jdate($obj->date_start);
$date_end = $db->jdate($obj->date_end);
2020-09-07 21:38:39 +02:00
} else {
2022-12-09 16:51:06 +01:00
$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp (#30557) * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Update phan baseline (remove PhanTypeInvalidLeftOperandOfNumericOp) * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Fix: Change argument '' to null as by getAvailableDiscounts signature * Qual: Cast '' to float for Phan notice * Fix: Convert $number with price2num before using this parameter * Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp # Qual: Fix PhanTypeInvalidLeftOperandOfNumericOp These changes ensure that the left operand is a numeric value * Add cast to ensure fmod is presented with floats
2024-08-15 16:57:02 +02:00
$year_start = (int) dol_print_date(dol_now(), '%Y');
if ($month_start > (int) dol_print_date(dol_now(), '%m')) {
Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests (#30544) * Remove PhanPluginDuplicateExpressionAssignmentOperation from baseline * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * fixup! Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-08-07 02:53:45 +02:00
$year_start -= 1;
}
2020-09-07 21:38:39 +02:00
$year_end = $year_start + 1;
$month_end = $month_start - 1;
2021-02-23 22:03:23 +01:00
if ($month_end < 1) {
2020-09-07 21:38:39 +02:00
$month_end = 12;
$year_end--;
}
$date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
$date_end = dol_get_last_day($year_end, $month_end);
}
2022-12-09 16:51:06 +01:00
} elseif ($periodbydefaultontransfer == 1) { // current month
$year_current = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$pastmonth = (int) dol_print_date(dol_now('gmt'), '%m', 'gmt');
2020-09-07 21:38:39 +02:00
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear--;
2020-09-07 21:38:39 +02:00
}
2022-12-09 16:51:06 +01:00
} else { // previous month
$year_current = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$pastmonth = (int) dol_print_date(dol_now('gmt'), '%m', 'gmt') - 1;
2020-09-07 21:38:39 +02:00
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear--;
2020-09-07 21:38:39 +02:00
}
}
return array(
'date_start' => $date_start,
'date_end' => $date_end,
'pastmonthyear' => $pastmonthyear,
'pastmonth' => $pastmonth
);
}
/**
2024-10-26 20:03:22 +02:00
* Get current period of fiscal year?
*
2024-10-26 20:03:22 +02:00
* @param DoliDB $db Database handler
* @param Conf $conf Config
* @param ?int $from_time [=null] Get current time or set time to find fiscal period
* @param 'tzserver'|'gmt' $gm 'gmt' => we return GMT timestamp (recommended), 'tzserver' => we return in the PHP server timezone
* @param int $withenddateonly Do not return period if end date is not defined
* @return array{date_start:int,date_end:int} Period of fiscal year : [date_start, date_end]
*/
2024-10-26 20:03:22 +02:00
function getCurrentPeriodOfFiscalYear($db, $conf, $from_time = null, $gm = 'tzserver', $withenddateonly = 1)
{
$now = dol_now();
$now_arr = dol_getdate($now);
if ($from_time === null) {
$from_time = $now;
} else {
$now_arr = dol_getdate($from_time);
}
2024-10-26 20:03:22 +02:00
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Take the first period found
$sql = "SELECT date_start, date_end FROM ".$db->prefix()."accounting_fiscalyear";
2024-10-26 20:03:22 +02:00
$sql .= " WHERE date_start <= '".$db->idate($from_time, $gm)."'";
if ($withenddateonly) {
$sql .= " AND (date_end >= '".$db->idate($from_time, $gm)."')";
} else {
$sql .= " AND (date_end >= '".$db->idate($from_time, $gm)."' OR date_end IS NULL)";
}
//$sql .= " AND statut = 0"
$sql .= " AND entity IN (".getEntity('accounting_fiscalyear').")";
$sql .= $db->order('date_start', 'DESC');
$sql .= $db->plimit(1);
2024-10-26 20:03:22 +02:00
$res = $db->query($sql);
2024-10-26 20:03:22 +02:00
if ($db->num_rows($res) > 0) {
2024-10-26 20:03:22 +02:00
// If found
$obj = $db->fetch_object($res);
2024-10-26 20:03:22 +02:00
$date_start = $db->jdate($obj->date_start, $gm);
$date_end = dol_get_last_hour($db->jdate($obj->date_end, $gm), $gm);
} else {
2024-10-26 20:03:22 +02:00
// If not found, we generate a period
$month_start = 1;
2024-10-26 20:03:22 +02:00
$conf_fiscal_month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START');
if ($conf_fiscal_month_start >= 1 && $conf_fiscal_month_start <= 12) {
$month_start = $conf_fiscal_month_start;
}
$year_start = $now_arr['year'];
if ($conf_fiscal_month_start > $now_arr['mon']) {
Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests (#30544) * Remove PhanPluginDuplicateExpressionAssignmentOperation from baseline * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * fixup! Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests * Qual: Apply PhanPluginDuplicateExpressionAssignmentOperation as phan suggests --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-08-07 02:53:45 +02:00
$year_start -= 1;
}
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1) {
$month_end = 12;
$year_end--;
}
2024-10-26 20:03:22 +02:00
$date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start, $gm);
$date_end = dol_get_last_day($year_end, $month_end, $gm);
}
return array(
'date_start' => $date_start,
'date_end' => $date_end,
);
}