diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php
index b842c8115da..e11355b1f50 100644
--- a/htdocs/accountancy/admin/index.php
+++ b/htdocs/accountancy/admin/index.php
@@ -83,6 +83,19 @@ if ($action == 'update') {
}
// TO DO Mutualize code for yes/no constants
+if ($action == 'setdisablefaq') {
+ $setdisablefaq = GETPOST('value', 'int');
+ $res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_FAQ", $setdisablefaq, 'yesno', 0, '', $conf->entity);
+ if (! $res > 0)
+ $error ++;
+
+ if (! $error) {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans("Error"), null, 'mesgs');
+ }
+}
+
if ($action == 'setlistsorttodo') {
$setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
@@ -212,6 +225,19 @@ if (! empty($user->admin))
{
// TO DO Mutualize code for yes/no constants
print '
';
print '| ' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ' | ';
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
print '';
diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php
index e8caaab8a89..5f44c0d32b7 100644
--- a/htdocs/accountancy/class/accountingjournal.class.php
+++ b/htdocs/accountancy/class/accountingjournal.class.php
@@ -235,7 +235,7 @@ class AccountingJournal extends CommonObject
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
- $label=$langs->trans("ShowAccoutingJournal");
+ $label=$langs->trans("ShowAccountingJournal");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 9e59093b885..f442730355c 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -406,7 +406,7 @@ class BookKeeping extends CommonObject
}
/**
- * Return a link to the object card (with optionaly the picto)
+ * Return a link to the object card (with optionally the picto)
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to ('nolink', ...)
@@ -1309,7 +1309,7 @@ class BookKeeping extends CommonObject
}
/**
- * Delete bookkepping by importkey
+ * Delete bookkeeping by importkey
*
* @param string $importkey Import key
* @return int Result
@@ -1337,7 +1337,7 @@ class BookKeeping extends CommonObject
}
/**
- * Delete bookkepping by year
+ * Delete bookkeeping by year
*
* @param string $delyear Year to delete
* @param string $journal Journal to delete
@@ -1379,7 +1379,7 @@ class BookKeeping extends CommonObject
}
/**
- * Delete bookkepping by piece number
+ * Delete bookkeeping by piece number
*
* @param int $piecenum Piecenum to delete
* @return int Result
@@ -1624,12 +1624,12 @@ class BookKeeping extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Export bookkeping
+ * Export bookkeeping
*
* @param string $model Model
* @return int Result
*/
- public function export_bookkeping($model = 'ebp')
+ public function export_bookkeeping($model = 'ebp')
{
// phpcs:enable
global $conf;
@@ -1641,7 +1641,7 @@ class BookKeeping extends CommonObject
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE entity IN (" . getEntity('accountancy') . ")";
- dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG);
+ dol_syslog(get_class($this) . "::export_bookkeeping", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1679,7 +1679,7 @@ class BookKeeping extends CommonObject
return $num;
} else {
$this->error = "Error " . $this->db->lasterror();
- dol_syslog(get_class($this) . "::export_bookkeping " . $this->error, LOG_ERR);
+ dol_syslog(get_class($this) . "::export_bookkeeping " . $this->error, LOG_ERR);
return - 1;
}
}
diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php
index 0bede00d86d..d3ea4ccfb24 100644
--- a/htdocs/accountancy/index.php
+++ b/htdocs/accountancy/index.php
@@ -26,6 +26,7 @@
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 . '/core/class/html.formother.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta","bills","other","accountancy","loans","banks","admin","dict"));
@@ -41,8 +42,17 @@ $hookmanager->initHooks(array('accountancyindex'));
* Actions
*/
-// None
+if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled)
+{
+ require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
+ $zone=GETPOST('areacode', 'aZ09');
+ $userid=GETPOST('userid', 'int');
+ $boxorder=GETPOST('boxorder', 'aZ09');
+ $boxorder.=GETPOST('boxcombo', 'aZ09');
+ $result=InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
+ if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
+}
/*
* View
@@ -50,134 +60,185 @@ $hookmanager->initHooks(array('accountancyindex'));
llxHeader('', $langs->trans("AccountancyArea"));
-print load_fiche_titre($langs->trans("AccountancyArea"), '', 'title_accountancy');
-//dol_fiche_head();
-
-$step = 0;
-
if ($conf->accounting->enabled)
{
- print ''.$langs->trans("AccountancyAreaDescIntro")." \n";
- print " \n";print " \n";
+ $resultboxes=FormOther::getBoxesArea($user, "1"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
- print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
- print ' ';
- print " \n";
+ print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy');
- // STEPS
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''.'');
- print " \n";
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''.'');
- print " \n";
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''.'');
- print " \n";
+ // FAQ
+ if (empty($conf->global->ACCOUNTING_DISABLE_FAQ)) {
+ $step = 0;
- print " \n";
- print $langs->trans("AccountancyAreaDescActionOnceBis");
- print " \n";
- print " \n";
+ print '' . $langs->trans("AccountancyAreaDescIntro") . " \n";
+ print " \n";
+ print " \n";
+ print load_fiche_titre(' ' . $langs->trans("AccountancyAreaDescActionOnce"),
+ '', '') . "\n";
+ print ' ';
+ print " \n";
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''.'');
- print " \n";
-
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").''.'')."\n";
- print " \n";
-
- $step++;
- $textlink = ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''.'';
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
- print " \n";
- if (! empty($conf->tax->enabled))
- {
- $textlink = ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''.'';
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
- print " \n";
- }
- /*if (! empty($conf->salaries->enabled))
- {
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'');
- // htdocs/admin/salaries.php
- print " \n";
- print " \n";
- }*/
- if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
- {
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''.'');
- print " \n";
- }
- /*
- if (! empty($conf->loan->enabled))
- {
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'');
- print " \n";
- }
- if (! empty($conf->don->enabled))
- {
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'');
- print " \n";
- }
- if (! empty($conf->adherents->enabled))
- {
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'');
- print " \n";
- }*/
-
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''.'');
- print " \n";
-
-
- print ' ';
-
- // Step A - E
-
- print " \n";
- print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
- print ' ';
- print " \n";
- $step = 0;
-
- $langs->loadLangs(array('bills', 'trips'));
-
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").''.'')."\n";
- print " \n";
-
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").''.'')."\n";
- print " \n";
-
- if (! empty($conf->expensereport->enabled) || ! empty($conf->deplacement->enabled))
- {
+ // STEPS
$step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").''.'')."\n";
- print " \n";
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescJournalSetup", $step,
+ '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("AccountingJournals") . '' . '');
+ print " \n";
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescChartModel", $step,
+ '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("Pcg_version") . '' . '');
+ print " \n";
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescChart", $step,
+ '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("Chartofaccounts") . '' . '');
+ print " \n";
+
+ print " \n";
+ print $langs->trans("AccountancyAreaDescActionOnceBis");
+ print " \n";
+ print " \n";
+
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescDefault", $step,
+ '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . '' . '');
+ print " \n";
+
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBank", $step,
+ '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuBankAccounts") . '' . '') . "\n";
+ print " \n";
+
+ $step++;
+ $textlink = '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuVatAccounts") . '' . '';
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescVat", $step, $textlink);
+ print " \n";
+ if (!empty($conf->tax->enabled)) {
+ $textlink = '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuTaxAccounts") . '' . '';
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescContrib", $step, $textlink);
+ print " \n";
+ }
+ /*if (! empty($conf->salaries->enabled))
+ {
+ $step++;
+ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'');
+ // htdocs/admin/salaries.php
+ print " \n";
+ print " \n";
+ }*/
+ if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
+ {
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescExpenseReport", $step,
+ '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuExpenseReportAccounts") . '' . '');
+ print " \n";
+ }
+ /*
+ if (! empty($conf->loan->enabled))
+ {
+ $step++;
+ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'');
+ print " \n";
+ }
+ if (! empty($conf->don->enabled))
+ {
+ $step++;
+ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'');
+ print " \n";
+ }
+ if (! empty($conf->adherents->enabled))
+ {
+ $step++;
+ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'');
+ print " \n";
+ }*/
+
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescProd", $step,
+ '' . '' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("ProductsBinding") . '' . '');
+ print " \n";
+
+ print ' ';
+
+ // Step A - E
+
+ print " \n";
+ print load_fiche_titre(' ' . $langs->trans("AccountancyAreaDescActionFreq"),
+ '', '');
+ print ' ';
+ print " \n";
+ $step = 0;
+
+ $langs->loadLangs(array('bills', 'trips'));
+
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step),
+ $langs->transnoentitiesnoconv("BillsCustomers"),
+ '' . '' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("CustomersVentilation") . '' . '') . "\n";
+ print " \n";
+
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step),
+ $langs->transnoentitiesnoconv("BillsSuppliers"),
+ '' . '' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("SuppliersVentilation") . '' . '') . "\n";
+ print " \n";
+
+ if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) {
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step),
+ $langs->transnoentitiesnoconv("ExpenseReports"),
+ '' . '' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("ExpenseReportsVentilation") . '' . '') . "\n";
+ print " \n";
+ }
+
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step),
+ $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("RegistrationInAccounting"),
+ $langs->transnoentitiesnoconv("WriteBookKeeping")) . "\n";
+ print " \n";
+
+ $step++;
+ print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step)) . " \n";
+ print " \n";
}
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
- print " \n";
+ print '';
- $step++;
- print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))." \n";
- print " \n";
+ print '';
+
+ /*
+ * Show boxes
+ */
+ $boxlist.=' ';
+
+ $boxlist.=' ';
+ if(!empty($nbworkboardcount))
+ {
+ $boxlist.=$boxwork;
+ }
+
+ $boxlist.=$resultboxes['boxlista'];
+
+ $boxlist.= ' ';
+
+ $boxlist.= ' ';
+
+ $boxlist.=$boxstat;
+ $boxlist.=$resultboxes['boxlistb'];
+
+ $boxlist.= ' ';
+ $boxlist.= "\n";
+
+ $boxlist.=' ';
+
+
+ print $boxlist;
+
+ print ' ';
}
else
{
print $langs->trans("Module10Desc")." \n";
}
-//dol_fiche_end();
// End of page
llxFooter();
diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php
index 2e81a2c6dad..da400cf6764 100644
--- a/htdocs/admin/boxes.php
+++ b/htdocs/admin/boxes.php
@@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array('admin', 'boxes'));
+$langs->loadLangs(array('admin', 'boxes', 'accountancy'));
if (! $user->admin) accessforbidden();
diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php
new file mode 100644
index 00000000000..d87f2f6cc50
--- /dev/null
+++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php
@@ -0,0 +1,183 @@
+
+ * Copyright (C) 2004-2009 Laurent Destailleur
+ * Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2019 Alexandre Spangaro
+ *
+ * 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/core/boxes/box_accountancy_last_manual_entries.php
+ * \ingroup Accountancy
+ * \brief Module to generated widget of last manual entries
+ */
+
+include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
+
+
+/**
+ * Class to manage the box to show last manual entries
+ */
+class box_accountancy_last_manual_entries extends ModeleBoxes
+{
+ public $boxcode="accountancy_last_manual_entries";
+ public $boximg="object_invoice";
+ public $boxlabel="BoxLastManualEntries";
+ public $depends = array("accounting");
+
+ /**
+ * @var DoliDB Database handler.
+ */
+ public $db;
+
+ public $param;
+
+ public $info_box_head = array();
+ public $info_box_contents = array();
+
+
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ * @param string $param More parameters
+ */
+ public function __construct($db, $param)
+ {
+ global $user;
+
+ $this->db = $db;
+
+ $this->hidden = ! ($user->rights->accounting->mouvements->lire);
+ }
+
+ /**
+ * Load data for box to show them later
+ *
+ * @param int $max Maximum number of records to load
+ * @return void
+ */
+ public function loadBox($max = 5)
+ {
+ global $user, $langs, $db, $conf;
+
+ $this->max = $max;
+
+ include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
+
+ $bookkeepingstatic = new BookKeeping($db);
+
+ $this->info_box_head = array('text' => $langs->trans("BoxTitleLastManualEntries", $max));
+
+ if ($user->rights->accounting->mouvements->lire)
+ {
+ $sql = "SELECT DISTINCT b.piece_num";
+ $sql.= ", b.doc_date as date_movement";
+ $sql.= ", b.label_operation";
+ $sql.= ", b.montant";
+ $sql.= ", b.code_journal";
+ $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
+ $sql.= " WHERE b.fk_doc = 0";
+ $sql.= " AND b.entity = ".$conf->entity;
+ $sql.= " ORDER BY b.piece_num DESC ";
+ $sql.= $db->plimit($max, 0);
+
+ $result = $db->query($sql);
+ if ($result) {
+ $num = $db->num_rows($result);
+
+ $line = 0;
+
+ while ($line < $num) {
+ $objp = $db->fetch_object($result);
+ $date = $db->jdate($objp->date_movement);
+ $journal = $objp->code_journal;
+ $label = $objp->label_operation;
+ $amount = $objp->montant;
+
+ $bookkeepingstatic->id = $objp->id;
+ $bookkeepingstatic->piece_num = $objp->piece_num;
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => '',
+ 'text' => $bookkeepingstatic->getNomUrl(1),
+ 'asis' => 1,
+ );
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="right"',
+ 'text' => dol_print_date($date, 'day'),
+ 'asis' => 1,
+ );
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="center"',
+ 'text' => $journal,
+ 'asis' => 1,
+ );
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
+ 'text' => $label,
+ 'asis' => 1,
+ );
+
+ /*
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
+ 'text' => $societestatic->getNomUrl(1),
+ 'asis' => 1,
+ );
+ */
+
+ $this->info_box_contents[$line][] = array(
+ 'td' => 'class="nowrap right"',
+ 'text' => price($amount, 0, $langs, 0, -1, -1, $conf->currency),
+ );
+
+ $line++;
+ }
+
+ if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedManualEntries"));
+
+ $db->free($result);
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => '',
+ 'maxlength'=>500,
+ 'text' => ($db->error().' sql='.$sql),
+ );
+ }
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'class="nohover opacitymedium left"',
+ 'text' => $langs->trans("ReadPermissionNotAllowed")
+ );
+ }
+ }
+
+ /**
+ * Method to show box
+ *
+ * @param array $head Array with properties of box title
+ * @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
+ * @return string
+ */
+ public function showBox($head = null, $contents = null, $nooutput = 0)
+ {
+ return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
+ }
+}
diff --git a/htdocs/core/boxes/box_accountancy_suspense_account.php b/htdocs/core/boxes/box_accountancy_suspense_account.php
new file mode 100644
index 00000000000..8f2851bc823
--- /dev/null
+++ b/htdocs/core/boxes/box_accountancy_suspense_account.php
@@ -0,0 +1,135 @@
+
+ * Copyright (C) 2004-2009 Laurent Destailleur
+ * Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2019 Alexandre Spangaro
+ *
+ * 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/core/boxes/box_accountancy_suspense_account.php
+ * \ingroup Accountancy
+ * \brief Module to generated widget of suspense account
+ */
+
+include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
+
+
+/**
+ * Class to manage the box to show suspense account
+ */
+class box_accountancy_suspense_account extends ModeleBoxes
+{
+ public $boxcode="accountancy_suspense_account";
+ public $boximg="object_invoice";
+ public $boxlabel="BoxSuspenseAccount";
+ public $depends = array("accounting");
+
+ /**
+ * @var DoliDB Database handler.
+ */
+ public $db;
+
+ public $param;
+
+ public $info_box_head = array();
+ public $info_box_contents = array();
+
+
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ * @param string $param More parameters
+ */
+ public function __construct($db, $param)
+ {
+ global $user;
+
+ $this->db = $db;
+
+ $this->hidden = ! ($user->rights->accounting->mouvements->lire);
+ }
+
+ /**
+ * Load data for box to show them later
+ *
+ * @param int $max Maximum number of records to load
+ * @return void
+ */
+ public function loadBox()
+ {
+ global $user, $langs, $db, $conf;
+
+ include_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
+
+ $bookkeepingstatic = new BookKeeping($db);
+
+ $this->info_box_head = array('text' => $langs->trans("BoxTitleSuspenseAccount"));
+
+ if ($user->rights->accounting->mouvements->lire)
+ {
+ $suspenseAccount = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
+ if (! empty($suspenseAccount) && $suspenseAccount > 0)
+ {
+ $sql = "SELECT COUNT(*) as nb_suspense_account";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
+ $sql .= " WHERE b.numero_compte = ". $suspenseAccount;
+ $sql .= " AND b.entity = " . $conf->entity;
+
+ $result = $db->query($sql);
+ if ($result)
+ {
+ $obj=$db->fetch_object($result);
+ $nbSuspenseAccount = $obj->nb_suspense_account;
+ }
+
+ $this->info_box_contents[0][0] = array(
+ 'td' => '',
+ 'text' => $langs->trans("NumberOfLinesInSuspenseAccount") . ':'
+ );
+
+ $this->info_box_contents[0][1] = array(
+ 'td' => 'class="right"',
+ 'text' => '' . $nbSuspenseAccount . '',
+ 'asis' => 1
+ );
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'class="nohover opacitymedium left"',
+ 'text' => $langs->trans("SuspenseAccountNotDefined")
+ );
+ }
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'class="nohover opacitymedium left"',
+ 'text' => $langs->trans("ReadPermissionNotAllowed")
+ );
+ }
+ }
+
+ /**
+ * Method to show box
+ *
+ * @param array $head Array with properties of box title
+ * @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
+ * @return string
+ */
+ public function showBox($head = null, $contents = null, $nooutput = 0)
+ {
+ return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
+ }
+}
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index c6a138b2a02..01dfbb6e985 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -989,8 +989,8 @@ class FormOther
* Class 'Form' must be known.
*
* @param User $user Object User
- * @param String $areacode Code of area for pages ('0'=value for Home page)
- * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>)
+ * @param String $areacode Code of area for pages - 0 = Home page / 1 = Accountancy page
+ * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>)
*/
public static function getBoxesArea($user, $areacode)
{
diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php
index 1138e3a69ad..f2257f8f894 100644
--- a/htdocs/core/class/infobox.class.php
+++ b/htdocs/core/class/infobox.class.php
@@ -28,13 +28,13 @@
class InfoBox
{
/**
- * Name of positions 0=Home, 1=...
+ * Name of positions 0=Home, 1=Accountancy, 2=xxx
*
* @return string[] Array with list of zones
*/
public static function getListOfPagesForBoxes()
{
- return array(0=>'Home');
+ return array(0=>'Home',1=>'Accountancy');
}
/**
@@ -42,7 +42,7 @@ class InfoBox
*
* @param DoliDB $db Database handler
* @param string $mode 'available' or 'activated'
- * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...)
+ * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...)
* @param User|null $user Object user to filter
* @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude
* @param int $includehidden Include also hidden boxes
@@ -71,7 +71,7 @@ class InfoBox
{
$sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
- $sql.= " WHERE d.entity IN (0,".$conf->entity.")";
+ $sql.= " WHERE d.entity IN (0,".$conf->entity.")";
}
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG);
@@ -113,7 +113,7 @@ class InfoBox
// box properties
$box->rowid = (empty($obj->rowid) ? '' : $obj->rowid);
$box->id = (empty($obj->box_id) ? '' : $obj->box_id);
- $box->position = ($obj->position == '' ? '' : $obj->position); // '0' must staty '0'
+ $box->position = ($obj->position == '' ? '' : $obj->position); // '0' must stay '0'
$box->box_order = (empty($obj->box_order) ? '' : $obj->box_order);
$box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user);
$box->sourcefile= $relsourcefile;
diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php
index 12f95053dc0..48e6e7df400 100644
--- a/htdocs/core/modules/modAccounting.class.php
+++ b/htdocs/core/modules/modAccounting.class.php
@@ -162,7 +162,10 @@ class modAccounting extends DolibarrModules
$this->module_parts = array();
// Boxes
- $this->boxes = array();
+ $this->boxes = array(
+ 0=>array('file'=>'box_accountancy_last_manual_entries.php', 'enabledbydefaulton'=>'Accountancy'),
+ 1=>array('file'=>'box_accountancy_suspense_account.php', 'enabledbydefaulton'=>'Accountancy')
+ );
// Permissions
$this->rights_class = 'accounting';
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index 8e44c378ba6..ce056b1f981 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -1,4 +1,5 @@
-# Dolibarr language file - en_US - Accounting Expert
+# Dolibarr language file - en_US - Accountancy (Double entries)
+Accountancy=Accountancy
Accounting=Accounting
ACCOUNTING_EXPORT_SEPARATORCSV=Column separator for export file
ACCOUNTING_EXPORT_DATE=Date format for export file
@@ -133,6 +134,7 @@ NotVentilatedinAccount=Not bound to the accounting account
XLineSuccessfullyBinded=%s products/services successfully bound to an accounting account
XLineFailedToBeBinded=%s products/services were not bound to any accounting account
+ACCOUNTING_DISABLE_FAQ=Disable FAQ on accountancy area
ACCOUNTING_LIMIT_LIST_VENTILATION=Number of elements to bind shown by page (maximum recommended: 50)
ACCOUNTING_LIST_SORT_VENTILATION_TODO=Begin the sorting of the page "Binding to do" by the most recent elements
ACCOUNTING_LIST_SORT_VENTILATION_DONE=Begin the sorting of the page "Binding done" by the most recent elements
@@ -264,7 +266,7 @@ CategoryDeleted=Category for the accounting account has been removed
AccountingJournals=Accounting journals
AccountingJournal=Accounting journal
NewAccountingJournal=New accounting journal
-ShowAccoutingJournal=Show accounting journal
+ShowAccountingJournal=Show accounting journal
NatureOfJournal=Nature of Journal
AccountingJournalType1=Miscellaneous operations
AccountingJournalType2=Sales
diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang
index b1ab8e41fbc..eedc75e7ca0 100644
--- a/htdocs/langs/en_US/boxes.lang
+++ b/htdocs/langs/en_US/boxes.lang
@@ -84,4 +84,11 @@ ForProposals=Proposals
LastXMonthRolling=The latest %s month rolling
ChooseBoxToAdd=Add widget to your dashboard
BoxAdded=Widget was added in your dashboard
-BoxTitleUserBirthdaysOfMonth=Birthdays of this month
\ No newline at end of file
+BoxTitleUserBirthdaysOfMonth=Birthdays of this month
+BoxLastManualEntries=Last manual entries in accountancy
+BoxTitleLastManualEntries=%s last manual entries
+NoRecordedManualEntries=No manual entries record in accountancy
+BoxSuspenseAccount=Count accountancy operation with suspense account
+BoxTitleSuspenseAccount=Number of unallocated lines
+NumberOfLinesInSuspenseAccount=Number of line in suspense account
+SuspenseAccountNotDefined=Suspense account isn't defined
|