Debug for expert accounting module
This commit is contained in:
parent
a83a291856
commit
55e904bc01
@ -1,31 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
*
|
* Copyright (C) 2016 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* it under the terms of the GNU General Public License as published by
|
||||||
* (at your option) any later version.
|
* 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
|
* This program is distributed in the hope that it will be useful,
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* GNU General Public License for more details.
|
* 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/>.
|
* You should have received a copy of the GNU General Public License
|
||||||
*
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/admin/journal.php
|
* \file htdocs/accountancy/admin/journal.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Setup page to configure accounting expert module
|
* \brief Setup page to configure accounting expert module
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
// Class
|
// Class
|
||||||
@ -48,24 +49,44 @@ $list = array (
|
|||||||
'ACCOUNTING_PURCHASE_JOURNAL',
|
'ACCOUNTING_PURCHASE_JOURNAL',
|
||||||
'ACCOUNTING_SOCIAL_JOURNAL',
|
'ACCOUNTING_SOCIAL_JOURNAL',
|
||||||
'ACCOUNTING_MISCELLANEOUS_JOURNAL',
|
'ACCOUNTING_MISCELLANEOUS_JOURNAL',
|
||||||
'ACCOUNTING_EXPENSEREPORT_JOURNAL'
|
'ACCOUNTING_EXPENSEREPORT_JOURNAL'
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
foreach ( $list as $constname ) {
|
// Save vars
|
||||||
|
foreach ($list as $constname)
|
||||||
|
{
|
||||||
$constvalue = GETPOST($constname, 'alpha');
|
$constvalue = GETPOST($constname, 'alpha');
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save bank account journals
|
||||||
|
$arrayofbankaccount = GETPOST('bank_account', 'array');
|
||||||
|
foreach($arrayofbankaccount as $key => $code)
|
||||||
|
{
|
||||||
|
$bankaccount = new Account($db);
|
||||||
|
$res = $bankaccount->fetch($key);
|
||||||
|
if ($res > 0)
|
||||||
|
{
|
||||||
|
$bankaccount->accountancy_journal = $code;
|
||||||
|
$bankaccount->update($user);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
@ -75,7 +96,7 @@ if ($action == 'update') {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
@ -99,13 +120,13 @@ print "</tr>\n";
|
|||||||
|
|
||||||
foreach ( $list as $key ) {
|
foreach ( $list as $key ) {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
print '<tr ' . $bc[$var] . ' class="value">';
|
print '<tr ' . $bc[$var] . ' class="value">';
|
||||||
|
|
||||||
// Param
|
// Param
|
||||||
$label = $langs->trans($key);
|
$label = $langs->trans($key);
|
||||||
print '<td width="50%"><label for="' . $key . '">' . $label . '</label></td>';
|
print '<td width="50%"><label for="' . $key . '">' . $label . '</label></td>';
|
||||||
|
|
||||||
// Value
|
// Value
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
|
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||||
@ -118,11 +139,11 @@ print '<br>';
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="3">' . $langs->trans('JournalFinancial') . '</td>';
|
print '<td colspan="3">' . $langs->trans('JournalFinancial') . ' ('.$langs->trans('Opened').')</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Bank account
|
// Bank account
|
||||||
$sql = "SELECT rowid, label, accountancy_journal";
|
$sql = "SELECT rowid, label, number, accountancy_journal";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_account";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_account";
|
||||||
$sql .= " WHERE entity = " . $conf->entity;
|
$sql .= " WHERE entity = " . $conf->entity;
|
||||||
$sql .= " AND clos = 0";
|
$sql .= " AND clos = 0";
|
||||||
@ -132,29 +153,41 @@ $resql = $db->query($sql);
|
|||||||
if ($resql) {
|
if ($resql) {
|
||||||
$numr = $db->num_rows($resql);
|
$numr = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ($numr > 0)
|
if ($numr > 0)
|
||||||
|
|
||||||
while ( $i < $numr ) {
|
$bankaccountstatic=new Account($db);
|
||||||
$objp = $db->fetch_object($resql);
|
|
||||||
|
while ( $i < $numr ) {
|
||||||
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
print '<tr ' . $bc[$var] . ' class="value">';
|
$bankaccountstatic->id = $objp->rowid;
|
||||||
|
$bankaccountstatic->label = $objp->label;
|
||||||
|
$bankaccountstatic->number = $objp->number;
|
||||||
|
$bankaccountstatic->accountancy_journal = $objp->accountancy_journal;
|
||||||
|
|
||||||
// Param
|
print '<tr ' . $bc[$var] . ' class="value">';
|
||||||
print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal") . ' - ' . $objp->label . '</label></td>';
|
|
||||||
|
|
||||||
// Value
|
// Param
|
||||||
print '<td>';
|
print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal");
|
||||||
print '<input type="text" size="20" id="' . $objp->rowid . '" name="' . $objp->label . '" value="' . $objp->accountancy_journal . '" disabled>';
|
print ' - '.$bankaccountstatic->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</label></td>';
|
||||||
|
|
||||||
$i ++;
|
// Value
|
||||||
}
|
print '<td>';
|
||||||
} else
|
print '<input type="text" size="20" id="' . $objp->rowid . '" name="bank_account['.$objp->rowid.']" value="' . $objp->accountancy_journal . '">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
$i ++;
|
||||||
|
}
|
||||||
|
$db->free($resql);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
$db->free($resql);
|
}
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ top_htmlhead('','',0,0,'',$arrayofcss);
|
|||||||
<div class="conteneur_img_droite">
|
<div class="conteneur_img_droite">
|
||||||
|
|
||||||
<div class="menu_principal hideonsmartphone">
|
<div class="menu_principal hideonsmartphone">
|
||||||
<div class="logo"><?php print '<img class="logopos" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?></div>
|
<div class="logo"><?php print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="contenu">
|
<div class="contenu">
|
||||||
|
|||||||
@ -308,7 +308,7 @@ if ($resql)
|
|||||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre("");
|
print_liste_field_titre("");
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -37,26 +37,26 @@ function admin_accounting_prepare_head(AccountingAccount $object=null)
|
|||||||
$head = array ();
|
$head = array ();
|
||||||
|
|
||||||
$head[$h][0] = dol_buildpath('/accountancy/admin/index.php', 1);
|
$head[$h][0] = dol_buildpath('/accountancy/admin/index.php', 1);
|
||||||
$head[$h][1] = $langs->trans("Configuration");
|
$head[$h][1] = $langs->trans("Miscellaneous");
|
||||||
$head[$h][2] = 'general';
|
$head[$h][2] = 'general';
|
||||||
$h ++;
|
$h ++;
|
||||||
|
|
||||||
// Show more tabs from modules
|
|
||||||
// Entries must be declared in modules descriptor with line
|
|
||||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
|
||||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin');
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/journal.php';
|
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/journal.php';
|
||||||
$head[$h][1] = $langs->trans("Journaux");
|
$head[$h][1] = $langs->trans("Journaux");
|
||||||
$head[$h][2] = 'journal';
|
$head[$h][2] = 'journal';
|
||||||
$h ++;
|
$h ++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/export.php';
|
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/export.php';
|
||||||
$head[$h][1] = $langs->trans("Export");
|
$head[$h][1] = $langs->trans("ExportOptions");
|
||||||
$head[$h][2] = 'export';
|
$head[$h][2] = 'export';
|
||||||
$h ++;
|
$h ++;
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// Entries must be declared in modules descriptor with line
|
||||||
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin');
|
||||||
|
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin', 'remove');
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin', 'remove');
|
||||||
|
|
||||||
return $head;
|
return $head;
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.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>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -50,7 +51,7 @@ class modAccounting extends DolibarrModules
|
|||||||
$this->description = "Advanced accounting management";
|
$this->description = "Advanced accounting management";
|
||||||
|
|
||||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||||
$this->version = 'development';
|
$this->version = 'experimental';
|
||||||
|
|
||||||
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
|
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
|
||||||
$this->special = 0;
|
$this->special = 0;
|
||||||
|
|||||||
@ -8,6 +8,7 @@ Calendar=Calendar
|
|||||||
Calendars=Calendars
|
Calendars=Calendars
|
||||||
LocalAgenda=Internal calendar
|
LocalAgenda=Internal calendar
|
||||||
ActionsOwnedBy=Event owned by
|
ActionsOwnedBy=Event owned by
|
||||||
|
ActionsOwnedByShort=Owner
|
||||||
AffectedTo=Assigned to
|
AffectedTo=Assigned to
|
||||||
DoneBy=Done by
|
DoneBy=Done by
|
||||||
Event=Event
|
Event=Event
|
||||||
|
|||||||
@ -84,14 +84,14 @@ if (empty($reshook))
|
|||||||
if ($action == 'close')
|
if ($action == 'close')
|
||||||
{
|
{
|
||||||
$object->status = Opensurveysondage::STATUS_CLOSED;
|
$object->status = Opensurveysondage::STATUS_CLOSED;
|
||||||
$object->update();
|
$object->update($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reopend
|
// Reopend
|
||||||
if ($action == 'reopen')
|
if ($action == 'reopen')
|
||||||
{
|
{
|
||||||
$object->status = Opensurveysondage::STATUS_VALIDATED;
|
$object->status = Opensurveysondage::STATUS_VALIDATED;
|
||||||
$object->update();
|
$object->update($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
|||||||
@ -275,7 +275,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user=null, $notrigger=0)
|
function update($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user