diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php
index f8401072123..0c5be4b49c4 100644
--- a/htdocs/accountancy/index.php
+++ b/htdocs/accountancy/index.php
@@ -146,11 +146,13 @@ if (isModEnabled('accounting')) {
print "
\n";
print "
\n";
- $step++;
- $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}');
- $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("FiscalPeriod").'', $s);
- print $s;
- print "
\n";
+ if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
+ $step++;
+ $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}');
+ $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("FiscalPeriod").'', $s);
+ print $s;
+ print "
\n";
+ }
$step++;
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php
index 536e510195e..eeeb28d5179 100644
--- a/htdocs/accountancy/journal/bankjournal.php
+++ b/htdocs/accountancy/journal/bankjournal.php
@@ -1065,21 +1065,23 @@ if (empty($action) || $action == 'view') {
$desc = '';
- // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
- // Fiscal period test
- $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
- $resql = $db->query($sql);
- if ($resql) {
- $obj = $db->fetch_object($resql);
- if ($obj->nb == 0) {
- print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
- $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
- $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc);
- print $desc;
- print '
';
+ if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
+ // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
+ // Fiscal period test
+ $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj->nb == 0) {
+ print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
+ $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
+ $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc);
+ print $desc;
+ print '
';
+ }
+ } else {
+ dol_print_error($db);
}
- } else {
- dol_print_error($db);
}
// Bank test
diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php
index e624a07108c..39fa8d8e050 100644
--- a/htdocs/accountancy/journal/expensereportsjournal.php
+++ b/htdocs/accountancy/journal/expensereportsjournal.php
@@ -564,21 +564,23 @@ if (empty($action) || $action == 'view') {
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
- // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
- // Fiscal period test
- $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
- $resql = $db->query($sql);
- if ($resql) {
- $obj = $db->fetch_object($resql);
- if ($obj->nb == 0) {
- print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
- $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
- $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc);
- print $desc;
- print '
';
+ if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
+ // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
+ // Fiscal period test
+ $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj->nb == 0) {
+ print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
+ $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
+ $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc);
+ print $desc;
+ print '
';
+ }
+ } else {
+ dol_print_error($db);
}
- } else {
- dol_print_error($db);
}
// Button to write into Ledger
diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index 69db686615f..214b548949b 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -937,21 +937,23 @@ if (empty($action) || $action == 'view') {
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
- // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
- // Fiscal period test
- $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
- $resql = $db->query($sql);
- if ($resql) {
- $obj = $db->fetch_object($resql);
- if ($obj->nb == 0) {
- print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
- $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
- $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc);
- print $desc;
- print '
';
+ if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
+ // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
+ // Fiscal period test
+ $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj->nb == 0) {
+ print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
+ $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
+ $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc);
+ print $desc;
+ print '
';
+ }
+ } else {
+ dol_print_error($db);
}
- } else {
- dol_print_error($db);
}
// Button to write into Ledger
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index f2dfb091edb..9a4e5561f46 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -994,21 +994,23 @@ if (empty($action) || $action == 'view') {
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
- // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
- // Fiscal period test
- $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
- $resql = $db->query($sql);
- if ($resql) {
- $obj = $db->fetch_object($resql);
- if ($obj->nb == 0) {
- print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
- $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
- $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc);
- print $desc;
- print '
';
+ if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
+ // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
+ // Fiscal period test
+ $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj->nb == 0) {
+ print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
+ $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
+ $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc);
+ print $desc;
+ print '
';
+ }
+ } else {
+ dol_print_error($db);
}
- } else {
- dol_print_error($db);
}
// Button to write into Ledger
diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php
index f32bfb73037..f7d1831ee87 100644
--- a/htdocs/accountancy/journal/variousjournal.php
+++ b/htdocs/accountancy/journal/variousjournal.php
@@ -214,21 +214,23 @@ $varlink = 'id_journal=' . $id_journal;
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
-// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
-// Fiscal period test
-$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
-$resql = $db->query($sql);
-if ($resql) {
- $obj = $db->fetch_object($resql);
- if ($obj->nb == 0) {
- print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
- $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
- $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc);
- print $desc;
- print '
';
+if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
+ // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
+ // Fiscal period test
+ $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj->nb == 0) {
+ print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined");
+ $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}');
+ $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc);
+ print $desc;
+ print '
';
+ }
+ } else {
+ dol_print_error($db);
}
-} else {
- dol_print_error($db);
}
if ($object->nature == 4) { // Bank journal