';
print '' . $langs->trans("AccountAccouting") . ' ';
print '' . $langs->trans("label") . ' ';
@@ -138,10 +137,10 @@ if ($result) {
print '' . $langs->trans("Pcgsubtype") . ' ';
print '' . $langs->trans("Import") . ' ';
print ' ';
-
+
$form = new Form($db);
- $htmlacc = new FormVentilation($db);
-
+ $formaccounting = new FormAccounting($db);
+
$var = true;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
@@ -157,7 +156,7 @@ if ($result) {
// Colonne choix du compte
print '';
- print $htmlacc->select_account($accounting->account_parent, 'AccountParent');
+ print $formaccounting->select_account($accounting->account_parent, 'AccountParent');
print ' ';
print '';
diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php
index 899aaa1a3d2..0e1f67a0e61 100644
--- a/htdocs/accountancy/admin/index.php
+++ b/htdocs/accountancy/admin/index.php
@@ -1,11 +1,11 @@
- * Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2013-2017 Alexandre Spangaro
- * Copyright (C) 2014-2015 Ari Elbaz (elarifr)
+/* Copyright (C) 2013-2014 Olivier Geffroy
+ * Copyright (C) 2013-2014 Florian Henry
+ * Copyright (C) 2013-2017 Alexandre Spangaro
+ * Copyright (C) 2014-2015 Ari Elbaz (elarifr)
* Copyright (C) 2014 Marcos García
- * Copyright (C) 2014 Juanjo Menent
- * Copyright (C) 2015 Jean-François Ferry
+ * Copyright (C) 2014 Juanjo Menent
+ * Copyright (C) 2015 Jean-François Ferry
*
* 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
@@ -31,8 +31,6 @@ require '../../main.inc.php';
// Class
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 . '/accountancy/class/html.formventilation.class.php';
$langs->load("compta");
$langs->load("bills");
@@ -160,7 +158,6 @@ if ($action == 'setdisabledirectinput') {
llxHeader();
$form = new Form($db);
-$formaccountancy = new FormVentilation($db);
$linkback = '' . $langs->trans("BackToModuleList") . ' ';
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php
index 359a8b40c12..fcb44c6f858 100644
--- a/htdocs/accountancy/admin/productaccount.php
+++ b/htdocs/accountancy/admin/productaccount.php
@@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
@@ -184,7 +184,7 @@ if ($action == 'update') {
* View
*/
-$form = new FormVentilation($db);
+$form = new FormAccounting($db);
// Defaut AccountingAccount RowId Product / Service
// at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php
index 9e5be25eb73..3111707cff6 100644
--- a/htdocs/accountancy/bookkeeping/balance.php
+++ b/htdocs/accountancy/bookkeeping/balance.php
@@ -28,8 +28,8 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
// Langs
@@ -61,7 +61,7 @@ $offset = $limit * $page;
$object = new BookKeeping($db);
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
$formother = new FormOther($db);
$form = new Form($db);
@@ -186,10 +186,10 @@ else {
print '';
print '';
print $langs->trans('From');
- print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
+ print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
print ' ';
print $langs->trans('to');
- print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, '');
+ print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, '');
print ' ';
print '';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index 7ee3e6bb4fe..4443fb959b2 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -27,9 +27,8 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
// Langs
$langs->load("accountancy");
@@ -215,7 +214,6 @@ else if ($action == "confirm_create") {
llxHeader();
$html = new Form($db);
-$formventilation = new FormVentilation($db);
$formaccountancy = new FormAccounting($db);
/*
@@ -389,10 +387,10 @@ if ($action == 'create') {
if ($action == 'update' && $line->id == $id) {
print ' ';
- print $formventilation->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, '');
+ print $formaccounting->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, '');
print ' ';
print '';
- print $formventilation->select_auxaccount($line->code_tiers, 'code_tiers', 1);
+ print $formaccounting->select_auxaccount($line->code_tiers, 'code_tiers', 1);
print ' ';
print ' ';
print ' ';
@@ -433,10 +431,10 @@ if ($action == 'create') {
if ($action == "" || $action == 'add') {
print ' ';
print '';
- print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
+ print $formaccounting->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
print ' ';
print '';
- print $formventilation->select_auxaccount($code_tiers, 'code_tiers', 1);
+ print $formaccounting->select_auxaccount($code_tiers, 'code_tiers', 1);
print ' ';
print ' ';
print ' ';
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 72385bab746..a955d671475 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -28,10 +28,10 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
// Langs
$langs->load("accountancy");
@@ -94,7 +94,7 @@ if ($sortfield == "") $sortfield = "t.rowid";
$object = new BookKeeping($db);
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
$formother = new FormOther($db);
$form = new Form($db);
@@ -321,8 +321,8 @@ if ($action == 'delbookkeepingyear') {
if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y');
}
- $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
- $journal_array = $formventilation->selectjournal_accountancy_bookkepping($deljournal, 'deljournal', 0, 'array');
+ $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
+ $journal_array = $formaccounting->selectjournal_accountancy_bookkepping($deljournal, 'deljournal', 0, 'array');
$form_question['delyear'] = array (
'name' => 'delyear',
@@ -385,17 +385,17 @@ print '';
print ' ';
print '';
print $langs->trans('From');
-print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
+print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
print ' ';
print $langs->trans('to');
-print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
+print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print ' ';
print '';
print $langs->trans('From');
-print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
+print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
print ' ';
print $langs->trans('to');
-print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
+print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print ' ';
print '';
print ' ';
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index eb8a53561d2..6b329e421ad 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -29,8 +29,8 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
// Langs
@@ -75,7 +75,7 @@ if (empty($search_date_end)) $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_
$object = new BookKeeping($db);
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
$formother = new FormOther($db);
$form = new Form($db);
@@ -188,7 +188,7 @@ if ($action == 'delbookkeepingyear') {
if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y');
}
- $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
+ $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
$form_question['delyear'] = array (
'name' => 'delyear',
diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php
index 263f293043a..5fba55f2eba 100644
--- a/htdocs/accountancy/bookkeeping/listbyyear.php
+++ b/htdocs/accountancy/bookkeeping/listbyyear.php
@@ -29,7 +29,7 @@ require '../../main.inc.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 . '/accountancy/class/bookkeeping.class.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
// Langs
$langs->load("accountancy");
@@ -67,7 +67,7 @@ $search_code_journal = GETPOST('search_code_journal', 'alpha');
$object = new BookKeeping($db);
$form = new Form($db);
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
// Filter
if (empty($search_date_start)) {
@@ -182,15 +182,15 @@ print $form->select_date($search_date_end, 'date_end');
print '';
print '';
print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
-print $formventilation->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, '');
+print $formaccounting->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, '');
print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
-print $formventilation->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, '');
+print $formaccounting->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, '');
print '
';
print '';
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
-print $formventilation->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1);
+print $formaccounting->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1);
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
-print $formventilation->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1);
+print $formaccounting->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1);
print '
';
print "";
diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php
deleted file mode 100644
index d7a827f2480..00000000000
--- a/htdocs/accountancy/class/html.formventilation.class.php
+++ /dev/null
@@ -1,292 +0,0 @@
-
- * Copyright (C) 2013-2014 Olivier Geffroy
- * Copyright (C) 2013-2016 Alexandre Spangaro
- * Copyright (C) 2015 Ari Elbaz (elarifr)
- * Copyright (C) 2016 Marcos García
- *
- * 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
- * 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
- * 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 .
- */
-
-/**
- * \file htdocs/accountancy/class/html.formventilation.class.php
- * \ingroup Advanced accountancy
- * \brief File of class with all html predefined components
- */
-
-/**
- * Class to manage generation of HTML components for bank module
- */
-class FormVentilation extends Form
-{
-
- private $options_cache = array();
-
-
- /**
- * Return select filter with date of transaction
- *
- * @param string $htmlname Name of select field
- * @param string $selectedkey Value
- * @return string HTML edit field
- */
- function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') {
- $options = array();
-
- $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
- $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
- $sql .= ' ORDER BY import_key DESC';
-
- dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG);
- $resql = $this->db->query($sql);
-
- if (!$resql) {
- $this->error = "Error " . $this->db->lasterror();
- dol_syslog(get_class($this) . "::select_bookkeeping_importkey " . $this->error, LOG_ERR);
- return - 1;
- }
-
- while ($obj = $this->db->fetch_object($resql)) {
- $options[$obj->import_key] = dol_print_date($obj->import_key, 'dayhourtext');
- }
-
- return Form::selectarray($htmlname, $options, $selectedkey);
- }
-
- /**
- * Return list of accounts with label by chart of accounts
- *
- * @param string $selectid Preselected id or code of accounting accounts (depends on $select_in)
- * @param string $htmlname Name of field in html form
- * @param int $showempty Add an empty field
- * @param array $event Event options
- * @param int $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number
- * @param int $select_out Set value returned by select. 0=rowid (default), 1=account_number
- * @param string $morecss More css non HTML object
- * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
- * @return string String with HTML select
- */
- function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='')
- {
- global $conf;
-
- require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
-
- $out = '';
-
- $options = array();
- if ($usecache && ! empty($this->options_cache[$usecache]))
- {
- $options = $this->options_cache[$usecache];
- $selected=$selectid;
- }
- else
- {
- $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
-
- $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
- $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
- $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
- $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
- $sql .= " AND aa.active = 1";
- $sql .= " ORDER BY aa.account_number";
-
- dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
- $resql = $this->db->query($sql);
-
- if (!$resql) {
- $this->error = "Error " . $this->db->lasterror();
- dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
- return -1;
- }
-
- $out .= ajax_combobox($htmlname, $event);
-
- $selected = 0;
- while ($obj = $this->db->fetch_object($resql))
- {
- $label = length_accountg($obj->account_number) . ' - ' . $obj->label;
- $label = dol_trunc($label, $trunclength);
-
- $select_value_in = $obj->rowid;
- $select_value_out = $obj->rowid;
-
- // Try to guess if we have found default value
- if ($select_in == 1) {
- $select_value_in = $obj->account_number;
- }
- if ($select_out == 1) {
- $select_value_out = $obj->account_number;
- }
- // Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
- // Because same account_number can be share between different accounting_system and do have the same meaning
- if ($selectid != '' && $selectid == $select_value_in) {
- //var_dump("Found ".$selectid." ".$select_value_in);
- $selected = $select_value_out;
- }
-
- $options[$select_value_out] = $label;
- }
- $this->db->free($resql);
-
- if ($usecache)
- {
- $this->options_cache[$usecache] = $options;
- }
- }
-
- $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
-
- return $out;
- }
-
- /**
- * Return list of auxilary thirdparty accounts
- *
- * @param string $selectid Preselected pcg_type
- * @param string $htmlname Name of field in html form
- * @param int $showempty Add an empty field
- * @param array $event Event options
- *
- * @return string String with HTML select
- */
- function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) {
-
- $aux_account = array();
-
- // Auxiliary customer account
- $sql = "SELECT DISTINCT code_compta, nom ";
- $sql .= " FROM ".MAIN_DB_PREFIX."societe";
- $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")";
- $sql .= " ORDER BY code_compta";
- dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
- $resql = $this->db->query($sql);
- if ($resql) {
- while ($obj = $this->db->fetch_object($resql)) {
- if (!empty($obj->code_compta)) {
- $aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->nom.')';
- }
- }
- } else {
- $this->error = "Error ".$this->db->lasterror();
- dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
- return -1;
- }
- $this->db->free($resql);
-
- // Auxiliary supplier account
- $sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
- $sql .= " FROM ".MAIN_DB_PREFIX."societe";
- $sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")";
- $sql .= " ORDER BY code_compta_fournisseur";
- dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
- $resql = $this->db->query($sql);
- if ($resql) {
- while ($obj = $this->db->fetch_object($resql)) {
- if (!empty($obj->code_compta_fournisseur)) {
- $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')';
- }
- }
- } else {
- $this->error = "Error ".$this->db->lasterror();
- dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
- return -1;
- }
- $this->db->free($resql);
-
- // Build select
- $out = ajax_combobox($htmlname, $event);
- $out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
-
- return $out;
- }
-
- /**
- * Return HTML combo list of years existing into book keepping
- *
- * @param string $selected Preselected value
- * @param string $htmlname Name of HTML select object
- * @param int $useempty Affiche valeur vide dans liste
- * @param string $output_format (html/opton (for option html only)/array (to return options arrays
- * @return string/array
- */
- function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html')
- {
- global $conf;
-
- $out_array = array();
-
- $sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
- $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
- $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
- $sql .= " ORDER BY date_format(doc_date,'%Y')";
- dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
- $resql = $this->db->query($sql);
-
- if (!$resql) {
- $this->error = "Error ".$this->db->lasterror();
- dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
- return -1;
- }
- while ($obj = $this->db->fetch_object($resql)) {
- $out_array[$obj->dtyear] = $obj->dtyear;
- }
- $this->db->free($resql);
-
- if ($output_format == 'html') {
- return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"');
- } else {
- return $out_array;
- }
- }
-
- /**
- * Return HTML combo list of years existing into book keepping
- *
- * @param string $selected Preselected value
- * @param string $htmlname Name of HTML select object
- * @param int $useempty Affiche valeur vide dans liste
- * @param string $output_format Html/option (for option html only)/array (to return options arrays
- * @return string/array
- */
- function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html')
- {
- global $conf,$langs;
-
- $out_array = array();
-
- $sql = "SELECT DISTINCT code_journal";
- $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
- $sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
- $sql .= " ORDER BY code_journal";
- dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
- $resql = $this->db->query($sql);
-
- if (!$resql) {
- $this->error = "Error ".$this->db->lasterror();
- dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
- return -1;
- }
- while ($obj = $this->db->fetch_object($resql)) {
- $out_array[$obj->code_journal] = $obj->code_journal?$obj->code_journal:$langs->trans("NotDefined"); // TODO Not defined is accepted ? We should avoid this, shouldn't we ?
- }
- $this->db->free($resql);
-
- if ($output_format == 'html') {
- return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"');
- } else {
- return $out_array;
- }
- }
-}
diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php
index baa70bf51e8..eca3be1d477 100644
--- a/htdocs/accountancy/customer/card.php
+++ b/htdocs/accountancy/customer/card.php
@@ -1,7 +1,7 @@
* Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2013-2015 Alexandre Spangaro
+ * Copyright (C) 2013-2017 Alexandre Spangaro
*
* 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
@@ -26,7 +26,7 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
// Langs
$langs->load("bills");
@@ -39,9 +39,7 @@ $id = GETPOST('id');
// Security check
if ($user->societe_id > 0)
accessforbidden();
-
-
-
+
/*
* Actions
*/
@@ -84,7 +82,7 @@ if ($cancel == $langs->trans("Cancel")) {
*/
$form = new Form($db);
$facture_static = new Facture($db);
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
if (! empty($id)) {
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price,";
@@ -96,50 +94,50 @@ if (! empty($id)) {
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = l.fk_facture";
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
-
+
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql);
-
+
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
-
+
if ($num_lines) {
-
+
$objp = $db->fetch_object($result);
-
+
print '';
} else {
print "Error";
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index 52b3a31d6f0..f3763dd9ca0 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -28,7 +28,7 @@
require '../../main.inc.php';
// Class
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
@@ -77,7 +77,7 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->bind->write)
accessforbidden();
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
/*
@@ -254,14 +254,14 @@ if ($result) {
print $langs->trans("DescVentilDoneCustomer") . ' ';
print '' . $langs->trans("ChangeAccount") . ' ';
- print $formventilation->select_account($account_parent, 'account_parent', 1);
+ print $formaccounting->select_account($account_parent, 'account_parent', 1);
print '
';
$moreforfilter = '';
-
- print '';
+
+ print '
';
print '
'."\n";
-
+
print '';
print ' ';
print ' ';
@@ -278,7 +278,7 @@ if ($result) {
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print " \n";
-
+
print '';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
@@ -303,16 +303,16 @@ if ($result) {
$facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->rowid;
-
+
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
$product_static->type = $objp->product_type;
$product_static->label = $objp->product_label;
-
+
print ' ';
print '' . $objp->rowid . ' ';
-
+
// Ref Invoice
print '' . $facture_static->getNomUrl(1) . ' ';
@@ -324,13 +324,13 @@ if ($result) {
print $product_static->getNomUrl(1);
if ($objp->product_label) print ' '.$objp->product_label;
print '';
-
+
print '';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
print ' ';
-
+
print '' . price($objp->total_ht) . ' ';
print '' . price($objp->tva_tx) . ' ';
print '';
@@ -338,20 +338,20 @@ if ($result) {
print img_edit();
print '';
print ' ';
-
+
print '' . $objp->country .' ';
-
+
print '' . $objp->tva_intra . ' ';
-
+
print ' ';
print " ";
$i ++;
}
-
+
print "
";
print "
";
-
+
if ($nbtotalofrecords > $limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
}
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index bbd875e0dbf..8af289f2c99 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -30,7 +30,7 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
@@ -85,7 +85,7 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->bind->write)
accessforbidden();
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
$accounting = new AccountingAccount($db);
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
@@ -101,7 +101,7 @@ if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction !=
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{
- $search_lineid = '';
+ $search_lineid = '';
$search_ref = '';
$search_invoice = '';
$search_label = '';
@@ -241,7 +241,7 @@ if ($result) {
$i = 0;
$arrayofselected=is_array($toselect)?$toselect:array();
-
+
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@@ -254,8 +254,7 @@ if ($result) {
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
//if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
-
-
+
print '
';
diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php
index 6d0ffbd4476..b3936bbf1a6 100644
--- a/htdocs/accountancy/expensereport/lines.php
+++ b/htdocs/accountancy/expensereport/lines.php
@@ -27,7 +27,7 @@
require '../../main.inc.php';
// Class
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
@@ -74,7 +74,7 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->bind->write)
accessforbidden();
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
/*
@@ -226,7 +226,7 @@ if ($result) {
print $langs->trans("DescVentilDoneExpenseReport") . ' ';
print '' . $langs->trans("ChangeAccount") . ' ';
- print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1);
+ print $formaccounting->select_account(GETPOST('account_parent'), 'account_parent', 1);
print '
';
$moreforfilter = '';
diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php
index 72316e4c4d6..b1a86c96838 100644
--- a/htdocs/accountancy/expensereport/list.php
+++ b/htdocs/accountancy/expensereport/list.php
@@ -29,7 +29,7 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
@@ -83,7 +83,7 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->bind->write)
accessforbidden();
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
$accounting = new AccountingAccount($db);
@@ -343,7 +343,7 @@ if ($result) {
// Suggested accounting account
print ' ';
- print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
+ print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print ' ';
print '';
diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php
index b7c5979aa7a..47a99c88496 100644
--- a/htdocs/accountancy/supplier/card.php
+++ b/htdocs/accountancy/supplier/card.php
@@ -1,11 +1,11 @@
* Copyright (C) 2005 Simon TOSSER
- * Copyright (C) 2013-2015 Alexandre Spangaro
+ * Copyright (C) 2013-2017 Alexandre Spangaro
* Copyright (C) 2013-2014 Olivier Geffroy
- * Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2014 Juanjo Menent
- * Copyright (C) 2015 Jean-François Ferry
+ * Copyright (C) 2013-2014 Florian Henry
+ * Copyright (C) 2014 Juanjo Menent
+ * Copyright (C) 2015 Jean-François Ferry
*
* 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
@@ -30,7 +30,7 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
// Langs
$langs->load("bills");
@@ -52,11 +52,11 @@ if ($user->societe_id > 0)
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
if (! GETPOST('cancel', 'alpha')) {
if ($codeventil < 0) $codeventil = 0;
-
+
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " SET fk_code_ventilation = " . $codeventil;
$sql .= " WHERE rowid = " . $id;
-
+
$resql = $db->query($sql);
if (! $resql) {
setEventMessages($db->lasterror(), null, 'errors');
@@ -85,7 +85,7 @@ if ($cancel == $langs->trans("Cancel")) {
// Create
$form = new Form($db);
$facturefournisseur_static = new FactureFournisseur($db);
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
if (! empty($id)) {
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, ";
@@ -107,41 +107,41 @@ if (! empty($id)) {
if ($num_lines) {
$objp = $db->fetch_object($result);
-
+
print '';
} else {
print "Error";
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index 1a95262f861..2757b6d8aec 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -1,9 +1,9 @@
- * Copyright (C) 2013-2016 Alexandre Spangaro
+ * Copyright (C) 2013-2017 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
* Copyright (C) 2013-2016 Florian Henry
- * Copyright (C) 2014 Juanjo Menent
+ * Copyright (C) 2014 Juanjo Menent
*
* 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
@@ -27,7 +27,7 @@
require '../../main.inc.php';
// Class
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
@@ -76,7 +76,7 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->bind->write)
accessforbidden();
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
/*
@@ -237,7 +237,7 @@ if ($result) {
print $langs->trans("DescVentilDoneSupplier") . ' ';
print '' . $langs->trans("ChangeAccount") . ' ';
- print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1);
+ print $formaccounting->select_account(GETPOST('account_parent'), 'account_parent', 1);
print '
';
$moreforfilter = '';
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index 061e465b1e7..9c822425a1c 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -1,10 +1,10 @@
- * Copyright (C) 2013-2016 Alexandre Spangaro
+ * Copyright (C) 2013-2017 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
* Copyright (C) 2013-2014 Florian Henry
* Copyright (C) 2014 Juanjo Menent s
- * Copyright (C) 2016 Laurent Destailleur
+ * Copyright (C) 2016 Laurent Destailleur
*
* 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
@@ -30,7 +30,7 @@ require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
@@ -85,7 +85,7 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->bind->write)
accessforbidden();
-$formventilation = new FormVentilation($db);
+$formaccounting = new FormAccounting($db);
$accounting = new AccountingAccount($db);
// TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
@@ -238,11 +238,11 @@ if ($result) {
$i = 0;
$arrayofselected=is_array($toselect)?$toselect:array();
-
+
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
-
+
$arrayofmassactions = array(
'ventil'=>$langs->trans("Ventilate")
//'presend'=>$langs->trans("SendByMail"),
@@ -251,8 +251,7 @@ if ($result) {
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
//if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
-
-
+
print '