Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
Browse files Browse the repository at this point in the history
develop_dict
  • Loading branch information
hregis committed Jul 16, 2017
2 parents cb6b81d + 75ec7a3 commit 200f232
Show file tree
Hide file tree
Showing 258 changed files with 7,051 additions and 3,406 deletions.
1 change: 1 addition & 0 deletions COPYRIGHT
Expand Up @@ -53,6 +53,7 @@ jQuery Tiptip 1.3 GPL and MIT License Yes
jsGanttImproved 1.7.5.2 BSD License Yes JS library (to build Gantt reports)
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
CodePress 0.9.6 LGPL Yes JS library to get code syntaxique coloration in a textarea.

For licenses compatibility informations:
http://www.gnu.org/licenses/licenses.en.html
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/admin/account.php
Expand Up @@ -97,7 +97,7 @@

include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';

if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
{
$search_account = "";
$search_label = "";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/admin/productaccount.php
Expand Up @@ -98,7 +98,7 @@
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
{
$search_ref = '';
$search_label = '';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/bookkeeping/balance.php
Expand Up @@ -98,7 +98,7 @@
* Action
*/

if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
Expand Down
55 changes: 39 additions & 16 deletions htdocs/accountancy/bookkeeping/card.php
Expand Up @@ -72,15 +72,24 @@
$error = 0;

if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$error ++;
$error++;
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$action='update';
}
if (empty($account_number) || $account_number == '-1')
{
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
$action='update';
}

if (empty($error)) {
if (! $error)
{
$book = new BookKeeping($db);

$result = $book->fetch($id, null, $mode);
if ($result < 0) {
$error++;
setEventMessages($book->error, $book->errors, 'errors');
} else {
$book->numero_compte = $account_number;
Expand Down Expand Up @@ -120,12 +129,20 @@
else if ($action == "add") {
$error = 0;

if (empty($debit) && empty($credit)) {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$error ++;
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0))
{
$error++;
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$action='';
}
if (empty($account_number) || $account_number == '-1')
{
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
$action='';
}

if (empty($error)) {
if (! $error) {
$book = new BookKeeping($db);

$book->numero_compte = $account_number;
Expand Down Expand Up @@ -567,7 +584,7 @@

if ($action == 'update' && $line->id == $id) {
print '<td>';
print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, '');
print $formaccounting->select_account($line->numero_compte, 'account_number', 1, array (), 1, 1, '');
print '</td>';
print '<td>';
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
Expand All @@ -583,8 +600,8 @@
print '</td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
print '<td align="right"><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
print '<td align="right"><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . price($line->debit) . '"/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . price($line->credit) . '"/></td>';
print '<td>';
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
Expand Down Expand Up @@ -622,7 +639,7 @@
if ($action == "" || $action == 'add') {
print '<tr class="oddeven">';
print '<td>';
print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
print $formaccounting->select_account($account_number, 'account_number', 1, array (), 1, 1, '');
print '</td>';
print '<td>';
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
Expand All @@ -638,24 +655,30 @@
print '</td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></td>';
print '<td align="right"><input type="text" size="6" name="debit" value="' . ($debit ? price($debit) : '') . '"/></td>';
print '<td align="right"><input type="text" size="6" name="credit" value="' . ($credit ? price($credit) : '') . '"/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="debit" value="' . ($debit ? price($debit) : '') . '"/></td>';
print '<td align="right"><input type="text" size="6" class="right" name="credit" value="' . ($credit ? price($credit) : '') . '"/></td>';
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
print '</tr>';
}
print '</table>';


if ($mode=='_tmp' && $action=='')
{
print '<div class="tabsAction">';
print '<br>';
print '<div class="center">';
if ($total_debit == $total_credit)
{
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
print '<a class="button" href="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '&action=valid">'.$langs->trans("ValidTransaction").'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $credit, $debit)).'">'.$langs->trans("ValidTransaction").'</a>';
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $credit, $debit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
}

print ' &nbsp; ';
print '<a class="button" href="' . DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">'.$langs->trans("Cancel").'</a>';

print "</div>";
}
print '</form>';
Expand Down
30 changes: 17 additions & 13 deletions htdocs/accountancy/bookkeeping/list.php
@@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
Expand All @@ -16,7 +16,6 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
Expand Down Expand Up @@ -112,7 +111,7 @@
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }

if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_mvt_num = '';
$search_doc_type = '';
Expand Down Expand Up @@ -377,28 +376,28 @@
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ': ';
print $langs->trans('From') . ' ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ': ';
print $langs->trans('to') . ' ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</div>';
print '</td>';
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
print '<td class="liste_titre">';
print '<div class="nowrap">';
print $langs->trans('From');
print $langs->trans('From').' ';
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to');
print $langs->trans('to').' ';
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
print '</div>';
print '</td>';
print '<td class="liste_titre">';
print '<div class="nowrap">';
print $langs->trans('From');
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
// use setup of keypress to select thirdparty and this hang browser on large database.
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
Expand All @@ -411,7 +410,7 @@
}
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to');
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
// use setup of keypress to select thirdparty and this hang browser on large database.
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
Expand Down Expand Up @@ -455,7 +454,10 @@
$total_debit = 0;
$total_credit = 0;

foreach ($object->lines as $line ) {
$i=0;
while ($i < min($num, $limit))
{
$line = $object->lines[$i];

$total_debit += $line->debit;
$total_credit += $line->credit;
Expand All @@ -481,6 +483,8 @@
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
print '</td>';
print "</tr>\n";

$i++;
}

print '<tr class="liste_total">';
Expand Down
27 changes: 16 additions & 11 deletions htdocs/accountancy/bookkeeping/listbyaccount.php
Expand Up @@ -92,7 +92,7 @@
}


if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
if (! GETPOST('button_removefilter_x','alpha') && ! GETPOST('button_removefilter.x','alpha') && ! GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
if (! empty($search_accountancy_code_start)) {
$filter['t.numero_compte'] = $search_accountancy_code_start;
Expand Down Expand Up @@ -121,7 +121,7 @@
* Action
*/

if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_doc_date = '';
$search_accountancy_code = '';
Expand Down Expand Up @@ -160,7 +160,6 @@
llxHeader('', $title_page);

// List

$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
Expand All @@ -173,7 +172,9 @@
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
$nbtotalofrecords = $result;

$num=count($object->lines);


if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
Expand Down Expand Up @@ -204,7 +205,7 @@



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

$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';

Expand Down Expand Up @@ -236,7 +237,7 @@
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_account" value="' . $search_label_account . '"/></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
print '<td class="liste_titre" align="right" colspan="2">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
Expand All @@ -250,7 +251,7 @@
print_liste_field_titre($langs->trans("Label"));
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";

Expand All @@ -263,7 +264,10 @@
$sous_total_credit = 0;
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty

foreach ( $object->lines as $line ) {
$i=0;
while ($i < min($num, $limit))
{
$line = $object->lines[$i];

$total_debit += $line->debit;
$total_credit += $line->credit;
Expand Down Expand Up @@ -323,10 +327,11 @@
print '</td>';
print "</tr>\n";

// Comptabilise le sous-total
$sous_total_debit += $line->debit;
$sous_total_credit += $line->credit;
// Comptabilise le sous-total
$sous_total_debit += $line->debit;
$sous_total_credit += $line->credit;

$i++;
}

// Affiche un Sous-Total du dernier compte comptable affiché
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/bookkeeping/listbyyear.php
Expand Up @@ -86,7 +86,7 @@
* Actions
*/

if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_doc_type = "";
$search_doc_date = "";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/accountancy/bookkeeping/thirdparty_lettrage.php
Expand Up @@ -22,7 +22,7 @@

/**
* \file accounting/bookkeeping/thirdparty_lettrage.php
* \ingroup Accounting Expert
* \ingroup Advanced accountancy
* \brief Onglet de gestion de parametrages des ventilations
*/

Expand Down
Expand Up @@ -22,8 +22,8 @@

/**
* \file accounting/bookkeeping/thirdparty_lettrage.php
* \ingroup Accounting Expert
* \brief Onglet de gestion de parametrages des ventilations
* \ingroup Advanced accountancy
* \brief Tab to setup lettering
*/

// Dolibarr environment
Expand Down
4 changes: 2 additions & 2 deletions htdocs/accountancy/class/bookkeeping.class.php
Expand Up @@ -176,7 +176,7 @@ public function create(User $user, $notrigger = false) {
if (empty($this->credit)) $this->credit = 0;

// Check parameters
if (empty($this->numero_compte) || $this->numero_compte == '-1')
if (empty($this->numero_compte) || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined')
{
$langs->load("errors");
if (in_array($this->doc_type, array('bank', 'expense_report')))
Expand Down Expand Up @@ -803,7 +803,7 @@ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset =
if (! empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
}
$this->lines = array ();
$this->lines = array();

$resql = $this->db->query($sql);
if ($resql) {
Expand Down
4 changes: 2 additions & 2 deletions htdocs/accountancy/class/lettering.class.php
Expand Up @@ -19,8 +19,8 @@

/**
* \file accountancy/class/bookkeeping.class.php
* \ingroup Accounting Expert
* \brief Fichier de la classe des comptes comptable
* \ingroup Advanced accountancy
* \brief File of class for lettering
*/

include_once DOL_DOCUMENT_ROOT."/accountancy/class/bookkeeping.class.php";
Expand Down

0 comments on commit 200f232

Please sign in to comment.