From c92e7c337fe18337797351735f65fb274fc97339 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 18 Dec 2024 22:17:12 +0100 Subject: [PATCH] NEW Accountancy - Show subledger account in thirdparty --- .../accountancy/bookkeeping/listbyaccount.php | 31 +++++-------------- htdocs/core/lib/company.lib.php | 7 +++-- htdocs/langs/en_US/accountancy.lang | 1 + 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 930baff6c5e..f31adb6b613 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -52,7 +52,6 @@ $langs->loadLangs(array("accountancy", "compta")); $action = GETPOST('action', 'aZ09'); $socid = GETPOSTINT('socid'); -$userid = GETPOSTINT('userid'); $mode = (GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'customer'); // Only for tab view $massaction = GETPOST('massaction', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); @@ -311,9 +310,6 @@ if (empty($reshook)) { if (!empty($socid)) { $param = '&socid='.$socid; } - if (!empty($userid)) { - $param = '&userid='.$userid; - } if (!empty($search_date_start)) { $filter['t.doc_date>='] = $search_date_start; @@ -600,7 +596,7 @@ $title_page .= ')'; $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double'; llxHeader('', $title_page, $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-consultation page-'.(($type == 'sub') ? 'sub' : '').'ledger'); -if (!empty($socid) || !empty($userid)) { +if (!empty($socid)) { $companystatic = new Societe($db); $res = $companystatic->fetch($socid); if ($res > 0) { @@ -611,7 +607,9 @@ if (!empty($socid) || !empty($userid)) { print dol_get_fiche_head($head, 'accounting', $langs->trans("ThirdParty"), -1, 'company'); - dol_banner_tab($companystatic, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($companystatic, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); print '
'; @@ -652,6 +650,8 @@ if (!empty($socid) || !empty($userid)) { print '
'; print dol_get_fiche_end(); + print info_admin($langs->trans("WarningThisPageContainsOnlyEntriesTransferredInAccounting")); + // Choice of mode (customer / supplier / employee) if (!empty($conf->dol_use_jmobile)) { print "\n".'
'."\n"; @@ -696,20 +696,6 @@ if (!empty($socid) || !empty($userid)) { } } - if (!empty($userid) && !empty($userstatic->code_compta_user)) { - if ($mode != 'employee') { - print ''; - } else { - print ''; - } - print $langs->trans("UserAccountancyCodeShort"); - if ($mode != 'employee') { - print ''; - } else { - print ''; - } - } - if (!empty($conf->dol_use_jmobile)) { print '
'; } else { @@ -786,9 +772,6 @@ print ''; if (!empty($socid)) { print ''; } -if (!empty($userid)) { - print ''; -} print ''; print ''; print ''; @@ -803,7 +786,7 @@ $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint; if (empty($reshook)) { // Remove button navigation if in thirdparty tab mode - if (empty($socid) && empty($userid)) { + if (empty($socid)) { $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?' . $param); if ($type == 'sub') { $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly')); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 82c6aa3062a..65a5599ef4e 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -145,13 +145,16 @@ function societe_prepare_head(Societe $object) // link to customer account by default if (!empty($object->code_compta_client)) { $subledger_start_account = $subledger_end_account = $object->code_compta_client; - } else if (!empty($object->code_compta_fournisseur)) { + $mode = 'customer'; + } elseif (!empty($object->code_compta_fournisseur)) { $subledger_start_account = $subledger_end_account = $object->code_compta_fournisseur; + $mode = 'supplier'; } else { $subledger_start_account = $subledger_end_account = ''; + $mode = 'customer'; } - $head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?socid='.$object->id.'&type=sub&search_accountancy_code_start='.$subledger_start_account.'&search_accountancy_code_end='.$subledger_end_account; + $head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?socid='.$object->id.'&mode='.$mode.'&type=sub&search_accountancy_code_start='.$subledger_start_account.'&search_accountancy_code_end='.$subledger_end_account; $head[$h][1] = $langs->trans("Accounting"); $head[$h][2] = 'accounting'; $h++; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index c4e8cfb2e9f..2a0b514a2c2 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -313,6 +313,7 @@ ClickOnUseTutorialForHelp=Welcome on the section to generate your accountancy. C NotReconciled=Not reconciled WarningRecordWithoutSubledgerAreExcluded=Warning, all lines without subledger account defined are filtered and excluded from this view AccountRemovedFromCurrentChartOfAccount=Accounting account that does not exist in the current chart of accounts +WarningThisPageContainsOnlyEntriesTransferredInAccounting=Warning, this page only contains entries transferred to the accounting system. ## Admin BindingOptions=Options for the transfer in accountancy ApplyMassCategories=Apply mass categories