Merge pull request #15863 from aspangaro/13b5

Accountancy - Add date_export on new ledger & subledger to show edit or delete link when is not export yet
This commit is contained in:
Laurent Destailleur 2021-01-07 11:15:37 +01:00 committed by GitHub
commit 396cbdb79c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 228 additions and 134 deletions

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
$error = 0;
// Load translation files required by the page
$langs->loadLangs(array("bills", "accountancy"));
$langs->loadLangs(array("bills", "accountancy", "compta"));
$mesg = '';
$action = GETPOST('action', 'aZ09');
@ -41,7 +41,9 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel', 'alpha');
$accountingaccount = GETPOST('accountingaccount', 'alpha');
$account_number = GETPOST('account_number', 'string');
$label = GETPOST('label', 'alpha');
// Security check
if ($user->socid > 0) accessforbidden();
@ -65,104 +67,118 @@ if (GETPOST('cancel', 'alpha'))
if ($action == 'add' && $user->rights->accounting->chartofaccount)
{
if (!$cancel) {
$sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql='.$sql);
$result = $db->query($sql);
$obj = $db->fetch_object($result);
// Clean code
// To manage zero or not at the end of the accounting account
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1)
if (!$account_number)
{
$account_number = GETPOST('account_number', 'string');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
$action = 'create';
} elseif (!$label)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
$action = 'create';
} else {
$account_number = clean_account(GETPOST('account_number', 'string'));
}
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
if (GETPOST('account_parent', 'int') <= 0)
{
$account_parent = 0;
} else {
$account_parent = GETPOST('account_parent', 'int');
}
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result = $db->query($sql);
$obj = $db->fetch_object($result);
$object->fk_pcg_version = $obj->pcg_version;
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
$object->label = GETPOST('label', 'alpha');
$object->labelshort = GETPOST('labelshort', 'alpha');
$object->active = 1;
// Clean code
$res = $object->create($user);
if ($res == - 3) {
$error = 1;
$action = "create";
setEventMessages($object->error, $object->errors, 'errors');
} elseif ($res == - 4) {
$error = 2;
$action = "create";
setEventMessages($object->error, $object->errors, 'errors');
} elseif ($res < 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$action = "create";
}
if (!$error)
{
setEventMessages("RecordCreatedSuccessfully", null, 'mesgs');
$urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1);
header("Location: ".$urltogo);
exit;
// To manage zero or not at the end of the accounting account
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
$account_number = $account_number;
} else {
$account_number = clean_account($account_number);
}
if (GETPOST('account_parent', 'int') <= 0) {
$account_parent = 0;
} else {
$account_parent = GETPOST('account_parent', 'int');
}
$object->fk_pcg_version = $obj->pcg_version;
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
$object->label = $label;
$object->labelshort = GETPOST('labelshort', 'alpha');
$object->active = 1;
$res = $object->create($user);
if ($res == -3) {
$error = 1;
$action = "create";
setEventMessages($object->error, $object->errors, 'errors');
} elseif ($res == -4) {
$error = 2;
$action = "create";
setEventMessages($object->error, $object->errors, 'errors');
} elseif ($res < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$action = "create";
}
if (!$error) {
setEventMessages("RecordCreatedSuccessfully", null, 'mesgs');
$urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1);
header("Location: " . $urltogo);
exit;
}
}
}
} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) {
if (!$cancel) {
$result = $object->fetch($id);
$sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql='.$sql);
$result2 = $db->query($sql);
$obj = $db->fetch_object($result2);
// Clean code
// To manage zero or not at the end of the accounting account
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1)
if (!$account_number)
{
$account_number = GETPOST('account_number', 'string');
} else {
$account_number = clean_account(GETPOST('account_number', 'string'));
}
if (GETPOST('account_parent', 'int') <= 0)
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
$action = 'update';
} elseif (!$label)
{
$account_parent = 0;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
$action = 'update';
} else {
$account_parent = GETPOST('account_parent', 'int');
}
$result = $object->fetch($id);
$object->fk_pcg_version = $obj->pcg_version;
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
$object->label = GETPOST('label', 'alpha');
$object->labelshort = GETPOST('labelshort', 'alpha');
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
$result = $object->update($user);
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result2 = $db->query($sql);
$obj = $db->fetch_object($result2);
if ($result > 0) {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo);
exit();
} else {
$mesg = $object->error;
// Clean code
// To manage zero or not at the end of the accounting account
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
$account_number = $account_number;
} else {
$account_number = clean_account($account_number);
}
if (GETPOST('account_parent', 'int') <= 0) {
$account_parent = 0;
} else {
$account_parent = GETPOST('account_parent', 'int');
}
$object->fk_pcg_version = $obj->pcg_version;
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
$object->label = $label;
$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;
}
}
} else {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
@ -222,7 +238,7 @@ if ($action == 'create') {
// Account number
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("AccountNumber").'</span></td>';
print '<td><input name="account_number" size="30" value="'.$accountingaccount.'"></td></tr>';
print '<td><input name="account_number" size="30" value="'.$account_number.'"></td></tr>';
// Label
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy"));
$langs->loadLangs(array("accountancy", "compta"));
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$sortorder = GETPOST("sortorder", 'alpha');
@ -323,7 +323,9 @@ if ($action != 'export_csv')
$root_account_number = $tmparrayforrootaccount['account_number'];
if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=update&token='.newToken().'&id='.$accountingaccountstatic->id.'">'.img_edit().'</a>';
$link = '<a class="editfielda reposition" href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=update&token=' . newToken() . '&id=' . $accountingaccountstatic->id . '">' . img_edit() . '</a>';
} elseif (empty($tmparrayforrootaccount['label'])) {
$link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=create&token=' . newToken() . '&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
}
if (!empty($show_subgroup))

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy"));
$langs->loadLangs(array("accountancy", "compta"));
$socid = GETPOST('socid', 'int');

View File

@ -48,6 +48,14 @@ $search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
@ -128,6 +136,7 @@ $arrayfields = array(
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
);
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
@ -181,6 +190,14 @@ if (empty($reshook))
$search_date_endyear = '';
$search_date_endmonth = '';
$search_date_endday = '';
$search_date_export_start = '';
$search_date_export_end = '';
$search_date_export_startyear = '';
$search_date_export_startmonth = '';
$search_date_export_startday = '';
$search_date_export_endyear = '';
$search_date_export_endmonth = '';
$search_date_export_endday = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
@ -251,6 +268,14 @@ if (empty($reshook))
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
}
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
}
}
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@ -490,6 +515,17 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>';
}
// Date export
if (!empty($arrayfields['t.date_export']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
@ -512,6 +548,7 @@ if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_tit
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@ -542,13 +579,12 @@ while ($i < min($num, $limit))
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colnumber = 5;
$colnumberend = 7;
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) $colnumber--;
if (empty($arrayfields['t.date_export']['checked'])) $colnumber--;
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account
@ -581,7 +617,7 @@ while ($i < min($num, $limit))
// Show the break account
print "<tr>";
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 9).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
else print '<span class="error">'.$langs->trans("Unknown").'</span>';
print '</td>';
@ -722,6 +758,13 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
// Exported operation date
if (!empty($arrayfields['t.date_export']['checked']))
{
print '<td class="center">'.dol_print_date($line->date_export, 'dayhour').'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
@ -750,14 +793,6 @@ while ($i < min($num, $limit))
}
if ($num > 0) {
// Show sub-total of last shown account
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
print '<tr class="liste_total">';

View File

@ -48,6 +48,14 @@ $search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
@ -128,6 +136,7 @@ $arrayfields = array(
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
);
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
@ -149,6 +158,7 @@ if ($search_date_end && empty($search_date_endyear)) {
/*
* Action
*/
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
@ -180,6 +190,14 @@ if (empty($reshook))
$search_date_endyear = '';
$search_date_endmonth = '';
$search_date_endday = '';
$search_date_export_start = '';
$search_date_export_end = '';
$search_date_export_startyear = '';
$search_date_export_startmonth = '';
$search_date_export_startday = '';
$search_date_export_endyear = '';
$search_date_export_endmonth = '';
$search_date_export_endday = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
@ -250,6 +268,14 @@ if (empty($reshook))
$filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
}
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
}
}
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@ -287,7 +313,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
}
// Make a redirect to avoid to launch the delete later after a back button
header("Location: listbysubaccount.php".($param ? '?'.$param : ''));
header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
exit;
} else {
setEventMessages("NoRecordDeleted", null, 'warnings');
@ -304,7 +330,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
}
header("Location: listbysubaccount.php?noreset=1".($param ? '&'.$param : ''));
header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
exit;
}
}
@ -403,7 +429,6 @@ if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php', '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbysubaccount.php', '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
}
@ -494,6 +519,17 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>';
}
// Date export
if (!empty($arrayfields['t.date_export']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
@ -516,6 +552,7 @@ if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_tit
if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@ -546,13 +583,12 @@ while ($i < min($num, $limit))
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colnumber = 5;
$colnumberend = 7;
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) $colnumber--;
if (empty($arrayfields['t.date_export']['checked'])) $colnumber--;
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account
@ -585,7 +621,7 @@ while ($i < min($num, $limit))
// Show the break account
print "<tr>";
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 9).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
if ($line->subledger_account != "" && $line->subledger_account != '-1') {
print $object->get_compte_desc($line->numero_compte).' : '.length_accounta($line->subledger_account);
} else {
@ -734,6 +770,13 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
// Exported operation date
if (!empty($arrayfields['t.date_export']['checked']))
{
print '<td class="center">'.dol_print_date($line->date_export, 'dayhour').'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
@ -762,14 +805,6 @@ while ($i < min($num, $limit))
}
if ($num > 0) {
// Show sub-total of last shown account
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
$colnumber = 3;
$colnumberend = 7;
} else {
$colnumber = 4;
$colnumberend = 7;
}
$colspan = $totalarray['nbfield'] - $colnumber;
$colspanend = $totalarray['nbfield'] - $colnumberend;
print '<tr class="liste_total">';

View File

@ -795,7 +795,7 @@ class BookKeeping extends CommonObject
$sql .= " t.label_operation,";
$sql .= " t.debit,";
$sql .= " t.credit,";
$sql .= " t.montant,";
$sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.multicurrency_amount,";
$sql .= " t.multicurrency_code,";
@ -806,7 +806,8 @@ class BookKeeping extends CommonObject
$sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num,";
$sql .= " t.date_creation";
$sql .= " t.date_creation,";
$sql .= " t.date_export";
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
@ -823,6 +824,8 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.reconciled_option') {
@ -878,7 +881,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
$line->montant = $obj->montant;
$line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->multicurrency_amount = $obj->multicurrency_amount;
$line->multicurrency_code = $obj->multicurrency_code;
@ -889,7 +893,8 @@ class BookKeeping extends CommonObject
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation;
$line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_export = $this->db->jdate($obj->date_export);
$this->lines[] = $line;
@ -941,7 +946,7 @@ class BookKeeping extends CommonObject
$sql .= " t.credit,";
$sql .= " t.lettering_code,";
$sql .= " t.date_lettering,";
$sql .= " t.montant,";
$sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.fk_user_author,";
$sql .= " t.import_key,";
@ -1019,7 +1024,8 @@ class BookKeeping extends CommonObject
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
$line->montant = $obj->montant;
$line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
$line->date_lettering = $obj->date_lettering;

View File

@ -182,8 +182,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre
if (!$dateech)
{
setEventMessages($langs->trans("ErrorFieldReqrequire_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
uired", $langs->transnoentities("Date")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
$action = 'edit';
} elseif (!$dateperiod)
{

View File

@ -1112,4 +1112,5 @@ UpToDate=Up-to-date
OutOfDate=Out-of-date
EventReminder=Event Reminder
UpdateForAllLines=Update for all lines
OnHold=On hold
OnHold=On hold
Civility=Civility

View File

@ -36,7 +36,7 @@ if (!$user->rights->user->user->lire && !$user->admin) {
}
// Load translation files required by page
$langs->loadLangs(array('users', 'companies', 'hrm'));
$langs->loadLangs(array('users', 'companies', 'hrm', 'salaries'));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)