NEW Various payment - Use list of account when edit (#27992)
* NEW Various payment - Use list of account when edit * Fix PHPStan 8.2 undefined variable * Update CSMSFile.class.php * Move to getDolGlobalString --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
d3ac91795b
commit
1747a2ff36
2 changed files with 59 additions and 10 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2017-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
/* Copyright (C) 2017-2024 Alexandre Spangaro <aspangaro@easya.solutions>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
|
||||
|
|
@ -649,10 +649,11 @@ if ($id) {
|
|||
$editvalue = '';
|
||||
if (isModEnabled('accounting')) {
|
||||
print '<tr><td class="nowrap">';
|
||||
print $form->editfieldkey('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0);
|
||||
print $form->editfieldkey('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0);
|
||||
print '</td><td>';
|
||||
if ($action == 'editaccountancy_code') {
|
||||
print $form->editfieldval('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0);
|
||||
if ($action == 'editaccountancy_code' && (!$alreadyaccounted && $permissiontoadd)) {
|
||||
//print $form->editfieldval('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0);
|
||||
print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->accountancy_code, 'accountancy_code', 0, 1, '', 1);
|
||||
} else {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('', $object->accountancy_code, 1);
|
||||
|
|
@ -672,7 +673,15 @@ if ($id) {
|
|||
print '<tr><td class="nowrap">';
|
||||
print $form->editfieldkey('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0, null, '', 1, 'lengthAccounta');
|
||||
if ($action == 'editsubledger_account' && (!$alreadyaccounted && $permissiontoadd)) {
|
||||
if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {
|
||||
print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->subledger_account, 'subledger_account', 1, 1, '', 1);
|
||||
} else {
|
||||
print $form->editfieldval('SubledgerAccount', 'subledger_account', $object->subledger_account, $object, (!$alreadyaccounted && $permissiontoadd), 'string', '', 0, null, '', 1, 'lengthAccounta');
|
||||
}
|
||||
} else {
|
||||
print length_accounta($object->subledger_account);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
$bankaccountnotfound = 0;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
/* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
/* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016-2024 Alexandre Spangaro <aspangaro@easya.solutions>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -592,4 +592,44 @@ class FormAccounting extends Form
|
|||
return $out_array;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output html select to select accounting account
|
||||
*
|
||||
* @param string $page Page
|
||||
* @param string $selected Id preselected
|
||||
* @param string $htmlname Name of HTML select object
|
||||
* @param int $option option (0: aggregate by general account or 1: aggregate by subaccount)
|
||||
* @param int $useempty Show empty value in list
|
||||
* @param string $filter optional filters criteria
|
||||
* @param int $nooutput No print output. Return it only.
|
||||
* @return void|string
|
||||
*/
|
||||
public function formAccountingAccount($page, $selected = '', $htmlname = 'none', $option = 0, $useempty = 1, $filter = '', $nooutput = 0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$out = '';
|
||||
if ($htmlname != "none") {
|
||||
$out .= '<form method="post" action="' . $page . '">';
|
||||
$out .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
|
||||
if ($option == 0) {
|
||||
$out .= $this->select_account($selected, $htmlname, $useempty, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts', $filter);
|
||||
} else {
|
||||
$out .= $this->select_auxaccount($selected, $htmlname, $useempty, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'subaccounts');
|
||||
}
|
||||
$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" name="modify" value="' . $langs->trans("Modify") . '">';
|
||||
//$out .= '<input type="submit" class="button smallpaddingimp valignmiddle button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||
$out .= '</form>';
|
||||
} else {
|
||||
$out .= " ";
|
||||
}
|
||||
|
||||
if ($nooutput) {
|
||||
return $out;
|
||||
} else {
|
||||
print $out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue