Fix navigation in accounting account card

This commit is contained in:
Laurent Destailleur 2018-01-11 17:06:06 +01:00
parent 6d9a9dd3fe
commit 15ed7584b8
5 changed files with 44 additions and 24 deletions

View File

@ -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 '</div>';
print '</form>';
} 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 = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">' . $langs->trans("BackToList") . '</a>';
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 '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Account number
print '<tr><td class="titlefield">' . $langs->trans("AccountNumber") . '</td>';
print '<td>' . $object->account_number . '</td>';
print '<td align="right" width="25%">' . $linkback . '</td></tr>';
// Label
print '<tr><td>' . $langs->trans("Label") . '</td>';
print '<tr><td class="titlefield">' . $langs->trans("Label") . '</td>';
print '<td colspan="2">' . $object->label . '</td></tr>';
// Account parent
@ -361,20 +365,10 @@ if ($action == 'create') {
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>';
// Active
print '<tr><td>' . $langs->trans("Status") . '</td>';
print '<td colspan="2">';
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 '</td></tr>';
print '</table>';
print '</div>';
dol_fiche_end();
/*
@ -397,7 +391,7 @@ if ($action == 'create') {
print '</div>';
}
} else {
dol_print_error($db);
dol_print_error($db, $object->error, $object->errors);
}
}

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -1036,10 +1036,13 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha'))
print '<tr><td colspan="2">';
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 '</td></tr>';
}
}