diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php
index f060be19440..1c9fa255fed 100644
--- a/htdocs/accountancy/closure/index.php
+++ b/htdocs/accountancy/closure/index.php
@@ -115,9 +115,9 @@ if ($resql) {
print '
';
for($i = 1; $i <= 12; $i ++) {
- print '' . price($row[$i]) . ' ';
+ print '' . $row[$i] . ' ';
}
- print '' . price($row[13]) . ' ';
+ print '' . $row[13] . ' ';
print ' ';
}
$db->free($resql);
diff --git a/htdocs/accountancy/closure/validate.php b/htdocs/accountancy/closure/validate.php
new file mode 100644
index 00000000000..7271ef4d98e
--- /dev/null
+++ b/htdocs/accountancy/closure/validate.php
@@ -0,0 +1,158 @@
+
+ *
+ * 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
+ * along with this program. If not, see .
+ *
+ */
+
+/**
+ * \file htdocs/accountancy/closure/validate.php
+ * \ingroup Accountancy
+ * \brief Validate entries page
+ */
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array("compta","bills","other","main","accountancy"));
+
+// Security check
+if (empty($conf->accounting->enabled)) {
+ accessforbidden();
+}
+if ($user->societe_id > 0)
+ accessforbidden();
+if (! $user->rights->accounting->fiscalyear->closure)
+ accessforbidden();
+
+
+$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
+if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
+else
+{
+ $year_start = dol_print_date(dol_now(), '%Y');
+ if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
+}
+$year_end = $year_start + 1;
+$month_end = $month_start - 1;
+if ($month_end < 1)
+{
+ $month_end = 12;
+ $year_end--;
+}
+$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
+$search_date_end = dol_get_last_day($year_end, $month_end);
+$year_current = $year_start;
+
+/*
+ * Actions
+ */
+
+if ($action == 'validate')
+{
+ $now = dol_now();
+
+ // Update database
+ $db->begin();
+ $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
+ $sql .= " SET b.date_validated = '" . $db->idate($now) . "'";
+ $sql .= ' WHERE b.date_validated IS NULL';
+
+ dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG);
+ $resql = $db->query($sql);
+ if (! $resql1) {
+ $error ++;
+ $db->rollback();
+ setEventMessages($db->lasterror(), null, 'errors');
+ } else {
+ $db->commit();
+ }
+ // End clean database
+}
+
+
+/*
+ * View
+ */
+
+llxHeader('', $langs->trans("ValidateMovements"));
+
+$textprevyear = '' . img_previous() . ' ';
+$textnextyear = ' ' . img_next() . ' ';
+
+
+print load_fiche_titre($langs->trans("ValidateMovements") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
+
+print $langs->trans("DescValidateMovements") . ' ';
+print ' ';
+
+
+$y = $year_current;
+
+print_barre_liste($langs->trans("SelectMonthAndValidate"), '', '', '', '', '', '', -1, '', '', 0, '', 'class="right"', 0, 1, 1);
+
+print '';
+print '
';
+print '';
+for($i = 1; $i <= 12; $i ++) {
+ $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
+ if ($j > 12) $j-=12;
+ print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ' ';
+}
+print '' . $langs->trans("Total") . ' ';
+
+print '';
+$sql = "SELECT COUNT(b.rowid) as detail,";
+for($i = 1; $i <= 12; $i ++) {
+ $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
+ if ($j > 12) $j-=12;
+ $sql .= " SUM(" . $db->ifsql('MONTH(b.doc_date)=' . $j, '1', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
+}
+$sql .= " COUNT(b.rowid) as total";
+$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
+$sql .= " WHERE b.doc_date >= '" . $db->idate($search_date_start) . "'";
+$sql .= " AND b.doc_date <= '" . $db->idate($search_date_end) . "'";
+$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
+
+dol_syslog('htdocs/accountancy/closure/index.php sql=' . $sql, LOG_DEBUG);
+$resql = $db->query($sql);
+if ($resql) {
+ $num = $db->num_rows($resql);
+
+ while ( $row = $db->fetch_row($resql)) {
+
+ for($i = 1; $i <= 12; $i ++) {
+ print '' . $row[$i] . ' ';
+ print ' ';
+ print ' ' ;
+ }
+ print '' . $row[13] . ' ';
+ }
+ print
+ $db->free($resql);
+} else {
+ print $db->lasterror(); // Show last sql error
+}
+print ' ';
+print "
\n";
+
+print '
';
+print '
';
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index 01c5752f4b5..2819ff372ec 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -245,6 +245,8 @@ DescVentilDoneExpenseReport=Consult here the list of the lines of expenses repor
DescClosure=Consult here the number of movements by month who are not validated & fiscal years already open
OverviewOfMovementsNotValidated=Step 1/ Overview of movements not validated. (Necessary to close a fiscal year)
ValidateMovements=Validate movements
+DescValidateMovements=Any modification or deletion of writing, lettering and deletes will be prohibited. All entries for an exercise must be validated otherwise closing will not be possible
+SelectMonthAndValidate=Select month and validate movements
ValidateHistory=Bind Automatically
AutomaticBindingDone=Automatic binding done