Export date muse not be erased if already set
FIX sort filter lose FIX bad date for export date shown on list
This commit is contained in:
parent
78f20ec7b2
commit
0ef2886aae
@ -754,30 +754,33 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements
|
||||
} else {
|
||||
if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
|
||||
if (is_array($object->lines)) {
|
||||
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
|
||||
|
||||
// Specify as export : update field date_export or date_validated
|
||||
$db->begin();
|
||||
|
||||
// TODO Merge update for each line into one gloacl using rowid IN (list of movement ids)
|
||||
foreach ($object->lines as $movement) {
|
||||
$now = dol_now();
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET";
|
||||
if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) {
|
||||
$sql .= " date_export = '".$db->idate($now)."'";
|
||||
$sql .= ", date_validated = '".$db->idate($now)."'";
|
||||
} elseif (!empty($notifiedexportdate)) {
|
||||
$sql .= " date_export = '".$db->idate($now)."'";
|
||||
} elseif (!empty($notifiedvalidationdate)) {
|
||||
$sql .= " date_validated = '".$db->idate($now)."'";
|
||||
$setfields = '';
|
||||
if (!empty($notifiedexportdate) && empty($movement->date_export)) {
|
||||
$setfields .= ($setfields ? "," : "")." date_export = '".$db->idate($now)."'";
|
||||
}
|
||||
if (!empty($notifiedvalidationdate) && empty($movement->date_validation)) {
|
||||
$setfields .= ($setfields ? "," : "")." date_validated = '".$db->idate($now)."'";
|
||||
}
|
||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||
|
||||
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
|
||||
if ($setfields) {
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET ".$setfields;
|
||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
break;
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1014,17 +1017,17 @@ $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
// Button re-export
|
||||
if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToHideAlreadyExportedLines").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
} else {
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"');
|
||||
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"');
|
||||
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreExcluded").'</span>';
|
||||
$newcardbutton .= '</a>';
|
||||
}
|
||||
|
||||
if ($user->hasRight('accounting', 'mouvements', 'export')) {
|
||||
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export'));
|
||||
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder), $user->hasRight('accounting', 'mouvements', 'export'));
|
||||
}
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
@ -1522,7 +1525,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Creation operation date
|
||||
if (!empty($arrayfields['t.date_creation']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($line->date_creation, 'dayhour').'</td>';
|
||||
print '<td class="center">'.dol_print_date($line->date_creation, 'dayhour', 'tzuserrel').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1530,7 +1533,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Modification operation date
|
||||
if (!empty($arrayfields['t.tms']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($line->date_modification, 'dayhour').'</td>';
|
||||
print '<td class="center">'.dol_print_date($line->date_modification, 'dayhour', 'tzuserrel').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1538,7 +1541,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Exported operation date
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) {
|
||||
print '<td class="center nowraponall">'.dol_print_date($line->date_export, 'dayhour').'</td>';
|
||||
print '<td class="center nowraponall">'.dol_print_date($line->date_export, 'dayhour', 'tzuserrel').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1546,7 +1549,7 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Validated operation date
|
||||
if (!empty($arrayfields['t.date_validated']['checked'])) {
|
||||
print '<td class="center nowraponall">'.dol_print_date($line->date_validation, 'dayhour').'</td>';
|
||||
print '<td class="center nowraponall">'.dol_print_date($line->date_validation, 'dayhour', 'tzuserrel').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -349,8 +349,8 @@ ACCOUNTING_ENABLE_AUTOLETTERING=Enable the automatic lettering when transferring
|
||||
|
||||
## Export
|
||||
NotExportLettering=Do not export the lettering when generating the file
|
||||
NotifiedExportDate=Flag exported lines as Exported <span class="warning">(to modify a line, you will need to delete the whole transaction and re-transfert it into accounting)</span>
|
||||
NotifiedValidationDate=Validate and Lock the exported entries <span class="warning">(same effect than the "%s" feature, modification and deletion of the lines will DEFINITELY not be possible)</span>
|
||||
NotifiedExportDate=Flag not yet exported lines as Exported <span class="warning">(to modify a line flagged as exported, you will need to delete the whole transaction and re-transfert it into accounting)</span>
|
||||
NotifiedValidationDate=Validate and Lock the exported entries not yet already locked <span class="warning">(same effect than the "%s" feature, modification and deletion of the lines will DEFINITELY not be possible)</span>
|
||||
NotifiedExportFull=Export documents ?
|
||||
DateValidationAndLock=Date validation and lock
|
||||
ConfirmExportFile=Confirmation of the generation of the accounting export file ?
|
||||
|
||||
Loading…
Reference in New Issue
Block a user