Add more tooltips on edition of accounting account
Fix setup of accountancy
This commit is contained in:
parent
8a62d97b89
commit
243fcb38ba
@ -51,6 +51,7 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
$permissiontoadd = $user->rights->accounting->chartofaccount;
|
||||
$permissiontodelete = $user->rights->accounting->chartofaccount;
|
||||
|
||||
// Security check
|
||||
@ -118,9 +119,11 @@ if (empty($reshook)) {
|
||||
if (!empty($cancel)) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
$objectclass = 'AccountingAccount';
|
||||
$uploaddir = $conf->accounting->multidir_output[$conf->entity];
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($action == "delete") {
|
||||
$action = "";
|
||||
}
|
||||
@ -136,7 +139,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on
|
||||
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) { // a submit of form is done and chartofaccounts combo has been modified
|
||||
if ($chartofaccounts > 0) {
|
||||
if ($chartofaccounts > 0 && $permissiontoadd) {
|
||||
// Get language code for this $chartofaccounts
|
||||
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a';
|
||||
$sql .= ' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
|
||||
@ -180,7 +183,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'disable') {
|
||||
if ($action == 'disable' && $permissiontoadd) {
|
||||
if ($accounting->fetch($id)) {
|
||||
$mode = GETPOST('mode', 'int');
|
||||
$result = $accounting->accountDeactivate($id, $mode);
|
||||
@ -190,7 +193,7 @@ if (empty($reshook)) {
|
||||
if ($result < 0) {
|
||||
setEventMessages($accounting->error, $accounting->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'enable') {
|
||||
} elseif ($action == 'enable' && $permissiontoadd) {
|
||||
if ($accounting->fetch($id)) {
|
||||
$mode = GETPOST('mode', 'int');
|
||||
$result = $accounting->account_activate($id, $mode);
|
||||
|
||||
@ -34,7 +34,6 @@ $error = 0;
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("bills", "accountancy", "compta"));
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
@ -139,7 +138,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
|
||||
} else {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.((int) $conf->global->CHARTOFACCOUNTS);
|
||||
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result2 = $db->query($sql);
|
||||
@ -148,7 +147,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
|
||||
// Clean code
|
||||
|
||||
// To manage zero or not at the end of the accounting account
|
||||
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
|
||||
if (isset($conf->global->ACCOUNTING_MANAGE_ZERO) && $conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
|
||||
$account_number = $account_number;
|
||||
} else {
|
||||
$account_number = clean_account($account_number);
|
||||
@ -169,13 +168,12 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
|
||||
$object->labelshort = GETPOST('labelshort', 'alpha');
|
||||
|
||||
$result = $object->update($user);
|
||||
|
||||
if ($result > 0) {
|
||||
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
header("Location: " . $urltogo);
|
||||
exit();
|
||||
} else {
|
||||
$mesg = $object->error;
|
||||
setEventMessages($object->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -255,13 +253,17 @@ if ($action == 'create') {
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts type
|
||||
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
|
||||
print '</td></tr>';
|
||||
@ -281,8 +283,6 @@ if ($action == 'create') {
|
||||
$result = $object->fetch($id, $ref, 1);
|
||||
|
||||
if ($result > 0) {
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
$head = accounting_prepare_head($object);
|
||||
|
||||
// Edit mode
|
||||
@ -316,13 +316,17 @@ if ($action == 'create') {
|
||||
print '</td></tr>';
|
||||
|
||||
// Chart of accounts type
|
||||
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
|
||||
print '</td></tr>';
|
||||
@ -368,13 +372,17 @@ if ($action == 'create') {
|
||||
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
|
||||
print '<td colspan="2">'.$accp->account_number.' - '.$accp->label.'</td></tr>';
|
||||
|
||||
// Category
|
||||
print "<tr><td>".$langs->trans("AccountingCategory")."</td><td colspan='2'>".$object->account_category_label."</td>";
|
||||
|
||||
// Chart of accounts type
|
||||
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
|
||||
// Group of accounting account
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc"));
|
||||
print '</td>';
|
||||
print '<td colspan="2">'.$object->pcg_type.'</td></tr>';
|
||||
|
||||
// Custom group of accounting account
|
||||
print "<tr><td>";
|
||||
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
|
||||
print "</td><td colspan='2'>".$object->account_category_label."</td>";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -58,17 +58,40 @@ $list_binding = array(
|
||||
'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER'
|
||||
);
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (in_array($action, array(
|
||||
'setBANK_DISABLE_DIRECT_INPUT',
|
||||
'setACCOUNTANCY_COMBO_FOR_AUX',
|
||||
'setACCOUNTING_MANAGE_ZERO',
|
||||
'setACCOUNTING_LIST_SORT_VENTILATION_TODO',
|
||||
'setACCOUNTING_LIST_SORT_VENTILATION_DONE'))) {
|
||||
$constname = preg_replace('/^set/', '', $action);
|
||||
$constvalue = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, $constname, $constvalue, '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 == 'update') {
|
||||
$error = 0;
|
||||
|
||||
if (!$error) {
|
||||
foreach ($list as $constname) {
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
var_dump($constname);
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
@ -268,11 +291,11 @@ print '</tr>';
|
||||
print '<tr class="oddeven">';
|
||||
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'].'?token='.newToken().'&disabledirectinput&value=0">';
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&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'].'?token='.newToken().'&disabledirectinput&value=1">';
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
@ -282,11 +305,11 @@ print '<tr class="oddeven">';
|
||||
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'].'?token='.newToken().'&enablesubsidiarylist&value=0">';
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&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'].'?token='.newToken().'&enablesubsidiarylist&value=1">';
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
@ -295,11 +318,11 @@ print '</tr>';
|
||||
print '<tr class="oddeven">';
|
||||
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'].'?token='.newToken().'&managezero&value=0">';
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&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'].'?token='.newToken().'&managezero&value=1">';
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
@ -336,11 +359,11 @@ print "</tr>\n";
|
||||
print '<tr class="oddeven">';
|
||||
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'].'?token='.newToken().'&listsorttodo&value=0">';
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&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'].'?token='.newToken().'&listsorttodo&value=1">';
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
@ -349,11 +372,11 @@ print '</tr>';
|
||||
print '<tr class="oddeven">';
|
||||
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'].'?token='.newToken().'&listsortdone&value=0">';
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&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'].'?token='.newToken().'&listsortdone&value=1">';
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
@ -385,7 +408,7 @@ print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").'</td>';
|
||||
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=1">';
|
||||
@ -398,7 +421,7 @@ print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").'</td>';
|
||||
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=1">';
|
||||
@ -411,7 +434,7 @@ print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").'</td>';
|
||||
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=1">';
|
||||
|
||||
@ -209,7 +209,7 @@ Codejournal=Journal
|
||||
JournalLabel=Journal label
|
||||
NumPiece=Piece number
|
||||
TransactionNumShort=Num. transaction
|
||||
AccountingCategory=Personalized groups
|
||||
AccountingCategory=Custom group
|
||||
GroupByAccountAccounting=Group by general ledger account
|
||||
GroupBySubAccountAccounting=Group by subledger account
|
||||
AccountingAccountGroupsDesc=You can define here some groups of accounting account. They will be used for personalized accounting reports.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user