Debug accounting module

This commit is contained in:
Laurent Destailleur 2016-10-07 12:10:16 +02:00
parent 77e87b3c07
commit 6489cd6164
5 changed files with 69 additions and 47 deletions

View File

@ -22,9 +22,8 @@
* \ingroup Advanced accountancy
* \brief List accounting account
*/
require '../../main.inc.php';
// Class
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
@ -35,6 +34,7 @@ $langs->load("accountancy");
$mesg = '';
$action = GETPOST('action');
$cancel = GETPOST('cancel');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$search_account = GETPOST("search_account");
@ -80,34 +80,39 @@ $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');
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 (empty($reshook))
{
$search_account = "";
$search_label = "";
$search_accountparent = "";
$search_pcgtype = "";
$search_pcgsubtype = "";
}
if ($action == 'disable') {
if ($accounting->fetch($id)) {
$result = $accounting->account_desactivate($id);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} else if ($action == 'enable') {
if ($accounting->fetch($id)) {
$result = $accounting->account_activate($id);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
if (! empty($cancel)) $action = '';
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
{
$search_account = "";
$search_label = "";
$search_accountparent = "";
$search_pcgtype = "";
$search_pcgsubtype = "";
}
if ($action == 'disable') {
if ($accounting->fetch($id)) {
$result = $accounting->account_desactivate($id);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} else if ($action == 'enable') {
if ($accounting->fetch($id)) {
$result = $accounting->account_activate($id);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}
}

View File

@ -22,9 +22,8 @@
* \ingroup Advanced accountancy
* \brief Card of accounting account
*/
require '../../main.inc.php';
// Class
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
@ -47,7 +46,11 @@ $cancel = GETPOST('cancel');
$object = new AccountingAccount($db);
// Action
/*
* Action
*/
if ($action == 'add' && $user->rights->accounting->chartofaccount)
{
if (! $cancel) {
@ -85,18 +88,28 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
$object->active = 1;
$res = $object->create($user);
if ($res == - 3) {
$error = 1;
$action = "create";
setEventMessages($object->error, $object->errors, 'errors');
}
if ($res == - 4) {
elseif ($res == - 4) {
$error = 2;
$action = "create";
setEventMessages($object->error, $object->errors, 'errors');
}
elseif ($res < 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$action = "create";
}
if (! $error)
{
header("Location: account.php");
exit;
}
}
header("Location: account.php");
exit;
} else if ($action == 'edit' && $user->rights->accounting->chartofaccount) {
if (! $cancel) {
$result = $object->fetch($id);

View File

@ -172,16 +172,15 @@ class AccountingAccount extends CommonObject
$sql .= " '" . $this->db->idate($now) . "'";
$sql .= ", " . $conf->entity;
$sql .= ", " . (! isset($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
$sql .= ", " . (! isset($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
$sql .= ", " . (! isset($this->pcg_subtype) ? 'NULL' : "'" . $this->pcg_subtype . "'");
$sql .= ", " . (! isset($this->account_number) ? 'NULL' : "'" . $this->account_number . "'");
$sql .= ", " . (! isset($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
$sql .= ", " . (! isset($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
$sql .= ", " . (! isset($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->pcg_subtype . "'");
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->account_number . "'");
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
$sql .= ", " . $user->id;
$sql .= ", " . (! isset($this->active) ? 'NULL' : "'" . $this->db->escape($this->active) . "'");
$sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active));
$sql .= ")";
$this->db->begin();

View File

@ -396,6 +396,11 @@ class SMTPs
$host=$this->getHost();
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
if (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS))
{
$host=preg_replace('@tls://@i','',$host); // Remove prefix
$host='tls://'.$host;
}
if ( $_retVal = $this->socket_send_str('EHLO ' . $host, '250') )
{
if (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS))

View File

@ -16,8 +16,8 @@ BackToChartofaccounts=Return chart of accounts
AccountancyArea=Accountancy area
AccountancyAreaDescIntro=Usage of the accountancy module is done in several step:
AccountancyAreaDescActionOnce=The following action are usually executed one time only, or once per year...
AccountancyAreaDescActionFreq=The following action are usually executed every month, week or day for very large companies...
AccountancyAreaDescActionOnce=The following actions are usually executed one time only, or once per year...
AccountancyAreaDescActionFreq=The following actions are usually executed every month, week or day for very large companies...
AccountancyAreaDescChart=STEP %s: Create or check your chart of account from menu %s
AccountancyAreaDescProd=STEP %s: Check the binding between products/services and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on your invoice lines.<br>For this you can use the menu entry %s.
AccountancyAreaDescBank=STEP %s: Check the binding between bank accounts and accounting account is done. Complete missing bindings. This will save you time in future for the next steps by suggesting you the correct default accounting account on your payment lines.<br>For this, go on the card of each financial account. You can start from page %s.