Add list to select journal in bank
This commit is contained in:
parent
a4defb8102
commit
68aaef2f66
@ -136,19 +136,19 @@ class AccountingJournal extends CommonObject
|
|||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
$prefix='';
|
$prefix='';
|
||||||
if ($nature == 9) return $langs->trans('AccountingJournalTypeHasNew');
|
if ($nature == 9) return $langs->trans('AccountingJournalType9');
|
||||||
if ($nature == 3) return $langs->trans('AccountingJournalTypeBank');
|
if ($nature == 4) return $langs->trans('AccountingJournalType4');
|
||||||
if ($nature == 2) return $langs->trans('AccountingJournalTypePurchase');
|
if ($nature == 3) return $langs->trans('AccountingJournalType3');
|
||||||
if ($nature == 1) return $langs->trans('AccountingJournalTypeSale');
|
if ($nature == 2) return $langs->trans('AccountingJournalType2');
|
||||||
if ($nature == 0) return $langs->trans('AccountingJournalTypeVariousOperation');
|
if ($nature == 1) return $langs->trans('AccountingJournalType1');
|
||||||
}
|
}
|
||||||
if ($mode == 1)
|
if ($mode == 1)
|
||||||
{
|
{
|
||||||
if ($nature == 9) return $langs->trans('AccountingJournalTypeHasNew');
|
if ($nature == 9) return $langs->trans('AccountingJournalType9');
|
||||||
if ($nature == 3) return $langs->trans('AccountingJournalTypeBank');
|
if ($nature == 4) return $langs->trans('AccountingJournalType4');
|
||||||
if ($nature == 2) return $langs->trans('AccountingJournalTypePurchase');
|
if ($nature == 3) return $langs->trans('AccountingJournalType3');
|
||||||
if ($nature == 1) return $langs->trans('AccountingJournalTypeSale');
|
if ($nature == 2) return $langs->trans('AccountingJournalType2');
|
||||||
if ($nature == 0) return $langs->trans('AccountingJournalTypeVariousOperation');
|
if ($nature == 1) return $langs->trans('AccountingJournalType1');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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';
|
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->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 . '/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/accountingaccount.class.php';
|
||||||
|
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
@ -278,6 +279,7 @@ $form = new Form($db);
|
|||||||
$formbank = new FormBank($db);
|
$formbank = new FormBank($db);
|
||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($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").')';
|
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||||
|
|
||||||
@ -534,7 +536,9 @@ if ($action == 'create')
|
|||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
||||||
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(GETPOST("accountancy_journal")?GETPOST('accountancy_journal', 'alpha'):$object->accountancy_journal).'"></td></tr>';
|
print '<td>';
|
||||||
|
print $formaccountancy2->select_journal($object->accountancy_journal, 'accountancy_journal', 4, 1, '', 1, 1);
|
||||||
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -981,7 +985,9 @@ else
|
|||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
|
||||||
print '<td><input type="text" name="accountancy_journal" value="'.(isset($_POST["accountancy_journal"])?GETPOST("accountancy_journal"):$object->accountancy_journal).'"></td></tr>';
|
print '<td>';
|
||||||
|
print $formaccountancy2->select_journal($object->accountancy_journal, 'accountancy_journal', 4, 1, '', 1, 1);
|
||||||
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -60,11 +60,21 @@ class FormAccounting extends Form
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
$out = '';
|
||||||
|
|
||||||
|
$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 = "SELECT rowid, code, label, nature, entity, active";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_journal";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_journal";
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
$sql.= " WHERE active = 1";
|
||||||
$sql.= " AND active = 1";
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
if (empty($nature)) $sql.= " AND nature = ".$nature;
|
//if ($nature && is_numeric($nature)) $sql .= " AND nature = ".$nature;
|
||||||
$sql.= " ORDER BY code";
|
$sql.= " ORDER BY code";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::select_journal", LOG_DEBUG);
|
dol_syslog(get_class($this) . "::select_journal", LOG_DEBUG);
|
||||||
@ -76,13 +86,14 @@ class FormAccounting extends Form
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array();
|
|
||||||
$out = ajax_combobox($htmlname, $event);
|
$out = ajax_combobox($htmlname, $event);
|
||||||
|
|
||||||
$selected = 0;
|
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$label = $obj->code . ' - ' . $obj->label;
|
$label = $obj->code . ' - ' . $obj->label;
|
||||||
|
$select_value_out = $obj->rowid;
|
||||||
|
|
||||||
|
$options[$select_value_out] = $label;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
@ -90,6 +101,7 @@ class FormAccounting extends Form
|
|||||||
{
|
{
|
||||||
$this->options_cache[$usecache] = $options;
|
$this->options_cache[$usecache] = $options;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,6 @@ create table llx_accounting_journal
|
|||||||
entity integer DEFAULT 1,
|
entity integer DEFAULT 1,
|
||||||
code varchar(32) NOT NULL,
|
code varchar(32) NOT NULL,
|
||||||
label varchar(128) 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
|
active smallint DEFAULT 0
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -19,3 +19,5 @@
|
|||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_bank_account ADD UNIQUE uk_bank_account_label (label,entity);
|
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);
|
||||||
|
|||||||
@ -51,7 +51,7 @@ create table llx_bank_account
|
|||||||
rappro smallint DEFAULT 1,
|
rappro smallint DEFAULT 1,
|
||||||
url varchar(128),
|
url varchar(128),
|
||||||
account_number varchar(32), -- bank accountancy number
|
account_number varchar(32), -- bank accountancy number
|
||||||
accountancy_journal varchar(16) DEFAULT NULL, -- bank accountancy journal
|
fk_accountancy_journal integer, -- bank accountancy journal
|
||||||
currency_code varchar(3) NOT NULL,
|
currency_code varchar(3) NOT NULL,
|
||||||
min_allowed integer DEFAULT 0,
|
min_allowed integer DEFAULT 0,
|
||||||
min_desired integer DEFAULT 0,
|
min_desired integer DEFAULT 0,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user