Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
1ea8bd2ed9
@ -126,7 +126,7 @@
|
||||
<rule ref="Generic.Metrics.CyclomaticComplexity">
|
||||
<properties>
|
||||
<property name="complexity" value="120" />
|
||||
<property name="absoluteComplexity" value="250" />
|
||||
<property name="absoluteComplexity" value="300" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="Generic.Metrics.NestingLevel">
|
||||
|
||||
@ -569,7 +569,7 @@ if ($action == 'create') {
|
||||
|
||||
print_liste_field_titre("AccountAccountingShort");
|
||||
print_liste_field_titre("SubledgerAccount");
|
||||
print_liste_field_titre("Labelcompte");
|
||||
print_liste_field_titre("LabelAccount");
|
||||
print_liste_field_titre("Label");
|
||||
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
|
||||
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
|
||||
|
||||
@ -98,8 +98,8 @@ $form = new Form($db);
|
||||
|
||||
|
||||
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'));
|
||||
$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'));
|
||||
}
|
||||
|
||||
|
||||
@ -134,67 +134,67 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$param = '';
|
||||
$filter = array ();
|
||||
if (! empty($search_date_start)) {
|
||||
$filter['t.doc_date>='] = $search_date_start;
|
||||
$tmp=dol_getdate($search_date_start);
|
||||
$param .= '&date_startmonth=' . $tmp['mon'] . '&date_startday=' . $tmp['mday'] . '&date_startyear=' . $tmp['year'];
|
||||
$filter['t.doc_date>='] = $search_date_start;
|
||||
$tmp=dol_getdate($search_date_start);
|
||||
$param .= '&date_startmonth=' . $tmp['mon'] . '&date_startday=' . $tmp['mday'] . '&date_startyear=' . $tmp['year'];
|
||||
}
|
||||
if (! empty($search_date_end)) {
|
||||
$filter['t.doc_date<='] = $search_date_end;
|
||||
$tmp=dol_getdate($search_date_end);
|
||||
$param .= '&date_endmonth=' . $tmp['mon'] . '&date_endday=' . $tmp['mday'] . '&date_endyear=' . $tmp['year'];
|
||||
$filter['t.doc_date<='] = $search_date_end;
|
||||
$tmp=dol_getdate($search_date_end);
|
||||
$param .= '&date_endmonth=' . $tmp['mon'] . '&date_endday=' . $tmp['mday'] . '&date_endyear=' . $tmp['year'];
|
||||
}
|
||||
if (! empty($search_doc_date)) {
|
||||
$filter['t.doc_date'] = $search_doc_date;
|
||||
$tmp=dol_getdate($search_doc_date);
|
||||
$param .= '&doc_datemonth=' . $tmp['mon'] . '&doc_dateday=' . $tmp['mday'] . '&doc_dateyear=' . $tmp['year'];
|
||||
$filter['t.doc_date'] = $search_doc_date;
|
||||
$tmp=dol_getdate($search_doc_date);
|
||||
$param .= '&doc_datemonth=' . $tmp['mon'] . '&doc_dateday=' . $tmp['mday'] . '&doc_dateyear=' . $tmp['year'];
|
||||
}
|
||||
if (! empty($search_doc_type)) {
|
||||
$filter['t.doc_type'] = $search_doc_type;
|
||||
$param .= '&search_doc_type=' . $search_doc_type;
|
||||
$filter['t.doc_type'] = $search_doc_type;
|
||||
$param .= '&search_doc_type=' . $search_doc_type;
|
||||
}
|
||||
if (! empty($search_doc_ref)) {
|
||||
$filter['t.doc_ref'] = $search_doc_ref;
|
||||
$param .= '&search_doc_ref=' . $search_doc_ref;
|
||||
$filter['t.doc_ref'] = $search_doc_ref;
|
||||
$param .= '&search_doc_ref=' . $search_doc_ref;
|
||||
}
|
||||
if (! empty($search_accountancy_code)) {
|
||||
$filter['t.numero_compte'] = $search_accountancy_code;
|
||||
$param .= '&search_accountancy_code=' . $search_accountancy_code;
|
||||
$filter['t.numero_compte'] = $search_accountancy_code;
|
||||
$param .= '&search_accountancy_code=' . $search_accountancy_code;
|
||||
}
|
||||
if (! empty($search_accountancy_code_start)) {
|
||||
$filter['t.numero_compte>='] = $search_accountancy_code_start;
|
||||
$param .= '&search_accountancy_code_start=' . $search_accountancy_code_start;
|
||||
$filter['t.numero_compte>='] = $search_accountancy_code_start;
|
||||
$param .= '&search_accountancy_code_start=' . $search_accountancy_code_start;
|
||||
}
|
||||
if (! empty($search_accountancy_code_end)) {
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
$param .= '&search_accountancy_code_end=' . $search_accountancy_code_end;
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
$param .= '&search_accountancy_code_end=' . $search_accountancy_code_end;
|
||||
}
|
||||
if (! empty($search_accountancy_aux_code)) {
|
||||
$filter['t.subledger_account'] = $search_accountancy_aux_code;
|
||||
$param .= '&search_accountancy_aux_code=' . $search_accountancy_aux_code;
|
||||
$filter['t.subledger_account'] = $search_accountancy_aux_code;
|
||||
$param .= '&search_accountancy_aux_code=' . $search_accountancy_aux_code;
|
||||
}
|
||||
if (! empty($search_accountancy_aux_code_start)) {
|
||||
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
||||
$param .= '&search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start;
|
||||
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
|
||||
$param .= '&search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start;
|
||||
}
|
||||
if (! empty($search_accountancy_aux_code_end)) {
|
||||
$filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
|
||||
$param .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end;
|
||||
$filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
|
||||
$param .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end;
|
||||
}
|
||||
if (! empty($search_mvt_label)) {
|
||||
$filter['t.label_operation'] = $search_mvt_label;
|
||||
$param .= '&search_mvt_label=' . $search_mvt_label;
|
||||
$filter['t.label_operation'] = $search_mvt_label;
|
||||
$param .= '&search_mvt_label=' . $search_mvt_label;
|
||||
}
|
||||
if (! empty($search_direction)) {
|
||||
$filter['t.sens'] = $search_direction;
|
||||
$param .= '&search_direction=' . $search_direction;
|
||||
$filter['t.sens'] = $search_direction;
|
||||
$param .= '&search_direction=' . $search_direction;
|
||||
}
|
||||
if (! empty($search_ledger_code)) {
|
||||
$filter['t.code_journal'] = $search_ledger_code;
|
||||
$param .= '&search_ledger_code=' . $search_ledger_code;
|
||||
$filter['t.code_journal'] = $search_ledger_code;
|
||||
$param .= '&search_ledger_code=' . $search_ledger_code;
|
||||
}
|
||||
if (! empty($search_mvt_num)) {
|
||||
$filter['t.piece_num'] = $search_mvt_num;
|
||||
$param .= '&search_mvt_num=' . $search_mvt_num;
|
||||
$filter['t.piece_num'] = $search_mvt_num;
|
||||
$param .= '&search_mvt_num=' . $search_mvt_num;
|
||||
}
|
||||
|
||||
if ($action == 'delbookkeeping') {
|
||||
@ -229,16 +229,16 @@ if ($action == 'delbookkeepingyearconfirm') {
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||
}
|
||||
Header("Location: list.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages("NoRecordDeleted", null, 'warnings');
|
||||
Header("Location: list.php");
|
||||
exit;
|
||||
setEventMessages("NoRecordDeleted", null, 'warnings');
|
||||
Header("Location: list.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ($action == 'delmouvconfirm') {
|
||||
@ -248,11 +248,11 @@ if ($action == 'delmouvconfirm') {
|
||||
if (! empty($mvt_num)) {
|
||||
$result = $object->deleteMvtNum($mvt_num);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
Header("Location: list.php");
|
||||
exit;
|
||||
@ -262,21 +262,21 @@ if ($action == 'delmouvconfirm') {
|
||||
// Export into a file with format defined into setup
|
||||
if ($action == 'export_file') {
|
||||
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
$accountancyexport->export($object->lines);
|
||||
if (!empty($accountancyexport->errors)) {
|
||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
$accountancyexport->export($object->lines);
|
||||
if (!empty($accountancyexport->errors)) {
|
||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -330,7 +330,7 @@ if ($action == 'delbookkeepingyear') {
|
||||
);
|
||||
$form_question['deljournal'] = array (
|
||||
'name' => 'deljournal',
|
||||
'type' => 'other', // We don't use select here, the journal_array is already a select html component
|
||||
'type' => 'other', // We don't use select here, the journal_array is already a select html component
|
||||
'label' => $langs->trans('DelJournal'),
|
||||
'value' => $journal_array,
|
||||
'default' => $deljournal
|
||||
@ -340,7 +340,7 @@ if ($action == 'delbookkeepingyear') {
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
//$param=''; param started before
|
||||
//$param=''; param started before
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
@ -399,28 +399,28 @@ print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@ -489,8 +489,8 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
if ($num < $limit) print '<td align="left" colspan="6">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left" colspan="6">'.$langs->trans("Totalforthispage").'</td>';
|
||||
if ($num < $limit) print '<td align="left" colspan="7">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left" colspan="7">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print price($total_debit);
|
||||
|
||||
@ -196,7 +196,7 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
||||
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
|
||||
print_liste_field_titre("LabelAccount", "liste.php", "bk_label_compte" );
|
||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
||||
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
||||
|
||||
@ -205,7 +205,7 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
||||
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
|
||||
print_liste_field_titre("LabelAccount", "liste.php", "bk_label_compte" );
|
||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
||||
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -310,6 +310,7 @@ if ($resql) {
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
@ -317,7 +318,7 @@ if ($resql) {
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -422,7 +422,6 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = $val["label"];
|
||||
$bookkeeping->label_compte = $langs->trans("Bank");
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||
@ -433,21 +432,28 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_user_author = $user->id;
|
||||
$bookkeeping->date_create = $now;
|
||||
|
||||
// No subledger_account value for the bank line
|
||||
// No subledger_account value for the bank line but add a specific label_operation
|
||||
if ($tabtype[$key] == 'payment') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||
} else if ($tabtype[$key] == 'payment_salary') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||
} else if ($tabtype[$key] == 'payment_vat') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
} else if ($tabtype[$key] == 'payment_donation') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
} else if ($tabtype[$key] == 'payment_various') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
} else if ($tabtype[$key] == 'unknown') {
|
||||
// ???
|
||||
$bookkeeping->subledger_account = '';
|
||||
@ -484,7 +490,6 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->doc_type = 'bank';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||
$bookkeeping->label_operation = $tabcompany[$key]['name'];
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
|
||||
@ -495,55 +500,55 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->date_create = $now;
|
||||
|
||||
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
||||
$bookkeeping->label_operation = '';
|
||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||
$bookkeeping->label_operation = '';
|
||||
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_expensereport') {
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_salary') {
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||
$bookkeeping->label_operation = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $objmid->labelc;
|
||||
} else if ($tabtype[$key] == 'payment_vat') {
|
||||
$bookkeeping->label_operation = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_donation') {
|
||||
$bookkeeping->label_operation = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'payment_various') {
|
||||
$bookkeeping->label_operation = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = '';
|
||||
} else if ($tabtype[$key] == 'banktransfert') {
|
||||
$bookkeeping->label_operation = '';
|
||||
$bookkeeping->label_operation = $ref;
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
@ -676,9 +681,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans('Bank') . " - " . utf8_decode($reflabel) . '"' . $sep;
|
||||
print '"' . $val['bank_account_ref'] . " - " . utf8_decode($reflabel) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
@ -720,9 +725,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($reflabel) . '"' . $sep;
|
||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($reflabel) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
@ -823,7 +828,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("Label") . "</td>";
|
||||
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||
print "<td>" . $langs->trans("PaymentMode") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -298,7 +298,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %';
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -552,7 +552,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("Label") . "</td>";
|
||||
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
print "</tr>\n";
|
||||
@ -659,7 +659,7 @@ if (empty($action) || $action == 'view') {
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||
print "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
|
||||
@ -151,7 +151,7 @@ if ($result) {
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
{
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||
}
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
@ -224,7 +224,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->doc_ref = $val["refsologest"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
@ -272,7 +272,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->doc_ref = $val["refsologest"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
@ -326,7 +326,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->doc_ref = $val["refsologest"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
@ -335,7 +335,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -374,8 +374,8 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
if ($error >= 10)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||
break; // Break in the foreach
|
||||
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||
break; // Break in the foreach
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -419,7 +419,6 @@ $form = new Form($db);
|
||||
// Export
|
||||
if ($action == 'exportcsv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
@ -445,7 +444,7 @@ if ($action == 'exportcsv') {
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
@ -465,11 +464,11 @@ if ($action == 'exportcsv') {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '""' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
@ -478,6 +477,7 @@ if ($action == 'exportcsv') {
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// VAT
|
||||
$listoftax = array(0, 1, 2);
|
||||
foreach ($listoftax as $numtax) {
|
||||
@ -489,13 +489,13 @@ if ($action == 'exportcsv') {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . $val["refsologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '""' . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal . '"' ;
|
||||
@ -531,15 +531,15 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
}
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
}
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
@ -565,7 +565,7 @@ if (empty($action) || $action == 'view') {
|
||||
print '<br>';
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<div class="div-table-responsive">';
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print "<td></td>";
|
||||
@ -573,7 +573,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("Label") . "</td>";
|
||||
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
print "</tr>\n";
|
||||
@ -625,8 +625,9 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
@ -683,7 +684,7 @@ if (empty($action) || $action == 'view') {
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||
print "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
|
||||
@ -156,7 +156,7 @@ if ($result) {
|
||||
$compta_localtax2 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||
|
||||
// Define array to display all VAT rates that use this accounting account $compta_tva
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code))
|
||||
{
|
||||
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':''));
|
||||
}
|
||||
@ -353,7 +353,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'');
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||
@ -392,8 +392,8 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
if ($error >= 10)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||
break; // Break in the foreach
|
||||
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
|
||||
break; // Break in the foreach
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,7 +441,6 @@ $form = new Form($db);
|
||||
if ($action == 'exportcsv') {
|
||||
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
@ -472,7 +471,7 @@ if ($action == 'exportcsv') {
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"';
|
||||
print '"' . $journal . '"';
|
||||
print "\n";
|
||||
}
|
||||
|
||||
@ -487,12 +486,12 @@ if ($action == 'exportcsv') {
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '""' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"';
|
||||
print '"' . $journal . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
@ -512,12 +511,12 @@ if ($action == 'exportcsv') {
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||
print '""' . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . ' %"' . $sep;
|
||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . join(', ',$def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"';
|
||||
print '"' . $journal . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
@ -593,7 +592,7 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||
print "<td>" . $langs->trans("Label") . "</td>";
|
||||
print "<td>" . $langs->trans("LabelOperation") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
print "</tr>\n";
|
||||
@ -699,7 +698,7 @@ if (empty($action) || $action == 'view') {
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
print '</td>';
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).($numtax?' - Localtax '.$numtax:'');
|
||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
|
||||
print "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
|
||||
@ -1562,7 +1562,7 @@ class Adherent extends CommonObject
|
||||
*
|
||||
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
|
||||
* @param int $maxlen length max label
|
||||
* @param string $option Page for link
|
||||
* @param string $option Page for link ('card', 'category', 'subscription', ...)
|
||||
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
|
||||
* @param string $morecss Add more css on link
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
@ -1592,10 +1592,7 @@ class Adherent extends CommonObject
|
||||
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
|
||||
$label.='</div>';
|
||||
|
||||
if (empty($option) || $option == 'card' || $option == 'category')
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
|
||||
}
|
||||
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
|
||||
if ($option == 'subscription')
|
||||
{
|
||||
$url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id;
|
||||
|
||||
@ -59,7 +59,7 @@ class AdherentType extends CommonObject
|
||||
public $note;
|
||||
/** @var bool Can vote*/
|
||||
public $vote;
|
||||
/** @var bool Email sent during validation */
|
||||
/** @var string Email sent during validation */
|
||||
public $mail_valid;
|
||||
/** @var array Array of members */
|
||||
public $members=array();
|
||||
@ -481,7 +481,7 @@ class AdherentType extends CommonObject
|
||||
|
||||
// Initialise parametres
|
||||
$this->id = 0;
|
||||
$this->ref = 0;
|
||||
$this->ref = 'MTSPEC';
|
||||
$this->specimen=1;
|
||||
|
||||
$this->label='MEMBERS TYPE SPECIMEN';
|
||||
|
||||
@ -1749,7 +1749,7 @@ $db->close();
|
||||
* @param Object $obj If we show a particular record, obj is filled with record fields
|
||||
* @param string $tabname Name of SQL table
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
* @return string '' or value of entity into table
|
||||
*/
|
||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
{
|
||||
@ -1763,7 +1763,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
$formcompany = new FormCompany($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||
|
||||
$withentity=null;
|
||||
$withentity='';
|
||||
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
|
||||
@ -49,66 +49,85 @@ class Documents extends DolibarrApi
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return list of documents.
|
||||
* Returns a document. Note that, this API is similar to using the wrapper link "documents.php" to download
|
||||
* a file (used for internal HTML links of documents into application), but with no need to be into a logged session (no need to post the session cookie).
|
||||
*
|
||||
* @param string $module_part Name of module or area concerned by file download ('facture', ...)
|
||||
* @param string $ref Reference of object (This will define subdir automatically)
|
||||
* @param string $subdir NOT YET AVAILABLE : Subdirectory (Only if ref not provided)
|
||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
|
||||
* @param int $regeneratedoc If requested document is the main document of an object, setting this to 1 ask API to regenerate document before returning it (supported for some module_part only). It is no effect in other cases.
|
||||
* Also, note that setting this to 1 nead write access on object.
|
||||
* @return array List of documents
|
||||
*
|
||||
* @throws 500
|
||||
* @throws 501
|
||||
* @throws 400
|
||||
* @throws 401
|
||||
* @throws 200 OK
|
||||
* @throws 200
|
||||
*/
|
||||
public function index($module_part, $ref='', $subdir='') {
|
||||
global $conf;
|
||||
public function index($module_part, $original_file='', $regeneratedoc=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($module_part)) {
|
||||
throw new RestException(400, 'bad value for parameter modulepart');
|
||||
}
|
||||
if (empty($ref) && empty($subdir)) {
|
||||
if (empty($module_part)) {
|
||||
throw new RestException(400, 'bad value for parameter modulepart');
|
||||
}
|
||||
if (empty($original_file)) {
|
||||
throw new RestException(400, 'bad value for parameter ref or subdir');
|
||||
}
|
||||
if (empty($ref)) {
|
||||
throw new RestException(404, 'FeatureNotYetAvailable');
|
||||
}
|
||||
if (!DolibarrApiAccess::$user->rights->ecm->read) {
|
||||
throw new RestException(401);
|
||||
|
||||
//--- Finds and returns the document
|
||||
$entity=$conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', ($regeneratedoc ? 'write' : 'read'));
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file'];
|
||||
|
||||
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
|
||||
{
|
||||
throw new RestException(401);
|
||||
}
|
||||
if (!$accessallowed) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
// --- Generates the document
|
||||
if ($regeneratedoc)
|
||||
{
|
||||
$hidedetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 0 : 1;
|
||||
$hidedesc = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 0 : 1;
|
||||
$hideref = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 0 : 1;
|
||||
|
||||
if ($module_part == 'facture' || $module_part == 'invoice')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$this->invoice = new Facture($this->db);
|
||||
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
$result = $this->invoice->generateDocument($this->invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if( $result <= 0 ) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$original_file = str_replace("../","/", $ref.'/'.$ref.'.pdf');
|
||||
$refname=basename(dirname($original_file)."/");
|
||||
$entity=$conf->entity;
|
||||
$filename = basename($original_file);
|
||||
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
$check_access = dol_check_secure_access_document($module_part,$original_file,$entity,DolibarrApiAccess::$user);
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file'];
|
||||
if (! file_exists($original_file_osencoded))
|
||||
{
|
||||
throw new RestException(404, 'File not found');
|
||||
}
|
||||
|
||||
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
|
||||
{
|
||||
throw new RestException(401);
|
||||
}
|
||||
if (!$accessallowed) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
|
||||
$filename = basename($original_file);
|
||||
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
if (! file_exists($original_file_osencoded))
|
||||
{
|
||||
throw new RestException(404, 'File not found');
|
||||
}
|
||||
|
||||
$file_content=file_get_contents($original_file_osencoded);
|
||||
$file_content=file_get_contents($original_file_osencoded);
|
||||
return array('filename'=>$filename, 'content'=>base64_encode($file_content), 'encoding'=>'MIME base64 (base64_encode php function, http://php.net/manual/en/function.base64-encode.php)' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return a document.
|
||||
*
|
||||
@ -121,10 +140,10 @@ class Documents extends DolibarrApi
|
||||
public function get($id) {
|
||||
return array('note'=>'xxx');
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Push a file.
|
||||
* Push a file.
|
||||
* Test sample 1: { "filename": "mynewfile.txt", "modulepart": "facture", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||
* Test sample 2: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "mysubdir1/mysubdir2", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||
*
|
||||
@ -141,12 +160,12 @@ class Documents extends DolibarrApi
|
||||
public function post($filename, $modulepart, $ref='', $subdir='', $filecontent='', $fileencoding='', $overwriteifexists=0)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
|
||||
/*var_dump($modulepart);
|
||||
var_dump($filename);
|
||||
var_dump($filecontent);
|
||||
exit;*/
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->ecm->upload) {
|
||||
@ -170,7 +189,7 @@ class Documents extends DolibarrApi
|
||||
$object=new Facture($db);
|
||||
$result = $object->fetch('', $ref);
|
||||
}
|
||||
|
||||
|
||||
if (! ($object->id > 0))
|
||||
{
|
||||
throw new RestException(500, 'The object '.$modulepart." with ref '".$ref."' was not found.");
|
||||
@ -178,7 +197,7 @@ class Documents extends DolibarrApi
|
||||
|
||||
$tmp = dol_check_secure_access_document($modulepart, $tmpreldir.$object->ref, $entity, DolibarrApiAccess::$user, $ref, 'write');
|
||||
$upload_dir = $tmp['original_file'];
|
||||
|
||||
|
||||
if (empty($upload_dir) || $upload_dir == '/')
|
||||
{
|
||||
throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.');
|
||||
@ -187,7 +206,7 @@ class Documents extends DolibarrApi
|
||||
else
|
||||
{
|
||||
if ($modulepart == 'invoice') $modulepart ='facture';
|
||||
|
||||
|
||||
$tmp = dol_check_secure_access_document($modulepart, $subdir, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
$upload_dir = $tmp['original_file'];
|
||||
|
||||
@ -196,14 +215,14 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$upload_dir = dol_sanitizePathName($upload_dir);
|
||||
|
||||
|
||||
$destfile = $upload_dir . '/' . $original_file;
|
||||
$destfiletmp = DOL_DATA_ROOT.'/admin/temp/' . $original_file;
|
||||
dol_delete_file($destfiletmp);
|
||||
|
||||
|
||||
if (!dol_is_dir($upload_dir)) {
|
||||
throw new RestException(401,'Directory not exists : '.$upload_dir);
|
||||
}
|
||||
@ -212,7 +231,7 @@ class Documents extends DolibarrApi
|
||||
{
|
||||
throw new RestException(500, "File with name '".$original_file."' already exists.");
|
||||
}
|
||||
|
||||
|
||||
$fhandle = @fopen($destfiletmp, 'w');
|
||||
if ($fhandle)
|
||||
{
|
||||
@ -224,9 +243,9 @@ class Documents extends DolibarrApi
|
||||
{
|
||||
throw new RestException(500, "Failed to open file '".$destfiletmp."' for write");
|
||||
}
|
||||
|
||||
|
||||
$result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1);
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -882,7 +882,7 @@ class Categorie extends CommonObject
|
||||
/**
|
||||
* List categories of an element id
|
||||
*
|
||||
* @param int $item Id of element
|
||||
* @param int $id Id of element
|
||||
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
/**
|
||||
* Class to manage comment
|
||||
*/
|
||||
@ -6,7 +6,7 @@ class Comment extends CommonObject
|
||||
{
|
||||
public $element='comment'; //!< Id that identify managed objects
|
||||
public $table_element='comment'; //!< Name of table without prefix where object is stored
|
||||
|
||||
|
||||
var $fk_element;
|
||||
var $element_type;
|
||||
|
||||
@ -34,7 +34,7 @@ class Comment extends CommonObject
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create into database
|
||||
@ -190,7 +190,7 @@ class Comment extends CommonObject
|
||||
$sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").",";
|
||||
$sql.= " datec=".($this->datec!=''?"'".$this->db->idate($this->datec)."'":'null').",";
|
||||
$sql.= " fk_element=".(isset($this->fk_element)?$this->fk_element:"null").",";
|
||||
$sql.= " element_type='".$this->element_type."',";
|
||||
$sql.= " element_type='".$this->db->escape($this->element_type)."',";
|
||||
$sql.= " fk_user_author=".(isset($this->fk_user_author)?$this->fk_user_author:"null").",";
|
||||
$sql.= " entity=".(!empty($this->entity)?$this->entity:'1').",";
|
||||
$sql.= " import_key=".(!empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
|
||||
@ -280,12 +280,14 @@ class Comment extends CommonObject
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load comments linked with current task
|
||||
*
|
||||
* @return array Comment array
|
||||
* @param string $element_type Element type
|
||||
* @param int $fk_element Id of element
|
||||
* @return array Comment array
|
||||
*/
|
||||
public static function fetchAllFor($element_type, $fk_element)
|
||||
{
|
||||
@ -299,7 +301,7 @@ class Comment extends CommonObject
|
||||
$sql.= " AND c.element_type = '".$element_type."'";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY c.tms DESC";
|
||||
|
||||
|
||||
dol_syslog("Comment::fetchAllFor", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -930,7 +930,7 @@ class ExtraFields
|
||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||
$value=price($value);
|
||||
}
|
||||
$out.='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
}
|
||||
elseif ($type == 'double')
|
||||
{
|
||||
|
||||
@ -138,7 +138,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
|
||||
$ldap->searchUser=$ldapuserattr."=".$usertotest.",".$ldapdn; // Default dn (will work if LDAP accept a dn with login value inside)
|
||||
// But if LDAP need a dn with name like "cn=Jhon Bloggs,ou=People,dc=foo,dc=com", previous part must have been executed to have
|
||||
// dn detected into ldapUserDN.
|
||||
if ($resultFetchLdapUser AND !empty($ldap->ldapUserDN)) $ldap->searchUser = $ldap->ldapUserDN;
|
||||
if ($resultFetchLdapUser && !empty($ldap->ldapUserDN)) $ldap->searchUser = $ldap->ldapUserDN;
|
||||
$ldap->searchPassword=$passwordtotest;
|
||||
|
||||
// Test with this->seachUser and this->searchPassword
|
||||
|
||||
@ -328,14 +328,14 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
public $langfiles;
|
||||
|
||||
/**
|
||||
* @var string[] Array of warnings to show when we activate the module
|
||||
* @var array<string,string> Array of warnings to show when we activate the module
|
||||
*
|
||||
* array('always'='text') or array('FR'='text')
|
||||
*/
|
||||
public $warnings_activation;
|
||||
|
||||
/**
|
||||
* @var string[] Array of warnings to show when we activate an external module
|
||||
* @var array<string,string> Array of warnings to show when we activate an external module
|
||||
*
|
||||
* array('always'='text') or array('FR'='text')
|
||||
*/
|
||||
|
||||
@ -136,27 +136,27 @@ class html_cerfafr extends ModeleDon
|
||||
else $paymentmode = '';
|
||||
|
||||
if ($don->modepaiementid==7){
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||
}
|
||||
else if ($don->modepaiementid==4){
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox" checked="checked"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox" checked="checked"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||
}
|
||||
else if ($don->modepaiementid==2 OR $don->modepaiementid==3 OR $don->modepaiementid==6){
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox" checked="checked"> Virement, prélèvement, carte bancaire</td>';
|
||||
else if ($don->modepaiementid==2 || $don->modepaiementid==3 || $don->modepaiementid==6){
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox" checked="checked"> Virement, prélèvement, carte bancaire</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
|
||||
}
|
||||
|
||||
/*
|
||||
if (empty($don->societe))
|
||||
{
|
||||
$CodeDon = '<td width="33%"><input type="checkbox" disabled="true" checked="checked" > 200 du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 238 bis du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 885-0 V bis A du CGI</td>';
|
||||
$CodeDon = '<td width="33%"><input type="checkbox" disabled="true" checked="checked" > 200 du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 238 bis du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 885-0 V bis A du CGI</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$CodeDon = '<td width="33%"><input type="checkbox" disabled="true" > 200 du CGI</td><td width="33%"><input type="checkbox" disabled="true" checked="checked" > 238 bis du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 885-0 V bis A du CGI</td>';
|
||||
$CodeDon = '<td width="33%"><input type="checkbox" disabled="true" > 200 du CGI</td><td width="33%"><input type="checkbox" disabled="true" checked="checked" > 238 bis du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 885-0 V bis A du CGI</td>';
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -98,7 +99,10 @@ class modGeneratePassPerso extends ModeleGenPassword
|
||||
$this->Spe = str_replace($this->Ambi,"",$this->Spe);
|
||||
}
|
||||
|
||||
$this->All = str_shuffle($this->Maj. $this->Min. $this->Nb. $this->Spe);
|
||||
$pattern = $this->Min . (! empty($this->NbMaj)?$this->Maj:'') . (! empty($this->NbNum)?$this->Nb:'') . (! empty($this->NbSpe)?$this->Spe:'');
|
||||
$this->All = str_shuffle($pattern);
|
||||
|
||||
//$this->All = str_shuffle($this->Maj. $this->Min. $this->Nb. $this->Spe);
|
||||
//$this->All = $this->Maj. $this->Min. $this->Nb. $this->Spe;
|
||||
//$this->All = $this->Spe;
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
* \remarks Call of this wrapper is made with URL:
|
||||
* document.php?modulepart=repfichierconcerne&file=relativepathoffile
|
||||
* document.php?modulepart=logs&file=dolibarr.log
|
||||
* document.php?modulepart=logs&hashp=sharekey
|
||||
*/
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
|
||||
@ -82,10 +82,9 @@ class EcmFiles //extends CommonObject
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
@ -144,8 +143,8 @@ class EcmFiles //extends CommonObject
|
||||
if (empty($this->date_c)) $this->date_c = dol_now();
|
||||
|
||||
// If ref not defined
|
||||
if (empty($ref)) $ref = dol_hash($this->filepath.'/'.$this->filename, 3);
|
||||
|
||||
$ref = dol_hash($this->filepath.'/'.$this->filename, 3);
|
||||
if (! empty($this->ref)) $ref=$this->ref;
|
||||
|
||||
$maxposition=0;
|
||||
if (empty($this->position)) // Get max used
|
||||
|
||||
@ -1487,14 +1487,14 @@ class Expedition extends CommonObject
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
* @param int $withpicto Add picto into link
|
||||
* @param int $option Where point the link
|
||||
* @param string $option Where the link point to
|
||||
* @param int $max Max length to show
|
||||
* @param int $short Use short labels
|
||||
* @param int $notooltip 1=No tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0, $option=0, $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
|
||||
function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
@ -663,7 +663,7 @@ class Fichinter extends CommonObject
|
||||
*/
|
||||
function getNomUrl($withpicto=0, $option='', $notooltip=0, $save_lastsearch_value=-1)
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$result='';
|
||||
|
||||
@ -674,13 +674,13 @@ class Fichinter extends CommonObject
|
||||
$picto='intervention';
|
||||
$url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id;
|
||||
|
||||
//if ($option !== 'nolink')
|
||||
//{
|
||||
// Add param to save lastsearch_values or not
|
||||
if ($option !== 'nolink')
|
||||
{
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
||||
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||
//}
|
||||
}
|
||||
|
||||
$linkclose='';
|
||||
if (empty($notooltip))
|
||||
|
||||
@ -781,12 +781,13 @@ class Holiday extends CommonObject
|
||||
$num_rows = $this->db->num_rows($resql); // Note, we can have 2 records if on is morning and the other one is afternoon
|
||||
if ($num_rows > 0)
|
||||
{
|
||||
$arrayofrecord=array();
|
||||
$i=0;
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// Note: $obj->halday is 0:Full days, 2:Sart afternoon end morning, -1:Start afternoon, 1:End morning
|
||||
// Note: $obj->halfday is 0:Full days, 2:Sart afternoon end morning, -1:Start afternoon, 1:End morning
|
||||
$arrayofrecord[$obj->rowid]=array('date_start'=>$this->db->jdate($obj->date_start), 'date_end'=>$this->db->jdate($obj->date_end), 'halfday'=>$obj->halfday);
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ CREATE TABLE llx_expensereport_rules (
|
||||
code_expense_rules_type varchar(50) NOT NULL,
|
||||
is_for_all tinyint DEFAULT '0',
|
||||
entity integer DEFAULT 1
|
||||
);
|
||||
)ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_expensereport_det ADD COLUMN rule_warning_message text;
|
||||
ALTER TABLE llx_expensereport_det ADD COLUMN fk_c_exp_tax_cat integer;
|
||||
@ -302,8 +302,9 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10);
|
||||
|
||||
DROP TABLE `llx_projet_task_comment`;
|
||||
CREATE TABLE IF NOT EXISTS llx_comment (
|
||||
DROP TABLE llx_projet_task_comment;
|
||||
|
||||
CREATE TABLE llx_comment (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
datec datetime DEFAULT NULL,
|
||||
tms timestamp,
|
||||
|
||||
@ -148,7 +148,8 @@ Doctype=Type of document
|
||||
Docdate=Date
|
||||
Docref=Reference
|
||||
Code_tiers=Thirdparty
|
||||
Labelcompte=Label account
|
||||
LabelAccount=Label account
|
||||
LabelOperation=Label operation
|
||||
Sens=Sens
|
||||
Codejournal=Journal
|
||||
NumPiece=Piece number
|
||||
|
||||
@ -12,7 +12,7 @@ ObjectKey=Object key
|
||||
ModuleInitialized=Module initialized
|
||||
FilesForObjectInitialized=Files for new object '%s' initialized
|
||||
FilesForObjectUpdated=Files for object '%s' updated (.sql files and .class.php file)
|
||||
ModuleBuilderDescdescription=Enter here all general information that describe your module
|
||||
ModuleBuilderDescdescription=Enter here all general information that describe your module.
|
||||
ModuleBuilderDescspecifications=You can enter here a long text to describe the specifications of your module that is not already structured into other tabs. So you have within easy reach all the rules to develop. Also this text content will be included into the generated documentation (see last tab). You can use Markdown format, but it is recommanded to use Asciidoc format (Comparison between .md and .asciidoc: http://asciidoctor.org/docs/user-manual/#compared-to-markdown)
|
||||
ModuleBuilderDescobjects=Define here the objects you want to manage with your module. A CRUD DAO class, SQL files, page to list record of objects, to create/edit/view a record and an API will be generated.
|
||||
ModuleBuilderDescmenus=This tab is dedicated to define menu entries provided by your module.
|
||||
@ -77,7 +77,7 @@ SpecDefDesc=Enter here all documentation you want to provide with your module th
|
||||
LanguageDefDesc=Enter in this files, all the key and the translation for each language file.
|
||||
MenusDefDesc=Define here the menus provided by your module (once defined, they are visible into the menu editor %s)
|
||||
PermissionsDefDesc=Define here the new permissions provided by your module (once defined, they are visible into the default permissions setup %s)
|
||||
HooksDefDesc=Define in the <b>module_parts['hooks']</b> property in the module descriptor the context of hooks you want to manage (list of contexts can be found by a search on '<b>initHooks(</b>' in core code).<br>Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on '<b>executeHooks</b>' in core code).
|
||||
TriggerDefDesc=Define in the trigger file the code you want to execute for each business event executed
|
||||
HooksDefDesc=Define in the <b>module_parts['hooks']</b> property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on '<b>initHooks(</b>' in core code).<br>Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on '<b>executeHooks</b>' in core code).
|
||||
TriggerDefDesc=Define in the trigger file the code you want to execute for each business event executed.
|
||||
SeeIDsInUse=See IDs in use in your installation
|
||||
SeeReservedIDsRangeHere=See range of reserved IDs
|
||||
@ -28,6 +28,7 @@ if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1');
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/modulebuilder.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
@ -764,6 +765,7 @@ if ($action == 'reset' && $user->admin)
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
// Set dir where external modules are installed
|
||||
if (! dol_is_dir($dirins))
|
||||
@ -1252,6 +1254,20 @@ elseif (! empty($module))
|
||||
print $langs->trans("LanguageDefDesc").'<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addlanguage">';
|
||||
print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">';
|
||||
print '<input type="hidden" name="tab" value="'.$tab.'">';
|
||||
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 1);
|
||||
print '<input type="submit" name="addlanguage" class="button" value="'.dol_escape_htmltag($langs->trans("AddLanguageFile")).'"><br>';
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
$langfiles=dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$');
|
||||
|
||||
foreach ($langfiles as $langfile)
|
||||
|
||||
@ -2109,8 +2109,8 @@ class User extends CommonObject
|
||||
if (! empty($_SESSION["disablemodules"])) $label.= '<br><b>'.$langs->trans("DisabledModules").':</b> <br>'.join(', ',explode(',',$_SESSION["disablemodules"]));
|
||||
}
|
||||
|
||||
if ($option == 'leave') $url.= DOL_URL_ROOT.'/holiday/list.php?id='.$this->id;
|
||||
else $link.= $url.= DOL_URL_ROOT.'/user/card.php?id='.$this->id;
|
||||
$url = DOL_URL_ROOT.'/user/card.php?id='.$this->id;
|
||||
if ($option == 'leave') $url = DOL_URL_ROOT.'/holiday/list.php?id='.$this->id;
|
||||
|
||||
if ($option != 'nolink')
|
||||
{
|
||||
|
||||
@ -1861,7 +1861,6 @@ function dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent)
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filehtmlheader, null, 'errors');
|
||||
return false;
|
||||
}
|
||||
@ -1887,14 +1886,13 @@ function dolSaveCssFile($filecss, $csscontent)
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filecss, null, 'errors');
|
||||
return false;
|
||||
}
|
||||
if (! $result)
|
||||
{
|
||||
setEventMessages('Failed to write file '.$filecss, null, 'errors');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1917,7 +1915,6 @@ function dolSaveRobotFile($filerobot, $robotcontent)
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filerobot, null, 'errors');
|
||||
return false;
|
||||
}
|
||||
@ -1945,7 +1942,6 @@ function dolSaveHtaccessFile($filehtaccess, $htaccess)
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filehtaccess, null, 'errors');
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ $required_fields = array(
|
||||
);
|
||||
|
||||
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
|
||||
$required_fields=array_unique(array_values(array_filter($required_fields, "dolValidElement")));
|
||||
$required_fields=array_unique(array_values(array_filter($required_fields, "dolValidElementType")));
|
||||
|
||||
|
||||
if (! isset($argv[1])) {
|
||||
@ -214,7 +214,7 @@ exit($error);
|
||||
* @param string $element Value to test
|
||||
* @return boolean True of false
|
||||
*/
|
||||
function dolValidElement($element)
|
||||
function dolValidElementType($element)
|
||||
{
|
||||
return (trim($element) != '');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user