forked from Wavyzz/dolibarr
Fix
This commit is contained in:
@@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
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
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("accountancy"));
|
$langs->loadLangs(array("accountancy"));
|
||||||
@@ -146,7 +147,7 @@ $arrayfields=array(
|
|||||||
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
|
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
|
||||||
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
|
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
|
||||||
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
|
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
|
||||||
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>0),
|
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
|
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
|
||||||
@@ -364,9 +365,7 @@ if ($action == 'delmouvconfirm') {
|
|||||||
|
|
||||||
// Export into a file with format defined into setup (FEC, CSV, ...)
|
// Export into a file with format defined into setup (FEC, CSV, ...)
|
||||||
if ($action == 'export_file') {
|
if ($action == 'export_file') {
|
||||||
$reexportMovements = GETPOST('already_exported')=='on'?1:0;
|
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
|
||||||
|
|
||||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $reexportMovements);
|
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@@ -374,11 +373,20 @@ if ($action == 'export_file') {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Export files
|
||||||
$accountancyexport = new AccountancyExport($db);
|
$accountancyexport = new AccountancyExport($db);
|
||||||
$accountancyexport->export($object->lines);
|
$accountancyexport->export($object->lines);
|
||||||
|
|
||||||
// TODO Move in class bookKeeping
|
if (! empty($accountancyexport->errors))
|
||||||
|
{
|
||||||
|
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||||
|
} else {
|
||||||
// Specify as export : update field date_export
|
// Specify as export : update field date_export
|
||||||
|
// TODO Move in class bookKeeping
|
||||||
|
$error=0;
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
if (is_array($object->lines)) {
|
||||||
foreach ($object->lines as $movement) {
|
foreach ($object->lines as $movement) {
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
$sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||||
@@ -386,21 +394,36 @@ if ($action == 'export_file') {
|
|||||||
$sql .= " WHERE rowid = " . $movement->id;
|
$sql .= " WHERE rowid = " . $movement->id;
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=" . $sql, LOG_DEBUG);
|
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=" . $sql, LOG_DEBUG);
|
||||||
if ($db->query($sql)) {
|
$result = $db->query($sql);
|
||||||
|
if ($result) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
// setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($accountancyexport->errors))
|
|
||||||
{
|
|
||||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'setreexport') {
|
||||||
|
$export = 0;
|
||||||
|
$setreexport = GETPOST('value', 'int');
|
||||||
|
if (! dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++;
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
|
||||||
|
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@@ -481,7 +504,14 @@ $listofformat=AccountancyExport::getType();
|
|||||||
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
|
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
|
||||||
else $buttonLabel = $langs->trans("ExportList");
|
else $buttonLabel = $langs->trans("ExportList");
|
||||||
|
|
||||||
$newcardbutton = '<input type="checkbox" name="already_exported"> ' . $langs->trans("IncludeDocsAlreadyExported");
|
// Button re-export
|
||||||
|
if (! empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||||
|
print $newcardbutton ='<a href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=0'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
|
||||||
|
} else {
|
||||||
|
print $newcardbutton ='<a href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=1'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
|
||||||
|
}
|
||||||
|
$newcardbutton.= $langs->trans("IncludeDocsAlreadyExported");
|
||||||
|
|
||||||
$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')', 'fa fa-file-export', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''));
|
$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')', 'fa fa-file-export', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''));
|
||||||
|
|
||||||
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-object-group', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
|
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-object-group', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
|
||||||
|
|||||||
@@ -936,10 +936,12 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')';
|
$sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')';
|
||||||
|
if ($showAlreadyExportMovements == 0) {
|
||||||
|
$sql .= " AND t.date_export IS NULL";
|
||||||
|
}
|
||||||
if (count($sqlwhere) > 0) {
|
if (count($sqlwhere) > 0) {
|
||||||
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($sortfield)) {
|
if (! empty($sortfield)) {
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -843,6 +843,10 @@ ExportFilteredList=Export filtered list
|
|||||||
ExportList=Export list
|
ExportList=Export list
|
||||||
ExportOptions=Export Options
|
ExportOptions=Export Options
|
||||||
IncludeDocsAlreadyExported=Include docs already exported
|
IncludeDocsAlreadyExported=Include docs already exported
|
||||||
|
ExportOfPiecesAlreadyExportedIsEnable=Export of pieces already exported is enable
|
||||||
|
ExportOfPiecesAlreadyExportedIsDisable=Export of pieces already exported is disable
|
||||||
|
AllExportedMovementsWereRecordedAsExported=All exported movements were recorded as exported
|
||||||
|
NotAllExportedMovementsCouldBeRecordedAsExported=Not all exported movements could be recorded as exported
|
||||||
Miscellaneous=Miscellaneous
|
Miscellaneous=Miscellaneous
|
||||||
Calendar=Calendar
|
Calendar=Calendar
|
||||||
GroupBy=Group by...
|
GroupBy=Group by...
|
||||||
|
|||||||
Reference in New Issue
Block a user