Fix: debug of accountancy module

This commit is contained in:
Laurent Destailleur 2014-09-09 09:46:57 +02:00
parent 2fb806bfc2
commit 9e2a0cb671
8 changed files with 201 additions and 196 deletions

View File

@ -16,12 +16,12 @@
*/ */
/** /**
* \file htdocs/admin/fiscalyear.php * \file htdocs/accountancy/admin/fiscalyear.php
* \ingroup fiscal year * \ingroup fiscal year
* \brief Setup page to configure fiscal year * \brief Setup page to configure fiscal year
*/ */
require '../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
@ -55,6 +55,8 @@ $object = new Fiscalyear($db);
* View * View
*/ */
$max=100;
$form = new Form($db); $form = new Form($db);
llxHeader('',$title); llxHeader('',$title);
@ -68,16 +70,13 @@ $sql.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f";
$sql.= " WHERE f.entity = ".$conf->entity; $sql.= " WHERE f.entity = ".$conf->entity;
$result = $db->query($sql); $result = $db->query($sql);
$max=10;
if ($result) if ($result)
{ {
$var=false; $var=false;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
// Load attribute_label // Load attribute_label
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -85,13 +84,13 @@ if ($result)
print '<td>'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("DateStart").'</td>'; print '<td>'.$langs->trans("DateStart").'</td>';
print '<td>'.$langs->trans("DateEnd").'</td>'; print '<td>'.$langs->trans("DateEnd").'</td>';
print '<td>'.$langs->trans("Statut").'</td>'; print '<td align="right">'.$langs->trans("Statut").'</td>';
print '</tr>'; print '</tr>';
if ($num) if ($num)
{ {
$fiscalyearstatic=new Fiscalyear($db); $fiscalyearstatic=new Fiscalyear($db);
while ($i < $num && $i < $max) while ($i < $num && $i < $max)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
@ -102,7 +101,7 @@ if ($result)
print '<td align="left">'.$obj->label.'</td>'; print '<td align="left">'.$obj->label.'</td>';
print '<td align="left">'.dol_print_date($db->jdate($obj->date_start),'day').'</td>'; print '<td align="left">'.dol_print_date($db->jdate($obj->date_start),'day').'</td>';
print '<td align="left">'.dol_print_date($db->jdate($obj->date_end),'day').'</td>'; print '<td align="left">'.dol_print_date($db->jdate($obj->date_end),'day').'</td>';
print '<td>'.$fiscalyearstatic->LibStatut($obj->statut,5).'</td>'; print '<td align="right">'.$fiscalyearstatic->LibStatut($obj->statut,5).'</td>';
print '</tr>'; print '</tr>';
$var=!$var; $var=!$var;
$i++; $i++;
@ -113,10 +112,9 @@ if ($result)
{ {
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>'; print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
} }
print '</table>'; print '</table>';
print '</form>'; }
}
else else
{ {
dol_print_error($db); dol_print_error($db);

View File

@ -16,11 +16,11 @@
*/ */
/** /**
* \file htdocs/admin/fiscalyear_card.php * \file htdocs/accountancy/admin/fiscalyear_card.php
* \brief Page to show a fiscal year * \brief Page to show a fiscal year
*/ */
require '../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
@ -51,6 +51,7 @@ $object = new Fiscalyear($db);
$date_start=dol_mktime(0,0,0,GETPOST('fiscalyearmonth','int'),GETPOST('fiscalyearday','int'),GETPOST('fiscalyearyear','int')); $date_start=dol_mktime(0,0,0,GETPOST('fiscalyearmonth','int'),GETPOST('fiscalyearday','int'),GETPOST('fiscalyearyear','int'));
$date_end=dol_mktime(0,0,0,GETPOST('fiscalyearendmonth','int'),GETPOST('fiscalyearendday','int'),GETPOST('fiscalyearendyear','int')); $date_end=dol_mktime(0,0,0,GETPOST('fiscalyearendmonth','int'),GETPOST('fiscalyearendday','int'),GETPOST('fiscalyearendyear','int'));
/* /*
* Actions * Actions
*/ */
@ -74,9 +75,7 @@ else if ($action == 'add')
if (! GETPOST('cancel','alpha')) if (! GETPOST('cancel','alpha'))
{ {
$error=0; $error=0;
$db->begin();
$object->date_start = $date_start; $object->date_start = $date_start;
$object->date_end = $date_end; $object->date_end = $date_end;
$object->label = GETPOST('label','alpha'); $object->label = GETPOST('label','alpha');
@ -96,21 +95,27 @@ else if ($action == 'add')
if (! $error) if (! $error)
{ {
$id = $object->create($user); $db->begin();
$id = $object->create($user);
if ($id > 0) if ($id > 0)
{ {
$db->commit();
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit; exit;
} }
else else
{ {
setEventMessage($object->error, 'errors'); $db->rollback();
setEventMessage($object->error, 'errors');
$action='create'; $action='create';
} }
} }
else else
{ {
$action='create'; $action='create';
} }
} }
@ -127,7 +132,7 @@ else if ($action == 'update')
if (! GETPOST('cancel','alpha')) if (! GETPOST('cancel','alpha'))
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
$object->date_start = empty($_POST["fiscalyear"])?'':$date_start; $object->date_start = empty($_POST["fiscalyear"])?'':$date_start;
$object->date_end = empty($_POST["fiscalyearend"])?'':$date_end; $object->date_end = empty($_POST["fiscalyearend"])?'':$date_end;
$object->label = GETPOST('label','alpha'); $object->label = GETPOST('label','alpha');
@ -175,7 +180,7 @@ if ($action == 'create')
// Label // Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="32" value="' . GETPOST("label") . '"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="32" value="' . GETPOST("label") . '"></td></tr>';
// Date start // Date start
print '<tr><td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>';
print $form->select_date(($date_start?$date_start:''),'fiscalyear'); print $form->select_date(($date_start?$date_start:''),'fiscalyear');
@ -185,7 +190,7 @@ if ($action == 'create')
print '<tr><td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date(($date_end?$date_end:-1),'fiscalyearend'); print $form->select_date(($date_end?$date_end:-1),'fiscalyearend');
print '</td></tr>'; print '</td></tr>';
// Statut // Statut
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("Statut").'</td>'; print '<td class="fieldrequired">'.$langs->trans("Statut").'</td>';
@ -207,11 +212,11 @@ else if ($id)
{ {
$head = fiscalyear_prepare_head($object); $head = fiscalyear_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
if ($action == 'edit') if ($action == 'edit')
{ {
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
@ -223,12 +228,12 @@ else if ($id)
print '<td width="20%">'.$langs->trans("Ref").'</td><td>'; print '<td width="20%">'.$langs->trans("Ref").'</td><td>';
print $object->ref; print $object->ref;
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>';
print '<input name="label" class="flat" size="32" value="'.$object->label.'">'; print '<input name="label" class="flat" size="32" value="'.$object->label.'">';
print '</td></tr>'; print '</td></tr>';
// Date start // Date start
print '<tr><td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>';
print $form->select_date($object->date_start?$object->date_start:-1,'fiscalyear'); print $form->select_date($object->date_start?$object->date_start:-1,'fiscalyear');
@ -238,7 +243,7 @@ else if ($id)
print '<tr><td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date($object->date_end?$object->date_end:-1,'fiscalyearend'); print $form->select_date($object->date_end?$object->date_end:-1,'fiscalyearend');
print '</td></tr>'; print '</td></tr>';
// Statut // Statut
print '<tr><td>'.$langs->trans("Statut").'</td><td>'; print '<tr><td>'.$langs->trans("Statut").'</td><td>';
print $form->selectarray('statut',$statut2label,$object->statut); print $form->selectarray('statut',$statut2label,$object->statut);
@ -252,7 +257,7 @@ else if ($id)
print '</form>'; print '</form>';
print '</div>'; dol_fiche_end();
} }
else else
{ {
@ -264,18 +269,20 @@ else if ($id)
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteFiscalYear"),$langs->trans("ConfirmDeleteFiscalYear"),"confirm_delete"); print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteFiscalYear"),$langs->trans("ConfirmDeleteFiscalYear"),"confirm_delete");
} }
print '<table class="border" width="100%">'; dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/fiscalyear.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/fiscalyear.php">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td width="50%">'; print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td width="50%">';
print $object->ref; print $object->ref;
print '</td><td width="25%">'; print '</td><td width="25%">';
print $linkback; print $linkback;
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td valign="top">'; print '<tr><td valign="top">';
print $form->editfieldkey("Label",'label',$object->label,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'alpha:32'); print $form->editfieldkey("Label",'label',$object->label,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'alpha:32');
@ -289,7 +296,7 @@ else if ($id)
print '</td><td colspan="2">'; print '</td><td colspan="2">';
print $form->editfieldval("Date",'date_start',$object->date_start,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker'); print $form->editfieldval("Date",'date_start',$object->date_start,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
print '</td></tr>'; print '</td></tr>';
// Date end // Date end
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey("Date",'date_end',$object->date_end,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker'); print $form->editfieldkey("Date",'date_end',$object->date_end,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
@ -300,9 +307,9 @@ else if ($id)
// Statut // Statut
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$object->getLibStatut(4).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$object->getLibStatut(4).'</td></tr>';
print "</table><br>"; print "</table>";
print '</div>'; dol_fiche_end();
/* /*
* Barre d'actions * Barre d'actions
@ -311,9 +318,9 @@ else if ($id)
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
print '</div>'; print '</div>';
} }
} }

View File

@ -16,11 +16,11 @@
*/ */
/** /**
* \file htdocs/admin/fiscalyear_card.php * \file htdocs/accountancy/admin/fiscalyear_card.php
* \brief Page to show info of a fiscal year * \brief Page to show info of a fiscal year
*/ */
require '../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -43,15 +43,15 @@ if ($id)
$object = new Fiscalyear($db); $object = new Fiscalyear($db);
$object->fetch($id); $object->fetch($id);
$object->info($id); $object->info($id);
$head = fiscalyear_prepare_head($object); $head = fiscalyear_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("FiscalYearCard"), 0, 'cron'); dol_fiche_head($head, 'info', $langs->trans("FiscalYearCard"), 0, 'cron');
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($object); dol_print_object_info($object);
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>'; print '</div>';
} }

View File

@ -29,12 +29,12 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'); 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';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
@ -118,16 +118,16 @@ if ($result) {
$tabtva = array (); $tabtva = array ();
$tabttc = array (); $tabttc = array ();
$tabcompany = array (); $tabcompany = array ();
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ( $i < $num ) { while ( $i < $num ) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
// les variables // les variables
$cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER)) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"); $cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER)) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli; $compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
$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)
@ -137,7 +137,7 @@ if ($result) {
} }
$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)) ? $conf->global->COMPTA_VAT_ACCOUNT : $langs->trans("CodeNotDef"); $cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)) ? $conf->global->COMPTA_VAT_ACCOUNT : $langs->trans("CodeNotDef");
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva); $compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
// Invoice lines // Invoice lines
$tabfac[$obj->rowid]["date"] = $obj->df; $tabfac[$obj->rowid]["date"] = $obj->df;
$tabfac[$obj->rowid]["ref"] = $obj->facnumber; $tabfac[$obj->rowid]["ref"] = $obj->facnumber;
@ -156,9 +156,9 @@ if ($result) {
$tabcompany[$obj->rowid] = array ( $tabcompany[$obj->rowid] = array (
'id' => $obj->socid, 'id' => $obj->socid,
'name' => $obj->name, 'name' => $obj->name,
'code_client' => $obj->code_compta 'code_client' => $obj->code_compta
); );
$i ++; $i ++;
} }
} else { } else {
@ -172,7 +172,7 @@ if ($result) {
// Bookkeeping Write // Bookkeeping Write
if ($action == 'writebookkeeping') { if ($action == 'writebookkeeping') {
$now = dol_now(); $now = dol_now();
foreach ( $tabfac as $key => $val ) { foreach ( $tabfac as $key => $val ) {
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
@ -190,10 +190,10 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0) ? $mt : 0; $bookkeeping->credit = ($mt < 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->create(); $bookkeeping->create();
} }
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) { if ($mt) {
@ -215,12 +215,12 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? $mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->create(); $bookkeeping->create();
} }
} }
} }
// VAT // VAT
// var_dump($tabtva); // var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) { foreach ( $tabtva[$key] as $k => $mt ) {
@ -241,7 +241,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? $mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->create(); $bookkeeping->create();
} }
} }
@ -250,21 +250,21 @@ if ($action == 'writebookkeeping') {
// export csv // export csv
if ($action == 'export_csv') { if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_SEPARATORCSV;
header('Content-Type: text/csv'); header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=journal_ventes.csv'); header('Content-Disposition: attachment;filename=journal_ventes.csv');
$companystatic = new Client($db); $companystatic = new Client($db);
if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert
{ {
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'];
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
print $date . $sep; print $date . $sep;
print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep; print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep;
print length_accountg($conf->global->COMPTA_ACCOUNT_CUSTOMER) . $sep; print length_accountg($conf->global->COMPTA_ACCOUNT_CUSTOMER) . $sep;
@ -276,7 +276,7 @@ if ($action == 'export_csv') {
} }
print $val["ref"]; print $val["ref"];
print "\n"; print "\n";
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) { if ($mt) {
@ -312,7 +312,7 @@ if ($action == 'export_csv') {
$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'];
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
@ -323,7 +323,7 @@ if ($action == 'export_csv') {
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
} }
print "\n"; print "\n";
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) { if ($mt) {
@ -336,7 +336,7 @@ if ($action == 'export_csv') {
print "\n"; print "\n";
} }
} }
// VAT // VAT
// var_dump($tabtva); // var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) { foreach ( $tabtva[$key] as $k => $mt ) {
@ -353,11 +353,11 @@ if ($action == 'export_csv') {
} }
} }
} else { } else {
$form = new Form($db); $form = new Form($db);
llxHeader('', $langs->trans("SellsJournal")); llxHeader('', $langs->trans("SellsJournal"));
$nom = $langs->trans("SellsJournal"); $nom = $langs->trans("SellsJournal");
$nomlink = ''; $nomlink = '';
$periodlink = ''; $periodlink = '';
@ -370,11 +370,11 @@ if ($action == 'export_csv') {
$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); $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);
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />'; print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print ' print '
<script type="text/javascript"> <script type="text/javascript">
function launch_export() { function launch_export() {
@ -388,12 +388,12 @@ if ($action == 'export_csv') {
$("div.fiche div.tabBar form input[name=\"action\"]").val(""); $("div.fiche div.tabBar form input[name=\"action\"]").val("");
} }
</script>'; </script>';
/* /*
* Show result array * Show result array
*/ */
print '<br><br>'; print '<br><br>';
$i = 0; $i = 0;
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
@ -404,23 +404,23 @@ if ($action == 'export_csv') {
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";
$var = true; $var = true;
$r = ''; $r = '';
$invoicestatic = new Facture($db); $invoicestatic = new Facture($db);
$companystatic = new Client($db); $companystatic = new Client($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->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($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
// Third party // Third party
// print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>"; // print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
@ -436,7 +436,7 @@ if ($action == 'export_csv') {
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
} }
print "</tr>"; print "</tr>";
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) { if ($mt) {
@ -451,7 +451,7 @@ if ($action == 'export_csv') {
print "</tr>"; print "</tr>";
} }
} }
// VAT // VAT
// var_dump($tabtva); // var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) { foreach ( $tabtva[$key] as $k => $mt ) {
@ -467,12 +467,12 @@ if ($action == 'export_csv') {
print "</tr>"; print "</tr>";
} }
} }
$var = ! $var; $var = ! $var;
} }
print "</table>"; print "</table>";
// End of page // End of page
llxFooter(); llxFooter();
} }

View File

@ -54,7 +54,7 @@ class Fiscalyear
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); $this->statuts_short = array(0 => 'Opened', 1 => 'Closed');
$this->statuts = array(0 => 'Opened', 1 => 'Closed'); $this->statuts = array(0 => 'Opened', 1 => 'Closed');
@ -70,9 +70,9 @@ class Fiscalyear
function create($user) function create($user)
{ {
global $conf; global $conf;
$error = 0; $error = 0;
$now=dol_now(); $now=dol_now();
$this->db->begin(); $this->db->begin();
@ -88,7 +88,7 @@ class Fiscalyear
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= " '".$this->label."'"; $sql.= " '".$this->label."'";
$sql.= ", '".$this->db->idate($this->date_start)."'"; $sql.= ", '".$this->db->idate($this->date_start)."'";
$sql.= ", '".$this->db->idate($this->date_end)."'"; $sql.= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'":"null");
$sql.= ", ".$this->statut; $sql.= ", ".$this->statut;
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '".$this->db->idate($now)."'";
@ -109,19 +109,19 @@ class Fiscalyear
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return $result; return $result;
} }
} }
else else
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->lasterror()." sql=".$sql;
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
* Update record * Update record
* *
@ -138,15 +138,15 @@ class Fiscalyear
$this->error='ErrorBadParameter'; $this->error='ErrorBadParameter';
return -1; return -1;
} }
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_fiscalyear";
$sql .= " SET label = '".$this->label."'"; $sql .= " SET label = '".$this->label."'";
$sql .= ", date_start = '".$this->db->idate($this->date_start)."'"; $sql .= ", date_start = '".$this->db->idate($this->date_start)."'";
$sql .= ", date_end = '".$this->db->idate($this->date_end)."'"; $sql .= ", date_end = ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null");
$sql .= ", statut = '".$this->statut."'"; $sql .= ", statut = '".$this->statut."'";
$sql .= ", datec = " . ($this->datec != '' ? $this->db->idate($this->datec) : 'null'); $sql .= ", datec = " . ($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null');
$sql .= ", fk_user_modif = " . $user->id; $sql .= ", fk_user_modif = " . $user->id;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
@ -160,11 +160,12 @@ class Fiscalyear
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog($this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
* Load an object from database * Load an object from database
* *
@ -194,11 +195,11 @@ class Fiscalyear
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }
/** /**
* Delete record * Delete record
* *
@ -220,12 +221,12 @@ class Fiscalyear
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
* Give a label from a status * Give a label from a status
* *
@ -238,7 +239,7 @@ class Fiscalyear
} }
/** /**
* Give a label from a status * Give a label from a status
* *
* @param int $statut Id status * @param int $statut Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
@ -277,7 +278,7 @@ class Fiscalyear
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut8');
} }
} }
/** /**
* Information on record * Information on record
* *

View File

@ -34,7 +34,7 @@ function fiscalyear_prepare_head($object)
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT . '/admin/fiscalyear_card.php?id=' . $object->id; $head[$h][0] = DOL_URL_ROOT . '/accountancy/admin/fiscalyear_card.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
@ -44,8 +44,8 @@ function fiscalyear_prepare_head($object)
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $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 // $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear'); complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear');
$head[$h][0] = DOL_URL_ROOT . '/admin/fiscalyear_info.php?id=' . $object->id; $head[$h][0] = DOL_URL_ROOT . '/accountancy/admin/fiscalyear_info.php?id=' . $object->id;
$head[$h][1] = $langs->trans("Info"); $head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $h++;

View File

@ -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("/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')))
{ {
if (empty($leftmenu) || $leftmenu=="setup") $newmenu->add("/admin/translation.php", $langs->trans("Translation"),1); if (empty($leftmenu) || $leftmenu=="setup") $newmenu->add("/admin/translation.php", $langs->trans("Translation"),1);
@ -863,18 +862,20 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
$langs->load("accountancy"); $langs->load("accountancy");
$newmenu->add("/accountancy/customer/index.php?leftmenu=ventil_customer",$langs->trans("CustomersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_customer'); $newmenu->add("/accountancy/customer/index.php?leftmenu=ventil_customer",$langs->trans("CustomersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_customer');
if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read); if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read);
if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read); if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read);
$newmenu->add("/accountancy/supplier/index.php?leftmenu=ventil_supplier",$langs->trans("SuppliersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_supplier'); $newmenu->add("/accountancy/supplier/index.php?leftmenu=ventil_supplier",$langs->trans("SuppliersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_supplier');
if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read); if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read);
if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read); if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read);
$newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookeeping'); $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookeeping');
if (empty($leftmenu) || $leftmenu=="bookeeping") $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire); if (empty($leftmenu) || $leftmenu=="bookeeping") $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire);
if (empty($leftmenu) || $leftmenu=="bookeeping") $newmenu->add("/accountancy/bookkeeping/balancebymonth.php.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); if (empty($leftmenu) || $leftmenu=="bookeeping") $newmenu->add("/accountancy/bookkeeping/balancebymonth.php.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire);
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->close, '', $mainmenu, 'fiscalyear');
} }
// Rapports // Rapports
@ -911,7 +912,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
//journaux //journaux
if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=ca",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire); if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=ca",$langs->trans("SellsJournal"),1,$user->rights->compta->resultat->lire);
if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=ca",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire); if (empty($leftmenu) || $leftmenu=="ca") $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=ca",$langs->trans("PurchasesJournal"),1,$user->rights->compta->resultat->lire);
} }
} }
} }
@ -1254,12 +1255,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
else dol_print_error($db); else dol_print_error($db);
$db->free($resql); $db->free($resql);
} }
// Accountancy journals // Accountancy journals
if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy')
{ {
$newmenu->add('/accountancy/journal/index.php',$langs->trans("Journaux"),0,$user->rights->banque->lire); $newmenu->add('/accountancy/journal/index.php',$langs->trans("Journaux"),0,$user->rights->banque->lire);
$sql = "SELECT rowid, label, accountancy_journal"; $sql = "SELECT rowid, label, 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;
@ -1273,7 +1274,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$i = 0; $i = 0;
if ($numr > 0) if ($numr > 0)
while ($i < $numr) while ($i < $numr)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
@ -1283,7 +1284,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
} }
else dol_print_error($db); else dol_print_error($db);
$db->free($resql); $db->free($resql);
// Add other journal // Add other journal
$newmenu->add("/accountancy/journal/sellsjournal.php",$langs->trans("SellsJournal"),1,$user->rights->accounting->comptarapport->lire); $newmenu->add("/accountancy/journal/sellsjournal.php",$langs->trans("SellsJournal"),1,$user->rights->accounting->comptarapport->lire);
$newmenu->add("/accountancy/journal/purchasesjournal.php",$langs->trans("PurchasesJournal"),1,$user->rights->accounting->comptarapport->lire); $newmenu->add("/accountancy/journal/purchasesjournal.php",$langs->trans("PurchasesJournal"),1,$user->rights->accounting->comptarapport->lire);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@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>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -19,7 +19,7 @@
*/ */
/** /**
* \file accountingex/core/modules/modAccountingExpert.class.php * \file accountingex/core/modules/modAccounting.class.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Module to activate Accounting Expert module * \brief Module to activate Accounting Expert module
*/ */
@ -42,164 +42,154 @@ class modAccounting extends DolibarrModules
$this->db = $db; $this->db = $db;
$this->numero = 50400; $this->numero = 50400;
$this->family = "financial"; $this->family = "financial";
// 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)
$this->name = preg_replace('/^mod/i', '', get_class($this)); $this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Advanced manage of accounting"; $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 = 'development';
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
$this->special = 0; $this->special = 0;
$this->picto = 'accounting'; $this->picto = 'accounting';
// Defined if the directory /mymodule/inc/triggers/ contains triggers or not // Defined if the directory /mymodule/inc/triggers/ contains triggers or not
// $this->triggers = 1; // $this->triggers = 1;
// Data directories to create when module is enabled // Data directories to create when module is enabled
$this->dirs = array ( $this->dirs = array('/accounting/temp');
'/accountingex/temp'
);
// Config pages // Config pages
$this->config_page_url = array('index.php@accountancy'); $this->config_page_url = array('index.php@accountancy');
// Dependencies // Dependencies
$this->depends = array ("modFacture","modBanque","modTax"); // List of modules id that must be enabled if this module is enabled $this->depends = array("modFacture","modBanque","modTax"); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array (); // List of modules id to disable if this one is disabled $this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array ("modComptabilite"); // List of modules are in conflict with this module $this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module
$this->phpmin = array ( $this->phpmin = array(5, 2); // Minimum version of PHP required by module
5, $this->need_dolibarr_version = array(3, 6); // Minimum version of Dolibarr required by module
2 $this->langfiles = array("accountancy");
); // Minimum version of PHP required by module
$this->need_dolibarr_version = array (
3,
6
); // Minimum version of Dolibarr required by module
$this->langfiles = array (
"accountancy"
);
// Constants // Constants
$this->const = array (); $this->const = array();
$this->const[1] = array ( $this->const[1] = array(
"MAIN_COMPANY_CODE_ALWAYS_REQUIRED", "MAIN_COMPANY_CODE_ALWAYS_REQUIRED",
"chaine", "chaine",
"1", "1",
"With this constants on, third party code is always required whatever is numbering module behaviour" "With this constants on, third party code is always required whatever is numbering module behaviour"
); );
$this->const[2] = array ( $this->const[2] = array(
"MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED", "MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED",
"chaine", "chaine",
"1", "1",
"With this constants on, bank account number is always required" "With this constants on, bank account number is always required"
); );
$this->const[1] = array ( $this->const[1] = array(
"ACCOUNTING_SEPARATORCSV", "ACCOUNTING_SEPARATORCSV",
"string", "string",
"," ","
); );
$this->const[2] = array ( $this->const[2] = array(
"ACCOUNTING_ACCOUNT_SUSPENSE", "ACCOUNTING_ACCOUNT_SUSPENSE",
"chaine", "chaine",
"471" "471"
); );
$this->const[3] = array ( $this->const[3] = array(
"ACCOUNTING_SELL_JOURNAL", "ACCOUNTING_SELL_JOURNAL",
"chaine", "chaine",
"VTE" "VTE"
); );
$this->const[4] = array ( $this->const[4] = array(
"ACCOUNTING_PURCHASE_JOURNAL", "ACCOUNTING_PURCHASE_JOURNAL",
"chaine", "chaine",
"ACH" "ACH"
); );
$this->const[5] = array ( $this->const[5] = array(
"ACCOUNTING_SOCIAL_JOURNAL", "ACCOUNTING_SOCIAL_JOURNAL",
"chaine", "chaine",
"SOC" "SOC"
); );
$this->const[6] = array ( $this->const[6] = array(
"ACCOUNTING_CASH_JOURNAL", "ACCOUNTING_CASH_JOURNAL",
"chaine", "chaine",
"CAI" "CAI"
); );
$this->const[7] = array ( $this->const[7] = array(
"ACCOUNTING_MISCELLANEOUS_JOURNAL", "ACCOUNTING_MISCELLANEOUS_JOURNAL",
"chaine", "chaine",
"OD" "OD"
); );
$this->const[8] = array ( $this->const[8] = array(
"ACCOUNTING_BANK_JOURNAL", "ACCOUNTING_BANK_JOURNAL",
"chaine", "chaine",
"BQ" "BQ"
); // Deprecated Move into llx_bank_account ); // Deprecated Move into llx_bank_account
$this->const[9] = array ( $this->const[9] = array(
"ACCOUNTING_ACCOUNT_TRANSFER_CASH", "ACCOUNTING_ACCOUNT_TRANSFER_CASH",
"chaine", "chaine",
"58" "58"
); );
$this->const[10] = array ( $this->const[10] = array(
"CHARTOFACCOUNTS", "CHARTOFACCOUNTS",
"chaine", "chaine",
"2" "2"
); );
$this->const[11] = array ( $this->const[11] = array(
"ACCOUNTING_MODELCSV", "ACCOUNTING_MODELCSV",
"chaine", "chaine",
"0" "0"
); );
$this->const[12] = array ( $this->const[12] = array(
"ACCOUNTING_LENGTH_GACCOUNT", "ACCOUNTING_LENGTH_GACCOUNT",
"chaine", "chaine",
"" ""
); );
$this->const[13] = array ( $this->const[13] = array(
"ACCOUNTING_LENGTH_AACCOUNT", "ACCOUNTING_LENGTH_AACCOUNT",
"chaine", "chaine",
"" ""
); );
$this->const[14] = array ( $this->const[14] = array(
"ACCOUNTING_LIMIT_LIST_VENTILATION", "ACCOUNTING_LIMIT_LIST_VENTILATION",
"chaine", "chaine",
"50" "50"
); );
$this->const[15] = array ( $this->const[15] = array(
"ACCOUNTING_LIST_SORT_VENTILATION_TODO", "ACCOUNTING_LIST_SORT_VENTILATION_TODO",
"yesno", "yesno",
"1" "1"
); );
$this->const[16] = array ( $this->const[16] = array(
"ACCOUNTING_LIST_SORT_VENTILATION_DONE", "ACCOUNTING_LIST_SORT_VENTILATION_DONE",
"yesno", "yesno",
"1" "1"
); );
// Tabs // Tabs
$this->tabs = array(); $this->tabs = array();
// Css // Css
$this->module_parts = array (); $this->module_parts = array();
// Boxes // Boxes
$this->boxes = array (); $this->boxes = array();
// Permissions // Permissions
$this->rights_class = 'accounting'; $this->rights_class = 'accounting';
$this->rights = array (); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$r = 0; $r = 0;
$this->rights[$r][0] = 50401; $this->rights[$r][0] = 50401; // TODO Goal of this permission compared to others ???
$this->rights[$r][1] = 'Access_accountancy'; $this->rights[$r][1] = 'Access_accountancy';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'access'; $this->rights[$r][4] = 'access';
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
$r++; $r++;
$this->rights[$r][0] = 50402; $this->rights[$r][0] = 50402;
$this->rights[$r][1] = 'Read ventilation'; $this->rights[$r][1] = 'Read ventilation';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
@ -207,7 +197,7 @@ class modAccounting extends DolibarrModules
$this->rights[$r][4] = 'ventilation'; $this->rights[$r][4] = 'ventilation';
$this->rights[$r][5] = 'read'; $this->rights[$r][5] = 'read';
$r++; $r++;
$this->rights[$r][0] = 50403; $this->rights[$r][0] = 50403;
$this->rights[$r][1] = 'Dispatched ventilation'; $this->rights[$r][1] = 'Dispatched ventilation';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
@ -239,12 +229,20 @@ class modAccounting extends DolibarrModules
$this->rights[$r][4] = 'comptarapport'; $this->rights[$r][4] = 'comptarapport';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
$r++; $r++;
$this->rights[$r][0] = 50430;
$this->rights[$r][1] = 'Define and close a fiscal year';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'fiscalyear';
$this->rights[$r][5] = '';
$r++;
// Main menu entries // Main menu entries
$this->menus = array (); $this->menus = array();
$r = 0; $r = 0;
} }
/** /**
* Function called when module is enabled. * Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.