Accountancy - Activate multijournal on bank_journal
This commit is contained in:
parent
417f71a8be
commit
90c1a38486
@ -65,10 +65,8 @@ $langs->load("accountancy");
|
|||||||
$langs->load("trips");
|
$langs->load("trips");
|
||||||
$langs->load("hrm");
|
$langs->load("hrm");
|
||||||
|
|
||||||
// Old system menu
|
|
||||||
$id_bank_account = GETPOST('id_account', 'int');
|
|
||||||
// Multi journal
|
// Multi journal
|
||||||
$code_journal = GETPOST('code_journal', 'alpha');
|
$id_journal = GETPOST('id_journal', 'int');
|
||||||
|
|
||||||
$date_startmonth = GETPOST('date_startmonth');
|
$date_startmonth = GETPOST('date_startmonth');
|
||||||
$date_startday = GETPOST('date_startday');
|
$date_startday = GETPOST('date_startday');
|
||||||
@ -81,7 +79,7 @@ $action = GETPOST('action','aZ09');
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0 && empty($id_bank_account))
|
if ($user->societe_id > 0 && empty($id_journal))
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
@ -112,7 +110,7 @@ $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
|||||||
$idpays = $p[0];
|
$idpays = $p[0];
|
||||||
|
|
||||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
||||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number,";
|
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
||||||
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop,";
|
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop,";
|
||||||
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as name, u.firstname as firstname, bu2.type as typeop";
|
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as name, u.firstname as firstname, bu2.type as typeop";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
||||||
@ -121,7 +119,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.row
|
|||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
|
||||||
$sql .= " WHERE ba.rowid=" . $id_bank_account;
|
$sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
|
||||||
$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||||
if ($date_start && $date_end)
|
if ($date_start && $date_end)
|
||||||
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
|
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
|
||||||
@ -139,20 +137,8 @@ $paymentsalstatic = new PaymentSalary($db);
|
|||||||
$paymentexpensereportstatic = new PaymentExpenseReport($db);
|
$paymentexpensereportstatic = new PaymentExpenseReport($db);
|
||||||
|
|
||||||
// Get code of finance journal
|
// Get code of finance journal
|
||||||
$journal = '';
|
|
||||||
$bankstatic = new Account($db);
|
|
||||||
$bankstatic->fetch($id_bank_account);
|
|
||||||
$bankstatic->rowid;
|
|
||||||
$bankstatic->number;
|
|
||||||
$bankstatic->label;
|
|
||||||
$bankstatic->fk_accountancy_journal;
|
|
||||||
|
|
||||||
$accountingjournalstatic = new AccountingJournal($db);
|
$accountingjournalstatic = new AccountingJournal($db);
|
||||||
if(! empty($id_bank_account)) {
|
$accountingjournalstatic->fetch($id_journal);
|
||||||
$accountingjournalstatic->fetch($bankstatic->fk_accountancy_journal);
|
|
||||||
} else {
|
|
||||||
$accountingjournalstatic->fetch('',$code_journal);
|
|
||||||
}
|
|
||||||
$journal = $accountingjournalstatic->code;
|
$journal = $accountingjournalstatic->code;
|
||||||
|
|
||||||
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
|
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
|
||||||
@ -745,13 +731,13 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("FinanceJournal"));
|
llxHeader('', $langs->trans("FinanceJournal"));
|
||||||
|
|
||||||
$nom = $langs->trans("FinanceJournal") . ' - ' . $bankstatic->getNomUrl(1);
|
$nom = $langs->trans("FinanceJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1);
|
||||||
$builddate = time();
|
$builddate = time();
|
||||||
//$description = $langs->trans("DescFinanceJournal") . '<br>';
|
//$description = $langs->trans("DescFinanceJournal") . '<br>';
|
||||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
||||||
|
|
||||||
$varlink = 'id_account=' . $id_bank_account;
|
$varlink = 'id_journal=' . $id_journal;
|
||||||
|
|
||||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||||
|
|
||||||
|
|||||||
@ -1008,7 +1008,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$sql = "SELECT rowid, code, label, nature";
|
$sql = "SELECT rowid, code, label, nature";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
$sql.= " ORDER BY nature";
|
$sql.= " ORDER BY label";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -1038,7 +1038,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
|
|
||||||
if ($nature)
|
if ($nature)
|
||||||
{
|
{
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&code_journal='.$objp->code,dol_trunc($objp->label,25),2,$user->rights->accounting->comptarapport->lire);
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid,dol_trunc($objp->label,25),2,$user->rights->accounting->comptarapport->lire);
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
create table llx_accounting_journal
|
create table llx_accounting_journal
|
||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
entity integer DEFAULT 1,
|
entity integer DEFAULT 1 NOT NULL,
|
||||||
code varchar(32) NOT NULL,
|
code varchar(32) NOT NULL,
|
||||||
label varchar(128) NOT NULL,
|
label varchar(128) NOT NULL,
|
||||||
nature smallint DEFAULT 1 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)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user