Fix : Sql error on salaries index for accountancy multijournal + debug
This commit is contained in:
parent
169e63d49a
commit
143c019905
@ -101,7 +101,8 @@ if ($action == 'add')
|
||||
|
||||
$account_number = GETPOST('account_number','alpha');
|
||||
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
||||
$object->fk_accountancy_journal = trim($_POST["fk_accountancy_journal"]);
|
||||
$fk_accountancy_journal = GETPOST('fk_accountancy_journal','int');
|
||||
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
|
||||
|
||||
$object->solde = $_POST["solde"];
|
||||
$object->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
|
||||
@ -199,7 +200,8 @@ if ($action == 'update')
|
||||
|
||||
$account_number = GETPOST('account_number', 'int');
|
||||
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
||||
$object->fk_accountancy_journal = trim($_POST["fk_accountancy_journal"]);
|
||||
$fk_accountancy_journal = GETPOST('fk_accountancy_journal','int');
|
||||
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
|
||||
|
||||
$object->currency_code = trim($_POST["account_currency_code"]);
|
||||
|
||||
@ -502,35 +504,20 @@ if ($action == 'create')
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Accountancy code
|
||||
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($object->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$object->account_number).'"></td></tr>';
|
||||
}
|
||||
$fieldrequired='';
|
||||
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) $fieldrequired='fieldrequired ';
|
||||
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($object->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($object->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$object->account_number).'"></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$object->account_number).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy journal
|
||||
@ -538,7 +525,7 @@ if ($action == 'create')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy2->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 1, 1);
|
||||
print $formaccountancy2->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 0, 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -994,7 +981,7 @@ else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy2->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 1, 1);
|
||||
print $formaccountancy2->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 0, 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -1259,7 +1259,7 @@ class Account extends CommonObject
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
$langs->load("accountancy");
|
||||
$label .= '<br><b>' . $langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number);
|
||||
$label .= '<br><b>' . $langs->trans('AccountancyJournal') . ':</b> ' . $this->fk_accountancy_journal;
|
||||
$label .= '<br><b>' . $langs->trans('AccountancyJournal') . ':</b> ' . $this->accountancy_journal;
|
||||
}
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("salaries");
|
||||
@ -94,7 +95,7 @@ $accountstatic = new Account($db);
|
||||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc,";
|
||||
$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.datev as datev, s.fk_typepayment as type, s.num_payment, s.fk_bank,";
|
||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel,";
|
||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
|
||||
$sql.= " pst.code as payment_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id";
|
||||
@ -236,8 +237,16 @@ if ($result)
|
||||
$accountstatic->id=$obj->bid;
|
||||
$accountstatic->ref=$obj->bref;
|
||||
$accountstatic->number=$obj->bnumber;
|
||||
$accountstatic->accountancy_number=$obj->account_number;
|
||||
$accountstatic->accountancy_journal=$obj->accountancy_journal;
|
||||
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountstatic->account_number=$obj->account_number;
|
||||
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($obj->fk_accountancy_journal);
|
||||
|
||||
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||
}
|
||||
$accountstatic->label=$obj->blabel;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -121,7 +121,7 @@ class FormAccounting extends Form
|
||||
}
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $select, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user