From 15ed7584b80f2e283780e190434d7b8d31925ec0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Jan 2018 17:06:06 +0100 Subject: [PATCH] Fix navigation in accounting account card --- htdocs/accountancy/admin/card.php | 38 ++++++++----------- .../class/accountingaccount.class.php | 20 ++++++++++ htdocs/core/class/html.form.class.php | 1 - .../install/mysql/migration/6.0.0-7.0.0.sql | 4 ++ htdocs/install/repair.php | 5 ++- 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 79a8a531ec9..82ba00a882c 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -39,6 +39,7 @@ $mesg = ''; $action = GETPOST('action','aZ09'); $backtopage = GETPOST('backtopage','alpha'); $id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); $rowid = GETPOST('rowid', 'int'); $cancel = GETPOST('cancel','alpha'); @@ -261,8 +262,10 @@ if ($action == 'create') { print ''; print ''; -} else if ($id) { - $result = $object->fetch($id); +} +else if ($id > 0 || $ref) { + + $result = $object->fetch($id, $ref, 1); if ($result > 0) { dol_htmloutput_mesg($mesg); @@ -329,17 +332,18 @@ if ($action == 'create') { // View mode $linkback = '' . $langs->trans("BackToList") . ''; - dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); + dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), -1, 'billr'); + + dol_banner_tab($object, 'ref', $linkback, 1, 'account_number', 'ref'); + + + print '
'; + print '
'; print ''; - // Account number - print ''; - print ''; - print ''; - // Label - print ''; + print ''; print ''; // Account parent @@ -361,20 +365,10 @@ if ($action == 'create') { print ''; print ''; - // Active - print ''; - print ''; - print '
' . $langs->trans("AccountNumber") . '' . $object->account_number . '' . $linkback . '
' . $langs->trans("Label") . '
' . $langs->trans("Label") . '' . $object->label . '
' . $langs->trans("Pcgsubtype") . '' . $object->pcg_subtype . '
' . $langs->trans("Status") . ''; - print $object->getLibStatut(4); - /*if (empty($object->active)) { - print img_picto($langs->trans("Disabled"), 'switch_off'); - } else { - print img_picto($langs->trans("Activated"), 'switch_on'); - }*/ - - print '
'; + print '
'; + dol_fiche_end(); /* @@ -397,7 +391,7 @@ if ($action == 'create') { print ''; } } else { - dol_print_error($db); + dol_print_error($db, $object->error, $object->errors); } } diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 74d86d567bf..f5dd7159528 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -30,6 +30,21 @@ */ class AccountingAccount extends CommonObject { + public $element='accounting_account'; + public $table_element='accounting_account'; + public $picto = 'billr'; + + /** + * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + * @var int + */ + public $ismultientitymanaged = 1; + /** + * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user + * @var integer + */ + public $restrictiononfksoc = 1; + var $db; var $error; var $errors; @@ -48,13 +63,17 @@ class AccountingAccount extends CommonObject var $active; // duplicate with status var $status; + /** * Constructor * * @param DoliDB $db Database handle */ function __construct($db) { + global $conf; + $this->db = $db; + $this->next_prev_filter='fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method } /** @@ -91,6 +110,7 @@ class AccountingAccount extends CommonObject if ($obj) { $this->id = $obj->rowid; $this->rowid = $obj->rowid; + $this->ref = $obj->account_number; $this->datec = $obj->datec; $this->tms = $obj->tms; $this->fk_pcg_version = $obj->fk_pcg_version; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4f347fb9f0e..8d513fae9bf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6234,7 +6234,6 @@ class Form $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters, $object); // Note that $action and $object may have been modified by hook $object->next_prev_filter.=$hookmanager->resPrint; } - $previous_ref = $next_ref = ''; if ($shownav) { diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index d3ff5bd6e17..ae74a1161fb 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -25,6 +25,10 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY fk_pcg_version VARCHAR(20) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY fk_pcg_version VARCHAR(20) COLLATE utf8_unicode_ci; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_system MODIFY pcg_version VARCHAR(20) CHARACTER SET utf8; +-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_system MODIFY pcg_version VARCHAR(20) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) CHARACTER SET utf8; diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 1396fbfb4cf..3f4fa2d2910 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1036,10 +1036,13 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) print ''; print $table; $sql='ALTER TABLE '.$table.' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci'; + print $sql; if (GETPOST('force_utf8_on_tables','alpha') == 'confirmed') { - $db->query($sql); + $resql = $db->query($sql); + print ' - Done ('.$resql.')'; } + else print ' - Disabled'; print ''; } }