NEW Accountancy - Add an option to hide FAQ on index and add widget in area

This commit is contained in:
Alexandre SPANGARO 2019-09-23 20:42:50 +02:00
parent b30c55a2ee
commit a005408d83
12 changed files with 557 additions and 140 deletions

View File

@ -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 '<tr class="oddeven">';
print '<td>' . $langs->trans("ACCOUNTING_DISABLE_FAQ") . '</td>';
if (! empty($conf->global->ACCOUNTING_DISABLE_FAQ)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setdisablefaq&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setdisablefaq&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . '</td>';
if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setlistsorttodo&value=0">';
@ -224,7 +250,7 @@ if (! empty($user->admin))
}
print '</tr>';
print '<tr class="oddeven">';
print '<tr>';
print '<td>' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . '</td>';
if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setlistsortdone&value=0">';
@ -237,7 +263,7 @@ if (! empty($user->admin))
}
print '</tr>';
print '<tr class="oddeven">';
print '<tr>';
print '<td>' . $langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL") . '</td>';
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setenabledraftexport&value=0">';
@ -250,7 +276,7 @@ if (! empty($user->admin))
}
print '</tr>';
print '<tr class="oddeven">';
print '<tr>';
print '<td>' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . '</td>';
if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=0">';
@ -263,7 +289,7 @@ if (! empty($user->admin))
}
print '</tr>';
print '<tr class="oddeven">';
print '<tr>';
print '<td>' . $langs->trans("ACCOUNTANCY_COMBO_FOR_AUX") . '</td>';
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setenablesubsidiarylist&value=0">';
@ -276,7 +302,7 @@ if (! empty($user->admin))
}
print '</tr>';
print '<tr class="oddeven">';
print '<tr>';
print '<td>' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . '</td>';
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setmanagezero&value=0">';

View File

@ -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).'"';

View File

@ -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;
}
}

View File

@ -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 '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
print "<br>\n";print "<br>\n";
$resultboxes=FormOther::getBoxesArea($user, "1"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
print '<hr>';
print "<br>\n";
print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy');
// STEPS
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong>'.'</a>');
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong>'.'</a>');
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>'.'</a>');
print "<br>\n";
// FAQ
if (empty($conf->global->ACCOUNTING_DISABLE_FAQ)) {
$step = 0;
print "<br>\n";
print $langs->trans("AccountancyAreaDescActionOnceBis");
print "<br>\n";
print "<br>\n";
print '<span class="opacitymedium">' . $langs->trans("AccountancyAreaDescIntro") . "</span><br>\n";
print "<br>\n";
print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> ' . $langs->trans("AccountancyAreaDescActionOnce"),
'', '') . "\n";
print '<hr>';
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'.'</a>');
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong>'.'</a>')."\n";
print "<br>\n";
$step++;
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'.'</a>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
print "<br>\n";
if (! empty($conf->tax->enabled))
{
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>'.'</a>';
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n";
}
/*if (! empty($conf->salaries->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
// htdocs/admin/salaries.php
print "<br>\n";
print "<br>\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, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>'.'</a>');
print "<br>\n";
}
/*
if (! empty($conf->loan->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}
if (! empty($conf->don->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}
if (! empty($conf->adherents->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}*/
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong>'.'</a>');
print "<br>\n";
print '<br>';
// Step A - E
print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
print '<hr>';
print "<br>\n";
$step = 0;
$langs->loadLangs(array('bills', 'trips'));
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>'.'</a>')."\n";
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>'.'</a>')."\n";
print "<br>\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"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>'.'</a>')."\n";
print "<br>\n";
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescJournalSetup", $step,
'<a href="' . DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35">' . '<strong>' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("AccountingJournals") . '</strong>' . '</a>');
print "<br>\n";
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescChartModel", $step,
'<a href="' . DOL_URL_ROOT . '/accountancy/admin/accountmodel.php">' . '<strong>' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("Pcg_version") . '</strong>' . '</a>');
print "<br>\n";
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescChart", $step,
'<a href="' . DOL_URL_ROOT . '/accountancy/admin/account.php">' . '<strong>' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("Chartofaccounts") . '</strong>' . '</a>');
print "<br>\n";
print "<br>\n";
print $langs->trans("AccountancyAreaDescActionOnceBis");
print "<br>\n";
print "<br>\n";
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescDefault", $step,
'<a href="' . DOL_URL_ROOT . '/accountancy/admin/defaultaccounts.php">' . '<strong>' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . '</strong>' . '</a>');
print "<br>\n";
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBank", $step,
'<a href="' . DOL_URL_ROOT . '/compta/bank/list.php">' . '<strong>' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuBankAccounts") . '</strong>' . '</a>') . "\n";
print "<br>\n";
$step++;
$textlink = '<a href="' . DOL_URL_ROOT . '/admin/dict.php?id=10&from=accountancy">' . '<strong>' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuVatAccounts") . '</strong>' . '</a>';
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescVat", $step, $textlink);
print "<br>\n";
if (!empty($conf->tax->enabled)) {
$textlink = '<a href="' . DOL_URL_ROOT . '/admin/dict.php?id=7&from=accountancy">' . '<strong>' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuTaxAccounts") . '</strong>' . '</a>';
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n";
}
/*if (! empty($conf->salaries->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
// htdocs/admin/salaries.php
print "<br>\n";
print "<br>\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,
'<a href="' . DOL_URL_ROOT . '/admin/dict.php?id=17&from=accountancy">' . '<strong>' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("MenuExpenseReportAccounts") . '</strong>' . '</a>');
print "<br>\n";
}
/*
if (! empty($conf->loan->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}
if (! empty($conf->don->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}
if (! empty($conf->adherents->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}*/
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescProd", $step,
'<a href="' . DOL_URL_ROOT . '/accountancy/admin/productaccount.php">' . '<strong>' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("ProductsBinding") . '</strong>' . '</a>');
print "<br>\n";
print '<br>';
// Step A - E
print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar"></span> ' . $langs->trans("AccountancyAreaDescActionFreq"),
'', '');
print '<hr>';
print "<br>\n";
$step = 0;
$langs->loadLangs(array('bills', 'trips'));
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step),
$langs->transnoentitiesnoconv("BillsCustomers"),
'<a href="' . DOL_URL_ROOT . '/accountancy/customer/index.php">' . '<strong>' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("CustomersVentilation") . '</strong>' . '</a>') . "\n";
print "<br>\n";
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step),
$langs->transnoentitiesnoconv("BillsSuppliers"),
'<a href="' . DOL_URL_ROOT . '/accountancy/supplier/index.php">' . '<strong>' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("SuppliersVentilation") . '</strong>' . '</a>') . "\n";
print "<br>\n";
if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) {
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step),
$langs->transnoentitiesnoconv("ExpenseReports"),
'<a href="' . DOL_URL_ROOT . '/accountancy/expensereport/index.php">' . '<strong>' . $langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("ExpenseReportsVentilation") . '</strong>' . '</a>') . "\n";
print "<br>\n";
}
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step),
$langs->transnoentitiesnoconv("TransferInAccounting") . ' - ' . $langs->transnoentitiesnoconv("RegistrationInAccounting"),
$langs->transnoentitiesnoconv("WriteBookKeeping")) . "\n";
print "<br>\n";
$step++;
print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step)) . "<br>\n";
print "<br>\n";
}
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
print "<br>\n";
print '<div class="clearboth"></div>';
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."<br>\n";
print "<br>\n";
print '<div class="fichecenter fichecenterbis">';
/*
* Show boxes
*/
$boxlist.='<div class="twocolumns">';
$boxlist.='<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
if(!empty($nbworkboardcount))
{
$boxlist.=$boxwork;
}
$boxlist.=$resultboxes['boxlista'];
$boxlist.= '</div>';
$boxlist.= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
$boxlist.=$boxstat;
$boxlist.=$resultboxes['boxlistb'];
$boxlist.= '</div>';
$boxlist.= "\n";
$boxlist.='</div>';
print $boxlist;
print '</div>';
}
else
{
print $langs->trans("Module10Desc")."<br>\n";
}
//dol_fiche_end();
// End of page
llxFooter();

View File

@ -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();

View File

@ -0,0 +1,183 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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);
}
}

View File

@ -0,0 +1,135 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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' => '<a href="' . DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start='.$suspenseAccount.'&search_accountancy_code_end='.$suspenseAccount.'">' . $nbSuspenseAccount . '</a>',
'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);
}
}

View File

@ -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)
{

View File

@ -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;

View File

@ -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';

View File

@ -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

View File

@ -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
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