Skip to content

Commit

Permalink
Debug v6
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 1, 2017
1 parent 2b0b209 commit 31fe8eb
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 63 deletions.
44 changes: 22 additions & 22 deletions htdocs/accountancy/admin/export.php
Expand Up @@ -47,7 +47,7 @@

// Parameters ACCOUNTING_EXPORT_*
$main_option = array (
'ACCOUNTING_EXPORT_PREFIX_SPEC'
'ACCOUNTING_EXPORT_PREFIX_SPEC'
);

$model_option = array (
Expand All @@ -67,18 +67,18 @@
*/
if ($action == 'update') {
$error = 0;

$format = GETPOST('format', 'alpha');
$modelcsv = GETPOST('modelcsv', 'int');

if (! empty($format)) {
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', $format, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
} else {
$error ++;
}

if (! empty($modelcsv)) {
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
$error ++;
Expand All @@ -89,23 +89,23 @@
} else {
$error ++;
}

foreach ( $main_option as $constname ) {
$constvalue = GETPOST($constname, 'alpha');

if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}

foreach ( $model_option as $constname ) {
$constvalue = GETPOST($constname, 'alpha');

if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}

if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
Expand Down Expand Up @@ -148,13 +148,13 @@
$num = count($main_option);
if ($num) {
foreach ( $main_option as $key ) {

print '<tr class="oddeven value">';

// Param
$label = $langs->trans($key);
print '<td width="50%">' . $label . '</td>';

// Value
print '<td>';
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
Expand Down Expand Up @@ -187,7 +187,7 @@
print '<td>';
$listmodelcsv = AccountancyExport::getType();
print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);

print '</td>';
}
print "</td></tr>";
Expand All @@ -205,12 +205,12 @@
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
print "</tr>\n";
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1)

if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::EXPORT_TYPE_NORMAL)
{
print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
}

print '<tr class="oddeven">';
print '<td width="50%">' . $langs->trans("Selectformat") . '</td>';
if (! $conf->use_javascript_ajax) {
Expand All @@ -224,24 +224,24 @@
'txt' => $langs->trans("txt")
);
print $form->selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0);

print '</td>';
}
print "</td></tr>";
foreach ( $model_option as $key ) {

foreach ( $model_option as $key ) {
print '<tr class="oddeven value">';

// Param
$label = $langs->trans($key);
print '<td width="50%">' . $label . '</td>';

// Value
print '<td>';
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
print '</td></tr>';
}

print "</table>\n";
}

Expand Down
13 changes: 6 additions & 7 deletions htdocs/accountancy/bookkeeping/balance.php
Expand Up @@ -51,7 +51,7 @@
$search_accountancy_code_end = '';
}

if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) {
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv.x") || GETPOST("button_export_csv")) {
$action = 'export_csv';
}

Expand Down Expand Up @@ -112,7 +112,10 @@
*/

if ($action == 'export_csv') {

$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == AccountancyExport::EXPORT_TYPE_CEGID) $sep = ";"; // For CEGID, we force separator.

$journal = 'bookkepping';

include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
Expand All @@ -122,11 +125,7 @@
setEventMessages($object->error, $object->errors, 'errors');
}

foreach ( $object->lines as $line ) {

if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
}
foreach ($object->lines as $line) {
print length_accountg($line->numero_compte) . $sep;
print $line->debit . $sep;
print $line->credit . $sep;
Expand Down Expand Up @@ -157,7 +156,7 @@

print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

$button = '<input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" />';
$button = '<input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);

$moreforfilter = '';
Expand Down
20 changes: 10 additions & 10 deletions htdocs/accountancy/bookkeeping/list.php
Expand Up @@ -25,8 +25,7 @@
* \brief List operation of book keeping
*/
require '../../main.inc.php';

// Class
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
Expand All @@ -47,11 +46,11 @@
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));

if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt")) {
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
$action = 'delbookkeepingyear';
}
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) {
$action = 'export_csv';
if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOST("button_export_file")) {
$action = 'export_file';
}

$search_accountancy_code = GETPOST("search_accountancy_code");
Expand Down Expand Up @@ -99,7 +98,7 @@
$form = new Form($db);


if ($action != 'export_csv' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page)) {
if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && empty($page)) {
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
}
Expand Down Expand Up @@ -261,9 +260,8 @@
}
}

if ($action == 'export_csv') {

include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
// Export into a file with format defined into setup
if ($action == 'export_file') {

$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);

Expand Down Expand Up @@ -356,9 +354,11 @@
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';

$button = '<a class="butAction" name="button_export_csv" href="'.$_SERVER["PHP_SELF"].'?action=export_csv'.($param?'&'.$param:'').'">';
$listofformat=AccountancyExport::getType();
$button = '<a class="butAction" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
if (count($filter)) $button.= $langs->trans("ExportFilteredList");
else $button.= $langs->trans("ExportList");
$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')';
$button.= '</a>';

$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
Expand Down
9 changes: 5 additions & 4 deletions htdocs/accountancy/class/accountancyexport.class.php
Expand Up @@ -32,14 +32,15 @@
*
* Manage the different format accountancy export
*/

require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';

class AccountancyExport
{
/**
*
* @var Type of export
* @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV
*/
public static $EXPORT_TYPE_NORMAL = 1;
public static $EXPORT_TYPE_NORMAL = 1; // Classic CSV
public static $EXPORT_TYPE_CEGID = 2;
public static $EXPORT_TYPE_COALA = 3;
public static $EXPORT_TYPE_BOB50 = 4;
Expand Down Expand Up @@ -81,7 +82,7 @@ public function __construct(DoliDB &$db) {
}

/**
* Get all export type are available
* Array wit all export type available (key + label)
*
* @return array of type
*/
Expand Down
5 changes: 4 additions & 1 deletion htdocs/accountancy/journal/expensereportsjournal.php
Expand Up @@ -52,6 +52,7 @@
$date_endmonth = GETPOST('date_endmonth');
$date_endday = GETPOST('date_endday');
$date_endyear = GETPOST('date_endyear');
$in_bookkeeping = GETPOST('in_bookkeeping');

$now = dol_now();

Expand Down Expand Up @@ -104,6 +105,8 @@
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
if ($date_start && $date_end)
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
if ($in_bookkeeping == 'yes')
$sql .= " AND (er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report') )";
$sql .= " ORDER BY er.date_debut";

dol_syslog('accountancy/journal/expensereportsjournal.php:: $sql=' . $sql);
Expand Down Expand Up @@ -466,7 +469,7 @@
$builddate = time();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';

$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);

$varlink = 'id_journal=' . $id_journal;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/journal/purchasesjournal.php
Expand Up @@ -43,7 +43,7 @@
$langs->load("accountancy");

$id_journal = GETPOST('id_journal', 'int');
$action = GETPOST('action','alpha');
$action = GETPOST('action','aZ09');

$date_startmonth = GETPOST('date_startmonth');
$date_startday = GETPOST('date_startday');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/salaries/document.php
Expand Up @@ -91,7 +91,7 @@

$head=salaries_prepare_head($object);

dol_fiche_head($head, 'documents', $langs->trans("SalaryPayment"), 0, 'payment');
dol_fiche_head($head, 'documents', $langs->trans("SalaryPayment"), -1, 'payment');

// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
Expand Down

0 comments on commit 31fe8eb

Please sign in to comment.