Merge pull request #17063 from aspangaro/13p31
FIX: Periodicity by default on fiscal year, according to the now date, we have plus 1 year added
This commit is contained in:
commit
5d7efcc0d1
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2019 Eric Seigne <eric.seigne@cap-rel.fr>
|
* Copyright (C) 2019 Eric Seigne <eric.seigne@cap-rel.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -257,8 +257,8 @@ function getDefaultDatesForTransfer()
|
|||||||
$periodbydefaultontransfer = $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER;
|
$periodbydefaultontransfer = $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER;
|
||||||
isset($periodbydefaultontransfer) ? $periodbydefaultontransfer : 0;
|
isset($periodbydefaultontransfer) ? $periodbydefaultontransfer : 0;
|
||||||
if ($periodbydefaultontransfer == 2) {
|
if ($periodbydefaultontransfer == 2) {
|
||||||
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
$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 .= " WHERE date_start < '".$db->idate(dol_now())."' AND date_end > '".$db->idate(dol_now())."'";
|
||||||
$sql .= $db->plimit(1);
|
$sql .= $db->plimit(1);
|
||||||
$res = $db->query($sql);
|
$res = $db->query($sql);
|
||||||
if ($res->num_rows > 0) {
|
if ($res->num_rows > 0) {
|
||||||
@ -268,6 +268,9 @@ function getDefaultDatesForTransfer()
|
|||||||
} else {
|
} else {
|
||||||
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||||
$year_start = dol_print_date(dol_now(), '%Y');
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
if ($conf->global->SOCIETE_FISCAL_MONTH_START > dol_print_date(dol_now(), '%m')) {
|
||||||
|
$year_start = $year_start - 1;
|
||||||
|
}
|
||||||
$year_end = $year_start + 1;
|
$year_end = $year_start + 1;
|
||||||
$month_end = $month_start - 1;
|
$month_end = $month_start - 1;
|
||||||
if ($month_end < 1)
|
if ($month_end < 1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user