From e28dff19eeca36c6245c7924f3ed321d9822c46f Mon Sep 17 00:00:00 2001 From: Benoit Date: Fri, 5 May 2017 22:21:46 +0200 Subject: [PATCH 01/14] Fix bug xhen insert new bankline --- htdocs/compta/bank/class/account.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 897fd5de496..97dacf34386 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -471,9 +471,9 @@ class Account extends CommonObject if ($accline->insert() > 0) { - if ($categorie) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_account ("; - $sql .= "fk_account, fk_categorie"; + if ($categorie>0) { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class ("; + $sql .= "lineid, fk_categ; $sql .= ") VALUES ("; $sql .= " ".$accline->id.", ".$categorie; $sql .= ")"; From 0fbf27895ad891ee9889e3e8a80a172dead1e975 Mon Sep 17 00:00:00 2001 From: Benoit Date: Fri, 5 May 2017 22:33:34 +0200 Subject: [PATCH 02/14] Add fk_facture_fourn element to fetch lines objects --- htdocs/fourn/class/fournisseur.facture.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 1798eb19059..496c4660895 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -640,7 +640,7 @@ class FactureFournisseur extends CommonInvoice function fetch_lines() { $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; - $sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; + $sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn '; $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; $sql.= ', f.fk_multicurrency, f.multicurrency_code, f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc'; @@ -649,6 +649,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ' WHERE fk_facture_fourn='.$this->id; $sql.= ' ORDER BY f.rang, f.rowid'; + dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $resql_rows = $this->db->query($sql); if ($resql_rows) @@ -687,6 +688,7 @@ class FactureFournisseur extends CommonInvoice $line->total_tva = $obj->total_tva; $line->total_localtax1 = $obj->total_localtax1; $line->total_localtax2 = $obj->total_localtax2; + $line->fk_facture_fourn = $obj->fk_facture_fourn; $line->total_ttc = $obj->total_ttc; $line->fk_product = $obj->fk_product; $line->product_type = $obj->product_type; From a4defb8102db6376afc91d59dbbd9f48b91bc525 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 6 May 2017 07:02:34 +0200 Subject: [PATCH 03/14] Add html form for accountancy journals list --- .../core/class/html.formaccounting.class.php | 59 ++++++++++++++++++- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index e1bf1645de0..cb988a511cd 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -25,12 +25,14 @@ /** * Class to manage generation of HTML components for accounting management */ -class FormAccounting +class FormAccounting extends Form { + + private $options_cache = array(); + var $db; var $error; - /** * Constructor * @@ -41,6 +43,59 @@ class FormAccounting $this->db = $db; } + /** + * Return list of journals with label by nature + * + * @param string $selectid Preselected pcg_type + * @param string $htmlname Name of field in html form + * @param int $nature Limit the list to a particular type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new) + * @param int $showempty Add an empty field + * @param array $event Event options + * @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_journal($selectid, $htmlname = 'journal', $nature=0, $showempty = 0, $event = array(), $morecss='maxwidth300 maxwidthonsmartphone', $usecache='') + { + global $conf; + + $sql = "SELECT rowid, code, label, nature, entity, active"; + $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_journal"; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " AND active = 1"; + if (empty($nature)) $sql.= " AND nature = ".$nature; + $sql.= " ORDER BY code"; + + dol_syslog(get_class($this) . "::select_journal", LOG_DEBUG); + $resql = $this->db->query($sql); + + if (!$resql) { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::select_journal ".$this->error, LOG_ERR); + return -1; + } + + $options = array(); + $out = ajax_combobox($htmlname, $event); + + $selected = 0; + while ($obj = $this->db->fetch_object($resql)) + { + $label = $obj->code . ' - ' . $obj->label; + } + $this->db->free($resql); + + if ($usecache) + { + $this->options_cache[$usecache] = $options; + } + + $out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); + + return $out; + } + /** * Return list of accounting category. * Use mysoc->country_id or mysoc->country_code so they must be defined. From 68aaef2f66737e5e9e24ea4c897a6e3a369c44cd Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 6 May 2017 08:06:01 +0200 Subject: [PATCH 04/14] Add list to select journal in bank --- .../class/accountingjournal.class.php | 20 +++--- htdocs/compta/bank/card.php | 12 +++- .../core/class/html.formaccounting.class.php | 66 ++++++++++------- .../install/mysql/migration/5.0.0-6.0.0.sql | 7 ++ .../mysql/tables/llx_accounting_journal.sql | 2 +- .../mysql/tables/llx_bank_account.key.sql | 2 + .../install/mysql/tables/llx_bank_account.sql | 70 +++++++++---------- 7 files changed, 103 insertions(+), 76 deletions(-) diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 064f56bddd6..9bff37560d7 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -136,19 +136,19 @@ class AccountingJournal extends CommonObject if ($mode == 0) { $prefix=''; - if ($nature == 9) return $langs->trans('AccountingJournalTypeHasNew'); - if ($nature == 3) return $langs->trans('AccountingJournalTypeBank'); - if ($nature == 2) return $langs->trans('AccountingJournalTypePurchase'); - if ($nature == 1) return $langs->trans('AccountingJournalTypeSale'); - if ($nature == 0) return $langs->trans('AccountingJournalTypeVariousOperation'); + if ($nature == 9) return $langs->trans('AccountingJournalType9'); + if ($nature == 4) return $langs->trans('AccountingJournalType4'); + if ($nature == 3) return $langs->trans('AccountingJournalType3'); + if ($nature == 2) return $langs->trans('AccountingJournalType2'); + if ($nature == 1) return $langs->trans('AccountingJournalType1'); } if ($mode == 1) { - if ($nature == 9) return $langs->trans('AccountingJournalTypeHasNew'); - if ($nature == 3) return $langs->trans('AccountingJournalTypeBank'); - if ($nature == 2) return $langs->trans('AccountingJournalTypePurchase'); - if ($nature == 1) return $langs->trans('AccountingJournalTypeSale'); - if ($nature == 0) return $langs->trans('AccountingJournalTypeVariousOperation'); + if ($nature == 9) return $langs->trans('AccountingJournalType9'); + if ($nature == 4) return $langs->trans('AccountingJournalType4'); + if ($nature == 3) return $langs->trans('AccountingJournalType3'); + if ($nature == 2) return $langs->trans('AccountingJournalType2'); + if ($nature == 1) return $langs->trans('AccountingJournalType1'); } } } diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 5b3bb3a58fe..75ba80052bc 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; $langs->load("banks"); @@ -278,6 +279,7 @@ $form = new Form($db); $formbank = new FormBank($db); $formcompany = new FormCompany($db); if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); +if (! empty($conf->accounting->enabled)) $formaccountancy2 = New FormAccounting($db); $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; @@ -534,7 +536,9 @@ if ($action == 'create') if (! empty($conf->accounting->enabled)) { print ''.$langs->trans("AccountancyJournal").''; - print 'accountancy_journal).'">'; + print ''; + print $formaccountancy2->select_journal($object->accountancy_journal, 'accountancy_journal', 4, 1, '', 1, 1); + print ''; } print ''; @@ -980,8 +984,10 @@ else // Accountancy journal if (! empty($conf->accounting->enabled)) { - print ''.$langs->trans("AccountancyJournal").''; - print 'accountancy_journal).'">'; + print ''.$langs->trans("AccountancyJournal").''; + print ''; + print $formaccountancy2->select_journal($object->accountancy_journal, 'accountancy_journal', 4, 1, '', 1, 1); + print ''; } print ''; diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index cb988a511cd..1a33f0fce60 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -60,37 +60,49 @@ class FormAccounting extends Form { global $conf; - $sql = "SELECT rowid, code, label, nature, entity, active"; - $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_journal"; - $sql.= " WHERE entity = ".$conf->entity; - $sql.= " AND active = 1"; - if (empty($nature)) $sql.= " AND nature = ".$nature; - $sql.= " ORDER BY code"; + $out = ''; - dol_syslog(get_class($this) . "::select_journal", LOG_DEBUG); - $resql = $this->db->query($sql); + $options = array(); + if ($usecache && ! empty($this->options_cache[$usecache])) + { + $options = $this->options_cache[$usecache]; + $selected=$selectid; + } + else + { + $sql = "SELECT rowid, code, label, nature, entity, active"; + $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_journal"; + $sql.= " WHERE active = 1"; + $sql.= " AND entity = ".$conf->entity; + //if ($nature && is_numeric($nature)) $sql .= " AND nature = ".$nature; + $sql.= " ORDER BY code"; - if (!$resql) { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::select_journal ".$this->error, LOG_ERR); - return -1; + dol_syslog(get_class($this) . "::select_journal", LOG_DEBUG); + $resql = $this->db->query($sql); + + if (!$resql) { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::select_journal ".$this->error, LOG_ERR); + return -1; + } + + $out = ajax_combobox($htmlname, $event); + + while ($obj = $this->db->fetch_object($resql)) + { + $label = $obj->code . ' - ' . $obj->label; + $select_value_out = $obj->rowid; + + $options[$select_value_out] = $label; + } + $this->db->free($resql); + + if ($usecache) + { + $this->options_cache[$usecache] = $options; + } } - $options = array(); - $out = ajax_combobox($htmlname, $event); - - $selected = 0; - while ($obj = $this->db->fetch_object($resql)) - { - $label = $obj->code . ' - ' . $obj->label; - } - $this->db->free($resql); - - if ($usecache) - { - $this->options_cache[$usecache] = $options; - } - $out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); return $out; diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index d96210dcbfe..9e4699b2e4b 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -259,4 +259,11 @@ UPDATE llx_accounting_journal SET nature = 3 where code = 'AC' and nature = 2; UPDATE llx_accounting_journal SET nature = 4 where (code = 'BK' or code = 'BQ') and nature = 3; +ALTER TABLE llx_bank_account CHANGE COLUMN accountancy_journal fk_accountancy_journal integer; +ALTER TABLE llx_bank_account ADD CONSTRAINT bank_fk_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid); + + + + + diff --git a/htdocs/install/mysql/tables/llx_accounting_journal.sql b/htdocs/install/mysql/tables/llx_accounting_journal.sql index a435de3cd80..348654b56dc 100644 --- a/htdocs/install/mysql/tables/llx_accounting_journal.sql +++ b/htdocs/install/mysql/tables/llx_accounting_journal.sql @@ -23,6 +23,6 @@ create table llx_accounting_journal entity integer DEFAULT 1, code varchar(32) NOT NULL, label varchar(128) NOT NULL, - nature smallint DEFAULT 0 NOT NULL, -- type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new) + nature smallint DEFAULT 1 NOT NULL, -- type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new) active smallint DEFAULT 0 )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_bank_account.key.sql b/htdocs/install/mysql/tables/llx_bank_account.key.sql index c91762a322e..0a168d63990 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.key.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.key.sql @@ -19,3 +19,5 @@ ALTER TABLE llx_bank_account ADD UNIQUE uk_bank_account_label (label,entity); + +ALTER TABLE llx_bank_account ADD CONSTRAINT bank_fk_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid); diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql index 7730ab79ef6..6db2857ddae 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.sql @@ -24,39 +24,39 @@ create table llx_bank_account ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - datec datetime, - tms timestamp, - ref varchar(12) NOT NULL, - label varchar(30) NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id - fk_user_author integer, - fk_user_modif integer, - bank varchar(60), - code_banque varchar(128), - code_guichet varchar(6), - number varchar(255), - cle_rib varchar(5), - bic varchar(11), - iban_prefix varchar(34), -- full iban. 34 according to ISO 13616 - country_iban varchar(2), -- deprecated - cle_iban varchar(2), - domiciliation varchar(255), - state_id integer DEFAULT NULL, - fk_pays integer NOT NULL, - proprio varchar(60), - owner_address varchar(255), - courant smallint DEFAULT 0 NOT NULL, - clos smallint DEFAULT 0 NOT NULL, - rappro smallint DEFAULT 1, - url varchar(128), - account_number varchar(32), -- bank accountancy number - accountancy_journal varchar(16) DEFAULT NULL, -- bank accountancy journal - currency_code varchar(3) NOT NULL, - min_allowed integer DEFAULT 0, - min_desired integer DEFAULT 0, - comment text, -- TODO rename in note_private - note_public text, - model_pdf varchar(255), - import_key varchar(14) + rowid integer AUTO_INCREMENT PRIMARY KEY, + datec datetime, + tms timestamp, + ref varchar(12) NOT NULL, + label varchar(30) NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + fk_user_author integer, + fk_user_modif integer, + bank varchar(60), + code_banque varchar(128), + code_guichet varchar(6), + number varchar(255), + cle_rib varchar(5), + bic varchar(11), + iban_prefix varchar(34), -- full iban. 34 according to ISO 13616 + country_iban varchar(2), -- deprecated + cle_iban varchar(2), + domiciliation varchar(255), + state_id integer DEFAULT NULL, + fk_pays integer NOT NULL, + proprio varchar(60), + owner_address varchar(255), + courant smallint DEFAULT 0 NOT NULL, + clos smallint DEFAULT 0 NOT NULL, + rappro smallint DEFAULT 1, + url varchar(128), + account_number varchar(32), -- bank accountancy number + fk_accountancy_journal integer, -- bank accountancy journal + currency_code varchar(3) NOT NULL, + min_allowed integer DEFAULT 0, + min_desired integer DEFAULT 0, + comment text, -- TODO rename in note_private + note_public text, + model_pdf varchar(255), + import_key varchar(14) )ENGINE=innodb; From 8113e6c2f21714e81dc1a4132325129fd999f4b7 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 6 May 2017 08:11:07 +0200 Subject: [PATCH 05/14] Update Accounting journal getNomUrl --- .../class/accountingjournal.class.php | 61 +++++++++++++++---- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 9bff37560d7..91924f08592 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -85,27 +85,62 @@ class AccountingJournal extends CommonObject /** * Return clicable name (with picto eventually) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @return string Chaine avec URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param int $withlabel 0=No label, 1=Include label of account + * @param int $nourl 1=Disable url + * @param string $moretitle Add more text to title tooltip + * @param int $notooltip 1=Disable tooltip + * @return string String with URL */ - function getNomUrl($withpicto = 0) { - global $langs; + function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle='',$notooltip=0) + { + global $langs, $conf, $user; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $result = ''; - $link = ''; - $linkend = ''; + $url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php'; $picto = 'billr'; + $label=''; - $label = $langs->trans("Show") . ': ' . $this->code . ' - ' . $this->label; + $label = '' . $langs->trans("ShowAccountingJournal") . ''; + if (! empty($this->code)) + $label .= '
'.$langs->trans('Code') . ': ' . $this->code; + if (! empty($this->label)) + $label .= '
'.$langs->trans('Label') . ': ' . $this->label; + if ($moretitle) $label.=' - '.$moretitle; - if ($withpicto) - $result .= ($link . img_object($label, $picto) . $linkend); - if ($withpicto && $withpicto != 2) - $result .= ' '; - if ($withpicto != 2) - $result .= $link . $this->code . ' - ' . $this->label . $linkend; + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowAccoutingJournal"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + } + + $linkstart=''; + $linkend=''; + + if ($nourl) + { + $linkstart = ''; + $linkclose = ''; + $linkend = ''; + } + + $label_link = $this->code; + if ($withlabel) $label_link .= ' - ' . $this->label; + + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); + if ($withpicto && $withpicto != 2) $result .= ' '; + if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend; return $result; } From 7c4b47f20d9e32fe753a433a5cae606c2e897854 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 6 May 2017 08:33:12 +0200 Subject: [PATCH 06/14] Update works --- htdocs/compta/bank/card.php | 18 +++++++++---- htdocs/compta/bank/class/account.class.php | 14 +++++----- htdocs/compta/bank/index.php | 27 ++++++++++++------- htdocs/compta/bank/various_payment/index.php | 4 +-- .../install/mysql/migration/5.0.0-6.0.0.sql | 2 +- .../mysql/tables/llx_bank_account.key.sql | 2 +- htdocs/langs/en_US/accountancy.lang | 3 ++- 7 files changed, 44 insertions(+), 26 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 75ba80052bc..804d2c5511d 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -38,6 +38,7 @@ if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categ if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; $langs->load("banks"); $langs->load("bills"); @@ -100,7 +101,7 @@ if ($action == 'add') $account_number = GETPOST('account_number','alpha'); if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; } - $object->accountancy_journal = trim($_POST["accountancy_journal"]); + $object->fk_accountancy_journal = trim($_POST["fk_accountancy_journal"]); $object->solde = $_POST["solde"]; $object->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); @@ -198,7 +199,7 @@ if ($action == 'update') $account_number = GETPOST('account_number', 'int'); if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; } - $object->accountancy_journal = trim($_POST["accountancy_journal"]); + $object->fk_accountancy_journal = trim($_POST["fk_accountancy_journal"]); $object->currency_code = trim($_POST["account_currency_code"]); @@ -537,7 +538,7 @@ if ($action == 'create') { print ''.$langs->trans("AccountancyJournal").''; print ''; - print $formaccountancy2->select_journal($object->accountancy_journal, 'accountancy_journal', 4, 1, '', 1, 1); + print $formaccountancy2->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 1, 1); print ''; } @@ -681,7 +682,14 @@ else if (! empty($conf->accounting->enabled)) { print ''.$langs->trans("AccountancyJournal").''; - print ''.$object->accountancy_journal.''; + print ''; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($object->fk_accountancy_journal); + + print $accountingjournal->getNomUrl(0,1,1,'',1); + + print ''; } // Other attributes @@ -986,7 +994,7 @@ else { print ''.$langs->trans("AccountancyJournal").''; print ''; - print $formaccountancy2->select_journal($object->accountancy_journal, 'accountancy_journal', 4, 1, '', 1, 1); + print $formaccountancy2->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 1, 1); print ''; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 897fd5de496..33181f666d7 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -160,7 +160,7 @@ class Account extends CommonObject * @var string */ public $account_number; - public $accountancy_journal; + public $fk_accountancy_journal; /** * Currency code @@ -545,7 +545,7 @@ class Account extends CommonObject $sql.= ", label"; $sql.= ", entity"; $sql.= ", account_number"; - $sql.= ", accountancy_journal"; + $sql.= ", fk_accountancy_journal"; $sql.= ", bank"; $sql.= ", code_banque"; $sql.= ", code_guichet"; @@ -569,7 +569,7 @@ class Account extends CommonObject $sql.= ", '".$this->db->escape($this->label)."'"; $sql.= ", ".$conf->entity; $sql.= ", '".$this->db->escape($this->account_number)."'"; - $sql.= ", '".$this->db->escape($this->accountancy_journal)."'"; + $sql.= ", '".$this->db->escape($this->fk_accountancy_journal)."'"; $sql.= ", '".$this->db->escape($this->bank)."'"; $sql.= ", '".$this->code_banque."'"; $sql.= ", '".$this->code_guichet."'"; @@ -702,7 +702,7 @@ class Account extends CommonObject $sql.= ",rappro = ".$this->rappro; $sql.= ",url = ".($this->url?"'".$this->url."'":"null"); $sql.= ",account_number = '".$this->account_number."'"; - $sql.= ",accountancy_journal = '".$this->accountancy_journal."'"; + $sql.= ",fk_accountancy_journal = '".$this->fk_accountancy_journal."'"; $sql.= ",bank = '".$this->db->escape($this->bank)."'"; $sql.= ",code_banque='".$this->code_banque."'"; @@ -847,7 +847,7 @@ class Account extends CommonObject $sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,"; $sql.= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,"; $sql.= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,"; - $sql.= " ba.account_number, ba.accountancy_journal, ba.currency_code,"; + $sql.= " ba.account_number, ba.fk_accountancy_journal, ba.currency_code,"; $sql.= " ba.min_allowed, ba.min_desired, ba.comment,"; $sql.= " ba.datec as date_creation, ba.tms as date_update,"; $sql.= ' c.code as country_code, c.label as country,'; @@ -897,7 +897,7 @@ class Account extends CommonObject $this->country = $obj->country; $this->account_number = $obj->account_number; - $this->accountancy_journal = $obj->accountancy_journal; + $this->fk_accountancy_journal = $obj->fk_accountancy_journal; $this->currency_code = $obj->currency_code; $this->account_currency_code = $obj->currency_code; @@ -1259,7 +1259,7 @@ class Account extends CommonObject include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; $langs->load("accountancy"); $label .= '
' . $langs->trans('AccountAccounting') . ': ' . length_accountg($this->account_number); - $label .= '
' . $langs->trans('AccountancyJournal') . ': ' . $this->accountancy_journal; + $label .= '
' . $langs->trans('AccountancyJournal') . ': ' . $this->fk_accountancy_journal; } $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index b808fa8f596..19ec335cac5 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -29,6 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; $langs->load("banks"); $langs->load("categories"); @@ -88,7 +90,7 @@ $arrayfields=array( 'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1), 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accountancy->enabled), - 'b.accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accountancy->enabled), + 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accountancy->enabled), 'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1), 'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), @@ -141,7 +143,7 @@ $title=$langs->trans('BankAccounts'); // Load array of financial accounts (opened by default) $accounts = array(); -$sql = "SELECT rowid, label, courant, rappro, account_number, accountancy_journal, datec as date_creation, tms as date_update"; +$sql = "SELECT rowid, label, courant, rappro, account_number, fk_accountancy_journal, datec as date_creation, tms as date_update"; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks @@ -323,7 +325,7 @@ if (! empty($arrayfields['b.account_number']['checked'])) print ''; } // Accountancy journal -if (! empty($arrayfields['b.accountancy_journal']['checked'])) +if (! empty($arrayfields['b.fk_accountancy_journal']['checked'])) { print ''; print ''; @@ -403,7 +405,7 @@ if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titr if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'],$_SERVER["PHP_SELF"],'b.account_number','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['b.accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.accountancy_journal']['label'],$_SERVER["PHP_SELF"],'b.accountancy_journal','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['b.fk_accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.fk_accountancy_journal']['label'],$_SERVER["PHP_SELF"],'b.fk_accountancy_journal','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -488,16 +490,23 @@ foreach ($accounts as $key=>$type) if (! empty($arrayfields['b.account_number']['checked'])) { include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - print ''.length_accountg($acc->account_number).''; + + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('',$acc->account_number); + + print ''.length_accountg($accountingaccount->getNomUrl(0,1,1,'',1)).''; + if (! $i) $totalarray['nbfield']++; } // Accountancy journal - if (! empty($arrayfields['b.accountancy_journal']['checked'])) + if (! empty($arrayfields['b.fk_accountancy_journal']['checked'])) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - print ''.length_accountg($acc->accountancy_journal).''; - if (! $i) $totalarray['nbfield']++; + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($acc->fk_accountancy_journal); + + print ''.$accountingjournal->getNomUrl(0,1,1,'',1).''; + if (! $i) $totalarray['nbfield']++; } // Transactions to reconcile diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 6c4b41333f1..abf6d23d22e 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -89,7 +89,7 @@ $variousstatic = new PaymentVarious($db); $accountstatic = new Account($db); $sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank,"; -$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel,"; +$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,"; $sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id"; @@ -217,7 +217,7 @@ if ($result) $accountstatic->ref=$obj->bref; $accountstatic->number=$obj->bnumber; $accountstatic->accountancy_number=$obj->account_number; - $accountstatic->accountancy_journal=$obj->accountancy_journal; + $accountstatic->fk_accountancy_journal=$obj->fk_accountancy_journal; $accountstatic->label=$obj->blabel; print $accountstatic->getNomUrl(1); } diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 9e4699b2e4b..a9293ea6915 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -260,7 +260,7 @@ UPDATE llx_accounting_journal SET nature = 4 where (code = 'BK' or code = 'BQ') ALTER TABLE llx_bank_account CHANGE COLUMN accountancy_journal fk_accountancy_journal integer; -ALTER TABLE llx_bank_account ADD CONSTRAINT bank_fk_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid); +--ALTER TABLE llx_bank_account ADD CONSTRAINT bank_fk_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid); diff --git a/htdocs/install/mysql/tables/llx_bank_account.key.sql b/htdocs/install/mysql/tables/llx_bank_account.key.sql index 0a168d63990..986ca7ea550 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.key.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.key.sql @@ -20,4 +20,4 @@ ALTER TABLE llx_bank_account ADD UNIQUE uk_bank_account_label (label,entity); -ALTER TABLE llx_bank_account ADD CONSTRAINT bank_fk_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid); +-- ALTER TABLE llx_bank_account ADD CONSTRAINT bank_fk_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 9eb4135397f..92fe19676c0 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -61,7 +61,8 @@ ChangeAndLoad=Change and load Addanaccount=Add an accounting account AccountAccounting=Accounting account AccountAccountingShort=Account -ShowAccoutingAccount=Show accounting account +ShowAccountingAccount=Show accounting account +ShowAccountingJournal=Show accounting journal AccountAccountingSuggest=Accounting account suggested MenuDefaultAccounts=Default accounts MenuVatAccounts=Vat accounts From 55feea5d9816a3a37042fe43ea790df7cfe1f613 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Sat, 6 May 2017 10:54:28 +0200 Subject: [PATCH 07/14] Update code using new css class --- htdocs/admin/stock.php | 17 +++--------- htdocs/categories/index.php | 3 +-- htdocs/categories/viewcat.php | 43 ++++++++++-------------------- htdocs/comm/card.php | 3 +-- htdocs/comm/index.php | 11 ++------ htdocs/comm/propal/stats/index.php | 5 ++-- 6 files changed, 24 insertions(+), 58 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index c8204f213c2..164e4fd6bc8 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -3,7 +3,7 @@ * Copyright (C) 2008-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2012-2013 Juanjo Menent - * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013-2017 Philippe Grand * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -435,7 +435,6 @@ if ($virtualdiffersfromphysical) print '
'; if ($conf->global->MAIN_LEVEL_FEATURES >= 2) { - $var=false; print ''; print ''; print ''."\n"; @@ -443,8 +442,7 @@ if ($conf->global->MAIN_LEVEL_FEATURES >= 2) print ''."\n"; // Example with a yes / no select - $var=!$var; - print ''; + print ''; print ''; print ''; print ''; // Example with a yes / no select - $var=!$var; - print ''; + print ''; print ''; print ''; print ''; // Example with a yes / no select - $var=!$var; - print ''; + print ''; print ''; print ''; print '
'.$langs->trans("Inventory").' 
'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").' '; @@ -457,8 +455,7 @@ if ($conf->global->MAIN_LEVEL_FEATURES >= 2) print '
'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").' '; @@ -471,8 +468,7 @@ if ($conf->global->MAIN_LEVEL_FEATURES >= 2) print '
'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").' '; @@ -487,7 +483,6 @@ if ($conf->global->MAIN_LEVEL_FEATURES >= 2) print '
'; } -$var=true; print ''; print ''; @@ -509,8 +504,6 @@ if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULAT print "\n\n"; } - - print ''; print ''; print '\n"; print "\n"; - - print ''; print ''; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index ca2b7b5c76f..b68da6fd597 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -112,8 +112,7 @@ if ($catname || $id > 0) $var=true; foreach ($cats as $cat) { - $var = ! $var; - print "\t\n"; + print "\t".''."\n"; print "\t\t\n"; if (count($cats) > 0) { - $var=true; foreach ($cats as $cat) - { - - print "\t\n"; + { + print "\t".''."\n"; print "\t\t".'\n"; @@ -360,11 +358,9 @@ if ($object->type == Categorie::TYPE_PRODUCT) if (count($prods) > 0) { - $var=true; foreach ($prods as $prod) - { - - print "\t\n"; + { + print "\t".''."\n"; print '\n"; @@ -411,12 +407,9 @@ if ($object->type == Categorie::TYPE_SUPPLIER) if (count($socs) > 0) { - $var=true; foreach ($socs as $soc) - { - - print "\t\n"; - + { + print "\t".''."\n"; print '\n"; @@ -464,14 +457,13 @@ if($object->type == Categorie::TYPE_CUSTOMER) if (count($socs) > 0) { $i = 0; - $var=true; foreach ($socs as $key => $soc) { if ($user->societe_id > 0 && $soc->id != $user->societe_id) continue; // External user always see only themself $i++; - print "\t\n"; + print "\t".''."\n"; print '\n"; @@ -520,11 +512,9 @@ if ($object->type == Categorie::TYPE_MEMBER) if (count($prods) > 0) { - $var=true; foreach ($prods as $key => $member) - { - - print "\t\n"; + { + print "\t".''."\n"; print '\n"; + print "\t".''."\n"; print '\n"; @@ -629,11 +618,9 @@ if ($object->type == Categorie::TYPE_ACCOUNT) if (count($accounts) > 0) { - $var=true; foreach ($accounts as $key => $account) - { - - print "\t\n"; + { + print "\t".''."\n"; print '\n"; @@ -684,11 +671,9 @@ if ($object->type == Categorie::TYPE_PROJECT) if (count($projects) > 0) { - $var=true; foreach ($projects as $key => $project) - { - - print "\t\n"; + { + print "\t".''."\n"; print '\n"; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index aae1398109d..b933289be4f 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -788,8 +788,7 @@ if ($id > 0) while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); - $var = ! $var; - print ""; + print ''; print '"; + print ''; print ''; print ''; print ''; - print ''; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch('',$line->code_journal); + print ''; + print '
'.$langs->trans("UserWarehouseAutoCreate").''; @@ -523,8 +516,6 @@ print ''; print "
'.$langs->trans("AllowAddLimitStockByWarehouse").'
"; $categstatic->id=$cat->id; $categstatic->ref=$cat->label; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index ebd5fa9991c..d04d0baebd2 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -289,11 +289,9 @@ else print "
'; print "".$cat->label.""; print "
'; print $prod->getNomUrl(1); print "
'; print $soc->getNomUrl(1); print "
'; print $soc->getNomUrl(1); print "
'; $member->ref=$member->login; print $member->getNomUrl(1,0); @@ -574,12 +564,11 @@ if($object->type == Categorie::TYPE_CONTACT) if (count($contacts) > 0) { $i = 0; - $var=true; foreach ($contacts as $key => $contact) { $i++; - print "\t
'; print $contact->getNomUrl(1,'category'); print "
'; print $account->getNomUrl(1,0); print "
'; print $project->getNomUrl(1,0); print "
'; $sendingstatic->id = $objp->id; $sendingstatic->ref = $objp->ref; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 4bd999b1d5a..24bccbf9c9c 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015 Jean-François Ferry + * 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 @@ -479,7 +479,6 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) $resql = $db->query($sql); if ($resql) { - $var=false; $num = $db->num_rows($resql); $i = 0; @@ -544,7 +543,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $result = $db->query($sql); if ($result) { - $var=false; $num = $db->num_rows($result); $i = 0; @@ -633,11 +631,10 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO $staticcontrat=new Contrat($db); - $var=false; while ($i < $num) { $obj = $db->fetch_object($resql); - print "
contratid."\">".img_object($langs->trans("ShowContract","contract"), 'contract')." ".$obj->ref."
contratid."\">".img_object($langs->trans("ShowContract","contract"), "contract")." ".$obj->ref."'; $companystatic->id=$objp->rowid; $companystatic->name=$objp->name; @@ -686,8 +683,6 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $i = 0; if ($num > 0) { - $var=true; - print ''; print ''; @@ -785,8 +780,6 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $i = 0; if ($num > 0) { - $var=true; - print '
'.$langs->trans("ProposalsOpened").' '.$num.'
'; print ''; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index abb24b8ffa4..5c74c8374a0 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -293,7 +293,6 @@ print ''; print ''; $oldyear=0; -$var=true; foreach ($data as $val) { $year = $val['year']; @@ -301,7 +300,7 @@ foreach ($data as $val) { // If we have empty year $oldyear--; - print ''; + print ''; print ''; print ''; print ''; @@ -311,7 +310,7 @@ foreach ($data as $val) print ''; print ''; } - print ''; + print ''; print ''; print ''; print ''; From a3602ff6b48170db1f964031565932e5786969a0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 8 May 2017 06:20:17 +0200 Subject: [PATCH 08/14] Add journal list in new movement card --- htdocs/accountancy/bookkeeping/card.php | 66 +++++++++-------- htdocs/accountancy/bookkeeping/list.php | 9 ++- .../class/accountingjournal.class.php | 71 +++++++++++-------- .../core/class/html.formaccounting.class.php | 22 +++++- 4 files changed, 107 insertions(+), 61 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index ce0bd4d3aa2..055451016e9 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2016 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 @@ -18,9 +18,9 @@ */ /** - * \file htdocs/accountancy/bookkeeping/card.php + * \file htdocs/accountancy/bookkeeping/card.php * \ingroup Advanced accountancy - * \brief Page to show book-entry + * \brief Page to show book-entry */ require '../../main.inc.php'; @@ -28,9 +28,14 @@ require '../../main.inc.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'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; // Langs $langs->load("accountancy"); +$langs->load("bank"); +$langs->load("bills"); +$langs->load("trips"); // Security check $id = GETPOST('id', 'int'); @@ -211,6 +216,7 @@ llxHeader(); $html = new Form($db); $formventilation = new FormVentilation($db); +$formaccountancy = new FormAccounting($db); /* * Confirmation to delete the command @@ -223,26 +229,6 @@ if ($action == 'delete') { if ($action == 'create') { print load_fiche_titre($langs->trans("CreateMvts")); - $code_journal_array = array ( - $conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL, - $conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL, - $conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL, - $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL, - $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL - ); - - $sql = 'SELECT DISTINCT accountancy_journal FROM ' . MAIN_DB_PREFIX . 'bank_account WHERE clos=0'; - $resql = $db->query($sql); - if (! $resql) { - setEventMessages($db->lasterror, null, 'errors'); - } else { - while ( $obj_bank = $db->fetch_object($resql) ) { - if (! empty($obj_bank->accountancy_journal)) { - $code_journal_array[$obj_bank->accountancy_journal] = $obj_bank->accountancy_journal; - } - } - } - $book = new BookKeeping($db); $next_num_mvt = $book->getNextNumMvt(); if (empty($next_num_mvt)) @@ -270,9 +256,10 @@ if ($action == 'create') { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; @@ -308,25 +295,46 @@ if ($action == 'create') { print '
'; print '
'.$langs->trans("OrdersOpened").' '.$num.'
%
0?'&userid='.$userid:'').'">'.$oldyear.'0
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.round($val['nb_diff']).'
' . $langs->trans("Codejournal") . '' . $html->selectarray('code_journal', $code_journal_array) . '
'.$langs->trans("AccountancyJournal").''; + print $formaccountancy->select_journal('', 'code_journal', '', 0, '', 1, 1, 1, 1); + print '
' . $langs->trans("Docref") . '
'; + print ''; print ''; print ''; print ''; + print ''; print ''; print ''; print ''; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; + + $typelabel = $book->doc_type; + if ($typelabel == 'bank') { + $typelabel = $langs->trans('Bank'); + } + if ($typelabel == 'customer_invoice') { + $typelabel = $langs->trans('CustomerInvoice'); + } + if ($typelabel == 'supplier_invoice') { + $typelabel = $langs->trans('SupplierInvoice'); + } + if ($typelabel == 'expense_report') { + $typelabel = $langs->trans('ExpenseReport'); + } print ''; print ''; - print ''; + print ''; print ''; print '
' . $langs->trans("NumMvts") . '' . $book->piece_num . '
' . $langs->trans("Docdate") . '' . dol_print_date($book->doc_date, 'daytextshort') . '
' . $langs->trans("Codejournal") . '' . $book->code_journal . '
'; + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch('',$book->code_journal); + print $accountingjournal->getNomUrl(0,1,1,'',1); + print '
' . $langs->trans("Docref") . '' . $book->doc_ref . '
' . $langs->trans("Doctype") . '' . $book->doc_type . '' . $typelabel . '
'; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 75d0a63bf39..b382d855994 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2016 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -31,6 +31,7 @@ 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'; // Langs $langs->load("accountancy"); @@ -443,7 +444,11 @@ foreach ($object->lines as $line ) { print '
' . $line->label_compte . '' . price($line->debit) . '' . price($line->credit) . '' . $line->code_journal . '' . $accountingjournal->getNomUrl(0,0,0,'',0) . ''; print '' . img_edit() . ' '; print '' . img_delete() . ''; diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 91924f08592..168934ee5a5 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -48,45 +48,60 @@ class AccountingJournal extends CommonObject } /** - * Load an object from database - * - * @param int $id Id of record to load - * @return int <0 if KO, >0 if OK - */ - function fetch($id) + * Load an object from database + * + * @param int $rowid Id of record to load + * @param string $journal_code Journal code + * @return int <0 if KO, Id of record if OK and found + */ + function fetch($rowid = null, $journal_code = null) { - $sql = "SELECT rowid, code, label, nature, active"; - $sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal"; - $sql.= " WHERE rowid = ".$id; - - dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG); - $result = $this->db->query($sql); - if ( $result ) + if ($rowid || $journal_code) { - $obj = $this->db->fetch_object($result); + $sql = "SELECT rowid, code, label, nature, active"; + $sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal"; + $sql .= " WHERE"; + if ($rowid) { + $sql .= " rowid = '" . $rowid . "'"; + } elseif ($journal_code) { + $sql .= " code = '" . $journal_code . "'"; + } - $this->id = $obj->rowid; + dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $obj = $this->db->fetch_object($result); - $this->code = $obj->code; - $this->ref = $obj->code; - $this->label = $obj->label; - $this->nature = $obj->nature; - $this->active = $obj->active; + if ($obj) { + $this->id = $obj->rowid; + $this->rowid = $obj->rowid; - return 1; - } - else - { - $this->error=$this->db->lasterror(); - return -1; + $this->code = $obj->code; + $this->ref = $obj->code; + $this->label = $obj->label; + $this->nature = $obj->nature; + $this->active = $obj->active; + + return $this->id; + } else { + return 0; + } + } + else + { + $this->error = "Error " . $this->db->lasterror(); + $this->errors[] = "Error " . $this->db->lasterror(); + } } + return -1; } /** * Return clicable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $withlabel 0=No label, 1=Include label of account + * @param int $withlabel 0=No label, 1=Include label of journal * @param int $nourl 1=Disable url * @param string $moretitle Add more text to title tooltip * @param int $notooltip 1=Disable tooltip @@ -100,7 +115,7 @@ class AccountingJournal extends CommonObject $result = ''; - $url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php'; + $url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35'; $picto = 'billr'; $label=''; diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 1a33f0fce60..a87b566d0d6 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -51,12 +51,14 @@ class FormAccounting extends Form * @param int $nature Limit the list to a particular type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new) * @param int $showempty Add an empty field * @param array $event Event options + * @param int $select_in 0=selectid value is the journal rowid (default) or 1=selectid is journal code + * @param int $select_out Set value returned by select. 0=rowid (default), 1=code * @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_journal($selectid, $htmlname = 'journal', $nature=0, $showempty = 0, $event = array(), $morecss='maxwidth300 maxwidthonsmartphone', $usecache='') + function select_journal($selectid, $htmlname = 'journal', $nature=0, $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='') { global $conf; @@ -88,11 +90,27 @@ class FormAccounting extends Form $out = ajax_combobox($htmlname, $event); + $selected = 0; while ($obj = $this->db->fetch_object($resql)) { $label = $obj->code . ' - ' . $obj->label; + + $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->code; + } + if ($select_out == 1) { + $select_value_out = $obj->code; + } + // Remember guy's we store in database llx_accounting_bookkeeping the code of accounting_journal and not the rowid + 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); @@ -103,7 +121,7 @@ class FormAccounting extends Form } } - $out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); + $out .= Form::selectarray($htmlname, $options, $select, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); return $out; } From ae57395562dd62e7ccc6e664974a4188decc7438 Mon Sep 17 00:00:00 2001 From: alexis portable Date: Tue, 9 May 2017 22:24:24 +0200 Subject: [PATCH 09/14] NEW get amount base on thm for ficheinter --- htdocs/fichinter/class/fichinter.class.php | 27 +++++++++++++++++++++- htdocs/projet/element.php | 7 +++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 2942a8903ab..b52dfdc904b 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -360,6 +360,8 @@ class Fichinter extends CommonObject $this->modelpdf = $obj->model_pdf; $this->fk_contrat = $obj->fk_contrat; + $this->user_creation= $obj->fk_user_author; + $this->extraparams = (array) json_decode($obj->extraparams, true); if ($this->statut == 0) $this->brouillon = 1; @@ -537,7 +539,30 @@ class Fichinter extends CommonObject } } - + /** + * Returns amount based on user thm + * + * @return float amount + */ + function getAmount() { + global $db; + + $amount = 0; + + $this->author = new User($db); + $this->author->fetch($this->user_creation); + + $thm = $this->author->thm; + + foreach($this->lines as &$line) { + + $amount+=$line->qty * $thm; + + } + + return $amount; + } + /** * Returns the label status * diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 09a3fecc4bd..02bf6c5a9ba 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -333,7 +333,8 @@ $listofreferent=array( 'class'=>'Fichinter', 'table'=>'fichinter', 'datefieldname'=>'date_valid', - 'disableamount'=>1, + 'disableamount'=>0, + 'margin'=>'minus', 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid, 'lang'=>'interventions', 'buttonnew'=>'AddIntervention', @@ -559,6 +560,7 @@ foreach ($listofreferent as $key => $value) if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty(); if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount; elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty); + else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount(); elseif ($tablename == 'projet_task') { if ($idofelementuser) @@ -583,6 +585,7 @@ foreach ($listofreferent as $key => $value) if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line; if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount; + else if($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount(); elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty); elseif ($tablename == 'projet_task') { @@ -948,6 +951,7 @@ foreach ($listofreferent as $key => $value) $total_ht_by_line=null; $othermessage=''; if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount; + else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount(); elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty); elseif (in_array($tablename, array('projet_task'))) { @@ -988,6 +992,7 @@ foreach ($listofreferent as $key => $value) { $total_ttc_by_line=null; if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount; + else if($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount(); elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty); elseif ($tablename == 'projet_task') { From b157398da4f8fa909678ec4a06bcd94d71103da9 Mon Sep 17 00:00:00 2001 From: alexis portable Date: Tue, 9 May 2017 22:54:33 +0200 Subject: [PATCH 10/14] fiche inter fix user author fetch --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index b52dfdc904b..d9912edfca1 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -326,7 +326,7 @@ class Fichinter extends CommonObject function fetch($rowid,$ref='') { $sql = "SELECT f.rowid, f.ref, f.description, f.fk_soc, f.fk_statut,"; - $sql.= " f.datec, f.dateo, f.datee, f.datet,"; + $sql.= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,"; $sql.= " f.date_valid as datev,"; $sql.= " f.tms as datem,"; $sql.= " f.duree, f.fk_projet, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat"; From 267e66abfa92ed83ee633677092bea20e9ecda4e Mon Sep 17 00:00:00 2001 From: Thomas Raschbacher Date: Wed, 10 May 2017 08:48:28 +0200 Subject: [PATCH 11/14] Add more fields to projectcontacts substitution civility added + extrafields for external contacts + isInternal to decide in template wether to list internal or not --- .../doc/doc_generic_project_odt.modules.php | 59 +++++++++++-------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 7d0fe1a41e6..fbe3db84370 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -185,39 +185,50 @@ class doc_generic_project_odt extends ModelePDFProjects function get_substitutionarray_project_contacts($contact,$outputlangs) { global $conf; + $pc='projcontacts_'; // prefix to avoid typos - // adding phone numbers if external - $phone_pro = ''; - $phone_perso = ''; - $phone_mobile = ''; + $ret = array( + $pc.'id'=>$contact['id'], + $pc.'rowid'=>$contact['rowid'], + $pc.'role'=>$contact['libelle'], + $pc.'lastname'=>$contact['lastname'], + $pc.'firstname'=>$contact['firstname'], + $pc.'civility'=>$contact['civility'], + $pc.'fullcivname'=>$contact['fullname'], + $pc.'socname'=>$contact['socname'], + $pc.'email'=>$contact['email'] + ); - $ct = new Contact($this->db); if ($contact['source']=='external') { + $ret[$pc.'isInternal'] = ''; // not internal + $ct = new Contact($this->db); $ct->fetch($contact['id']); - $phone_pro = $ct->phone_pro; - $phone_perso = $ct->phone_perso; - $phone_mobile = $ct->phone_mobile; + $ret[$pc.'phone_pro'] = $ct->phone_pro; + $ret[$pc.'phone_perso'] = $ct->phone_perso; + $ret[$pc.'phone_mobile'] = $ct->phone_mobile; + + // fetch external user extrafields + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); + $extrafields=new ExtraFields($this->db); + $extralabels=$extrafields->fetch_name_optionals_label($ct->table_element, true); + $extrafields_num = $ct->fetch_optionals($ct->id, $extralabels); + //dol_syslog(get_class($this)."::get_substitutionarray_project_contacts: ===== Number of Extrafields found: ".$extrafields_num, LOG_DEBUG); + foreach($ct->array_options as $efkey => $efval) { + dol_syslog(get_class($this)."::get_substitutionarray_project_contacts: +++++ Extrafield ".$efkey." => ".$efval, LOG_DEBUG); + $ret[$pc.$efkey] = $efval; // add nothing else because it already comes as 'options_XX' + } } elseif ($contact['source']=='internal') { + $ret[$pc.'isInternal'] = '1'; // this is an internal user + $ct = new User($this->db); $ct->fetch($contact['id']); - $phone_pro = $ct->office_phone; - $phone_mobile = $ct->user_mobile; + $ret[$pc.'phone_pro'] = $ct->office_phone; + $ret[$pc.'phone_perso'] = ''; + $ret[$pc.'phone_mobile'] = $ct->user_mobile; + // do internal users have extrafields ? } - - return array( - 'projcontacts_id'=>$contact['id'], - 'projcontacts_rowid'=>$contact['rowid'], - 'projcontacts_role'=>$contact['libelle'], - 'projcontacts_lastname'=>$contact['lastname'], - 'projcontacts_firstname'=>$contact['firstname'], - 'projcontacts_fullcivname'=>$contact['fullname'], - 'projcontacts_socname'=>$contact['socname'], - 'projcontacts_email'=>$contact['email'], - 'projcontacts_phone_pro'=>$phone_pro, - 'projcontacts_phone_perso'=>$phone_perso, - 'projcontacts_phone_mobile'=>$phone_mobile - ); + return $ret; } /** From 984531411d123527f7209eef1e459d74dfe16ae2 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Wed, 10 May 2017 15:01:27 +0200 Subject: [PATCH 12/14] NEW: permit multiple file upload in linked documents --- htdocs/core/class/html.formfile.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8d90892cfb6..022579b3a7c 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -126,7 +126,9 @@ class FormFile { $out .= ''; } - $out .= 'global->MAIN_USE_MULTIPLE_FILEUPLOAD)?' name="userfile"':' name="userfile[]" multiple'); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':''); $out .= '>'; $out .= ' '; From 70de54e97dfd85fa601ef4af22500824bf890037 Mon Sep 17 00:00:00 2001 From: Thomas Raschbacher Date: Wed, 10 May 2017 15:21:53 +0200 Subject: [PATCH 13/14] fix project extrafields for ODT for some raeson the code was checking for already existing extra fields before even fetching it. removed the if condition, now it works fine. --- .../doc/doc_generic_project_odt.modules.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index fbe3db84370..e050bf8e3eb 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -131,18 +131,15 @@ class doc_generic_project_odt extends ModelePDFProjects ); // Retrieve extrafields - if (is_array($object->array_options) && count($object->array_options)) - { - $extrafieldkey=$object->element; + $extrafieldkey=$object->element; - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true); - $object->fetch_optionals($object->id,$extralabels); - - $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); - } + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true); + $object->fetch_optionals($object->id,$extralabels); + $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); + return $resarray; } From 2b64cf0ebeabaf79fbc315994cb0f34cf5de3dbf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 May 2017 23:24:33 +0200 Subject: [PATCH 14/14] Update html.formfile.class.php --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 022579b3a7c..5dada97908b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -128,7 +128,7 @@ class FormFile } $out .= 'global->MAIN_USE_MULTIPLE_FILEUPLOAD)?' name="userfile"':' name="userfile[]" multiple'); + $out .= ((empty($conf->global->MAIN_USE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout == 'phone')?' name="userfile"':' name="userfile[]" multiple'); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':''); $out .= '>'; $out .= ' ';