Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
develop_dict
This commit is contained in:
commit
200f232164
@ -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)
|
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
|
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
|
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:
|
For licenses compatibility informations:
|
||||||
http://www.gnu.org/licenses/licenses.en.html
|
http://www.gnu.org/licenses/licenses.en.html
|
||||||
|
|||||||
@ -97,7 +97,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
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_account = "";
|
||||||
$search_label = "";
|
$search_label = "";
|
||||||
|
|||||||
@ -98,7 +98,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
|
|||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
// Purge search criteria
|
// 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_ref = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
|
|||||||
@ -98,7 +98,7 @@ if (! empty($search_accountancy_code_end)) {
|
|||||||
* Action
|
* 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_start = '';
|
||||||
$search_accountancy_code_end = '';
|
$search_accountancy_code_end = '';
|
||||||
|
|||||||
@ -72,15 +72,24 @@ if ($action == "confirm_update") {
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.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);
|
$book = new BookKeeping($db);
|
||||||
|
|
||||||
$result = $book->fetch($id, null, $mode);
|
$result = $book->fetch($id, null, $mode);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
setEventMessages($book->error, $book->errors, 'errors');
|
setEventMessages($book->error, $book->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
$book->numero_compte = $account_number;
|
$book->numero_compte = $account_number;
|
||||||
@ -120,12 +129,20 @@ if ($action == "confirm_update") {
|
|||||||
else if ($action == "add") {
|
else if ($action == "add") {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (empty($debit) && empty($credit)) {
|
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0))
|
||||||
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
|
{
|
||||||
$error++;
|
$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 = new BookKeeping($db);
|
||||||
|
|
||||||
$book->numero_compte = $account_number;
|
$book->numero_compte = $account_number;
|
||||||
@ -567,7 +584,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
if ($action == 'update' && $line->id == $id) {
|
if ($action == 'update' && $line->id == $id) {
|
||||||
print '<td>';
|
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>';
|
||||||
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
|
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
@ -583,8 +600,8 @@ if ($action == 'create') {
|
|||||||
print '</td>';
|
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_compte" value="' . $line->label_compte . '"/></td>';
|
||||||
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></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" class="right" 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="credit" value="' . price($line->credit) . '"/></td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
|
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
|
||||||
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
|
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
|
||||||
@ -622,7 +639,7 @@ if ($action == 'create') {
|
|||||||
if ($action == "" || $action == 'add') {
|
if ($action == "" || $action == 'add') {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>';
|
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>';
|
||||||
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
|
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||||
@ -638,24 +655,30 @@ if ($action == 'create') {
|
|||||||
print '</td>';
|
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_compte" value="' . $line->label_compte . '"/></td>';
|
||||||
print '<td><input type="text" size="15" name="label_operation" value="' . $line->label_operation. '"/></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" class="right" 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="credit" value="' . ($credit ? price($credit) : '') . '"/></td>';
|
||||||
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
if ($mode=='_tmp' && $action=='')
|
if ($mode=='_tmp' && $action=='')
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<br>';
|
||||||
|
print '<div class="center">';
|
||||||
if ($total_debit == $total_credit)
|
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
|
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 ' ';
|
||||||
|
print '<a class="button" href="' . DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">'.$langs->trans("Cancel").'</a>';
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
}
|
}
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,7 +16,6 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,7 +111,7 @@ if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin
|
|||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $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_mvt_num = '';
|
||||||
$search_doc_type = '';
|
$search_doc_type = '';
|
||||||
@ -377,28 +376,28 @@ print '<tr class="liste_titre_filter">';
|
|||||||
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"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
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 $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
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 $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
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"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<div class="nowrap">';
|
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 $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
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 $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<div class="nowrap">';
|
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
|
// 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.
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
@ -411,7 +410,7 @@ else
|
|||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
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
|
// 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.
|
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||||
@ -455,7 +454,10 @@ print "</tr>\n";
|
|||||||
$total_debit = 0;
|
$total_debit = 0;
|
||||||
$total_credit = 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_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
@ -481,6 +483,8 @@ foreach ($object->lines as $line ) {
|
|||||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
|
|||||||
@ -92,7 +92,7 @@ if (! empty($search_doc_date)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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)) {
|
if (! empty($search_accountancy_code_start)) {
|
||||||
$filter['t.numero_compte'] = $search_accountancy_code_start;
|
$filter['t.numero_compte'] = $search_accountancy_code_start;
|
||||||
@ -121,7 +121,7 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot
|
|||||||
* Action
|
* 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_doc_date = '';
|
||||||
$search_accountancy_code = '';
|
$search_accountancy_code = '';
|
||||||
@ -160,7 +160,6 @@ $title_page = $langs->trans("Bookkeeping") . ' ' . strtolower($langs->trans("By"
|
|||||||
llxHeader('', $title_page);
|
llxHeader('', $title_page);
|
||||||
|
|
||||||
// List
|
// List
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
|
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter);
|
||||||
@ -173,7 +172,9 @@ $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $f
|
|||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
$nbtotalofrecords = $result;
|
|
||||||
|
$num=count($object->lines);
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'delmouv') {
|
if ($action == 'delmouv') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
|
||||||
@ -204,7 +205,7 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
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>';
|
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
||||||
|
|
||||||
@ -236,7 +237,7 @@ print '<td class="liste_titre"><input type="text" size="7" class="flat" name="se
|
|||||||
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"><input type="text" size="7" class="flat" name="search_label_account" value="' . $search_label_account . '"/></td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </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">';
|
print '<td class="liste_titre" align="right" colspan="2">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
@ -250,7 +251,7 @@ print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_re
|
|||||||
print_liste_field_titre($langs->trans("Label"));
|
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("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("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_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -263,7 +264,10 @@ $sous_total_debit = 0;
|
|||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
|
$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_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
@ -327,6 +331,7 @@ foreach ( $object->lines as $line ) {
|
|||||||
$sous_total_debit += $line->debit;
|
$sous_total_debit += $line->debit;
|
||||||
$sous_total_credit += $line->credit;
|
$sous_total_credit += $line->credit;
|
||||||
|
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche un Sous-Total du dernier compte comptable affiché
|
// Affiche un Sous-Total du dernier compte comptable affiché
|
||||||
|
|||||||
@ -86,7 +86,7 @@ $offset = $limit * $page;
|
|||||||
* Actions
|
* 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_type = "";
|
||||||
$search_doc_date = "";
|
$search_doc_date = "";
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||||
* \ingroup Accounting Expert
|
* \ingroup Advanced accountancy
|
||||||
* \brief Onglet de gestion de parametrages des ventilations
|
* \brief Onglet de gestion de parametrages des ventilations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||||
* \ingroup Accounting Expert
|
* \ingroup Advanced accountancy
|
||||||
* \brief Onglet de gestion de parametrages des ventilations
|
* \brief Tab to setup lettering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Dolibarr environment
|
// Dolibarr environment
|
||||||
|
|||||||
@ -176,7 +176,7 @@ class BookKeeping extends CommonObject
|
|||||||
if (empty($this->credit)) $this->credit = 0;
|
if (empty($this->credit)) $this->credit = 0;
|
||||||
|
|
||||||
// Check parameters
|
// 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");
|
$langs->load("errors");
|
||||||
if (in_array($this->doc_type, array('bank', 'expense_report')))
|
if (in_array($this->doc_type, array('bank', 'expense_report')))
|
||||||
|
|||||||
@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file accountancy/class/bookkeeping.class.php
|
* \file accountancy/class/bookkeeping.class.php
|
||||||
* \ingroup Accounting Expert
|
* \ingroup Advanced accountancy
|
||||||
* \brief Fichier de la classe des comptes comptable
|
* \brief File of class for lettering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT."/accountancy/class/bookkeeping.class.php";
|
include_once DOL_DOCUMENT_ROOT."/accountancy/class/bookkeeping.class.php";
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/customer/card.php
|
* \file htdocs/accountancy/customer/card.php
|
||||||
* \ingroup Accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Card customer ventilation
|
* \brief Card customer ventilation
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|||||||
@ -85,7 +85,7 @@ $formaccounting = new FormAccounting($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
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_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
@ -153,7 +153,7 @@ print '<script type="text/javascript">
|
|||||||
* Customer Invoice lines
|
* Customer Invoice lines
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||||
$sql .= " fd.rowid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
$sql .= " fd.rowid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
|
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
|
||||||
$sql .= " fd.situation_percent, co.label as country, s.tva_intra";
|
$sql .= " fd.situation_percent, co.label as country, s.tva_intra";
|
||||||
@ -270,9 +270,9 @@ if ($result) {
|
|||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
@ -287,9 +287,9 @@ if ($result) {
|
|||||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||||
$clickpicto=$form->showCheckAddButtons();
|
$clickpicto=$form->showCheckAddButtons();
|
||||||
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
|
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
|
||||||
@ -332,14 +332,14 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
print '<td align="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
print '<td>';
|
print '<td align="center">';
|
||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>' . $objp->country .'</td>';
|
print '<td align="center">' . $objp->country .'</td>';
|
||||||
|
|
||||||
print '<td>' . $objp->tva_intra . '</td>';
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
|||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// 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_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
@ -179,7 +179,7 @@ llxHeader('', $langs->trans("Ventilation"));
|
|||||||
|
|
||||||
// Customer Invoice lines
|
// Customer Invoice lines
|
||||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,";
|
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,";
|
||||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line,";
|
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql .= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||||
@ -388,7 +388,7 @@ if ($result) {
|
|||||||
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
||||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||||
print '<td style="' . $code_vat_differ . '" align="right">';
|
print '<td style="' . $code_vat_differ . '" align="right">';
|
||||||
print price($objp->tva_tx_line);
|
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Current account
|
// Current account
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/supplier/card.php
|
* \file htdocs/accountancy/supplier/card.php
|
||||||
* \ingroup Accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Card expense report ventilation
|
* \brief Card expense report ventilation
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|||||||
@ -82,7 +82,7 @@ $formaccounting = new FormAccounting($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || 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')) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_expensereport = '';
|
$search_expensereport = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
@ -146,7 +146,7 @@ print '<script type="text/javascript">
|
|||||||
* Expense reports lines
|
* Expense reports lines
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT er.ref, er.rowid as erid,";
|
$sql = "SELECT er.ref, er.rowid as erid,";
|
||||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.date,";
|
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,";
|
||||||
$sql .= " aa.label, aa.account_number,";
|
$sql .= " aa.label, aa.account_number,";
|
||||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label";
|
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
@ -241,8 +241,8 @@ if ($result) {
|
|||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"></td>';
|
print '<td class="liste_titre" align="right"></td>';
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpicto=$form->showFilterButtons();
|
$searchpicto=$form->showFilterButtons();
|
||||||
@ -258,7 +258,7 @@ if ($result) {
|
|||||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('');
|
print_liste_field_titre('');
|
||||||
$checkpicto=$form->showCheckAddButtons();
|
$checkpicto=$form->showCheckAddButtons();
|
||||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||||
@ -293,7 +293,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
|
|
||||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
|
|
||||||
print '<td>' . $codeCompta . '</td>';
|
print '<td>' . $codeCompta . '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
|||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// 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_expensereport = '';
|
$search_expensereport = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
@ -174,7 +174,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
|||||||
|
|
||||||
// Expense report lines
|
// Expense report lines
|
||||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
||||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.date,";
|
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||||
$sql .= " aa.rowid as aarowid";
|
$sql .= " aa.rowid as aarowid";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||||
@ -284,8 +284,8 @@ if ($result) {
|
|||||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"', $sortfield, $sortorder);
|
||||||
$checkpicto='';
|
$checkpicto='';
|
||||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
||||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||||
@ -333,7 +333,7 @@ if ($result) {
|
|||||||
|
|
||||||
// Vat rate
|
// Vat rate
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($objp->tva_tx_line);
|
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Current account
|
// Current account
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -36,12 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","trips","errors"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("trips");
|
|
||||||
|
|
||||||
$id_journal = GETPOST('id_journal', 'int');
|
$id_journal = GETPOST('id_journal', 'int');
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
@ -53,6 +48,7 @@ $date_endmonth = GETPOST('date_endmonth');
|
|||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||||
|
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -90,7 +86,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$idpays = $mysoc->country_id;
|
$idpays = $mysoc->country_id;
|
||||||
|
|
||||||
$sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
|
$sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
|
||||||
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ttc, erd.tva_tx, erd.total_ht, erd.total_tva, erd.fk_code_ventilation, erd.vat_src_code, ";
|
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ht, erd.total_tva, erd.total_localtax1, erd.total_localtax2, erd.tva_tx, erd.total_ttc, erd.fk_code_ventilation, erd.vat_src_code, ";
|
||||||
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
|
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
|
||||||
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||||
//$sql .= " ct.accountancy_code_buy as account_tva";
|
//$sql .= " ct.accountancy_code_buy as account_tva";
|
||||||
@ -105,26 +101,31 @@ $sql .= " AND erd.fk_code_ventilation > 0";
|
|||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
||||||
if ($in_bookkeeping == 'yes')
|
if ($in_bookkeeping == 'already')
|
||||||
|
$sql .= " AND er.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||||
|
if ($in_bookkeeping == 'notyet')
|
||||||
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
|
||||||
$sql .= " ORDER BY er.date_debut";
|
$sql .= " ORDER BY er.date_debut";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/expensereportsjournal.php:: $sql=' . $sql);
|
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
|
||||||
|
|
||||||
// Variables
|
|
||||||
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef");
|
|
||||||
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
|
||||||
|
|
||||||
$taber = array ();
|
$taber = array ();
|
||||||
$tabht = array ();
|
$tabht = array ();
|
||||||
$tabtva = array ();
|
$tabtva = array ();
|
||||||
$def_tva = array ();
|
$def_tva = array ();
|
||||||
$tabttc = array ();
|
$tabttc = array ();
|
||||||
|
$tablocaltax1 = array ();
|
||||||
|
$tablocaltax2 = array ();
|
||||||
$tabuser = array ();
|
$tabuser = array ();
|
||||||
|
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
$account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT)) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined';
|
||||||
|
$account_vat = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
@ -135,6 +136,8 @@ if ($result) {
|
|||||||
|
|
||||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat);
|
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat);
|
||||||
|
$compta_localtax1 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||||
|
$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
|
// 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))
|
||||||
@ -146,9 +149,19 @@ if ($result) {
|
|||||||
$taber[$obj->rowid]["ref"] = $obj->ref;
|
$taber[$obj->rowid]["ref"] = $obj->ref;
|
||||||
$taber[$obj->rowid]["comments"] = $obj->comments;
|
$taber[$obj->rowid]["comments"] = $obj->comments;
|
||||||
$taber[$obj->rowid]["fk_expensereportdet"] = $obj->erdid;
|
$taber[$obj->rowid]["fk_expensereportdet"] = $obj->erdid;
|
||||||
|
|
||||||
|
// Avoid warnings
|
||||||
|
if (! isset($tabttc[$obj->rowid][$compta_user])) $tabttc[$obj->rowid][$compta_user] = 0;
|
||||||
|
if (! isset($tabht[$obj->rowid][$compta_fees])) $tabht[$obj->rowid][$compta_fees] = 0;
|
||||||
|
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||||
|
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||||
|
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||||
|
|
||||||
$tabttc[$obj->rowid][$compta_user] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_user] += $obj->total_ttc;
|
||||||
$tabht[$obj->rowid][$compta_fees] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_fees] += $obj->total_ht;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||||
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||||
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||||
$tabuser[$obj->rowid] = array (
|
$tabuser[$obj->rowid] = array (
|
||||||
'id' => $obj->uid,
|
'id' => $obj->uid,
|
||||||
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
||||||
@ -166,7 +179,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ($taber as $key => $val)
|
foreach ($taber as $key => $val) // Loop on each expense report
|
||||||
{
|
{
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
@ -177,7 +190,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
@ -187,8 +199,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
|
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
|
||||||
$bookkeeping->subledger_label = $tabuser[$key]['user_accountancy_code'];
|
$bookkeeping->subledger_label = $tabuser[$key]['user_accountancy_code'];
|
||||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
|
||||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
|
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
|
||||||
@ -203,7 +215,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -220,8 +232,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
|
||||||
$accountingaccount->fetch(null, $k, true);
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
// get compte id and label
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
@ -235,8 +245,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->label_operation = $accountingaccount->label;
|
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_operation = $accountingaccount->label;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -251,7 +261,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -268,8 +278,14 @@ if ($action == 'writebookkeeping') {
|
|||||||
// VAT
|
// VAT
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
// var_dump($tabtva);
|
$listoftax=array(0, 1, 2);
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
foreach($listoftax as $numtax)
|
||||||
|
{
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
// get compte id and label
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
@ -281,8 +297,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -297,7 +313,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -309,6 +325,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
@ -326,7 +343,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($error) && count($tabpay)) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
elseif (count($tabpay) == $error)
|
elseif (count($tabpay) == $error)
|
||||||
@ -339,6 +356,21 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
|
|
||||||
|
// Must reload data, so we make a redirect
|
||||||
|
if (count($tabpay) != $error)
|
||||||
|
{
|
||||||
|
$param='id_journal='.$id_journal;
|
||||||
|
$param.='&date_startday='.$date_startday;
|
||||||
|
$param.='&date_startmonth='.$date_startmonth;
|
||||||
|
$param.='&date_startyear='.$date_startyear;
|
||||||
|
$param.='&date_endday='.$date_endday;
|
||||||
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
|
$param.='&date_endyear='.$date_endyear;
|
||||||
|
$param.='&in_bookeeping='.$in_bookeeping;
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -350,7 +382,7 @@ $form = new Form($db);
|
|||||||
$userstatic = new User($db);
|
$userstatic = new User($db);
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
/*if ($action == 'export_csv') {
|
/*if ($action == 'exportcsv') {
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
@ -469,26 +501,32 @@ if (empty($action) || $action == 'view') {
|
|||||||
$builddate = time();
|
$builddate = time();
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
|
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||||
|
|
||||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
// Button to write into Ledger
|
||||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
} else {
|
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}*/
|
}
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
|
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
|
}
|
||||||
|
else {
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
|
}
|
||||||
|
//print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
@ -510,7 +548,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td></td>";
|
print "<td></td>";
|
||||||
print "<td>" . $langs->trans("Date") . "</td>";
|
print "<td>" . $langs->trans("Date") . "</td>";
|
||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ExpenseReportRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("Account") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("Label") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
@ -540,6 +579,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
$userstatic->name = $tabuser[$key]['name'];
|
$userstatic->name = $tabuser[$key]['name'];
|
||||||
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
@ -547,7 +587,10 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<span class="error">'.$langs->trans("FeeAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("FeeAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print '</td>';
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
$userstatic->name = $tabuser[$key]['name'];
|
$userstatic->name = $tabuser[$key]['name'];
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $accountingaccount->label . "</td>";
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $accountingaccount->label . "</td>";
|
||||||
@ -557,28 +600,6 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
|
||||||
if ($mt) {
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print "<td><!-- VAT --></td>";
|
|
||||||
print "<td>" . $date . "</td>";
|
|
||||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
|
||||||
print "<td>";
|
|
||||||
$accountoshow = length_accountg($k);
|
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
|
||||||
{
|
|
||||||
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
|
||||||
}
|
|
||||||
else print $accountoshow;
|
|
||||||
print "</td>";
|
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
|
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
|
||||||
print "</tr>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -587,19 +608,63 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||||
$userstatic->id = $tabuser[$key]['id'];
|
$userstatic->id = $tabuser[$key]['id'];
|
||||||
$userstatic->name = $tabuser[$key]['name'];
|
$userstatic->name = $tabuser[$key]['name'];
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accounta($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("MainAccountForUsersNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print "</td>";
|
||||||
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accounta($k);
|
$accountoshow = length_accounta($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("UserAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print '</td>';
|
||||||
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VAT
|
||||||
|
$listoftax = array(0, 1, 2);
|
||||||
|
foreach ($listoftax as $numtax) {
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
|
if ($mt) {
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td><!-- VAT --></td>";
|
||||||
|
print "<td>" . $date . "</td>";
|
||||||
|
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accountg($k);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print "</td>";
|
||||||
|
// 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>";
|
||||||
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
|
print "</tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
@ -36,11 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","errors"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$id_journal = GETPOST('id_journal', 'int');
|
$id_journal = GETPOST('id_journal', 'int');
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
@ -52,6 +48,7 @@ $date_endmonth = GETPOST('date_endmonth');
|
|||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||||
|
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -89,7 +86,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$idpays = $mysoc->country_id;
|
$idpays = $mysoc->country_id;
|
||||||
|
|
||||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,";
|
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,";
|
||||||
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.vat_src_code,";
|
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||||
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||||
//$sql .= " ct.accountancy_code_buy as account_tva";
|
//$sql .= " ct.accountancy_code_buy as account_tva";
|
||||||
@ -109,26 +106,30 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
}
|
}
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||||
if ($in_bookkeeping == 'yes')
|
if ($in_bookkeeping == 'already')
|
||||||
|
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||||
|
if ($in_bookkeeping == 'notyet')
|
||||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice')";
|
||||||
$sql .= " ORDER BY f.datef";
|
$sql .= " ORDER BY f.datef";
|
||||||
|
|
||||||
dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql);
|
dol_syslog('accountancy/journal/purchasesjournal.php', LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
|
||||||
|
|
||||||
// Variables
|
|
||||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
|
|
||||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
|
||||||
|
|
||||||
$tabfac = array ();
|
$tabfac = array ();
|
||||||
$tabht = array ();
|
$tabht = array ();
|
||||||
$tabtva = array ();
|
$tabtva = array ();
|
||||||
$def_tva = array ();
|
$def_tva = array ();
|
||||||
$tabttc = array ();
|
$tabttc = array ();
|
||||||
|
$tablocaltax1 = array ();
|
||||||
|
$tablocaltax2 = array ();
|
||||||
$tabcompany = array ();
|
$tabcompany = array ();
|
||||||
|
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined';
|
||||||
|
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
@ -139,9 +140,9 @@ if ($result) {
|
|||||||
$compta_prod = $obj->compte;
|
$compta_prod = $obj->compte;
|
||||||
if (empty($compta_prod)) {
|
if (empty($compta_prod)) {
|
||||||
if ($obj->product_type == 0)
|
if ($obj->product_type == 0)
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
|
||||||
else
|
else
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
|
||||||
}
|
}
|
||||||
|
|
||||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
@ -166,10 +167,14 @@ if ($result) {
|
|||||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||||
|
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||||
|
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||||
|
|
||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||||
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||||
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
'id' => $obj->socid,
|
'id' => $obj->socid,
|
||||||
'name' => $obj->name,
|
'name' => $obj->name,
|
||||||
@ -188,8 +193,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val) // Loop on each invoice
|
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||||
{
|
|
||||||
$errorforline = 0;
|
$errorforline = 0;
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -197,12 +201,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
$companystatic = new Societe($db);
|
$companystatic = new Societe($db);
|
||||||
$invoicestatic = new FactureFournisseur($db);
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
|
||||||
$invoicestatic->ref = (string) $val["refsologest"];
|
|
||||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
|
||||||
$invoicestatic->type = $val["type"];
|
|
||||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
|
||||||
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
$companystatic->code_compta = $tabcompany[$key]['code_compta'];
|
||||||
@ -211,6 +209,12 @@ if ($action == 'writebookkeeping') {
|
|||||||
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
$companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
|
|
||||||
|
$invoicestatic->id = $key;
|
||||||
|
$invoicestatic->ref = (string) $val["refsologest"];
|
||||||
|
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||||
|
$invoicestatic->type = $val["type"];
|
||||||
|
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||||
|
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
@ -226,8 +230,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||||
$bookkeeping->subledger_label = ''; // TODO To complete
|
$bookkeeping->subledger_label = ''; // TODO To complete
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount");
|
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount");
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
|
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
|
||||||
@ -242,7 +246,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -259,8 +263,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
|
||||||
$accountingaccount->fetch(null, $k, true);
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
// get compte id and label
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
@ -275,8 +277,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
|
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -291,7 +293,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -309,9 +311,15 @@ if ($action == 'writebookkeeping') {
|
|||||||
// var_dump($tabtva);
|
// var_dump($tabtva);
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax=array(0, 1, 2);
|
||||||
|
foreach($listoftax as $numtax)
|
||||||
|
{
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
@ -322,8 +330,8 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
|
||||||
$bookkeeping->numero_compte = $k;
|
$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->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||||
@ -338,7 +346,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -350,6 +358,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
@ -367,7 +376,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($error) && count($tabpay)) {
|
if (empty($error) && count($tabpay) > 0) {
|
||||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
elseif (count($tabpay) == $error)
|
elseif (count($tabpay) == $error)
|
||||||
@ -378,7 +387,23 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
|
|
||||||
|
// Must reload data, so we make a redirect
|
||||||
|
if (count($tabpay) != $error)
|
||||||
|
{
|
||||||
|
$param='id_journal='.$id_journal;
|
||||||
|
$param.='&date_startday='.$date_startday;
|
||||||
|
$param.='&date_startmonth='.$date_startmonth;
|
||||||
|
$param.='&date_startyear='.$date_startyear;
|
||||||
|
$param.='&date_endday='.$date_endday;
|
||||||
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
|
$param.='&date_endyear='.$date_endyear;
|
||||||
|
$param.='&in_bookeeping='.$in_bookeeping;
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -387,9 +412,6 @@ if ($action == 'writebookkeeping') {
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$companystatic = new Fournisseur($db);
|
|
||||||
$invoicestatic = new FactureFournisseur($db);
|
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
if ($action == 'exportcsv') {
|
if ($action == 'exportcsv') {
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
@ -397,20 +419,40 @@ if ($action == 'exportcsv') {
|
|||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
$companystatic = new Fournisseur($db);
|
||||||
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
|
||||||
|
foreach ( $tabfac as $key => $val )
|
||||||
|
{
|
||||||
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
|
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["ref"];
|
||||||
$invoicestatic->ref = $val["refsologest"];
|
$invoicestatic->ref = $val["refsologest"];
|
||||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||||
$invoicestatic->type = $val["type"];
|
$invoicestatic->type = $val["type"];
|
||||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
$invoicestatic->description = dol_trunc($val["description"], 32);
|
||||||
|
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
// Third party
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
print '"' . $key . '"' . $sep;
|
||||||
|
print '"' . $date . '"' . $sep;
|
||||||
|
print '"' . $val["refsuppliersologest"] . '"' . $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;
|
||||||
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
|
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
|
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||||
|
print '"' . $journal . '"' ;
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
@ -428,12 +470,18 @@ if ($action == 'exportcsv') {
|
|||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . 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;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||||
print '"' . $journal_label . '"' ;
|
print '"' . $journal . '"' ;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// VAT
|
// VAT
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax = array(0, 1, 2);
|
||||||
|
foreach ($listoftax as $numtax) {
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
@ -442,35 +490,17 @@ if ($action == 'exportcsv') {
|
|||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $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") . '"' . $sep;
|
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $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 '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||||
print '"' . $journal_label . '"' ;
|
print '"' . $journal . '"' ;
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third party
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
|
||||||
print '"' . $key . '"' . $sep;
|
|
||||||
print '"' . $date . '"' . $sep;
|
|
||||||
print '"' . $val["refsuppliersologest"] . '"' . $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;
|
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
|
||||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
|
||||||
print '"' . $journal_label . '"' ;
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($action) || $action == 'view') {
|
if (empty($action) || $action == 'view') {
|
||||||
|
|
||||||
@ -481,7 +511,6 @@ if (empty($action) || $action == 'view') {
|
|||||||
$periodlink = '';
|
$periodlink = '';
|
||||||
$exportlink = '';
|
$exportlink = '';
|
||||||
$builddate = time();
|
$builddate = time();
|
||||||
//$description = $langs->trans("DescPurchasesJournal") . '<br>';
|
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||||
@ -489,18 +518,13 @@ if (empty($action) || $action == 'view') {
|
|||||||
$description .= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
}
|
}
|
||||||
|
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||||
|
|
||||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
|
||||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
|
||||||
} else {
|
|
||||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Button to write into Ledger
|
// Button to write into Ledger
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
|
||||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
@ -542,7 +566,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Date") . "</td>";
|
print "<td>" . $langs->trans("Date") . "</td>";
|
||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("Type") . "</td>";
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
|
print "<td>" . $langs->trans("Label") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -550,19 +575,52 @@ if (empty($action) || $action == 'view') {
|
|||||||
$r = '';
|
$r = '';
|
||||||
|
|
||||||
$invoicestatic = new FactureFournisseur($db);
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
$companystatic = new Fournisseur($db);
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
foreach ( $tabfac as $key => $val ) {
|
||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["ref"];
|
||||||
|
$invoicestatic->type = $val["type"];
|
||||||
|
|
||||||
$invoicestatic->ref = $val["refsologest"];
|
$invoicestatic->ref = $val["refsologest"];
|
||||||
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
$invoicestatic->refsupplier = $val["refsuppliersologest"];
|
||||||
|
|
||||||
$invoicestatic->type = $val["type"];
|
|
||||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||||
|
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
|
// Third party
|
||||||
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td><!-- Thirdparty --></td>";
|
||||||
|
print "<td>" . $date . "</td>";
|
||||||
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
$companystatic->supplier_code = $tabcompany[$key]['code_supplier'];
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print '</td>';
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accounta($k);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print '</td>';
|
||||||
|
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>";
|
||||||
|
}
|
||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
@ -573,6 +631,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td><!-- Product --></td>";
|
print "<td><!-- Product --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
@ -581,10 +640,12 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label . "</td>";
|
||||||
// print "<td>" . $accountingaccount->label . "</td>";
|
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
@ -592,50 +653,37 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax = array(0, 1, 2);
|
||||||
|
foreach ($listoftax as $numtax) {
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- VAT --></td>";
|
print "<td><!-- VAT --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("VatAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]). "</td>";
|
// 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>";
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third party
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print "<td><!-- Thirdparty --></td>";
|
|
||||||
print "<td>" . $date . "</td>";
|
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
|
||||||
print "<td>";
|
|
||||||
$accountoshow = length_accounta($k);
|
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
|
||||||
{
|
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
|
||||||
}
|
|
||||||
else print $accountoshow;
|
|
||||||
print "</td>";
|
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
|
||||||
// print "</td><td>" . $langs->trans("ThirdParty");
|
|
||||||
// print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
|
|
||||||
// print "</td>";
|
|
||||||
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
|
|
||||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
||||||
print "</tr>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,12 +39,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
|
||||||
$langs->load("commercial");
|
$langs->loadLangs(array("commercial", "compta","bills","other","accountancy","errors"));
|
||||||
$langs->load("compta");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("other");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$id_journal = GETPOST('id_journal', 'int');
|
$id_journal = GETPOST('id_journal', 'int');
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
@ -56,6 +51,7 @@ $date_endmonth = GETPOST('date_endmonth');
|
|||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||||
|
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -94,7 +90,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
$idpays = $mysoc->country_id;
|
$idpays = $mysoc->country_id;
|
||||||
|
|
||||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
|
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
|
||||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||||
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||||
//$sql .= " ct.accountancy_code_sell as account_tva";
|
//$sql .= " ct.accountancy_code_sell as account_tva";
|
||||||
@ -115,7 +111,9 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|||||||
$sql .= " AND fd.product_type IN (0,1)";
|
$sql .= " AND fd.product_type IN (0,1)";
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||||
if ($in_bookkeeping == 'yes')
|
if ($in_bookkeeping == 'already')
|
||||||
|
$sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||||
|
if ($in_bookkeeping == 'notyet')
|
||||||
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
|
||||||
$sql .= " ORDER BY f.datef";
|
$sql .= " ORDER BY f.datef";
|
||||||
|
|
||||||
@ -127,13 +125,15 @@ if ($result) {
|
|||||||
$tabtva = array ();
|
$tabtva = array ();
|
||||||
$def_tva = array ();
|
$def_tva = array ();
|
||||||
$tabttc = array ();
|
$tabttc = array ();
|
||||||
|
$tablocaltax1 = array ();
|
||||||
|
$tablocaltax2 = array ();
|
||||||
$tabcompany = array ();
|
$tabcompany = array ();
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
|
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined';
|
||||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined';
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
@ -145,13 +145,15 @@ if ($result) {
|
|||||||
$compta_prod = $obj->compte;
|
$compta_prod = $obj->compte;
|
||||||
if (empty($compta_prod)) {
|
if (empty($compta_prod)) {
|
||||||
if ($obj->product_type == 0)
|
if ($obj->product_type == 0)
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
|
||||||
else
|
else
|
||||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
|
||||||
}
|
}
|
||||||
|
|
||||||
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code?' ('.$obj->vat_src_code.')':''), $mysoc, $mysoc, 0);
|
||||||
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
$compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||||
|
$compta_localtax1 = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
|
||||||
|
$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
|
// 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))
|
||||||
@ -185,10 +187,14 @@ if ($result) {
|
|||||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc] = 0;
|
||||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod] = 0;
|
||||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva] = 0;
|
||||||
|
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1] = 0;
|
||||||
|
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
|
||||||
|
|
||||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
||||||
|
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio;
|
||||||
|
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio;
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
'id' => $obj->socid,
|
'id' => $obj->socid,
|
||||||
'name' => $obj->name,
|
'name' => $obj->name,
|
||||||
@ -258,7 +264,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -285,7 +291,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->date_create = $now;
|
$bookkeeping->date_create = $now;
|
||||||
$bookkeeping->doc_type = 'customer_invoice';
|
$bookkeeping->doc_type = 'customer_invoice';
|
||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add;
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
@ -305,7 +311,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -323,7 +329,14 @@ if ($action == 'writebookkeeping') {
|
|||||||
// var_dump($tabtva);
|
// var_dump($tabtva);
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax=array(0, 1, 2);
|
||||||
|
foreach($listoftax as $numtax)
|
||||||
|
{
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
@ -336,7 +349,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->subledger_account = '';
|
$bookkeeping->subledger_account = '';
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_label = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ',$def_tva[$key][$k]);
|
$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->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||||
@ -351,7 +364,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errorforline++;
|
$errorforline++;
|
||||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -363,6 +376,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
@ -394,6 +408,21 @@ if ($action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$action='';
|
$action='';
|
||||||
|
|
||||||
|
// Must reload data, so we make a redirect
|
||||||
|
if (count($tabpay) != $error)
|
||||||
|
{
|
||||||
|
$param='id_journal='.$id_journal;
|
||||||
|
$param.='&date_startday='.$date_startday;
|
||||||
|
$param.='&date_startmonth='.$date_startmonth;
|
||||||
|
$param.='&date_startyear='.$date_startyear;
|
||||||
|
$param.='&date_endday='.$date_endday;
|
||||||
|
$param.='&date_endmonth='.$date_endmonth;
|
||||||
|
$param.='&date_endyear='.$date_endyear;
|
||||||
|
$param.='&in_bookeeping='.$in_bookeeping;
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -410,13 +439,13 @@ if ($action == 'exportcsv') {
|
|||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||||
|
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||||
|
|
||||||
$companystatic = new Client($db);
|
$companystatic = new Client($db);
|
||||||
$invoicestatic = new Facture($db);
|
$invoicestatic = new Facture($db);
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
foreach ( $tabfac as $key => $val )
|
||||||
|
{
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||||
@ -426,6 +455,7 @@ if ($action == 'exportcsv') {
|
|||||||
|
|
||||||
$date = dol_print_date($val["date"], 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
|
// Third party
|
||||||
foreach ($tabttc[$key] as $k => $mt) {
|
foreach ($tabttc[$key] as $k => $mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
@ -446,8 +476,6 @@ if ($action == 'exportcsv') {
|
|||||||
foreach ($tabht[$key] as $k => $mt) {
|
foreach ($tabht[$key] as $k => $mt) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k, true);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
|
|
||||||
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
@ -466,10 +494,13 @@ if ($action == 'exportcsv') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax = array(0, 1, 2);
|
||||||
|
foreach ($listoftax as $numtax) {
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $key . '"' . $sep;
|
print '"' . $key . '"' . $sep;
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
@ -479,7 +510,7 @@ if ($action == 'exportcsv') {
|
|||||||
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 '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key] . '"' . $sep;
|
||||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ). ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $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 '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . $sell_journal . '"';
|
print '"' . $sell_journal . '"';
|
||||||
@ -488,6 +519,7 @@ if ($action == 'exportcsv') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -500,13 +532,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
$periodlink = '';
|
$periodlink = '';
|
||||||
$exportlink = '';
|
$exportlink = '';
|
||||||
$builddate = time();
|
$builddate = time();
|
||||||
//$description = $langs->trans("DescSellsJournal") . '<br>';
|
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||||
else
|
else
|
||||||
$description .= $langs->trans("DepositsAreIncluded");
|
$description .= $langs->trans("DepositsAreIncluded");
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
|
||||||
|
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||||
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||||
|
|
||||||
$varlink = 'id_journal=' . $id_journal;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
@ -553,6 +586,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("Date") . "</td>";
|
print "<td>" . $langs->trans("Date") . "</td>";
|
||||||
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
|
||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
|
print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td>" . $langs->trans("Label") . "</td>";
|
print "<td>" . $langs->trans("Label") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||||
@ -578,7 +612,17 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
$companystatic->customer_code = $tabcompany[$key]['code_client'];
|
||||||
|
// Account
|
||||||
|
print "<td>";
|
||||||
|
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
|
||||||
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
|
{
|
||||||
|
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
|
||||||
|
}
|
||||||
|
else print $accountoshow;
|
||||||
|
print '</td>';
|
||||||
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accounta($k);
|
$accountoshow = length_accounta($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
@ -586,12 +630,10 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
// print "</td><td>" . $langs->trans("ThirdParty");
|
|
||||||
// print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,6 +647,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td><!-- Product --></td>";
|
print "<td><!-- Product --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
@ -613,7 +656,11 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
// print "<td>" . $accountingaccount->label . "</td>";
|
// Subledger account
|
||||||
|
print "<td>";
|
||||||
|
print '</td>';
|
||||||
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
@ -622,12 +669,19 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
$listoftax = array(0, 1, 2);
|
||||||
|
foreach ($listoftax as $numtax) {
|
||||||
|
$arrayofvat = $tabtva;
|
||||||
|
if ($numtax == 1) $arrayofvat = $tablocaltax1;
|
||||||
|
if ($numtax == 2) $arrayofvat = $tablocaltax2;
|
||||||
|
|
||||||
|
foreach ( $arrayofvat[$key] as $k => $mt ) {
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- VAT --></td>";
|
print "<td><!-- VAT --></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
|
// Account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$accountoshow = length_accountg($k);
|
$accountoshow = length_accountg($k);
|
||||||
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
if (empty($accountoshow) || $accountoshow == 'NotDefined')
|
||||||
@ -636,15 +690,18 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accountoshow;
|
else print $accountoshow;
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]);
|
// 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>";
|
print "</td>";
|
||||||
// print "<td>" . $langs->trans("VAT") . "</td>";
|
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/supplier/card.php
|
* \file htdocs/accountancy/supplier/card.php
|
||||||
* \ingroup Accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Card supplier ventilation
|
* \brief Card supplier ventilation
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|||||||
@ -86,7 +86,7 @@ $formaccounting = new FormAccounting($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
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_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
@ -154,7 +154,8 @@ print '<script type="text/javascript">
|
|||||||
* Supplier Invoice lines
|
* Supplier Invoice lines
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, aa.label, aa.account_number, ";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
|
||||||
|
$sql.= " aa.label, aa.account_number, ";
|
||||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
@ -266,8 +267,8 @@ if ($result) {
|
|||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
@ -285,10 +286,10 @@ if ($result) {
|
|||||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||||
$checkpicto=$form->showCheckAddButtons();
|
$checkpicto=$form->showCheckAddButtons();
|
||||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -336,7 +337,7 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
|
|||||||
@ -100,7 +100,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
|||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// 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_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
@ -181,7 +181,7 @@ llxHeader('', $langs->trans("SuppliersVentilation"));
|
|||||||
|
|
||||||
// Supplier Invoice Lines
|
// Supplier Invoice Lines
|
||||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
||||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, ";
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht as price, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||||
$sql.= " aa.rowid as aarowid";
|
$sql.= " aa.rowid as aarowid";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||||
@ -394,7 +394,7 @@ if ($result) {
|
|||||||
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
||||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||||
print '<td style="' . $code_vat_differ . '" align="right">';
|
print '<td style="' . $code_vat_differ . '" align="right">';
|
||||||
print price($objp->tva_tx_line);
|
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Current account
|
// Current account
|
||||||
|
|||||||
@ -151,7 +151,7 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
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="";
|
$search="";
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
|
|||||||
@ -88,7 +88,7 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
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="";
|
$search="";
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
|
|||||||
@ -69,7 +69,7 @@ $extrafields = new ExtraFields($db);
|
|||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
|
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
|
||||||
|
|
||||||
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_lastname="";
|
$search_lastname="";
|
||||||
$search_login="";
|
$search_login="";
|
||||||
|
|||||||
@ -79,7 +79,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
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
|
||||||
{
|
{
|
||||||
$defaulturl='';
|
$defaulturl='';
|
||||||
$defaultkey='';
|
$defaultkey='';
|
||||||
|
|||||||
@ -676,6 +676,8 @@ else
|
|||||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||||
print load_fiche_titre($action == 'testhtml'?$langs->trans("DoTestSendHTML"):$langs->trans("DoTestSend"));
|
print load_fiche_titre($action == 'testhtml'?$langs->trans("DoTestSendHTML"):$langs->trans("DoTestSend"));
|
||||||
|
|
||||||
|
dol_fiche_head('');
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||||
$formmail = new FormMail($db);
|
$formmail = new FormMail($db);
|
||||||
@ -714,7 +716,7 @@ else
|
|||||||
|
|
||||||
print $formmail->get_form('addfile','removefile');
|
print $formmail->get_form('addfile','removefile');
|
||||||
|
|
||||||
print '<br>';
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -180,7 +180,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
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_label='';
|
$search_label='';
|
||||||
$toselect='';
|
$toselect='';
|
||||||
|
|||||||
@ -178,7 +178,7 @@ print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useRateOnDocumentDate").'</td>';
|
print '<td>'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE").'</td>';
|
||||||
print '<td align="center" width="20"> </td>';
|
print '<td align="center" width="20"> </td>';
|
||||||
print '<td align="right" width="400">';
|
print '<td align="right" width="400">';
|
||||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
|
|||||||
@ -55,7 +55,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
|
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error && is_array($_POST))
|
||||||
{
|
{
|
||||||
//var_dump($_POST);
|
//var_dump($_POST);
|
||||||
foreach($_POST as $key => $val)
|
foreach($_POST as $key => $val)
|
||||||
|
|||||||
@ -116,7 +116,7 @@ print load_fiche_titre($langs->trans("Backup"),'','title_setup');
|
|||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print $langs->trans("BackupDesc",DOL_DATA_ROOT);
|
print $langs->trans("BackupDesc",DOL_DATA_ROOT);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<br><br>';
|
print '<br>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ print load_fiche_titre($langs->trans("Restore"),'','title_setup');
|
|||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print $langs->trans("RestoreDesc",DOL_DATA_ROOT);
|
print $langs->trans("RestoreDesc",DOL_DATA_ROOT);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<br><br>';
|
print '<br>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|||||||
@ -100,7 +100,7 @@ $date_endyear = $tmp['year'];
|
|||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
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
|
||||||
{
|
{
|
||||||
$date_start=-1;
|
$date_start=-1;
|
||||||
$date_end=-1;
|
$date_end=-1;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ if (! $user->admin)
|
|||||||
|
|
||||||
$action=GETPOST('action','alpha');
|
$action=GETPOST('action','alpha');
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$choice=GETPOST('choice');
|
$choice=GETPOST('choice','aZ09');
|
||||||
|
|
||||||
|
|
||||||
// Define filelog to discard it from purge
|
// Define filelog to discard it from purge
|
||||||
|
|||||||
@ -74,7 +74,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
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
|
||||||
{
|
{
|
||||||
$transkey='';
|
$transkey='';
|
||||||
$transvalue='';
|
$transvalue='';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -48,24 +48,21 @@ $acts[1] = "disable";
|
|||||||
$actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
|
$actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
|
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
|
||||||
$listoffset=GETPOST('listoffset');
|
|
||||||
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
|
|
||||||
$status = 1;
|
$status = 1;
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
// Load variable for pagination
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$page = GETPOST("page",'int');
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
$offset = $listlimit * $page ;
|
$page = GETPOST('page','int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('admin'));
|
$hookmanager->initHooks(array('admin'));
|
||||||
|
|
||||||
// This page is a generic page to edit dictionaries
|
|
||||||
// Put here declaration of dictionaries properties
|
|
||||||
|
|
||||||
// Name of SQL tables of dictionaries
|
// Name of SQL tables of dictionaries
|
||||||
$tabname=array();
|
$tabname=array();
|
||||||
$tabname[1] = MAIN_DB_PREFIX."website";
|
$tabname[1] = MAIN_DB_PREFIX."website";
|
||||||
@ -118,7 +115,7 @@ $elementList = array();
|
|||||||
$sourceList=array();
|
$sourceList=array();
|
||||||
|
|
||||||
// Actions add or modify an entry into a dictionary
|
// Actions add or modify an entry into a dictionary
|
||||||
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||||
{
|
{
|
||||||
$listfield=explode(',',$tabfield[$id]);
|
$listfield=explode(',',$tabfield[$id]);
|
||||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||||
@ -138,7 +135,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si verif ok et action add, on ajoute la ligne
|
// Si verif ok et action add, on ajoute la ligne
|
||||||
if ($ok && GETPOST('actionadd'))
|
if ($ok && GETPOST('actionadd','alpha'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id])
|
if ($tabrowid[$id])
|
||||||
{
|
{
|
||||||
@ -200,7 +197,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si verif ok et action modify, on modifie la ligne
|
// Si verif ok et action modify, on modifie la ligne
|
||||||
if ($ok && GETPOST('actionmodify'))
|
if ($ok && GETPOST('actionmodify','alpha'))
|
||||||
{
|
{
|
||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
@ -252,7 +249,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('actioncancel'))
|
if (GETPOST('actioncancel','alpha'))
|
||||||
{
|
{
|
||||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||||
}
|
}
|
||||||
@ -262,7 +259,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
|||||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||||
else { $rowidcol="rowid"; }
|
else { $rowidcol="rowid"; }
|
||||||
|
|
||||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_pages WHERE fk_website ='".$rowid."'";
|
$sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website ='".$rowid."'";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'";
|
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'";
|
||||||
@ -341,7 +338,7 @@ if ($action == 'delete')
|
|||||||
//var_dump($elementList);
|
//var_dump($elementList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show a dictionary
|
* Show website list
|
||||||
*/
|
*/
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
@ -412,11 +409,11 @@ if ($id)
|
|||||||
|
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
// If data was already input, we define them in obj to populate input fields.
|
// If data was already input, we define them in obj to populate input fields.
|
||||||
if (GETPOST('actionadd'))
|
if (GETPOST('actionadd','alpha'))
|
||||||
{
|
{
|
||||||
foreach ($fieldlist as $key=>$val)
|
foreach ($fieldlist as $key=>$val)
|
||||||
{
|
{
|
||||||
if (GETPOST($val))
|
if (GETPOST($val,'alpha'))
|
||||||
$obj->$val=GETPOST($val);
|
$obj->$val=GETPOST($val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -447,8 +444,7 @@ if ($id)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// List of available values in database
|
// List of websites in database
|
||||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -465,14 +461,6 @@ if ($id)
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// There is several pages
|
|
||||||
if ($num > $listlimit)
|
|
||||||
{
|
|
||||||
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
|
||||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], '', ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Title of lines
|
// Title of lines
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($fieldlist as $field => $value)
|
foreach ($fieldlist as $field => $value)
|
||||||
|
|||||||
@ -77,11 +77,11 @@ $workflowcodes=array(
|
|||||||
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||||
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
||||||
// Automatic classification
|
// Automatic classification
|
||||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''),
|
||||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
|
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'order','warning'=>''),
|
||||||
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
||||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>''),
|
||||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
|
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>''),
|
||||||
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -53,11 +53,13 @@ function printBookmarksList($aDb, $aLangs)
|
|||||||
// No urlencode, all param $url will be urlencoded later
|
// No urlencode, all param $url will be urlencoded later
|
||||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
||||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
||||||
|
if (is_array($_POST))
|
||||||
|
{
|
||||||
foreach($_POST as $key => $val)
|
foreach($_POST as $key => $val)
|
||||||
{
|
{
|
||||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
$url.=($tmpurl?'?'.$tmpurl:'');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
|||||||
|
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$attrname=GETPOST('attrname', 'alpha');
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
$elementtype='categories'; //Must be the $element of the class that manage extrafield
|
$elementtype='categorie'; //Must be the $element of the class that manage extrafield
|
||||||
|
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class Categorie extends CommonObject
|
|||||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
||||||
|
|
||||||
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
|
||||||
const TYPE_PROJECT = 6;
|
const TYPE_PROJECT = 6; // TODO Replace this value with 'project'
|
||||||
const TYPE_BANK_LINE = 'bank_line';
|
const TYPE_BANK_LINE = 'bank_line';
|
||||||
public $picto = 'category';
|
public $picto = 'category';
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ class Categorie extends CommonObject
|
|||||||
);
|
);
|
||||||
|
|
||||||
public $element='category';
|
public $element='category';
|
||||||
public $table_element='categories';
|
public $table_element='categorie';
|
||||||
|
|
||||||
public $fk_parent;
|
public $fk_parent;
|
||||||
public $label;
|
public $label;
|
||||||
|
|||||||
@ -35,14 +35,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
|
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$ref=GETPOST('ref');
|
$label=GETPOST('label');
|
||||||
$type=GETPOST('type');
|
$type=GETPOST('type');
|
||||||
$action=GETPOST('action','aZ09');
|
$action=GETPOST('action','aZ09');
|
||||||
$confirm=GETPOST('confirm');
|
$confirm=GETPOST('confirm');
|
||||||
$removeelem = GETPOST('removeelem','int');
|
$removeelem = GETPOST('removeelem','int');
|
||||||
$elemid=GETPOST('elemid');
|
$elemid=GETPOST('elemid');
|
||||||
|
|
||||||
if ($id == "")
|
if ($id == "" && $label == "")
|
||||||
{
|
{
|
||||||
dol_print_error('','Missing parameter id');
|
dol_print_error('','Missing parameter id');
|
||||||
exit();
|
exit();
|
||||||
@ -52,7 +52,7 @@ if ($id == "")
|
|||||||
$result = restrictedArea($user, 'categorie', $id, '&category');
|
$result = restrictedArea($user, 'categorie', $id, '&category');
|
||||||
|
|
||||||
$object = new Categorie($db);
|
$object = new Categorie($db);
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id, $label);
|
||||||
$object->fetch_optionals($id,$extralabels);
|
$object->fetch_optionals($id,$extralabels);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
@ -195,7 +195,7 @@ $head = categories_prepare_head($object,$type);
|
|||||||
dol_fiche_head($head, 'card', $title, -1, 'category');
|
dol_fiche_head($head, 'card', $title, -1, 'category');
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
$object->next_prev_filter=" type = ".$object->type;
|
||||||
$object->ref = $object->label;
|
$object->ref = $object->label;
|
||||||
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||||
$ways = $object->print_all_ways(" >> ", '', 1);
|
$ways = $object->print_all_ways(" >> ", '', 1);
|
||||||
@ -205,7 +205,7 @@ foreach ($ways as $way)
|
|||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$morehtmlref.='</div>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
dol_banner_tab($object, 'label', $linkback, ($user->societe_id?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -129,11 +129,14 @@ $hookmanager->initHooks(array('agenda'));
|
|||||||
if (GETPOST("viewlist") || $action == 'show_list')
|
if (GETPOST("viewlist") || $action == 'show_list')
|
||||||
{
|
{
|
||||||
$param='';
|
$param='';
|
||||||
|
if (is_array($_POST))
|
||||||
|
{
|
||||||
foreach($_POST as $key => $val)
|
foreach($_POST as $key => $val)
|
||||||
{
|
{
|
||||||
if ($key=='token') continue;
|
if ($key=='token') continue;
|
||||||
$param.='&'.$key.'='.urlencode($val);
|
$param.='&'.$key.'='.urlencode($val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//print $param;
|
//print $param;
|
||||||
header("Location: ".DOL_URL_ROOT.'/comm/action/listactions.php?'.$param);
|
header("Location: ".DOL_URL_ROOT.'/comm/action/listactions.php?'.$param);
|
||||||
exit;
|
exit;
|
||||||
@ -142,11 +145,14 @@ if (GETPOST("viewlist") || $action == 'show_list')
|
|||||||
if (GETPOST("viewperuser") || $action == 'show_peruser')
|
if (GETPOST("viewperuser") || $action == 'show_peruser')
|
||||||
{
|
{
|
||||||
$param='';
|
$param='';
|
||||||
|
if (is_array($_POST))
|
||||||
|
{
|
||||||
foreach($_POST as $key => $val)
|
foreach($_POST as $key => $val)
|
||||||
{
|
{
|
||||||
if ($key=='token') continue;
|
if ($key=='token') continue;
|
||||||
$param.='&'.$key.'='.urlencode($val);
|
$param.='&'.$key.'='.urlencode($val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//print $param;
|
//print $param;
|
||||||
header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param);
|
header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param);
|
||||||
exit;
|
exit;
|
||||||
@ -537,8 +543,10 @@ $resql=$db->query($sql);
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
$MAXONSAMEPAGE=10000; // Useless to have more. Protection to avoid memory overload when high number of event (for example after a mass import)
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $num)
|
while ($i < $num && $i < $MAXONSAMEPAGE)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
|||||||
@ -120,10 +120,13 @@ $hookmanager->initHooks(array('agendalist'));
|
|||||||
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
|
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
|
||||||
{
|
{
|
||||||
$param='';
|
$param='';
|
||||||
|
if (is_array($_POST))
|
||||||
|
{
|
||||||
foreach($_POST as $key => $val)
|
foreach($_POST as $key => $val)
|
||||||
{
|
{
|
||||||
$param.='&'.$key.'='.urlencode($val);
|
$param.='&'.$key.'='.urlencode($val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//print $param;
|
//print $param;
|
||||||
header("Location: ".DOL_URL_ROOT.'/comm/action/index.php?'.$param);
|
header("Location: ".DOL_URL_ROOT.'/comm/action/index.php?'.$param);
|
||||||
exit;
|
exit;
|
||||||
@ -134,7 +137,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
|
|||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
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
|
||||||
{
|
{
|
||||||
$actioncode='';
|
$actioncode='';
|
||||||
$search_title='';
|
$search_title='';
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
@ -534,7 +534,7 @@ if ($id > 0)
|
|||||||
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom" width="100%">';
|
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom" width="100%">';
|
||||||
$boxstat.='<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
|
$boxstat.='<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
|
||||||
|
|
||||||
if ($conf->propal->enabled)
|
if (! empty($conf->propal->enabled))
|
||||||
{
|
{
|
||||||
// Box proposals
|
// Box proposals
|
||||||
$tmp = $object->getOutstandingProposals();
|
$tmp = $object->getOutstandingProposals();
|
||||||
@ -552,7 +552,7 @@ if ($id > 0)
|
|||||||
if ($link) $boxstat.='</a>';
|
if ($link) $boxstat.='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->commande->enabled)
|
if (! empty($conf->commande->enabled))
|
||||||
{
|
{
|
||||||
// Box proposals
|
// Box proposals
|
||||||
$tmp = $object->getOutstandingOrders();
|
$tmp = $object->getOutstandingOrders();
|
||||||
@ -570,13 +570,12 @@ if ($id > 0)
|
|||||||
if ($link) $boxstat.='</a>';
|
if ($link) $boxstat.='</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->facture->enabled)
|
if (! empty($conf->facture->enabled))
|
||||||
{
|
{
|
||||||
$tmp = $object->getOutstandingBills();
|
$tmp = $object->getOutstandingBills();
|
||||||
$outstandingOpened=$tmp['opened'];
|
$outstandingOpened=$tmp['opened'];
|
||||||
$outstandingTotal=$tmp['total_ht'];
|
$outstandingTotal=$tmp['total_ht'];
|
||||||
$outstandingTotalIncTax=$tmp['total_ttc'];
|
$outstandingTotalIncTax=$tmp['total_ttc'];
|
||||||
|
|
||||||
$text=$langs->trans("OverAllInvoices");
|
$text=$langs->trans("OverAllInvoices");
|
||||||
$link='';
|
$link='';
|
||||||
$icon='bill';
|
$icon='bill';
|
||||||
|
|||||||
@ -22,6 +22,8 @@
|
|||||||
* \brief Page to define emailing targets
|
* \brief Page to define emailing targets
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1');
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/mailing.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/mailing.class.php';
|
||||||
@ -66,7 +68,7 @@ $search_email = GETPOST("search_email");
|
|||||||
$template_id = GETPOST('template_id', 'int');
|
$template_id = GETPOST('template_id', 'int');
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
// Do we click on purge search criteria ?
|
||||||
if (GETPOST("button_removefilter_x")) {
|
if (GETPOST('button_removefilter_x','alpha')) {
|
||||||
$search_nom = '';
|
$search_nom = '';
|
||||||
$search_prenom = '';
|
$search_prenom = '';
|
||||||
$search_email = '';
|
$search_email = '';
|
||||||
@ -404,14 +406,8 @@ if ($_POST["button_removefilter"]) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$extrajs = array (
|
|
||||||
'/includes/jquery/plugins/multiselect/js/ui.multiselect.js'
|
|
||||||
);
|
|
||||||
$extracss = array (
|
|
||||||
'/includes/jquery/plugins/multiselect/css/ui.multiselect.css',
|
|
||||||
);
|
|
||||||
|
|
||||||
llxHeader('', $langs->trans("MailAdvTargetRecipients"), '', '', '', '', $extrajs, $extracss);
|
llxHeader('', $langs->trans("MailAdvTargetRecipients"));
|
||||||
|
|
||||||
print '<script type="text/javascript" language="javascript">
|
print '<script type="text/javascript" language="javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|||||||
@ -474,7 +474,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=t.rowid ";
|
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=t.rowid ";
|
||||||
}
|
}
|
||||||
if (array_key_exists('cust_categ', $arrayquery)) {
|
if (array_key_exists('cust_categ', $arrayquery)) {
|
||||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_societe=t.rowid ";
|
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_soc=t.rowid ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($arrayquery['cust_name'])) {
|
if (!empty($arrayquery['cust_name'])) {
|
||||||
|
|||||||
@ -335,49 +335,8 @@ class FormAdvTargetEmailing extends Form
|
|||||||
function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) {
|
function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) {
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$return = '';
|
$form=new Form($this->db);
|
||||||
$return .= '<script type="text/javascript" language="javascript">
|
$return = $form->multiselectarray($htmlname, $options_array, $selected_array,0,0,'',0,295);
|
||||||
$(document).ready(function() {
|
|
||||||
$.extend($.ui.multiselect.locale, {
|
|
||||||
addAll:\'' . $langs->transnoentities ( "AddAll" ) . '\',
|
|
||||||
removeAll:\'' . $langs->transnoentities ( "RemoveAll" ) . '\',
|
|
||||||
itemsCount:\'' . $langs->transnoentities ( "ItemsCount" ) . '\'
|
|
||||||
});
|
|
||||||
|
|
||||||
$(function(){
|
|
||||||
$("#' . $htmlname . '").addClass("' . $htmlname . '").attr("multiple","multiple").attr("name","' . $htmlname . '[]");
|
|
||||||
$(".multiselect").multiselect({sortable: false, searchable: false});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>';
|
|
||||||
$return .= '<select id="' . $htmlname . '" class="multiselect" multiple="multiple" name="' . $htmlname . '[]" style="display: none;">';
|
|
||||||
//$return .= '<select id="' . $htmlname . '" class="multiselect" multiple="multiple" name="' . $htmlname . '[]">';
|
|
||||||
|
|
||||||
if ($showempty)
|
|
||||||
$return .= '<option value=""> </option>';
|
|
||||||
|
|
||||||
// Find if keys is in selected array value
|
|
||||||
if (is_array($selected_array) && count($selected_array)>0) {
|
|
||||||
$intersect_array = array_intersect_key($options_array, array_flip($selected_array));
|
|
||||||
} else {
|
|
||||||
$intersect_array=array();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($options_array) > 0) {
|
|
||||||
foreach ($options_array as $keyoption => $valoption) {
|
|
||||||
// If key is in intersect table then it have to e selected
|
|
||||||
$selected = '';
|
|
||||||
if (count ( $intersect_array ) > 0) {
|
|
||||||
if (array_key_exists ( $keyoption, $intersect_array )) {
|
|
||||||
$selected = ' selected="selected"';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$return .= '<option' . $selected . ' value="' . $keyoption . '">' . $valoption . '</option>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$return .= '</select>';
|
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1250,6 +1250,8 @@ $now = dol_now();
|
|||||||
// Add new proposal
|
// Add new proposal
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
|
$currency_code = $conf->currency;
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("NewProp"));
|
print load_fiche_titre($langs->trans("NewProp"));
|
||||||
|
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
|
|||||||
@ -2362,7 +2362,7 @@ class Propal extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED;
|
||||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT.' ;';
|
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|||||||
@ -178,7 +178,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
// Do we click on purge search criteria ?
|
||||||
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_categ='';
|
$search_categ='';
|
||||||
$search_user='';
|
$search_user='';
|
||||||
|
|||||||
@ -65,9 +65,8 @@ class Commande extends CommonOrder
|
|||||||
public $contactid;
|
public $contactid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status of the order. Check the following constants:
|
* Status of the order
|
||||||
* @var int
|
* @var int
|
||||||
* @see Commande::STATUS_CANCELED, Commande::STATUS_DRAFT, Commande::STATUS_ACCEPTED, Commande::STATUS_CLOSED
|
|
||||||
*/
|
*/
|
||||||
public $statut;
|
public $statut;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -162,7 +162,7 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
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_categ='';
|
$search_categ='';
|
||||||
$search_user='';
|
$search_user='';
|
||||||
@ -191,6 +191,11 @@ if (empty($reshook))
|
|||||||
$toselect='';
|
$toselect='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|
||||||
|
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
|
||||||
|
{
|
||||||
|
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||||
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='Commande';
|
$objectclass='Commande';
|
||||||
@ -371,7 +376,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd->classifyBilled($user);
|
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
|
||||||
|
|
||||||
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
|
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
|
||||||
else $TFact[$object->id] = $object;
|
else $TFact[$object->id] = $object;
|
||||||
@ -754,7 +759,7 @@ if ($resql)
|
|||||||
//var_dump($_REQUEST);
|
//var_dump($_REQUEST);
|
||||||
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
||||||
|
|
||||||
print '<table class="border" width="100%" >';
|
print '<table class="noborder" width="100%" >';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="titlefieldmiddle">';
|
print '<td class="titlefieldmiddle">';
|
||||||
print $langs->trans('DateInvoice');
|
print $langs->trans('DateInvoice');
|
||||||
@ -776,7 +781,15 @@ if ($resql)
|
|||||||
print $langs->trans('ValidateInvoices');
|
print $langs->trans('ValidateInvoices');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectyesno('valdate_invoices', 1, 1);
|
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
|
||||||
|
{
|
||||||
|
print $form->selectyesno('valdate_invoices', 0, 1, 1);
|
||||||
|
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $form->selectyesno('valdate_invoices', 0, 1);
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -838,7 +851,7 @@ if ($resql)
|
|||||||
|
|
||||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
$selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
@ -976,6 +989,7 @@ if ($resql)
|
|||||||
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
||||||
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"),
|
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSentShort"),
|
||||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||||
|
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
|
||||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
|
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
|
||||||
);
|
);
|
||||||
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
|
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
|
||||||
@ -1033,7 +1047,7 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'],$_SERVER["PHP_SELF"],"c.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'],$_SERVER["PHP_SELF"],"c.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'],$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,'');
|
if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'],$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,'');
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'',$param,'align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$total=0;
|
$total=0;
|
||||||
|
|||||||
@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||||
@ -46,17 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||||
|
|
||||||
$langs->load("banks");
|
$langs->loadLangs(array("banks","bills","categories","companies","margins","salaries","loan","donations","trips","members","compta","accountancy"));
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("categories");
|
|
||||||
$langs->load("companies");
|
|
||||||
$langs->load("margins");
|
|
||||||
$langs->load("salaries");
|
|
||||||
$langs->load("loan");
|
|
||||||
$langs->load("donations");
|
|
||||||
$langs->load("trips");
|
|
||||||
$langs->load("members");
|
|
||||||
$langs->load("compta");
|
|
||||||
|
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
$ref = GETPOST('ref','alpha');
|
$ref = GETPOST('ref','alpha');
|
||||||
@ -84,6 +75,7 @@ $debit=GETPOST("debit",'alpha');
|
|||||||
$credit=GETPOST("credit",'alpha');
|
$credit=GETPOST("credit",'alpha');
|
||||||
$type=GETPOST("type",'alpha');
|
$type=GETPOST("type",'alpha');
|
||||||
$account=GETPOST("account",'int');
|
$account=GETPOST("account",'int');
|
||||||
|
$accountancy_code=GETPOST('accountancy_code', 'alpha');
|
||||||
$bid=GETPOST("bid","int");
|
$bid=GETPOST("bid","int");
|
||||||
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
|
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
|
||||||
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
||||||
@ -178,7 +170,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
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_dt_start='';
|
$search_dt_start='';
|
||||||
$search_dt_end='';
|
$search_dt_end='';
|
||||||
@ -277,10 +269,10 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
|
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
|
||||||
$operation=$_POST["operation"];
|
$operation = GETPOST("operation",'alpha');
|
||||||
$num_chq=$_POST["num_chq"];
|
$num_chq = GETPOST("num_chq",'alpha');
|
||||||
$label=$_POST["label"];
|
$label = GETPOST("label",'alpha');
|
||||||
$cat1=$_POST["cat1"];
|
$cat1 = GETPOST("cat1",'alpha');
|
||||||
|
|
||||||
if (! $dateop) {
|
if (! $dateop) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -290,15 +282,24 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier)
|
|||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Type")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Type")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
if (! $label) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Label")), null, 'errors');
|
||||||
|
}
|
||||||
if (! $amount) {
|
if (! $amount) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
/*if (! empty($conf->accounting->enabled) && (empty($accountancy_code) || $accountancy_code == '-1'))
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}*/
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user);
|
$insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $accountancy_code);
|
||||||
if ($insertid > 0)
|
if ($insertid > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
@ -331,6 +332,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->m
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
$companystatic=new Societe($db);
|
$companystatic=new Societe($db);
|
||||||
$bankaccountstatic=new Account($db);
|
$bankaccountstatic=new Account($db);
|
||||||
@ -365,6 +367,7 @@ if (!empty($debit)) $param.='&debit='.$debit;
|
|||||||
if (!empty($credit)) $param.='&credit='.$credit;
|
if (!empty($credit)) $param.='&credit='.$credit;
|
||||||
if (!empty($account)) $param.='&account='.$account;
|
if (!empty($account)) $param.='&account='.$account;
|
||||||
if (!empty($search_num_releve)) $param.='&search_num_releve='.urlencode($search_num_releve);
|
if (!empty($search_num_releve)) $param.='&search_num_releve='.urlencode($search_num_releve);
|
||||||
|
if ($search_conciliated != '') $param.='&search_conciliated='.urlencode($search_conciliated);
|
||||||
if (!empty($bid)) $param.='&bid='.$bid;
|
if (!empty($bid)) $param.='&bid='.$bid;
|
||||||
if (dol_strlen($search_dt_start) > 0) $param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
if (dol_strlen($search_dt_start) > 0) $param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
||||||
if (dol_strlen($search_dt_end) > 0) $param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
if (dol_strlen($search_dt_end) > 0) $param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
||||||
@ -408,21 +411,34 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Buttons actions
|
* Buttons actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action != 'reconcile')
|
if ($action != 'reconcile')
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->BANK_USE_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments
|
||||||
{
|
{
|
||||||
if ($user->rights->banque->modifier) {
|
if ($user->rights->banque->modifier) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'">'.$langs->trans("AddBankRecord").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$account).'">'.$langs->trans("AddBankRecord").'</a>';
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // If direct entries is not done using miscellaneous payments
|
||||||
|
{
|
||||||
|
if ($user->rights->banque->modifier) {
|
||||||
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param.'">'.$langs->trans("AddBankRecord").'</a>';
|
||||||
|
} else {
|
||||||
|
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||||
@ -431,7 +447,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($object->canBeConciliated() > 0) {
|
if ($object->canBeConciliated() > 0) {
|
||||||
// If not cash account and can be reconciliate
|
// If not cash account and can be reconciliate
|
||||||
if ($user->rights->banque->consolidate) {
|
if ($user->rights->banque->consolidate) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||||
}
|
}
|
||||||
@ -637,6 +653,60 @@ if ($resql)
|
|||||||
// print '</td></tr></table>';
|
// print '</td></tr></table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Form to add a transaction with no invoice
|
||||||
|
if ($user->rights->banque->modifier && $action == 'addline')
|
||||||
|
{
|
||||||
|
print load_fiche_titre($langs->trans("AddBankRecordLong"),'','');
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Date").'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Numero").'</td>';
|
||||||
|
print '<td colspan="2">'.$langs->trans("Description").'</td>';
|
||||||
|
print '<td align=right>'.$langs->trans("Debit").'</td>';
|
||||||
|
print '<td align=right>'.$langs->trans("Credit").'</td>';
|
||||||
|
/*if (! empty($conf->accounting->enabled))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print $langs->trans("AccountAccounting");
|
||||||
|
print '</td>';
|
||||||
|
}*/
|
||||||
|
print '<td colspan="2" align="center"> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print '<tr '.$bcnd[false].'>';
|
||||||
|
print '<td class="nowrap" colspan="2">';
|
||||||
|
$form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction');
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
|
||||||
|
print '</td><td>';
|
||||||
|
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq").'"></td>';
|
||||||
|
print '<td colspan="2">';
|
||||||
|
print '<input name="label" class="flat" type="text" size="24" value="'.GETPOST("label").'">';
|
||||||
|
if ($options) {
|
||||||
|
print '<br>'.$langs->trans("Rubrique").': ';
|
||||||
|
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit").'"></td>';
|
||||||
|
print '<td align="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit").'"></td>';
|
||||||
|
/*if (! empty($conf->accounting->enabled))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
||||||
|
print '</td>';
|
||||||
|
}*/
|
||||||
|
print '<td colspan="2" align="center">';
|
||||||
|
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Add").'"><br>';
|
||||||
|
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
/// ajax to adjust value date with plus and less picto
|
/// ajax to adjust value date with plus and less picto
|
||||||
print '
|
print '
|
||||||
|
|||||||
@ -394,9 +394,10 @@ class Account extends CommonObject
|
|||||||
* @param User $user User that create
|
* @param User $user User that create
|
||||||
* @param string $emetteur Name of cheque writer
|
* @param string $emetteur Name of cheque writer
|
||||||
* @param string $banque Bank of cheque writer
|
* @param string $banque Bank of cheque writer
|
||||||
|
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
||||||
* @return int Rowid of added entry, <0 if KO
|
* @return int Rowid of added entry, <0 if KO
|
||||||
*/
|
*/
|
||||||
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='')
|
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='', $accountancycode='')
|
||||||
{
|
{
|
||||||
// Deprecatîon warning
|
// Deprecatîon warning
|
||||||
if (is_numeric($oper)) {
|
if (is_numeric($oper)) {
|
||||||
@ -457,6 +458,7 @@ class Account extends CommonObject
|
|||||||
$accline->fk_user_author = $user->id;
|
$accline->fk_user_author = $user->id;
|
||||||
$accline->fk_account = $this->rowid;
|
$accline->fk_account = $this->rowid;
|
||||||
$accline->fk_type = $oper;
|
$accline->fk_type = $oper;
|
||||||
|
$accline->numero_compte = $accountancycode;
|
||||||
|
|
||||||
if ($num_chq) {
|
if ($num_chq) {
|
||||||
$accline->num_chq = $num_chq;
|
$accline->num_chq = $num_chq;
|
||||||
@ -1686,6 +1688,7 @@ class AccountLine extends CommonObject
|
|||||||
$sql .= ", fk_type";
|
$sql .= ", fk_type";
|
||||||
$sql .= ", emetteur,banque";
|
$sql .= ", emetteur,banque";
|
||||||
$sql .= ", rappro";
|
$sql .= ", rappro";
|
||||||
|
$sql .= ", numero_compte";
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
$sql .= "'".$this->db->idate($this->datec)."'";
|
$sql .= "'".$this->db->idate($this->datec)."'";
|
||||||
$sql .= ", '".$this->db->idate($this->dateo)."'";
|
$sql .= ", '".$this->db->idate($this->dateo)."'";
|
||||||
@ -1699,6 +1702,7 @@ class AccountLine extends CommonObject
|
|||||||
$sql .= ", ".($this->emetteur ? "'".$this->db->escape($this->emetteur)."'" : "null");
|
$sql .= ", ".($this->emetteur ? "'".$this->db->escape($this->emetteur)."'" : "null");
|
||||||
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
|
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
|
||||||
$sql .= ", ".(int) $this->rappro;
|
$sql .= ", ".(int) $this->rappro;
|
||||||
|
$sql .= ", ".($this->numero_compte ? "'".$this->db->escape($this->numero_compte)."'" : "''");
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||||
|
|||||||
@ -325,14 +325,14 @@ class PaymentVarious extends CommonObject
|
|||||||
$sql.= " VALUES (";
|
$sql.= " VALUES (";
|
||||||
$sql.= "'".$this->db->idate($this->datep)."'";
|
$sql.= "'".$this->db->idate($this->datep)."'";
|
||||||
$sql.= ", '".$this->db->idate($this->datev)."'";
|
$sql.= ", '".$this->db->idate($this->datev)."'";
|
||||||
$sql.= ", '".$this->sens."'";
|
$sql.= ", '".$this->db->escape($this->sens)."'";
|
||||||
$sql.= ", ".$this->amount;
|
$sql.= ", ".$this->amount;
|
||||||
$sql.= ", '".$this->type_payment."'";
|
$sql.= ", '".$this->db->escape($this->type_payment)."'";
|
||||||
$sql.= ", '".$this->num_payment."'";
|
$sql.= ", '".$this->db->escape($this->num_payment)."'";
|
||||||
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
|
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->label)."'";
|
$sql.= ", '".$this->db->escape($this->label)."'";
|
||||||
$sql.= ", '".$this->accountancy_code."'";
|
$sql.= ", '".$this->db->escape($this->accountancy_code)."'";
|
||||||
$sql.= ", '".$user->id."'";
|
$sql.= ", ".$user->id;
|
||||||
$sql.= ", '".$this->db->idate($now)."'";
|
$sql.= ", '".$this->db->idate($now)."'";
|
||||||
$sql.= ", NULL";
|
$sql.= ", NULL";
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
@ -342,7 +342,6 @@ class PaymentVarious extends CommonObject
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
|
||||||
|
|
||||||
if ($this->id > 0)
|
if ($this->id > 0)
|
||||||
|
|||||||
@ -121,7 +121,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// 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
|
||||||
{
|
{
|
||||||
$statut = 'all';
|
$statut = 'all';
|
||||||
$search_ref='';
|
$search_ref='';
|
||||||
|
|||||||
@ -340,7 +340,7 @@ if (empty($numref))
|
|||||||
if ($object->canBeConciliated() > 0) {
|
if ($object->canBeConciliated() > 0) {
|
||||||
// If not cash account and can be reconciliate
|
// If not cash account and can be reconciliate
|
||||||
if ($user->rights->banque->consolidate) {
|
if ($user->rights->banque->consolidate) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,15 +29,14 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|||||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
|
||||||
$langs->load("banks");
|
|
||||||
$langs->load("bills");
|
|
||||||
$langs->load("users");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
|
|
||||||
$id=GETPOST("id",'int');
|
// Get parameters
|
||||||
|
$id = GETPOST('id', 'int');
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
$cancel=GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel', 'aZ09');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
|
$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
|
||||||
$label=GETPOST("label","alpha");
|
$label=GETPOST("label","alpha");
|
||||||
$sens=GETPOST("sens","int");
|
$sens=GETPOST("sens","int");
|
||||||
@ -61,13 +60,25 @@ $hookmanager->initHooks(array('variouscard','globalcard'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! empty($cancel))
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
header("Location: index.php");
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if ($action != 'addlink')
|
||||||
|
{
|
||||||
|
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/myobject_list.php',1);
|
||||||
|
header("Location: ".$urltogo);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref);
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'add' && empty($cancel))
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -85,27 +96,38 @@ if ($action == 'add' && empty($cancel))
|
|||||||
$object->num_payment=GETPOST("num_payment");
|
$object->num_payment=GETPOST("num_payment");
|
||||||
$object->fk_user_author=$user->id;
|
$object->fk_user_author=$user->id;
|
||||||
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
|
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
|
||||||
|
$object->sens=GETPOST('sens');
|
||||||
|
|
||||||
if (empty($datep) || empty($datev))
|
if (empty($datep) || empty($datev))
|
||||||
{
|
{
|
||||||
|
$langs->load('errors');
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($object->type_payment) || $object->type_payment < 0)
|
if (empty($object->type_payment) || $object->type_payment < 0)
|
||||||
{
|
{
|
||||||
|
$langs->load('errors');
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($object->amount))
|
if (empty($object->amount))
|
||||||
{
|
{
|
||||||
|
$langs->load('errors');
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (! empty($conf->banque->enabled) && ! $object->accountid > 0)
|
if (! empty($conf->banque->enabled) && ! $object->accountid > 0)
|
||||||
{
|
{
|
||||||
|
$langs->load('errors');
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
if (! empty($conf->accounting->enabled) && ! $object->accountancy_code)
|
||||||
|
{
|
||||||
|
$langs->load('errors');
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -171,6 +193,7 @@ if ($action == 'delete')
|
|||||||
setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors');
|
setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -200,8 +223,9 @@ if ($id)
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("NewVariousPayment"),'', 'title_accountancy.png');
|
print load_fiche_titre($langs->trans("NewVariousPayment"),'', 'title_accountancy.png');
|
||||||
@ -269,7 +293,7 @@ if ($action == 'create')
|
|||||||
// Accountancy account
|
// Accountancy account
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("AccountAccounting").'</td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, '');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -292,7 +316,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
|
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -34,6 +35,8 @@ $socid = GETPOST("socid","int");
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'banque', '', '', '');
|
$result = restrictedArea($user, 'banque', '', '', '');
|
||||||
|
|
||||||
|
$optioncss = GETPOST('optioncss','alpha');
|
||||||
|
|
||||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$search_ref = GETPOST('search_ref','int');
|
$search_ref = GETPOST('search_ref','int');
|
||||||
$search_user = GETPOST('search_user','alpha');
|
$search_user = GETPOST('search_user','alpha');
|
||||||
@ -50,11 +53,10 @@ $pageprev = $page - 1;
|
|||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortfield) $sortfield="v.datep";
|
if (! $sortfield) $sortfield="v.datep";
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
|
||||||
|
|
||||||
$filtre=$_GET["filtre"];
|
$filtre=GETPOST("filtre",'alpha');
|
||||||
|
|
||||||
if (empty($_REQUEST['typeid']))
|
if (! GETPOST('typeid'))
|
||||||
{
|
{
|
||||||
$newfiltre=str_replace('filtre=','',$filtre);
|
$newfiltre=str_replace('filtre=','',$filtre);
|
||||||
$filterarray=explode('-',$newfiltre);
|
$filterarray=explode('-',$newfiltre);
|
||||||
@ -66,10 +68,10 @@ if (empty($_REQUEST['typeid']))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$typeid=$_REQUEST['typeid'];
|
$typeid=GETPOST('typeid');
|
||||||
}
|
}
|
||||||
|
|
||||||
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_ref="";
|
||||||
$search_label="";
|
$search_label="";
|
||||||
@ -240,9 +242,12 @@ if ($result)
|
|||||||
|
|
||||||
$colspan=4;
|
$colspan=4;
|
||||||
if (! empty($conf->banque->enabled)) $colspan++;
|
if (! empty($conf->banque->enabled)) $colspan++;
|
||||||
print '<tr class="liste_total"><td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
|
print '<tr class="liste_total">';
|
||||||
|
print '<td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||||
print '<td class="liste_total" align="right">'.price($total)."</td>";
|
print '<td class="liste_total" align="right">'.price($total)."</td>";
|
||||||
print "<td></td></tr>";
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -57,7 +57,7 @@ if (! $sortfield) $sortfield="d.dated";
|
|||||||
$year=GETPOST("year");
|
$year=GETPOST("year");
|
||||||
$month=GETPOST("month");
|
$month=GETPOST("month");
|
||||||
|
|
||||||
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','alpha')) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
$search_name="";
|
$search_name="";
|
||||||
|
|||||||
@ -4189,7 +4189,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if (! $objectidnext && count($object->lines) > 0)
|
if (! $objectidnext && count($object->lines) > 0)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php.php?facid=' . $object->id . '&action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid=' . $object->id . '&action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2044,7 +2044,12 @@ class Facture extends CommonInvoice
|
|||||||
dol_syslog(get_class($this)."::validate no draft status", LOG_WARNING);
|
dol_syslog(get_class($this)."::validate no draft status", LOG_WARNING);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (count($this->lines) <= 0)
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans("ErrorObjectMustHaveLinesToBeValidated", $this->ref);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->creer))
|
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->creer))
|
||||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->invoice_advance->validate)))
|
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->invoice_advance->validate)))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -46,13 +46,18 @@ $langs->load('compta');
|
|||||||
$langs->load('admin');
|
$langs->load('admin');
|
||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
|
|
||||||
// Security check
|
$action = GETPOST('action','alpha');
|
||||||
$id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int'));
|
$massaction = GETPOST('massaction','alpha');
|
||||||
|
$show_files = GETPOST('show_files','int');
|
||||||
$confirm = GETPOST('confirm','alpha');
|
$confirm = GETPOST('confirm','alpha');
|
||||||
$cancel = GETPOST('cancel', 'alpha');
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'invoicetemplatelist'; // To manage different context of search
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int'));
|
||||||
$lineid=GETPOST('lineid','int');
|
$lineid=GETPOST('lineid','int');
|
||||||
$ref=GETPOST('ref','alpha');
|
$ref=GETPOST('ref','alpha');
|
||||||
$action=GETPOST('action', 'alpha');
|
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$objecttype = 'facture_rec';
|
$objecttype = 'facture_rec';
|
||||||
if ($action == "create" || $action == "add") $objecttype = '';
|
if ($action == "create" || $action == "add") $objecttype = '';
|
||||||
@ -112,7 +117,7 @@ $arrayfields=array(
|
|||||||
'f.tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1),
|
'f.tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1),
|
||||||
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1),
|
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1),
|
||||||
'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1),
|
'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1),
|
||||||
'f.nb_gen_done'=>array('label'=>$langs->trans("NbGeneration"), 'checked'=>1),
|
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1),
|
||||||
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1),
|
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1),
|
||||||
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1),
|
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1),
|
||||||
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||||
@ -132,6 +137,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters = array('socid' => $socid);
|
$parameters = array('socid' => $socid);
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
@ -140,6 +148,9 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
if (GETPOST('cancel')) $action='';
|
if (GETPOST('cancel')) $action='';
|
||||||
|
|
||||||
|
// Selection of new fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Set note
|
// Set note
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
@ -148,7 +159,7 @@ if (empty($reshook))
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
// Do we click on 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_ref='';
|
||||||
$search_societe='';
|
$search_societe='';
|
||||||
@ -165,6 +176,14 @@ if (empty($reshook))
|
|||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mass actions
|
||||||
|
/*$objectclass='MyObject';
|
||||||
|
$objectlabel='MyObject';
|
||||||
|
$permtoread = $user->rights->mymodule->read;
|
||||||
|
$permtodelete = $user->rights->mymodule->delete;
|
||||||
|
$uploaddir = $conf->mymodule->dir_output;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';*/
|
||||||
|
|
||||||
// Create predefined invoice
|
// Create predefined invoice
|
||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
@ -905,7 +924,7 @@ if ($action == 'create')
|
|||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<input type="hidden" name="facid" value="'.$object->id.'">';
|
print '<input type="hidden" name="facid" value="'.$object->id.'">';
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head(null, '', '', 0);
|
||||||
|
|
||||||
$rowspan=4;
|
$rowspan=4;
|
||||||
if (! empty($conf->projet->enabled)) $rowspan++;
|
if (! empty($conf->projet->enabled)) $rowspan++;
|
||||||
@ -952,10 +971,10 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Public note
|
// Public note
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="border tdtop">';
|
print '<td class="tdtop">';
|
||||||
print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic');
|
print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td valign="top" colspan="2">';
|
print '<td colspan="2">';
|
||||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
|
|
||||||
@ -963,7 +982,7 @@ if ($action == 'create')
|
|||||||
if (empty($user->societe_id))
|
if (empty($user->societe_id))
|
||||||
{
|
{
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="border tdtop">';
|
print '<td class="tdtop">';
|
||||||
print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate');
|
print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td valign="top" colspan="2">';
|
print '<td valign="top" colspan="2">';
|
||||||
@ -1007,12 +1026,14 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '<br><br>';
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
// Autogeneration
|
// Autogeneration
|
||||||
$title = $langs->trans("Recurrence");
|
$title = $langs->trans("Recurrence");
|
||||||
print load_fiche_titre($title, '', 'calendar');
|
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$title, '', '');
|
||||||
|
|
||||||
|
dol_fiche_head(null, '', '', 0);
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
@ -1040,7 +1061,8 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '<br><br>';
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
$title = $langs->trans("ProductsAndServices");
|
$title = $langs->trans("ProductsAndServices");
|
||||||
if (empty($conf->service->enabled))
|
if (empty($conf->service->enabled))
|
||||||
@ -1078,8 +1100,6 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'">';
|
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||||
@ -1558,7 +1578,8 @@ else
|
|||||||
* List mode
|
* List mode
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,";
|
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,";
|
||||||
$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when";
|
$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when,";
|
||||||
|
$sql.= " f.datec, f.tms";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -1570,10 +1591,10 @@ else
|
|||||||
}
|
}
|
||||||
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
|
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
|
||||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||||
if ($search_frequency) $sql .= natural_search('f.frequency', $search_frequency);
|
|
||||||
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
|
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
|
||||||
if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1);
|
if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1);
|
||||||
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||||
|
if ($search_frequency > 0) $sql.= natural_search('f.frequency', $search_frequency);
|
||||||
if ($search_frequency == '1') $sql.= ' AND f.frequency > 0';
|
if ($search_frequency == '1') $sql.= ' AND f.frequency > 0';
|
||||||
if ($search_frequency == '0') $sql.= ' AND (f.frequency IS NULL or f.frequency = 0)';
|
if ($search_frequency == '0') $sql.= ' AND (f.frequency IS NULL or f.frequency = 0)';
|
||||||
|
|
||||||
@ -1619,9 +1640,10 @@ else
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$param='&socid='.$socid;
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($socid) $param.='&socid='.$socid;
|
||||||
if ($day) $param.='&day='.$day;
|
if ($day) $param.='&day='.$day;
|
||||||
if ($month) $param.='&month='.$month;
|
if ($month) $param.='&month='.$month;
|
||||||
if ($year) $param.='&year=' .$year;
|
if ($year) $param.='&year=' .$year;
|
||||||
@ -1633,7 +1655,7 @@ else
|
|||||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
|
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
|
||||||
if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat;
|
if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat;
|
||||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
|
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||||
if ($search_frequency) $param.='&search_frequency=' .$search_frequency;
|
if ($search_frequency > 0) $param.='&search_frequency=' .$search_frequency;
|
||||||
if ($option) $param.="&option=".$option;
|
if ($option) $param.="&option=".$option;
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
@ -1646,13 +1668,19 @@ else
|
|||||||
|
|
||||||
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||||
|
|
||||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
|
//$selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||||
|
|
||||||
|
print '<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="action" value="list">';
|
print '<input type="hidden" name="action" value="list">';
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||||
|
|
||||||
print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit);
|
print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit);
|
||||||
@ -1776,20 +1804,20 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder);
|
if (! empty($arrayfields['f.titre']['checked'])) print_liste_field_titre($arrayfields['f.titre']['label'],$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder);
|
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER['PHP_SELF'],"f.total","",$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.total']['checked'])) print_liste_field_titre($arrayfields['f.total']['label'],$_SERVER['PHP_SELF'],"f.total","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("AmountVAT"),$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.tva']['checked'])) print_liste_field_titre($arrayfields['f.tva']['label'],$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("RecurringInvoiceTemplate"),$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.frequency']['checked'])) print_liste_field_titre($arrayfields['f.frequency']['label'],$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['f.nb_gen_done']['checked']))
|
if (! empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'],$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
{
|
if (! empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'],$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("NbOfGenerationDone"),$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
}
|
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DateLastGeneration"),$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("NextDateToExecution"),$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||||
print_liste_field_titre(''); // Field may contains ling text
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
@ -1800,26 +1828,67 @@ else
|
|||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?id='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre;
|
|
||||||
print "</a></td>\n";
|
|
||||||
|
|
||||||
$companystatic->id=$objp->socid;
|
$companystatic->id=$objp->socid;
|
||||||
$companystatic->name=$objp->name;
|
$companystatic->name=$objp->name;
|
||||||
print '<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1,'customer').'</td>';
|
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
if (! empty($arrayfields['f.titre']['checked']))
|
||||||
|
{
|
||||||
|
print '<td><a href="'.$_SERVER['PHP_SELF'].'?id='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre;
|
||||||
|
print "</a></td>\n";
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1,'customer').'</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['f.total']['checked']))
|
||||||
|
{
|
||||||
print '<td align="right">'.price($objp->total).'</td>'."\n";
|
print '<td align="right">'.price($objp->total).'</td>'."\n";
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['f.tva']['checked']))
|
||||||
|
{
|
||||||
print '<td align="right">'.price($objp->total_vat).'</td>'."\n";
|
print '<td align="right">'.price($objp->total_vat).'</td>'."\n";
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['f.total_ttc']['checked']))
|
||||||
|
{
|
||||||
print '<td align="right">'.price($objp->total_ttc).'</td>'."\n";
|
print '<td align="right">'.price($objp->total_ttc).'</td>'."\n";
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['f.frequency']['checked']))
|
||||||
|
{
|
||||||
print '<td align="center">'.yn($objp->frequency?1:0).'</td>';
|
print '<td align="center">'.yn($objp->frequency?1:0).'</td>';
|
||||||
|
}
|
||||||
if (! empty($arrayfields['f.nb_gen_done']['checked']))
|
if (! empty($arrayfields['f.nb_gen_done']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center">'.($objp->frequency ? $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') : '').'</td>';
|
print '<td align="center">';
|
||||||
|
print ($objp->frequency ? $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '<td align="center">'.($objp->frequency ? dol_print_date($objp->date_last_gen,'day') : '').'</td>';
|
if (! empty($arrayfields['f.date_last_gen']['checked']))
|
||||||
print '<td align="center">'.($objp->frequency ? dol_print_date($objp->date_when,'day') : '').'</td>';
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print ($objp->frequency ? dol_print_date($db->jdate($objp->date_last_gen),'day') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['f.date_when']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print ($objp->frequency ? dol_print_date($db->jdate($objp->date_when),'day') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['f.datec']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print dol_print_date($db->jdate($objp->datec),'dayhour');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['f.tms']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print dol_print_date($db->jdate($objp->tms),'dayhour');
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Action column
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($user->rights->facture->creer)
|
if ($user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
@ -1842,7 +1911,12 @@ else
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else print '<tr '.$bc[false].'><td colspan="9" class="opacitymedium">'.$langs->trans("NoneF").'</td></tr>';
|
else
|
||||||
|
{
|
||||||
|
$colspan=1;
|
||||||
|
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||||
|
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|||||||
@ -191,7 +191,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
// Do we click on purge search criteria ?
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOST("button_removefilter.x")) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','alpha') || GETPOST('button_removefilter.x','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_user='';
|
$search_user='';
|
||||||
$search_sale='';
|
$search_sale='';
|
||||||
|
|||||||
@ -54,8 +54,9 @@ if (empty($year))
|
|||||||
$year_current = $year;
|
$year_current = $year;
|
||||||
$year_start = $year;
|
$year_start = $year;
|
||||||
}
|
}
|
||||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
|
||||||
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
$date_start = dol_mktime( 0, 0, 0, GETPOST( "date_startmonth" ), GETPOST( "date_startday" ), GETPOST( "date_startyear" ) );
|
||||||
|
$date_end = dol_mktime( 23, 59, 59, GETPOST( "date_endmonth" ), GETPOST( "date_endday" ), GETPOST( "date_endyear" ) );
|
||||||
// Quarter
|
// Quarter
|
||||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||||
{
|
{
|
||||||
@ -92,12 +93,9 @@ $socid = GETPOST('socid','int');
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$morequerystring='';
|
$morequerystring='';
|
||||||
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
|
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
|
||||||
foreach($listofparams as $param)
|
foreach($listofparams as $param)
|
||||||
@ -118,6 +116,7 @@ $paymentfourn_static=new PaiementFourn($db);
|
|||||||
|
|
||||||
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
|
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
|
||||||
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||||
|
$fsearch.=' <input type="hidden" name="localTaxType" value="'.$local.'">';
|
||||||
|
|
||||||
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
|
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
|
||||||
|
|
||||||
@ -196,9 +195,8 @@ $total = 0;
|
|||||||
$i=0;
|
$i=0;
|
||||||
|
|
||||||
// Load arrays of datas
|
// Load arrays of datas
|
||||||
$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell');
|
$x_coll = tax_by_date('localtax' . $local, $db, 0, 0, $date_start, $date_end, $modetax, 'sell');
|
||||||
$x_paye = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy');
|
$x_paye = tax_by_date('localtax' . $local, $db, 0, 0, $date_start, $date_end, $modetax, 'buy');
|
||||||
|
|
||||||
|
|
||||||
echo '<table class="noborder" width="100%">';
|
echo '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
|||||||
@ -685,7 +685,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
{
|
{
|
||||||
if (!empty($conf->use_javascript_ajax))
|
if (!empty($conf->use_javascript_ajax))
|
||||||
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'");
|
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'");
|
||||||
print '<input type=hidden class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
||||||
print '<input type="text" size="8" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
|
print '<input type="text" size="8" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -760,7 +760,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
if ($totalrecudeposits) print '+'.price($totalrecudeposits);
|
if ($totalrecudeposits) print '+'.price($totalrecudeposits);
|
||||||
print '</b></td>';
|
print '</b></td>';
|
||||||
print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
|
print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
|
||||||
print '<td align="right" id="result" style="font-weight: bold;"></td>';
|
print '<td align="right" id="result" style="font-weight: bold;"></td>'; // Autofilled
|
||||||
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
|
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
|
||||||
print '<td align="center"> </td>';
|
print '<td align="center"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -804,7 +804,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
if (!empty($totalpayment)) $text=$langs->trans('ConfirmCustomerPayment',$totalpayment,$langs->trans("Currency".$conf->currency));
|
if (!empty($totalpayment)) $text=$langs->trans('ConfirmCustomerPayment',$totalpayment,$langs->trans("Currency".$conf->currency));
|
||||||
if (!empty($multicurrency_totalpayment))
|
if (!empty($multicurrency_totalpayment))
|
||||||
{
|
{
|
||||||
$text.='<br />'.$langs->trans('ConfirmCustomerPayment',$multicurrency_totalpayment,$langs->trans("paymentInInvoiceCurrency"));
|
$text.='<br>'.$langs->trans('ConfirmCustomerPayment',$multicurrency_totalpayment,$langs->trans("paymentInInvoiceCurrency"));
|
||||||
}
|
}
|
||||||
if (GETPOST('closepaidinvoices'))
|
if (GETPOST('closepaidinvoices'))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -68,7 +68,7 @@ $accountstatic=new Account($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// If click on purge search criteria ?
|
// If click on purge search criteria ?
|
||||||
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_ref='';
|
$search_ref='';
|
||||||
$search_amount='';
|
$search_amount='';
|
||||||
|
|||||||
@ -77,7 +77,7 @@ $extrafields = new ExtraFields($db);
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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','alpha')) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
$search_account="";
|
$search_account="";
|
||||||
|
|||||||
@ -57,7 +57,7 @@ $search_ref = GETPOST('search_ref','alpha');
|
|||||||
* Actions
|
* 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_ref="";
|
$search_ref="";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,7 +65,7 @@ $ligne=new LignePrelevement($db,$user);
|
|||||||
* Actions
|
* 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_line="";
|
$search_line="";
|
||||||
$search_bon="";
|
$search_bon="";
|
||||||
|
|||||||
@ -44,7 +44,7 @@ $action=GETPOST('action','aZ09');
|
|||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid","int");
|
$socid = GETPOST("socid","int");
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'salaries', '', '', '');
|
$result = restrictedArea($user, 'salaries', '', '', 'payment');
|
||||||
|
|
||||||
$object = new PaymentSalary($db);
|
$object = new PaymentSalary($db);
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,7 @@ else
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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_ref="";
|
||||||
$search_label="";
|
$search_label="";
|
||||||
|
|||||||
@ -71,7 +71,7 @@ else
|
|||||||
$typeid=$_REQUEST['typeid'];
|
$typeid=$_REQUEST['typeid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
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_ref="";
|
||||||
$search_label="";
|
$search_label="";
|
||||||
|
|||||||
@ -74,7 +74,7 @@ else
|
|||||||
$typeid=$_REQUEST['typeid'];
|
$typeid=$_REQUEST['typeid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || 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')) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
$search_label="";
|
$search_label="";
|
||||||
|
|||||||
@ -122,7 +122,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Purge search criteria
|
// 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
|
||||||
{
|
{
|
||||||
$actioncode='';
|
$actioncode='';
|
||||||
$search_agenda_label='';
|
$search_agenda_label='';
|
||||||
|
|||||||
@ -410,6 +410,8 @@ class Contact extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$info = array();
|
||||||
|
|
||||||
// Object classes
|
// Object classes
|
||||||
$info["objectclass"]=explode(',',$conf->global->LDAP_CONTACT_OBJECT_CLASS);
|
$info["objectclass"]=explode(',',$conf->global->LDAP_CONTACT_OBJECT_CLASS);
|
||||||
|
|
||||||
|
|||||||
@ -146,7 +146,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// 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
|
||||||
{
|
{
|
||||||
$day='';
|
$day='';
|
||||||
$month='';
|
$month='';
|
||||||
|
|||||||
@ -152,7 +152,7 @@ if (empty($reshook))
|
|||||||
// Selection of new fields
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
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_name="";
|
$search_name="";
|
||||||
$search_contract="";
|
$search_contract="";
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -26,6 +26,7 @@
|
|||||||
// $objectclass and $$objectlabel must be defined
|
// $objectclass and $$objectlabel must be defined
|
||||||
// $parameters, $object, $action must be defined for the hook.
|
// $parameters, $object, $action must be defined for the hook.
|
||||||
|
|
||||||
|
// $permtoread, $permtocreate and $permtodelete may be defined
|
||||||
// $uploaddir may be defined (example to $conf->projet->dir_output."/";)
|
// $uploaddir may be defined (example to $conf->projet->dir_output."/";)
|
||||||
// $toselect may be defined
|
// $toselect may be defined
|
||||||
|
|
||||||
@ -524,6 +525,66 @@ if ($action == 'remove_file')
|
|||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate records
|
||||||
|
if (! $error && $massaction == 'validate' && $permtocreate)
|
||||||
|
{
|
||||||
|
if ($object->element == 'invoice_supplier' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$objecttmp=new $objectclass($db);
|
||||||
|
$nbok = 0;
|
||||||
|
foreach($toselect as $toselectid)
|
||||||
|
{
|
||||||
|
$result=$objecttmp->fetch($toselectid);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
//if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
|
||||||
|
//else
|
||||||
|
$result = $objecttmp->validate($user);
|
||||||
|
if ($result == 0)
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
elseif ($result < 0)
|
||||||
|
{
|
||||||
|
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else $nbok++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||||
|
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
//var_dump($listofobjectthirdparties);exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delete records
|
// Delete records
|
||||||
if (! $error && $massaction == 'delete' && $permtodelete)
|
if (! $error && $massaction == 'delete' && $permtodelete)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -32,6 +32,8 @@ if ($action == 'setModuleOptions')
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Process common param fields
|
// Process common param fields
|
||||||
|
if (is_array($_POST))
|
||||||
|
{
|
||||||
foreach($_POST as $key => $val)
|
foreach($_POST as $key => $val)
|
||||||
{
|
{
|
||||||
if (preg_match('/^param(\d*)$/', $key, $reg)) // Works for POST['param'], POST['param1'], POST['param2'], ...
|
if (preg_match('/^param(\d*)$/', $key, $reg)) // Works for POST['param'], POST['param1'], POST['param2'], ...
|
||||||
@ -45,6 +47,7 @@ if ($action == 'setModuleOptions')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Process upload fields
|
// Process upload fields
|
||||||
if (GETPOST('upload','alpha') && GETPOST('keyforuploaddir','aZ09'))
|
if (GETPOST('upload','alpha') && GETPOST('keyforuploaddir','aZ09'))
|
||||||
|
|||||||
@ -4169,6 +4169,9 @@ abstract class CommonObject
|
|||||||
$optionsArray = $extrafields->attributes[$this->table_element]['label'];
|
$optionsArray = $extrafields->attributes[$this->table_element]['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$table_element = $this->table_element;
|
||||||
|
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
|
||||||
|
|
||||||
// Request to get complementary values
|
// Request to get complementary values
|
||||||
if (count($optionsArray) > 0)
|
if (count($optionsArray) > 0)
|
||||||
{
|
{
|
||||||
@ -4180,7 +4183,7 @@ abstract class CommonObject
|
|||||||
$sql.= ", ".$name;
|
$sql.= ", ".$name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields";
|
$sql.= " FROM ".MAIN_DB_PREFIX.$table_element."_extrafields";
|
||||||
$sql.= " WHERE fk_object = ".$rowid;
|
$sql.= " WHERE fk_object = ".$rowid;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG);
|
||||||
@ -4226,7 +4229,10 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
|
$table_element = $this->table_element;
|
||||||
|
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
|
||||||
|
|
||||||
|
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".$this->id;
|
||||||
dol_syslog(get_class($this)."::deleteExtraFields delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::deleteExtraFields delete", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql_del);
|
$resql=$this->db->query($sql_del);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
@ -4332,11 +4338,14 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
|
$table_element = $this->table_element;
|
||||||
|
if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility
|
||||||
|
|
||||||
|
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".$this->id;
|
||||||
dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG);
|
||||||
$this->db->query($sql_del);
|
$this->db->query($sql_del);
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$table_element."_extrafields (fk_object";
|
||||||
foreach($new_array_options as $key => $value)
|
foreach($new_array_options as $key => $value)
|
||||||
{
|
{
|
||||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||||
@ -4646,18 +4655,17 @@ abstract class CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get buy price to use for margin calculation. This function is called when buy price is unknown.
|
* Get buy price to use for margin calculation. This function is called when buy price is unknown.
|
||||||
* set buy price = sell price if ForceBuyingPriceIfNull configured,
|
* Set buy price = sell price if ForceBuyingPriceIfNull configured,
|
||||||
* else if calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice
|
* else if calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice
|
||||||
* else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice
|
* else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice
|
||||||
* else set min buy price as buy price
|
* else set min buy price as buy price
|
||||||
*
|
*
|
||||||
* @param float $unitPrice product unit price
|
* @param float $unitPrice Product unit price
|
||||||
* @param float $discountPercent line discount percent
|
* @param float $discountPercent Line discount percent
|
||||||
* @param int $fk_product product id
|
* @param int $fk_product Product id
|
||||||
*
|
* @return float <0 if KO, buyprice if OK
|
||||||
* @return float <0 if ko, buyprice if ok
|
|
||||||
*/
|
*/
|
||||||
public function defineBuyPrice($unitPrice = 0, $discountPercent = 0, $fk_product = 0)
|
public function defineBuyPrice($unitPrice = 0.0, $discountPercent = 0.0, $fk_product = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -4726,6 +4734,9 @@ abstract class CommonObject
|
|||||||
return $buyPrice;
|
return $buyPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function test if type is date
|
* Function test if type is date
|
||||||
*
|
*
|
||||||
@ -4734,7 +4745,7 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
protected function isDate($info)
|
protected function isDate($info)
|
||||||
{
|
{
|
||||||
if(isset($info['type']) && $info['type']=='date') return true;
|
if(isset($info['type']) && ($info['type']=='date' || $info['type']=='datetime' || $info['type']=='timestamp')) return true;
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4880,40 +4891,6 @@ abstract class CommonObject
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public function createCommon(User $user, $notrigger = false)
|
|
||||||
{
|
|
||||||
|
|
||||||
$fields = array_merge(array('datec'=>$this->db->idate(dol_now())), $this->set_save_query());
|
|
||||||
|
|
||||||
foreach ($fields as $k => $v) {
|
|
||||||
|
|
||||||
$keys[] = $k;
|
|
||||||
$values[] = $this->quote($v);
|
|
||||||
|
|
||||||
}
|
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'
|
|
||||||
( '.implode( ",", $keys ).' )
|
|
||||||
VALUES ( '.implode( ",", $values ).' ) ';
|
|
||||||
$res = $this->db->query( $sql );
|
|
||||||
if($res===false) {
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO Add triggers
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to load data into current object this
|
* Function to load data into current object this
|
||||||
*
|
*
|
||||||
@ -4967,17 +4944,132 @@ abstract class CommonObject
|
|||||||
return implode(',', $keys);
|
return implode(',', $keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add quote to field value if necessary
|
||||||
|
*
|
||||||
|
* @param string|int $value value to protect
|
||||||
|
* @return string|int
|
||||||
|
*/
|
||||||
|
protected function quote($value) {
|
||||||
|
|
||||||
|
if(is_null($value)) return 'NULL';
|
||||||
|
else if(is_numeric($value)) return $value;
|
||||||
|
else return "'".$this->db->escape( $value )."'";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
public function createCommon(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$fields = array_merge(array('datec'=>$this->db->idate(dol_now())), $this->set_save_query());
|
||||||
|
|
||||||
|
$keys=array();
|
||||||
|
$values = array();
|
||||||
|
foreach ($fields as $k => $v) {
|
||||||
|
$keys[] = $k;
|
||||||
|
$values[] = $this->quote($v);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'
|
||||||
|
( '.implode( ",", $keys ).' )
|
||||||
|
VALUES ( '.implode( ",", $values ).' ) ';
|
||||||
|
$res = $this->db->query( $sql );
|
||||||
|
if ($res===false) {
|
||||||
|
$error++;
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error && ! $notrigger) {
|
||||||
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||||
|
|
||||||
|
if (!$notrigger) {
|
||||||
|
// Call triggers
|
||||||
|
$result=$this->call_trigger(strtoupper(get_class(self)).'_CREATE',$user);
|
||||||
|
if ($result < 0) { $error++; }
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load an object from its id and create a new one in database
|
||||||
|
*
|
||||||
|
* @param User $user User that creates
|
||||||
|
* @param int $fromid Id of object to clone
|
||||||
|
* @return int New id of clone
|
||||||
|
*/
|
||||||
|
public function createFromCloneCommon(User $user, $fromid)
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$object = new self($this->db);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
// Load source object
|
||||||
|
$object->fetchCommon($fromid);
|
||||||
|
// Reset object
|
||||||
|
$object->id = 0;
|
||||||
|
|
||||||
|
// Clear fields
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// Create clone
|
||||||
|
$result = $object->createCommon($user);
|
||||||
|
|
||||||
|
// Other options
|
||||||
|
if ($result < 0) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors = $object->errors;
|
||||||
|
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// End
|
||||||
|
if (!$error) {
|
||||||
|
$this->db->commit();
|
||||||
|
return $object->id;
|
||||||
|
} else {
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load object in memory from the database
|
* Load object in memory from the database
|
||||||
*
|
*
|
||||||
* @param int $id Id object
|
* @param int $id Id object
|
||||||
* @param string $ref Ref
|
* @param string $ref Ref
|
||||||
*
|
|
||||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function fetchCommon($id, $ref = null)
|
public function fetchCommon($id, $ref = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (empty($id) && empty($ref)) return false;
|
if (empty($id) && empty($ref)) return false;
|
||||||
|
|
||||||
$sql = 'SELECT '.$this->get_field_list().', datec, tms';
|
$sql = 'SELECT '.$this->get_field_list().', datec, tms';
|
||||||
@ -4990,6 +5082,8 @@ abstract class CommonObject
|
|||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
if ($obj = $this->db->fetch_object($res))
|
if ($obj = $this->db->fetch_object($res))
|
||||||
|
{
|
||||||
|
if ($obj)
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->set_vars_by_db($obj);
|
$this->set_vars_by_db($obj);
|
||||||
@ -5000,6 +5094,11 @@ abstract class CommonObject
|
|||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$this->errors[] = $this->error;
|
$this->errors[] = $this->error;
|
||||||
@ -5019,15 +5118,15 @@ abstract class CommonObject
|
|||||||
*
|
*
|
||||||
* @param User $user User that modifies
|
* @param User $user User that modifies
|
||||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
*
|
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function updateCommon(User $user, $notrigger = false)
|
public function updateCommon(User $user, $notrigger = false)
|
||||||
{
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
$fields = $this->set_save_query();
|
$fields = $this->set_save_query();
|
||||||
|
|
||||||
foreach ($fields as $k => $v) {
|
foreach ($fields as $k => $v) {
|
||||||
|
|
||||||
if (is_array($key)){
|
if (is_array($key)){
|
||||||
$i=array_search($k, $key);
|
$i=array_search($k, $key);
|
||||||
if ( $i !== false) {
|
if ( $i !== false) {
|
||||||
@ -5040,20 +5139,37 @@ abstract class CommonObject
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp[] = $k.'='.$this->quote($v);
|
$tmp[] = $k.'='.$this->quote($v);
|
||||||
}
|
}
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode( ',', $tmp ).' WHERE rowid='.$this->id ;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode( ',', $tmp ).' WHERE rowid='.$this->id ;
|
||||||
$res = $this->db->query( $sql );
|
|
||||||
|
|
||||||
if($res===false) {
|
$this->db->begin();
|
||||||
//error
|
|
||||||
return false;
|
if (! $error)
|
||||||
|
{
|
||||||
|
$res = $this->db->query($sql);
|
||||||
|
if ($res===false)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Add triggers
|
if (! $error && ! $notrigger) {
|
||||||
|
// Call triggers
|
||||||
|
$result=$this->call_trigger(strtoupper(get_class(self)).'_MODIFY',$user);
|
||||||
|
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -5061,36 +5177,55 @@ abstract class CommonObject
|
|||||||
*
|
*
|
||||||
* @param User $user User that deletes
|
* @param User $user User that deletes
|
||||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||||
*
|
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function deleteCommon(User $user, $notrigger = false)
|
public function deleteCommon(User $user, $notrigger = false)
|
||||||
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
if (! $notrigger) {
|
||||||
|
// Call triggers
|
||||||
|
$result=$this->call_trigger(strtoupper(get_class(self)).'_DELETE', $user);
|
||||||
|
if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if($res===false) {
|
if($res===false) {
|
||||||
return false;
|
$error++;
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Add triggers
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
return true;
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add quote to field value if necessary
|
* Initialise object with example values
|
||||||
|
* Id must be 0 if object instance is a specimen
|
||||||
*
|
*
|
||||||
* @param string|int $value value to protect
|
* @return void
|
||||||
* @return string|int
|
|
||||||
*/
|
*/
|
||||||
protected function quote($value) {
|
public function initAsSpecimenCommon()
|
||||||
|
{
|
||||||
if(is_null($value)) return 'NULL';
|
$this->id = 0;
|
||||||
else if(is_numeric($value)) return $value;
|
|
||||||
else return "'".$this->db->escape( $value )."'";
|
|
||||||
|
|
||||||
|
// TODO...
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -197,6 +197,7 @@ class ExtraFields
|
|||||||
if ($elementtype == 'contact') $elementtype='socpeople';
|
if ($elementtype == 'contact') $elementtype='socpeople';
|
||||||
|
|
||||||
$table=$elementtype.'_extrafields';
|
$table=$elementtype.'_extrafields';
|
||||||
|
if ($elementtype == 'categorie') $table='categories_extrafields';
|
||||||
|
|
||||||
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname))
|
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname))
|
||||||
{
|
{
|
||||||
@ -350,6 +351,7 @@ class ExtraFields
|
|||||||
if ($elementtype == 'contact') $elementtype='socpeople';
|
if ($elementtype == 'contact') $elementtype='socpeople';
|
||||||
|
|
||||||
$table=$elementtype.'_extrafields';
|
$table=$elementtype.'_extrafields';
|
||||||
|
if ($elementtype == 'categorie') $table='categories_extrafields';
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -460,6 +462,7 @@ class ExtraFields
|
|||||||
if ($elementtype == 'contact') $elementtype='socpeople';
|
if ($elementtype == 'contact') $elementtype='socpeople';
|
||||||
|
|
||||||
$table=$elementtype.'_extrafields';
|
$table=$elementtype.'_extrafields';
|
||||||
|
if ($elementtype == 'categorie') $table='categories_extrafields';
|
||||||
|
|
||||||
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
|
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2006 Marc Barilley/Ocebo <marc@ocebo.com>
|
* Copyright (C) 2006 Marc Barilley/Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
|
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
|
||||||
@ -5916,7 +5916,7 @@ class Form
|
|||||||
{
|
{
|
||||||
$ret.=dol_htmlentities($object->name);
|
$ret.=dol_htmlentities($object->name);
|
||||||
}
|
}
|
||||||
else if (in_array($object->element, array('contact', 'user', 'member')))
|
else if (in_array($object->element, array('contact', 'user', 'usergroup', 'member')))
|
||||||
{
|
{
|
||||||
$ret.=dol_htmlentities($object->getFullName($langs));
|
$ret.=dol_htmlentities($object->getFullName($langs));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -314,7 +314,7 @@ class FormFile
|
|||||||
|
|
||||||
if (preg_match('/massfilesarea_/', $modulepart))
|
if (preg_match('/massfilesarea_/', $modulepart))
|
||||||
{
|
{
|
||||||
$out.='<div id="show_files"><br></div>';
|
$out.='<div id="show_files"><br></div>'."\n";
|
||||||
$title=$langs->trans("MassFilesArea").' <a href="" id="togglemassfilesarea" ref="shown">('.$langs->trans("Hide").')</a>';
|
$title=$langs->trans("MassFilesArea").' <a href="" id="togglemassfilesarea" ref="shown">('.$langs->trans("Hide").')</a>';
|
||||||
$title.='<script type="text/javascript" language="javascript">
|
$title.='<script type="text/javascript" language="javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
@ -788,14 +788,14 @@ class FormFile
|
|||||||
$out.=dol_print_date($file->datea,'dayhour');
|
$out.=dol_print_date($file->datea,'dayhour');
|
||||||
$out.='</td>';
|
$out.='</td>';
|
||||||
if ($delallowed || $printer || $morepicto) $out.='<td></td>';
|
if ($delallowed || $printer || $morepicto) $out.='<td></td>';
|
||||||
$out.='</tr>';
|
$out.='</tr>'."\n";
|
||||||
}
|
}
|
||||||
$this->numoffiles++;
|
$this->numoffiles++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($file_list) == 0 && count($link_list) == 0 && $headershown)
|
if (count($file_list) == 0 && count($link_list) == 0 && $headershown)
|
||||||
{
|
{
|
||||||
$out.='<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
$out.='<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -433,7 +433,7 @@ class FormMail extends Form
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out.= "<tr><td>".$langs->trans("MailFrom")."</td><td>";
|
$out.= '<tr><td class="fieldrequired">'.$langs->trans("MailFrom")."</td><td>";
|
||||||
$out.= $langs->trans("Name").':<input type="text" id="fromname" name="fromname" size="32" value="'.$this->fromname.'" />';
|
$out.= $langs->trans("Name").':<input type="text" id="fromname" name="fromname" size="32" value="'.$this->fromname.'" />';
|
||||||
$out.= ' ';
|
$out.= ' ';
|
||||||
$out.= $langs->trans("EMail").':<<input type="text" id="frommail" name="frommail" size="32" value="'.$this->frommail.'" />>';
|
$out.= $langs->trans("EMail").':<<input type="text" id="frommail" name="frommail" size="32" value="'.$this->frommail.'" />>';
|
||||||
@ -441,42 +441,10 @@ class FormMail extends Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replyto
|
|
||||||
if (! empty($this->withreplyto))
|
|
||||||
{
|
|
||||||
if ($this->withreplytoreadonly)
|
|
||||||
{
|
|
||||||
$out.= '<input type="hidden" id="replyname" name="replyname" value="'.$this->replytoname.'" />';
|
|
||||||
$out.= '<input type="hidden" id="replymail" name="replymail" value="'.$this->replytomail.'" />';
|
|
||||||
$out.= "<tr><td>".$langs->trans("MailReply")."</td><td>".$this->replytoname.($this->replytomail?(" <".$this->replytomail.">"):"");
|
|
||||||
$out.= "</td></tr>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Errorsto
|
|
||||||
if (! empty($this->witherrorsto))
|
|
||||||
{
|
|
||||||
//if (! $this->errorstomail) $this->errorstomail=$this->frommail;
|
|
||||||
$errorstomail = (! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : $this->errorstomail);
|
|
||||||
if ($this->witherrorstoreadonly)
|
|
||||||
{
|
|
||||||
$out.= '<input type="hidden" id="errorstomail" name="errorstomail" value="'.$errorstomail.'" />';
|
|
||||||
$out.= '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
|
|
||||||
$out.= $errorstomail;
|
|
||||||
$out.= "</td></tr>\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$out.= '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
|
|
||||||
$out.= '<input size="30" id="errorstomail" name="errorstomail" value="'.$errorstomail.'" />';
|
|
||||||
$out.= "</td></tr>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// To
|
// To
|
||||||
if (! empty($this->withto) || is_array($this->withto))
|
if (! empty($this->withto) || is_array($this->withto))
|
||||||
{
|
{
|
||||||
$out.= '<tr><td width="180">';
|
$out.= '<tr><td class="fieldrequired" width="180">';
|
||||||
if ($this->withtofree) $out.= $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
if ($this->withtofree) $out.= $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||||
else $out.= $langs->trans("MailTo");
|
else $out.= $langs->trans("MailTo");
|
||||||
$out.= '</td><td>';
|
$out.= '</td><td>';
|
||||||
@ -604,6 +572,38 @@ class FormMail extends Form
|
|||||||
$out.= "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replyto
|
||||||
|
if (! empty($this->withreplyto))
|
||||||
|
{
|
||||||
|
if ($this->withreplytoreadonly)
|
||||||
|
{
|
||||||
|
$out.= '<input type="hidden" id="replyname" name="replyname" value="'.$this->replytoname.'" />';
|
||||||
|
$out.= '<input type="hidden" id="replymail" name="replymail" value="'.$this->replytomail.'" />';
|
||||||
|
$out.= "<tr><td>".$langs->trans("MailReply")."</td><td>".$this->replytoname.($this->replytomail?(" <".$this->replytomail.">"):"");
|
||||||
|
$out.= "</td></tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Errorsto
|
||||||
|
if (! empty($this->witherrorsto))
|
||||||
|
{
|
||||||
|
//if (! $this->errorstomail) $this->errorstomail=$this->frommail;
|
||||||
|
$errorstomail = (! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : $this->errorstomail);
|
||||||
|
if ($this->witherrorstoreadonly)
|
||||||
|
{
|
||||||
|
$out.= '<input type="hidden" id="errorstomail" name="errorstomail" value="'.$errorstomail.'" />';
|
||||||
|
$out.= '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
|
||||||
|
$out.= $errorstomail;
|
||||||
|
$out.= "</td></tr>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$out.= '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
|
||||||
|
$out.= '<input size="30" id="errorstomail" name="errorstomail" value="'.$errorstomail.'" />';
|
||||||
|
$out.= "</td></tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ask delivery receipt
|
// Ask delivery receipt
|
||||||
if (! empty($this->withdeliveryreceipt))
|
if (! empty($this->withdeliveryreceipt))
|
||||||
{
|
{
|
||||||
@ -636,7 +636,7 @@ class FormMail extends Form
|
|||||||
$defaulttopic=make_substitutions($defaulttopic,$this->substit);
|
$defaulttopic=make_substitutions($defaulttopic,$this->substit);
|
||||||
|
|
||||||
$out.= '<tr>';
|
$out.= '<tr>';
|
||||||
$out.= '<td width="180">'.$langs->trans("MailTopic").'</td>';
|
$out.= '<td class="fieldrequired" width="180">'.$langs->trans("MailTopic").'</td>';
|
||||||
$out.= '<td>';
|
$out.= '<td>';
|
||||||
if ($this->withtopicreadonly)
|
if ($this->withtopicreadonly)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class Utils
|
|||||||
* Purge files into directory of data files.
|
* Purge files into directory of data files.
|
||||||
* CAN BE A CRON TASK
|
* CAN BE A CRON TASK
|
||||||
*
|
*
|
||||||
* @param string $choice Choice of purge mode ('tempfiles', 'tempfilesold' to purge temp older than 24h, 'allfiles', 'logfiles')
|
* @param string $choice Choice of purge mode ('tempfiles', 'tempfilesold' to purge temp older than 24h, 'allfiles', 'logfile')
|
||||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||||
*/
|
*/
|
||||||
function purgeFiles($choice='tempfilesold')
|
function purgeFiles($choice='tempfilesold')
|
||||||
@ -81,7 +81,7 @@ class Utils
|
|||||||
|
|
||||||
if ($choice=='allfiles')
|
if ($choice=='allfiles')
|
||||||
{
|
{
|
||||||
// Delete all files
|
// Delete all files (except install.lock)
|
||||||
if ($dolibarr_main_data_root)
|
if ($dolibarr_main_data_root)
|
||||||
{
|
{
|
||||||
$filesarray=dol_dir_list($dolibarr_main_data_root,"all",0,'','install\.lock$');
|
$filesarray=dol_dir_list($dolibarr_main_data_root,"all",0,'','install\.lock$');
|
||||||
@ -90,33 +90,55 @@ class Utils
|
|||||||
|
|
||||||
if ($choice=='logfile')
|
if ($choice=='logfile')
|
||||||
{
|
{
|
||||||
// Define filelog to discard it from purge
|
// Define files log
|
||||||
|
if ($dolibarr_main_data_root)
|
||||||
|
{
|
||||||
|
$filesarray=dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*$', 'install\.lock$');
|
||||||
|
}
|
||||||
|
|
||||||
$filelog='';
|
$filelog='';
|
||||||
if (! empty($conf->syslog->enabled))
|
if (! empty($conf->syslog->enabled))
|
||||||
{
|
{
|
||||||
$filelog=$conf->global->SYSLOG_FILE;
|
$filelog=$conf->global->SYSLOG_FILE;
|
||||||
$filelog=preg_replace('/DOL_DATA_ROOT/i',DOL_DATA_ROOT,$filelog);
|
$filelog=preg_replace('/DOL_DATA_ROOT/i',DOL_DATA_ROOT,$filelog);
|
||||||
}
|
|
||||||
|
|
||||||
$filesarray[]=array('fullname'=>$filelog,'type'=>'file');
|
$alreadyincluded=false;
|
||||||
|
foreach ($filesarray as $tmpcursor)
|
||||||
|
{
|
||||||
|
if ($tmpcursor['fullname'] == $filelog) { $alreadyincluded=true; }
|
||||||
|
}
|
||||||
|
if (! $alreadyincluded) $filesarray[]=array('fullname'=>$filelog,'type'=>'file');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$count=0;
|
$count=0;
|
||||||
|
$countdeleted=0;
|
||||||
|
$counterror=0;
|
||||||
if (count($filesarray))
|
if (count($filesarray))
|
||||||
{
|
{
|
||||||
foreach($filesarray as $key => $value)
|
foreach($filesarray as $key => $value)
|
||||||
{
|
{
|
||||||
//print "x ".$filesarray[$key]['fullname']."<br>\n";
|
//print "x ".$filesarray[$key]['fullname']."-".$filesarray[$key]['type']."<br>\n";
|
||||||
if ($filesarray[$key]['type'] == 'dir')
|
if ($filesarray[$key]['type'] == 'dir')
|
||||||
{
|
{
|
||||||
$count+=dol_delete_dir_recursive($filesarray[$key]['fullname']);
|
$startcount=0;
|
||||||
|
$tmpcountdeleted=0;
|
||||||
|
$result=dol_delete_dir_recursive($filesarray[$key]['fullname'], $startcount, 1, 0, $tmpcountdeleted);
|
||||||
|
$count+=$result;
|
||||||
|
$countdeleted+=$tmpcountdeleted;
|
||||||
}
|
}
|
||||||
elseif ($filesarray[$key]['type'] == 'file')
|
elseif ($filesarray[$key]['type'] == 'file')
|
||||||
{
|
{
|
||||||
// If (file that is not logfile) or (if logfile with option logfile)
|
// If (file that is not logfile) or (if logfile with option logfile)
|
||||||
if ($filesarray[$key]['fullname'] != $filelog || $choice=='logfile')
|
if ($filesarray[$key]['fullname'] != $filelog || $choice=='logfile')
|
||||||
{
|
{
|
||||||
$count+=(dol_delete_file($filesarray[$key]['fullname'])?1:0);
|
$result=dol_delete_file($filesarray[$key]['fullname'], 1, 1);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$count++;
|
||||||
|
$countdeleted++;
|
||||||
|
}
|
||||||
|
else $counterror++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,8 +152,12 @@ class Utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($count > 0) $this->output=$langs->trans("PurgeNDirectoriesDeleted", $count);
|
if ($count > 0)
|
||||||
else $this->output=$langs->trans("PurgeNothingToDelete");
|
{
|
||||||
|
$this->output=$langs->trans("PurgeNDirectoriesDeleted", $countdeleted);
|
||||||
|
if ($count > $countdeleted) $this->output.='<br>'.$langs->trans("PurgeNDirectoriesFailed", ($count - $countdeleted));
|
||||||
|
}
|
||||||
|
else $this->output=$langs->trans("PurgeNothingToDelete").($choice == 'tempfilesold' ? ' (older than 24h)':'');
|
||||||
|
|
||||||
//return $count;
|
//return $count;
|
||||||
return 0; // This function can be called by cron so must return 0 if OK
|
return 0; // This function can be called by cron so must return 0 if OK
|
||||||
|
|||||||
@ -1113,12 +1113,13 @@ function dol_delete_dir($dir,$nophperrors=0)
|
|||||||
* Remove a directory $dir and its subdirectories (or only files and subdirectories)
|
* Remove a directory $dir and its subdirectories (or only files and subdirectories)
|
||||||
*
|
*
|
||||||
* @param string $dir Dir to delete
|
* @param string $dir Dir to delete
|
||||||
* @param int $count Counter to count nb of deleted elements
|
* @param int $count Counter to count nb of elements found to delete
|
||||||
* @param int $nophperrors Disable all PHP output errors
|
* @param int $nophperrors Disable all PHP output errors
|
||||||
* @param int $onlysub Delete only files and subdir, not main directory
|
* @param int $onlysub Delete only files and subdir, not main directory
|
||||||
* @return int Number of files and directory removed
|
* @param int $countdeleted Counter to count nb of elements found really deleted
|
||||||
|
* @return int Number of files and directory we try to remove. NB really removed is returned into $countdeleted.
|
||||||
*/
|
*/
|
||||||
function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0,$onlysub=0)
|
function dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0)
|
||||||
{
|
{
|
||||||
dol_syslog("functions.lib:dol_delete_dir_recursive ".$dir,LOG_DEBUG);
|
dol_syslog("functions.lib:dol_delete_dir_recursive ".$dir,LOG_DEBUG);
|
||||||
if (dol_is_dir($dir))
|
if (dol_is_dir($dir))
|
||||||
@ -1134,13 +1135,13 @@ function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0,$onlysub=0)
|
|||||||
{
|
{
|
||||||
if (is_dir(dol_osencode("$dir/$item")))
|
if (is_dir(dol_osencode("$dir/$item")))
|
||||||
{
|
{
|
||||||
$count=dol_delete_dir_recursive("$dir/$item",$count,$nophperrors);
|
$count=dol_delete_dir_recursive("$dir/$item", $count, $nophperrors, 0, $countdeleted);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_delete_file("$dir/$item",1,$nophperrors);
|
$result=dol_delete_file("$dir/$item", 1, $nophperrors);
|
||||||
$count++;
|
$count++;
|
||||||
//echo " removing $dir/$item<br>\n";
|
if ($result) $countdeleted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1148,14 +1149,13 @@ function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0,$onlysub=0)
|
|||||||
|
|
||||||
if (empty($onlysub))
|
if (empty($onlysub))
|
||||||
{
|
{
|
||||||
dol_delete_dir($dir,$nophperrors);
|
$result=dol_delete_dir($dir, $nophperrors);
|
||||||
$count++;
|
$count++;
|
||||||
//echo "removing $dir<br>\n";
|
if ($result) $countdeleted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//echo "return=".$count;
|
|
||||||
return $count;
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
@ -410,7 +410,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
|||||||
{
|
{
|
||||||
case 'none':
|
case 'none':
|
||||||
break;
|
break;
|
||||||
case 'int':
|
case 'int': // Check param is a numeric value (integer but also float or hexadecimal)
|
||||||
if (! is_numeric($out)) { $out=''; }
|
if (! is_numeric($out)) { $out=''; }
|
||||||
break;
|
break;
|
||||||
case 'intcomma':
|
case 'intcomma':
|
||||||
|
|||||||
209
htdocs/core/lib/modulebuilder.lib.php
Normal file
209
htdocs/core/lib/modulebuilder.lib.php
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2009-2010 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
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/lib/memory.lib.php
|
||||||
|
* \brief Set of function for memory/cache management
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save data into a memory area shared by all users, all sessions on server
|
||||||
|
*
|
||||||
|
* @param string $destdir Directory
|
||||||
|
* @param string $module Module name
|
||||||
|
* @param string $objectname Name of object
|
||||||
|
* @param string $newmask New mask
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function rebuildObjectClass($destdir, $module, $objectname, $newmask)
|
||||||
|
{
|
||||||
|
global $db, $langs;
|
||||||
|
|
||||||
|
if (empty($objectname)) return -1;
|
||||||
|
|
||||||
|
$pathoffiletoeditsrc=$destdir.'/class/'.strtolower($objectname).'.class.php';
|
||||||
|
$pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php';
|
||||||
|
if (! dol_is_file($pathoffiletoeditsrc))
|
||||||
|
{
|
||||||
|
//$pathoffiletoeditsrc=DOL_DOCUMENT_ROOT.'/modulebuilder/template/class/myobject.class.php';
|
||||||
|
setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//$pathoffiletoedittmp=$destdir.'/class/'.strtolower($objectname).'.class.php.tmp';
|
||||||
|
//dol_delete_file($pathoffiletoedittmp, 0, 1, 1);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
include_once $pathoffiletoeditsrc;
|
||||||
|
if (class_exists($objectname)) $object=new $objectname($db);
|
||||||
|
else return -1;
|
||||||
|
|
||||||
|
// Backup old file
|
||||||
|
dol_copy($pathoffiletoeditsrc, $pathoffiletoeditsrc.'.back', $newmask, 1);
|
||||||
|
|
||||||
|
// Edit class files
|
||||||
|
$contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
|
||||||
|
|
||||||
|
$i=0;
|
||||||
|
$texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n";
|
||||||
|
$texttoinsert.= "\t".'/**'."\n";
|
||||||
|
$texttoinsert.= "\t".' * @var array Array with all fields and their property'."\n";
|
||||||
|
$texttoinsert.= "\t".' */'."\n";
|
||||||
|
$texttoinsert.= "\t".'public $fields=array('."\n";
|
||||||
|
|
||||||
|
if (count($object->fields))
|
||||||
|
{
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
$typephp='';
|
||||||
|
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
|
||||||
|
if ($val['position']) $texttoinsert.= " 'position'=>".$val['position'].",";
|
||||||
|
if ($val['notnull']) $texttoinsert.= " 'notnull'=>".$val['notnull'].",";
|
||||||
|
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||||
|
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||||
|
if ($val['comment']) $texttoinsert.= " 'comment'=>'".$val['comment']."',";
|
||||||
|
$texttoinsert.= "),\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$texttoinsert.= "\t".');'."\n";
|
||||||
|
|
||||||
|
$texttoinsert.= "\n";
|
||||||
|
|
||||||
|
if (count($object->fields))
|
||||||
|
{
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
$typephp='';
|
||||||
|
$texttoinsert.= "\t".'public $'.$key.$typephp.";";
|
||||||
|
//if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
||||||
|
//if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
||||||
|
//$texttoinsert.= ($val['notnull']?' NOT NULL':'');
|
||||||
|
//if ($i < count($object->fields)) $texttoinsert.=";";
|
||||||
|
$texttoinsert.= "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$texttoinsert.= "\t".'// END MODULEBUILDER PROPERTIES';
|
||||||
|
|
||||||
|
$contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass);
|
||||||
|
|
||||||
|
//file_put_contents($pathoffiletoedittmp, $contentclass);
|
||||||
|
file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass);
|
||||||
|
@chmod($pathoffiletoedittarget, octdec($newmask));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
print $e->getMessage();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save data into a memory area shared by all users, all sessions on server
|
||||||
|
*
|
||||||
|
* @param string $destdir Directory
|
||||||
|
* @param string $module Module name
|
||||||
|
* @param string $objectname Name of object
|
||||||
|
* @param string $newmask New mask
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function rebuildObjectSql($destdir, $module, $objectname, $newmask)
|
||||||
|
{
|
||||||
|
global $db, $langs;
|
||||||
|
|
||||||
|
if (empty($objectname)) return -1;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dol_include_once(strtolower($module).'/class/'.strtolower($objectname).'.class.php');
|
||||||
|
if (class_exists($objectname)) $object=new $objectname($db);
|
||||||
|
else return -1;
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
print $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit .sql file
|
||||||
|
$pathoffiletoeditsrc=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.sql');
|
||||||
|
$pathoffiletoedittarget=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.sql');
|
||||||
|
|
||||||
|
$contentsql = file_get_contents($pathoffiletoeditsrc, 'r');
|
||||||
|
|
||||||
|
$i=0;
|
||||||
|
$texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n";
|
||||||
|
if (count($object->fields))
|
||||||
|
{
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
$texttoinsert.= "\t".$key." ".$val['type'];
|
||||||
|
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
||||||
|
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
||||||
|
$texttoinsert.= ($val['notnull']?' NOT NULL':'');
|
||||||
|
if ($i < count($object->fields)) $texttoinsert.=", ";
|
||||||
|
$texttoinsert.= "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$texttoinsert.= "\t".'-- END MODULEBUILDER FIELDS';
|
||||||
|
|
||||||
|
$contentsql = preg_replace('/-- BEGIN MODULEBUILDER FIELDS.*END MODULEBUILDER FIELDS/ims', $texttoinsert, $contentsql);
|
||||||
|
|
||||||
|
file_put_contents($pathoffiletoedittarget, $contentsql);
|
||||||
|
@chmod($pathoffiletoedittarget, octdec($newmask));
|
||||||
|
|
||||||
|
|
||||||
|
// Edit .key.sql file
|
||||||
|
$pathoffiletoeditsrc=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.key.sql');
|
||||||
|
$pathoffiletoedittarget=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.key.sql');
|
||||||
|
|
||||||
|
$contentsql = file_get_contents($pathoffiletoeditsrc, 'r');
|
||||||
|
|
||||||
|
$i=0;
|
||||||
|
$texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n";
|
||||||
|
if (count($object->fields))
|
||||||
|
{
|
||||||
|
foreach($object->fields as $key => $val)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
if ($val['index'])
|
||||||
|
{
|
||||||
|
$texttoinsert.= "ALTER TABLE llx_".strtolower($objectname)." ADD INDEX idx_".strtolower($objectname)."_".$key." (".$key.");";
|
||||||
|
$texttoinsert.= "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$texttoinsert.= '-- END MODULEBUILDER INDEXES';
|
||||||
|
|
||||||
|
$contentsql = preg_replace('/-- BEGIN MODULEBUILDER INDEXES.*END MODULEBUILDER INDEXES/ims', $texttoinsert, $contentsql);
|
||||||
|
|
||||||
|
file_put_contents($pathoffiletoedittarget, $contentsql);
|
||||||
|
@chmod($pathoffiletoedittarget, octdec($newmask));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -181,11 +181,12 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets VAT to collect for the given year (and given quarter or month)
|
* Gets Tax to collect for the given year (and given quarter or month)
|
||||||
* The function gets the VAT in split results, as the VAT declaration asks
|
* The function gets the Tax in split results, as the Tax declaration asks
|
||||||
* to report the amounts for different VAT rates as different lines.
|
* to report the amounts for different Tax rates as different lines.
|
||||||
* This function also accounts recurrent invoices.
|
* This function also accounts recurrent invoices.
|
||||||
*
|
*
|
||||||
|
* @param string $type Tax type, either 'vat', 'localtax1' or 'localtax2'
|
||||||
* @param DoliDB $db Database handler object
|
* @param DoliDB $db Database handler object
|
||||||
* @param int $y Year
|
* @param int $y Year
|
||||||
* @param int $q Quarter
|
* @param int $q Quarter
|
||||||
@ -196,7 +197,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
|||||||
* @param int $m Month
|
* @param int $m Month
|
||||||
* @return array List of quarters with vat
|
* @return array List of quarters with vat
|
||||||
*/
|
*/
|
||||||
function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $m=0)
|
function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -210,8 +211,6 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
$fk_facture2='fk_facture';
|
$fk_facture2='fk_facture';
|
||||||
$fk_payment='fk_paiement';
|
$fk_payment='fk_paiement';
|
||||||
$total_tva='total_tva';
|
$total_tva='total_tva';
|
||||||
$total_localtax1='total_localtax1';
|
|
||||||
$total_localtax2='total_localtax2';
|
|
||||||
$paymenttable='paiement';
|
$paymenttable='paiement';
|
||||||
$paymentfacturetable='paiement_facture';
|
$paymentfacturetable='paiement_facture';
|
||||||
$invoicefieldref='facnumber';
|
$invoicefieldref='facnumber';
|
||||||
@ -224,13 +223,20 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
$fk_facture2='fk_facturefourn';
|
$fk_facture2='fk_facturefourn';
|
||||||
$fk_payment='fk_paiementfourn';
|
$fk_payment='fk_paiementfourn';
|
||||||
$total_tva='tva';
|
$total_tva='tva';
|
||||||
$total_localtax1='total_localtax1';
|
|
||||||
$total_localtax2='total_localtax2';
|
|
||||||
$paymenttable='paiementfourn';
|
$paymenttable='paiementfourn';
|
||||||
$paymentfacturetable='paiementfourn_facturefourn';
|
$paymentfacturetable='paiementfourn_facturefourn';
|
||||||
$invoicefieldref='ref';
|
$invoicefieldref='ref';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( strpos( $type, 'localtax' ) === 0 ) {
|
||||||
|
$f_rate = $type . '_tx';
|
||||||
|
} else {
|
||||||
|
$f_rate = 'tva_tx';
|
||||||
|
}
|
||||||
|
|
||||||
|
$total_localtax1='total_localtax1';
|
||||||
|
$total_localtax2='total_localtax2';
|
||||||
|
|
||||||
// CAS DES BIENS
|
// CAS DES BIENS
|
||||||
|
|
||||||
// Define sql request
|
// Define sql request
|
||||||
@ -238,7 +244,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
if ($modetax == 1) // Option vat on delivery for goods (payment) and debit invoice for services
|
if ($modetax == 1) // Option vat on delivery for goods (payment) and debit invoice for services
|
||||||
{
|
{
|
||||||
// Count on delivery date (use invoice date as delivery is unknown)
|
// Count on delivery date (use invoice date as delivery is unknown)
|
||||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||||
$sql .=" d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
$sql .=" d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
||||||
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
||||||
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef, s.nom as company_name, s.rowid as company_id,";
|
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef, s.nom as company_name, s.rowid as company_id,";
|
||||||
@ -273,7 +279,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
else // Option vat on delivery for goods (payments) and payments for services
|
else // Option vat on delivery for goods (payments) and payments for services
|
||||||
{
|
{
|
||||||
// Count on delivery date (use invoice date as delivery is unknown)
|
// Count on delivery date (use invoice date as delivery is unknown)
|
||||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||||
$sql .=" d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
$sql .=" d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
||||||
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
||||||
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef as date_f, s.nom as company_name, s.rowid as company_id,";
|
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef as date_f, s.nom as company_name, s.rowid as company_id,";
|
||||||
@ -378,7 +384,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
if ($modetax == 1) // Option vat on delivery for goods (payment) and debit invoice for services
|
if ($modetax == 1) // Option vat on delivery for goods (payment) and debit invoice for services
|
||||||
{
|
{
|
||||||
// Count on invoice date
|
// Count on invoice date
|
||||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||||
$sql .=" d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
$sql .=" d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
||||||
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
||||||
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef, s.nom as company_name, s.rowid as company_id,";
|
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef, s.nom as company_name, s.rowid as company_id,";
|
||||||
@ -413,7 +419,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
else // Option vat on delivery for goods (payments) and payments for services
|
else // Option vat on delivery for goods (payments) and payments for services
|
||||||
{
|
{
|
||||||
// Count on payments date
|
// Count on payments date
|
||||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||||
$sql .=" d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
$sql .=" d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
||||||
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
||||||
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef, s.nom as company_name, s.rowid as company_id,";
|
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef, s.nom as company_name, s.rowid as company_id,";
|
||||||
@ -522,7 +528,7 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
$sql='';
|
$sql='';
|
||||||
|
|
||||||
// Count on payments date
|
// Count on payments date
|
||||||
$sql = "SELECT e.rowid, d.product_type as dtype, e.rowid as facid, d.tva_tx as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,";
|
$sql = "SELECT e.rowid, d.product_type as dtype, e.rowid as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,";
|
||||||
$sql .=" d.total_localtax1 as total_localtax1, d.total_localtax2 as total_localtax2, ";
|
$sql .=" d.total_localtax1 as total_localtax1, d.total_localtax2 as total_localtax2, ";
|
||||||
$sql.= " e.date_debut as date_start, e.date_fin as date_end,";
|
$sql.= " e.date_debut as date_start, e.date_fin as date_end,";
|
||||||
$sql.= " e.ref as facnum, e.total_ttc as ftotal_ttc, e.date_create, s.nom as company_name, s.rowid as company_id, d.fk_c_type_fees as type,";
|
$sql.= " e.ref as facnum, e.total_ttc as ftotal_ttc, e.date_create, s.nom as company_name, s.rowid as company_id, d.fk_c_type_fees as type,";
|
||||||
@ -622,3 +628,24 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction,
|
|||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets VAT to collect for the given year (and given quarter or month)
|
||||||
|
* The function gets the VAT in split results, as the VAT declaration asks
|
||||||
|
* to report the amounts for different VAT rates as different lines.
|
||||||
|
* This function also accounts recurrent invoices.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler object
|
||||||
|
* @param int $y Year
|
||||||
|
* @param int $q Quarter
|
||||||
|
* @param string $date_start Start date
|
||||||
|
* @param string $date_end End date
|
||||||
|
* @param int $modetax 0 or 1 (option vat on debit)
|
||||||
|
* @param int $direction 'sell' (customer invoice) or 'buy' (supplier invoices)
|
||||||
|
* @param int $m Month
|
||||||
|
* @return array List of quarters with vat
|
||||||
|
*/
|
||||||
|
function vat_by_date ($db, $y, $q, $date_start, $date_end, $modetax, $direction, $m=0)
|
||||||
|
{
|
||||||
|
return tax_by_date('vat', $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -193,9 +193,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||||||
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
||||||
-- Special expenses
|
-- Special expenses
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)', '', 0, 6, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)', '', 0, 6, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->salaries->read', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->salaries->payment->read', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->write', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->payment->write', '', 0, 2, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->read', '', 0, 3, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'accountancy', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->payment->read', '', 0, 3, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'accountancy', 'tax_loan', 2200__+MAX_llx_menu__, '/loan/index.php?leftmenu=tax_loan&mainmenu=accountancy', 'Loans', 1, 'loan', '$user->rights->loan->read', '', 0, 1, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'accountancy', 'tax_loan', 2200__+MAX_llx_menu__, '/loan/index.php?leftmenu=tax_loan&mainmenu=accountancy', 'Loans', 1, 'loan', '$user->rights->loan->read', '', 0, 1, __ENTITY__);
|
||||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/card.php?leftmenu=tax_loan&action=create', 'NewLoan', 2, 'loan', '$user->rights->loan->write', '', 0, 2, __ENTITY__);
|
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/card.php?leftmenu=tax_loan&action=create', 'NewLoan', 2, 'loan', '$user->rights->loan->write', '', 0, 2, __ENTITY__);
|
||||||
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?leftmenu=tax_loan', 'Payments', 2, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__);
|
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'accountancy', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?leftmenu=tax_loan', 'Payments', 2, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__);
|
||||||
|
|||||||
@ -904,9 +904,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
if (! empty($conf->salaries->enabled))
|
if (! empty($conf->salaries->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("salaries");
|
$langs->load("salaries");
|
||||||
$newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->salaries->read, '', $mainmenu, 'tax_salary');
|
$newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy",$langs->trans("Salaries"),1,$user->rights->salaries->payment->read, '', $mainmenu, 'tax_salary');
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->write);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->payment->write);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->read);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->payment->read);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loan
|
// Loan
|
||||||
@ -993,7 +993,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
$sql.= " AND active = 1";
|
$sql.= " AND active = 1";
|
||||||
$sql.= " ORDER BY label";
|
$sql.= " ORDER BY label DESC";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -1119,8 +1119,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
|
|
||||||
// Journaux
|
// Journaux
|
||||||
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
|
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire, '', '', '', 50);
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire, '', '', '', 51);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1141,7 +1141,26 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
}
|
}
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
|
// Situations totals migth be wrong on huge amounts
|
||||||
|
if ($object->situation_cycle_ref && $object->situation_counter > 1) {
|
||||||
|
|
||||||
|
$sum_pdf_tva = 0;
|
||||||
|
foreach($this->tva as $tvakey => $tvaval){
|
||||||
|
$sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object
|
||||||
|
}
|
||||||
|
|
||||||
|
if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one)
|
||||||
|
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
|
||||||
|
|
||||||
|
foreach($this->tva as $tvakey => $tvaval) {
|
||||||
|
$this->tva[$tvakey]=$tvaval * $coef_fix_tva;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
foreach($this->tva as $tvakey => $tvaval)
|
foreach($this->tva as $tvakey => $tvaval)
|
||||||
{
|
{
|
||||||
if ($tvakey != 0) // On affiche pas taux 0
|
if ($tvakey != 0) // On affiche pas taux 0
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -96,12 +96,14 @@ class modFournisseur extends DolibarrModules
|
|||||||
$this->const[$r][4] = 0;
|
$this->const[$r][4] = 0;
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
|
/* For supplier invoice, we must not have default pdf template on. In most cases, we need to join PDF from supplier, not have a document generated.
|
||||||
$this->const[$r][0] = "INVOICE_SUPPLIER_ADDON_PDF";
|
$this->const[$r][0] = "INVOICE_SUPPLIER_ADDON_PDF";
|
||||||
$this->const[$r][1] = "chaine";
|
$this->const[$r][1] = "chaine";
|
||||||
$this->const[$r][2] = "canelle";
|
$this->const[$r][2] = "canelle";
|
||||||
$this->const[$r][3] = 'Nom du gestionnaire de generation des factures fournisseur en PDF';
|
$this->const[$r][3] = 'Nom du gestionnaire de generation des factures fournisseur en PDF';
|
||||||
$this->const[$r][4] = 0;
|
$this->const[$r][4] = 0;
|
||||||
$r++;
|
$r++;
|
||||||
|
*/
|
||||||
|
|
||||||
$this->const[$r][0] = "INVOICE_SUPPLIER_ADDON_NUMBER";
|
$this->const[$r][0] = "INVOICE_SUPPLIER_ADDON_NUMBER";
|
||||||
$this->const[$r][1] = "chaine";
|
$this->const[$r][1] = "chaine";
|
||||||
|
|||||||
@ -159,7 +159,7 @@ class modProduct extends DolibarrModules
|
|||||||
$this->export_label[$r]="Products"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
$this->export_label[$r]="Products"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||||
$this->export_permission[$r]=array(array("produit","export"));
|
$this->export_permission[$r]=array(array("produit","export"));
|
||||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
|
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification');
|
||||||
if ($mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
|
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
|
||||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
|
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices'));
|
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices'));
|
||||||
@ -203,7 +203,7 @@ class modProduct extends DolibarrModules
|
|||||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||||
'pr.date_price'=>'DateCreation');
|
'pr.date_price'=>'DateCreation');
|
||||||
if ($mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
||||||
//$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
|
//$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
|
||||||
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
|
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
|
||||||
'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product",
|
'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product",
|
||||||
@ -262,7 +262,7 @@ class modProduct extends DolibarrModules
|
|||||||
$this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation');
|
$this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation');
|
||||||
if (! empty($conf->stock->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
if (! empty($conf->stock->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.cost_price'=>'CostPrice'));
|
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.cost_price'=>'CostPrice'));
|
||||||
if ($mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.recuperableonly'=>'NPR'));
|
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.recuperableonly'=>'NPR'));
|
||||||
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
|
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||||
// Add extra fields
|
// Add extra fields
|
||||||
$import_extrafield_sample=array();
|
$import_extrafield_sample=array();
|
||||||
@ -331,7 +331,7 @@ class modProduct extends DolibarrModules
|
|||||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||||
'pr.date_price'=>'DateCreation*');
|
'pr.date_price'=>'DateCreation*');
|
||||||
if ($mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('pr.recuperableonly'=>'NPR'));
|
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('pr.recuperableonly'=>'NPR'));
|
||||||
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$');
|
$this->import_regex_array[$r]=array('pr.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','pr.recuperableonly'=>'^[0|1]$');
|
||||||
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
|
$this->import_examplevalues_array[$r]=array('pr.fk_product'=>"1",
|
||||||
'pr.price_base_type'=>"HT",'pr.price_level'=>"1",
|
'pr.price_base_type'=>"HT",'pr.price_level'=>"1",
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class modSalaries extends DolibarrModules
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->numero = 510;
|
$this->numero = 510; // Perms from 501..519
|
||||||
|
|
||||||
$this->family = "hr";
|
$this->family = "hr";
|
||||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||||
@ -97,7 +97,7 @@ class modSalaries extends DolibarrModules
|
|||||||
$r=0;
|
$r=0;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 511;
|
$this->rights[$r][0] = 501;
|
||||||
$this->rights[$r][1] = 'Read employee contracts/salaries';
|
$this->rights[$r][1] = 'Read employee contracts/salaries';
|
||||||
$this->rights[$r][2] = 'r';
|
$this->rights[$r][2] = 'r';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
@ -105,7 +105,7 @@ class modSalaries extends DolibarrModules
|
|||||||
$this->rights[$r][5] = '';
|
$this->rights[$r][5] = '';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 512;
|
$this->rights[$r][0] = 502;
|
||||||
$this->rights[$r][1] = 'Create/modify employee contracts/salaries';
|
$this->rights[$r][1] = 'Create/modify employee contracts/salaries';
|
||||||
$this->rights[$r][2] = 'w';
|
$this->rights[$r][2] = 'w';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
@ -113,12 +113,20 @@ class modSalaries extends DolibarrModules
|
|||||||
$this->rights[$r][5] = '';
|
$this->rights[$r][5] = '';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 513;
|
$this->rights[$r][0] = 511;
|
||||||
|
$this->rights[$r][1] = 'Read payment of salaries';
|
||||||
|
$this->rights[$r][2] = 'w';
|
||||||
|
$this->rights[$r][3] = 0;
|
||||||
|
$this->rights[$r][4] = 'payment';
|
||||||
|
$this->rights[$r][5] = 'read';
|
||||||
|
|
||||||
|
$r++;
|
||||||
|
$this->rights[$r][0] = 512;
|
||||||
$this->rights[$r][1] = 'Create/modify payment of salaries';
|
$this->rights[$r][1] = 'Create/modify payment of salaries';
|
||||||
$this->rights[$r][2] = 'w';
|
$this->rights[$r][2] = 'w';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[$r][4] = 'write';
|
$this->rights[$r][4] = 'payment';
|
||||||
$this->rights[$r][5] = '';
|
$this->rights[$r][5] = 'write';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 514;
|
$this->rights[$r][0] = 514;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user