diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 3522460e07b..b23f5cb5421 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro - * Copyright (C) 2014 Florian Henry + * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2014 Florian Henry * * 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 @@ -19,7 +19,7 @@ /** * \file htdocs/accountancy/admin/card.php - * \ingroup Advanced accountancy + * \ingroup Advanced accountancy * \brief Card of accounting account */ @@ -59,7 +59,7 @@ if (GETPOST('cancel')) header("Location: ".$urltogo); exit; } - + if ($action == 'add' && $user->rights->accounting->chartofaccount) { if (! $cancel) { @@ -86,7 +86,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) } else { $account_parent = GETPOST('account_parent','int'); } - + $object->fk_pcg_version = $obj->pcg_version; $object->pcg_type = GETPOST('pcg_type'); $object->pcg_subtype = GETPOST('pcg_subtype'); @@ -95,7 +95,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) $object->account_category = GETPOST('account_category'); $object->label = GETPOST('label', 'alpha'); $object->active = 1; - + $res = $object->create($user); if ($res == - 3) { $error = 1; @@ -124,9 +124,9 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) } else if ($action == 'edit' && $user->rights->accounting->chartofaccount) { if (! $cancel) { $result = $object->fetch($id); - + $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; - + dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); $result2 = $db->query($sql); $obj = $db->fetch_object($result2); @@ -156,9 +156,9 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) $object->account_parent = $account_parent; $object->account_category = GETPOST('account_category'); $object->label = GETPOST('label', 'alpha'); - + $result = $object->update($user); - + if ($result > 0) { $urltogo=$backtopage?$backtopage:($_SERVER["PHP_SELF"]."?id=".$id); header("Location: " . $urltogo); @@ -205,13 +205,13 @@ $accountsystem->fetch($conf->global->CHARTOFACCOUNTS); // Create mode if ($action == 'create') { print load_fiche_titre($langs->trans('NewAccountingAccount')); - + print '
' . "\n"; print ''; print ''; - + dol_fiche_head(); - + print ''; // Chart of account @@ -219,8 +219,7 @@ if ($action == 'create') { print ''; - - + // Account number print ''; print ''; @@ -245,56 +244,54 @@ if ($action == 'create') { print ''; print ''; // Chart of acounts subtype print ''; print ''; - + print '
'; print $accountsystem->ref; print '
' . $langs->trans("AccountNumber") . '
' . $langs->trans("Pcgtype") . ''; print ''; - //print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1); print '
' . $langs->trans("Pcgsubtype") . ''; print ''; - //print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1); print '
'; - + dol_fiche_end(); - + print '
'; print ''; print '     '; print ''; print '
'; - + print '
'; } else if ($id) { $result = $object->fetch($id); - + if ($result > 0) { dol_htmloutput_mesg($mesg); - + $head = accounting_prepare_head($object); - + // Edit mode if ($action == 'update') { dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); - + print '
' . "\n"; print ''; print ''; print ''; print ''; - + print ''; - + // Account number print ''; print ''; - + // Label print ''; print ''; - + // Account parent print ''; print ''; // Category - print ''; + print ''; print ''; + $formaccounting->select_accounting_category($object->account_category, 'account_category', 1); + print ''; // Chart of accounts type print ''; print ''; @@ -318,29 +314,27 @@ if ($action == 'create') { print ''; print ''; - + print '
' . $langs->trans("AccountNumber") . '
' . $langs->trans("Label") . '
' . $langs->trans("Accountparent") . ''; @@ -302,15 +299,14 @@ if ($action == 'create') { print '
'.$langs->trans("AccountingCategory").'
'.$langs->trans("AccountingCategory").''; - $formaccounting->select_accounting_category($object->account_category, 'account_category', 1); - print '
' . $langs->trans("Pcgtype") . ''; - //print $htmlacc->select_pcgtype($object->pcg_type, 'pcg_type', 1); print ''; print '
' . $langs->trans("Pcgsubtype") . ''; print ''; - //print $htmlacc->select_pcgsubtype($object->pcg_subtype, 'pcg_subtype', 1); print '
'; - + dol_fiche_end(); - + print '
'; print ''; print '     '; print ''; print '
'; - + print '
'; } else { - // View mode $linkback = '' . $langs->trans("BackToChartofaccounts") . ''; - + dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); - + print ''; - + // Account number print ''; print ''; @@ -378,31 +372,30 @@ if ($action == 'create') { } else { print img_picto($langs->trans("Activated"), 'switch_on'); }*/ - + print ''; - + print '
' . $langs->trans("AccountNumber") . '' . $object->account_number . '
'; - + dol_fiche_end(); - + /* * Actions buttons */ - print '
'; - + if (! empty($user->rights->accounting->chartofaccount)) { print '' . $langs->trans('Modify') . ''; } else { print '' . $langs->trans('Modify') . ''; } - + if (! empty($user->rights->accounting->chartofaccount)) { print '' . $langs->trans('Delete') . ''; } else { print '' . $langs->trans('Delete') . ''; } - + print '
'; } } else { diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 4a6c82cb581..f4f155c0b59 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -146,36 +146,35 @@ if ($result) { while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); print ''; - + print ''; print $objp->accounting; print ''; - + print ''; print ''; print ''; - + // Colonne choix du compte print ''; print $htmlacc->select_account($accounting->account_parent, 'AccountParent'); print ''; - + print ''; - print $htmlacc->select_pcgtype($accounting->pcg_type, 'pcgType'); + print ''; print ''; - + print ''; - print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcgSubType'); + print ''; print ''; - + // Colonne choix ligne a ventiler - $checked = ('label' == 'O') ? ' checked' : ''; - + print ''; print ''; print ''; - + print ''; $i ++; } diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index 112bde76038..d7a827f2480 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -151,97 +151,6 @@ class FormVentilation extends Form return $out; } - /** - * Return list of accounts with label by class of 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_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) { - global $conf; - - $sql = "SELECT DISTINCT pcg_type "; - $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 .= " ORDER BY pcg_type"; - - dol_syslog(get_class($this) . "::select_pcgtype", LOG_DEBUG); - $resql = $this->db->query($sql); - - if (!$resql) { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::select_pcgtype ".$this->error, LOG_ERR); - return -1; - } - - $options = array(); - $out = ajax_combobox($htmlname, $event); - - while ($obj = $this->db->fetch_object($resql)) - { - if ($obj->pcg_type != '-1') - { - $options[$obj->pcg_type] = $obj->pcg_type; - } - } - - $out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200'); - - $this->db->free($resql); - return $out; - } - - /** - * Return list of accounts with label by sub_class of 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_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) - { - global $conf; - - $sql = "SELECT DISTINCT pcg_subtype "; - $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 .= " ORDER BY pcg_subtype"; - - dol_syslog(get_class($this) . "::select_pcgsubtype", LOG_DEBUG); - $resql = $this->db->query($sql); - - if (!$resql) { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR); - return -1; - } - - $options = array(); - $out = ajax_combobox($htmlname, $event); - - while ($obj = $this->db->fetch_object($resql)) - { - if ($obj->pcg_type != '-1') - { - $options[$obj->pcg_subtype] = $obj->pcg_subtype; - } - } - - $out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth200'); - - $this->db->free($resql); - return $out; - } - /** * Return list of auxilary thirdparty accounts *