Patch Accounting Expert module
This commit is contained in:
parent
e4f51d8f7a
commit
9d08f4c5f5
@ -22,21 +22,12 @@
|
|||||||
* \brief List accounting account
|
* \brief List accounting account
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Dolibarr environment
|
require '../../main.inc.php';
|
||||||
$res = @include ("../main.inc.php");
|
|
||||||
if (! $res && file_exists("../main.inc.php"))
|
|
||||||
$res = @include ("../main.inc.php");
|
|
||||||
if (! $res && file_exists("../../main.inc.php"))
|
|
||||||
$res = @include ("../../main.inc.php");
|
|
||||||
if (! $res && file_exists("../../../main.inc.php"))
|
|
||||||
$res = @include ("../../../main.inc.php");
|
|
||||||
if (! $res)
|
|
||||||
die("Include of main fails");
|
|
||||||
|
|
||||||
// Class
|
// Class
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
dol_include_once("/accountancy/class/accountingaccount.class.php");
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||||
dol_include_once("/accountancy/class/html.formventilation.class.php");
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
|
|||||||
@ -22,20 +22,12 @@
|
|||||||
* \ingroup Accounting Expert
|
* \ingroup Accounting Expert
|
||||||
* \brief Card accounting account
|
* \brief Card accounting account
|
||||||
*/
|
*/
|
||||||
$res = @include ("../main.inc.php");
|
require '../../main.inc.php';
|
||||||
if (! $res && file_exists("../main.inc.php"))
|
|
||||||
$res = @include ("../main.inc.php");
|
|
||||||
if (! $res && file_exists("../../main.inc.php"))
|
|
||||||
$res = @include ("../../main.inc.php");
|
|
||||||
if (! $res && file_exists("../../../main.inc.php"))
|
|
||||||
$res = @include ("../../../main.inc.php");
|
|
||||||
if (! $res)
|
|
||||||
die("Include of main fails");
|
|
||||||
|
|
||||||
// Class
|
// Class
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
dol_include_once("/accountancy/class/accountingaccount.class.php");
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||||
dol_include_once("/accountancy/class/html.formventilation.class.php");
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
@ -53,7 +45,8 @@ if (!$user->admin)
|
|||||||
$accounting = new AccountingAccount($db);
|
$accounting = new AccountingAccount($db);
|
||||||
|
|
||||||
// Action
|
// Action
|
||||||
if ($action == 'add') {
|
if ($action == 'add')
|
||||||
|
{
|
||||||
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
|
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
|
||||||
|
|
||||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||||
@ -82,7 +75,9 @@ if ($action == 'add') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Header("Location: account.php");
|
Header("Location: account.php");
|
||||||
} elseif ($action == 'edit') {
|
}
|
||||||
|
else if ($action == 'edit')
|
||||||
|
{
|
||||||
if (! GETPOST('cancel', 'alpha')) {
|
if (! GETPOST('cancel', 'alpha')) {
|
||||||
$result = $accounting->fetch($id);
|
$result = $accounting->fetch($id);
|
||||||
|
|
||||||
@ -111,8 +106,9 @@ if ($action == 'add') {
|
|||||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
} else if ($action == 'delete') {
|
}
|
||||||
|
else if ($action == 'delete')
|
||||||
|
{
|
||||||
$result = $accounting->fetch($id);
|
$result = $accounting->fetch($id);
|
||||||
|
|
||||||
if (! empty($accounting->id)) {
|
if (! empty($accounting->id)) {
|
||||||
@ -137,7 +133,8 @@ llxheader('', $langs->trans('AccountAccounting'));
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$htmlacc = new FormVentilation($db);
|
$htmlacc = new FormVentilation($db);
|
||||||
|
|
||||||
if ($action == 'create') {
|
if ($action == 'create')
|
||||||
|
{
|
||||||
print_fiche_titre($langs->trans('NewAccount'));
|
print_fiche_titre($langs->trans('NewAccount'));
|
||||||
|
|
||||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||||
@ -169,16 +166,19 @@ if ($action == 'create') {
|
|||||||
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '"></center';
|
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '"></center';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else if ($id) {
|
}
|
||||||
|
else if ($id)
|
||||||
|
{
|
||||||
$rowid = $id;
|
$rowid = $id;
|
||||||
$account = $accounting->fetch($rowid);
|
$account = $accounting->fetch($rowid);
|
||||||
|
|
||||||
if ($account > 0) {
|
if ($account > 0) {
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
$head = account_prepare_head($accounting);
|
$head = accounting_prepare_head($accounting);
|
||||||
|
|
||||||
if ($action == 'update') {
|
if ($action == 'update')
|
||||||
|
{
|
||||||
// WYSIWYG Editor
|
// WYSIWYG Editor
|
||||||
$htmlacc = new FormVentilation($db);
|
$htmlacc = new FormVentilation($db);
|
||||||
|
|
||||||
@ -224,7 +224,9 @@ if ($action == 'create') {
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
|
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||||
@ -268,8 +270,8 @@ if ($action == 'create') {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Barre d'actions
|
* Barre d'actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
@ -287,7 +289,9 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,7 @@ $form = new Form($db);
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans('ConfigAccountingExpert'));
|
print_fiche_titre($langs->trans('ConfigAccountingExpert'));
|
||||||
|
|
||||||
$head = admin_account_prepare_head(null);
|
$head = admin_accounting_prepare_head(null);
|
||||||
|
|
||||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron');
|
dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron');
|
||||||
|
|
||||||
|
|||||||
@ -26,19 +26,10 @@
|
|||||||
* \brief Setup page to configure accounting expert module
|
* \brief Setup page to configure accounting expert module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Dolibarr environment
|
require '../../main.inc.php';
|
||||||
$res = @include ("../main.inc.php");
|
|
||||||
if (! $res && file_exists("../main.inc.php"))
|
|
||||||
$res = @include ("../main.inc.php");
|
|
||||||
if (! $res && file_exists("../../main.inc.php"))
|
|
||||||
$res = @include ("../../main.inc.php");
|
|
||||||
if (! $res && file_exists("../../../main.inc.php"))
|
|
||||||
$res = @include ("../../../main.inc.php");
|
|
||||||
if (! $res)
|
|
||||||
die("Include of main fails");
|
|
||||||
|
|
||||||
// Class
|
// Class
|
||||||
dol_include_once("/core/lib/admin.lib.php");
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -157,7 +148,7 @@ $form = new Form($db);
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans('ConfigAccountingExpert'));
|
print_fiche_titre($langs->trans('ConfigAccountingExpert'));
|
||||||
|
|
||||||
$head = admin_account_prepare_head($accounting);
|
$head = admin_accounting_prepare_head($accounting);
|
||||||
|
|
||||||
dol_fiche_head($head, 'general', $langs->trans("Configuration"), 0, 'cron');
|
dol_fiche_head($head, 'general', $langs->trans("Configuration"), 0, 'cron');
|
||||||
|
|
||||||
@ -264,6 +255,7 @@ foreach ($list as $key)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$var = ! $var;
|
||||||
print "<tr " . $bc[$var] . ">";
|
print "<tr " . $bc[$var] . ">";
|
||||||
print '<td width="80%">' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . '</td>';
|
print '<td width="80%">' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . '</td>';
|
||||||
if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
|
if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
|
||||||
@ -277,6 +269,7 @@ if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
|
|||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
$var = ! $var;
|
||||||
print "<tr " . $bc[$var] . ">";
|
print "<tr " . $bc[$var] . ">";
|
||||||
print '<td width="80%">' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . '</td>';
|
print '<td width="80%">' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . '</td>';
|
||||||
if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
|
if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
|
||||||
|
|||||||
@ -91,7 +91,7 @@ $form = new Form($db);
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans('ConfigAccountingExpert'));
|
print_fiche_titre($langs->trans('ConfigAccountingExpert'));
|
||||||
|
|
||||||
$head = admin_account_prepare_head(null);
|
$head = admin_accounting_prepare_head(null);
|
||||||
|
|
||||||
dol_fiche_head($head, 'journal', $langs->trans("Configuration"), 0, 'cron');
|
dol_fiche_head($head, 'journal', $langs->trans("Configuration"), 0, 'cron');
|
||||||
|
|
||||||
|
|||||||
@ -43,11 +43,12 @@ class AccountingAccount
|
|||||||
var $active;
|
var $active;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* Constructor
|
||||||
* \param DB handler acces base de donnees
|
*
|
||||||
* \param id id compte (0 par defaut)
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db, $rowid = '') {
|
function __construct($db, $rowid = '')
|
||||||
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
if ($rowid != '')
|
if ($rowid != '')
|
||||||
@ -57,7 +58,8 @@ class AccountingAccount
|
|||||||
/**
|
/**
|
||||||
* \brief Load record in memory
|
* \brief Load record in memory
|
||||||
*/
|
*/
|
||||||
function fetch($rowid = null, $account_number = null) {
|
function fetch($rowid = null, $account_number = null)
|
||||||
|
{
|
||||||
if ($rowid || $account_number) {
|
if ($rowid || $account_number) {
|
||||||
$sql = "SELECT * FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE ";
|
$sql = "SELECT * FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE ";
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
@ -96,7 +98,8 @@ class AccountingAccount
|
|||||||
* \brief insert line in accountingaccount
|
* \brief insert line in accountingaccount
|
||||||
* \param user utilisateur qui effectue l'insertion
|
* \param user utilisateur qui effectue l'insertion
|
||||||
*/
|
*/
|
||||||
function create($user, $notrigger = 0) {
|
function create($user, $notrigger = 0)
|
||||||
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
@ -195,7 +198,8 @@ class AccountingAccount
|
|||||||
* @param User $user update
|
* @param User $user update
|
||||||
* @return int if KO, >0 if OK
|
* @return int if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user) {
|
function update($user)
|
||||||
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -230,7 +234,8 @@ class AccountingAccount
|
|||||||
* @param User $user update
|
* @param User $user update
|
||||||
* @return int if KO, >0 if OK
|
* @return int if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function checkUsage() {
|
function checkUsage()
|
||||||
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
|
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
|
||||||
@ -259,11 +264,12 @@ class AccountingAccount
|
|||||||
/**
|
/**
|
||||||
* Delete object in database
|
* Delete object in database
|
||||||
*
|
*
|
||||||
* @param User $user that deletes
|
* @param User $user User object of making delete
|
||||||
* @param int $notrigger triggers after, 1=disable triggers
|
* @param int $notrigger 1=Disable all triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger = 0) {
|
function delete($user, $notrigger = 0)
|
||||||
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
@ -281,7 +287,7 @@ class AccountingAccount
|
|||||||
// // Call triggers
|
// // Call triggers
|
||||||
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
// $interface=new Interfaces($this->db);
|
// $interface=new Interfaces($this->db);
|
||||||
// $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
// $result=$interface->run_triggers('ACCOUNTANCY_ACOUNT_DELETE',$this,$user,$langs,$conf);
|
||||||
// if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
// if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
// // End call triggers
|
// // End call triggers
|
||||||
}
|
}
|
||||||
@ -322,7 +328,8 @@ class AccountingAccount
|
|||||||
* @param int $id of record
|
* @param int $id of record
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function info($id) {
|
function info($id)
|
||||||
|
{
|
||||||
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
|
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as a';
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as a';
|
||||||
$sql .= ' WHERE a.rowid = ' . $id;
|
$sql .= ' WHERE a.rowid = ' . $id;
|
||||||
@ -359,7 +366,8 @@ class AccountingAccount
|
|||||||
* @param User $user update
|
* @param User $user update
|
||||||
* @return int if KO, >0 if OK
|
* @return int if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function account_desactivate($id) {
|
function account_desactivate($id)
|
||||||
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$result = $this->checkUsage();
|
$result = $this->checkUsage();
|
||||||
@ -393,7 +401,8 @@ class AccountingAccount
|
|||||||
* @param User $user update
|
* @param User $user update
|
||||||
* @return int if KO, >0 if OK
|
* @return int if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function account_activate($id) {
|
function account_activate($id)
|
||||||
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|||||||
@ -501,7 +501,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto,1);
|
$newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto,1);
|
||||||
$newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1);
|
$newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1);
|
||||||
$newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1);
|
$newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1);
|
||||||
$newmenu->add("/accountancy/admin/account.php?mainmenu=home", $langs->trans("Chartofaccounts"),1);
|
|
||||||
$newmenu->add("/admin/fiscalyear.php?mainmenu=home", $langs->trans("Fiscalyear"),1);
|
$newmenu->add("/admin/fiscalyear.php?mainmenu=home", $langs->trans("Fiscalyear"),1);
|
||||||
if (! in_array($langs->defaultlang,array('en_US','en_GB','en_NZ','en_AU','fr_FR','fr_BE','es_ES','ca_ES')))
|
if (! in_array($langs->defaultlang,array('en_US','en_GB','en_NZ','en_AU','fr_FR','fr_BE','es_ES','ca_ES')))
|
||||||
{
|
{
|
||||||
@ -515,6 +514,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
|
$newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
|
||||||
$newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
|
$newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
|
||||||
$newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"),1);
|
$newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"),1);
|
||||||
|
if (! empty($conf->accounting->enabled)) $newmenu->add("/accountancy/admin/account.php?mainmenu=home", $langs->trans("Chartofaccounts"),1);
|
||||||
$newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
|
$newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user