Update notified

This commit is contained in:
Alexandre SPANGARO 2021-04-19 06:03:03 +02:00
parent 7c0350e948
commit 305b338a11
4 changed files with 30 additions and 16 deletions

View File

@ -524,10 +524,15 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
$accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines, $formatexportset);
$notifiedexportdate = GETPOST('notifiedexportdate', 'alpha');
$notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
dol_syslog("date_export/date_validated=".$notifiedexportdate.'/'.$notifiedvalidationdate, LOG_DEBUG);
if (!empty($accountancyexport->errors)) {
setEventMessages('', $accountancyexport->errors, 'errors');
} else {
// Specify as export : update field date_export
} elseif (!$notifiedexportdate || !$notifiedvalidationdate) {
// Specify as export : update field date_export or date_validated
$error = 0;
$db->begin();
@ -536,8 +541,15 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
$now = dol_now();
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_export = '".$db->idate($now)."'";
$sql .= " , date_validated = '".$db->idate($now)."'";
$sql .= " SET";
if (!$notifiedexportdate && !$notifiedvalidationdate) {
$sql .= " date_export = '".$db->idate($now)."'";
$sql .= ", date_validated = '".$db->idate($now)."'";
} elseif (!$notifiedexportdate) {
$sql .= " date_export = '".$db->idate($now)."'";
} elseif (!$notifiedvalidationdate) {
$sql .= " date_validated = '".$db->idate($now)."'";
}
$sql .= " WHERE rowid = ".((int) $movement->id);
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
@ -551,11 +563,11 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
if (!$error) {
$db->commit();
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExportedOrValidated"), null, 'mesgs');
} else {
$error++;
$db->rollback();
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"), null, 'errors');
}
}
exit;
@ -603,6 +615,8 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
llxHeader('', $title_page);
$formconfirm = '';
if ($action == 'export_file') {
$form_question = array();
@ -614,17 +628,15 @@ if ($action == 'export_file') {
);
$form_question['notifiedvalidationdate'] = array(
'name' => 'notifiedvalidationdate',
'type' => 'checkbox', // We don't use select here, the journal_array is already a select html component
'type' => 'checkbox',
'label' => $langs->trans('NotifiedValidationDate'),
'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) ? 'false' : 'true'),
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300);
print $formconfirm;
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600);
}
if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
print $formconfirm;
}
if ($action == 'delbookkeepingyear') {
$form_question = array();
@ -664,9 +676,11 @@ if ($action == 'delbookkeepingyear') {
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
print $formconfirm;
}
// Print form confirm
print $formconfirm;
//$param=''; param started before
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);

View File

@ -263,7 +263,7 @@ class AccountancyCategory // extends CommonObject
if ($id) {
$sql .= " WHERE t.rowid = ".((int) $id);
} else {
$sql .= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid
$sql .= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Don't use entity if you use rowid
if ($code) {
$sql .= " AND t.code = '".$this->db->escape($code)."'";
} elseif ($label) {

View File

@ -993,8 +993,8 @@ class BookKeeping extends CommonObject
$sql .= " t.date_creation,";
$sql .= " t.date_lim_reglement,";
$sql .= " t.tms as date_modification,";
$sql .= " t.date_export";
$sql .= " t.date_validated as date_validation,";
$sql .= " t.date_export,";
$sql .= " t.date_validated as date_validation";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
// Manage filter
$sqlwhere = array();

View File

@ -328,7 +328,7 @@ ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountanc
ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting)
## Export
NotifiedExportDate=Notified export date
NotifiedExportDate=Notified export date (modification of the entries will not be possible)
NotifiedValidationDate=Validation of the entries (modification or deletion of the entries will not be possible)
ConfirmExportFile=Confirmation of the generation of the accounting export file ?
ExportDraftJournal=Export draft journal
@ -430,4 +430,4 @@ WarningReportNotReliable=Warning, this report is not based on the Ledger, so doe
ExpenseReportJournal=Expense Report Journal
InventoryJournal=Inventory Journal
NAccounts=%s accounts
NAccounts=%s accounts