From dc9d9b47b4c61362138778b7896e28ceefbe3388 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 31 May 2017 21:35:26 +0200 Subject: [PATCH 1/3] Fix : Missing language key --- htdocs/langs/en_US/banks.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index d98d2b465d0..3c7f8b338c0 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -66,6 +66,7 @@ RemoveFromRubriqueConfirm=Are you sure you want to remove link between the entry ListBankTransactions=List of bank entries IdTransaction=Transaction ID BankTransactions=Bank entries +BankTransaction=Bank entry ListTransactions=List entries ListTransactionsByCategory=List entries/category TransactionsToConciliate=Entries to reconcile From 9d8374693509f237538c490a29dfb15164430f2c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 1 Jun 2017 04:44:05 +0200 Subject: [PATCH 2/3] Fix : Book entry in general ledger for salaries --- htdocs/accountancy/journal/bankjournal.php | 70 ++++++++++++++-------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index b42ef34d663..35d4112ebc9 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -223,7 +223,7 @@ if ($result) { // Now loop on each link of record in bank. foreach ( $links as $key => $val ) { - if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation'))) // So we excluded 'company' here + if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'payment_salary'))) // So we excluded 'company' here { // We save tabtype for a future use, to remember what kind of payment it is $tabtype[$obj->rowid] = $links[$key]['type']; @@ -294,7 +294,7 @@ if ($result) { $paymentsalstatic->ref = $links[$key]['url_id']; $paymentsalstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); - // $tabtp[$obj->rowid][$account_employee] += $obj->amount; + $tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id; } else if ($links[$key]['type'] == 'payment_expensereport') { $paymentexpensereportstatic->id = $links[$key]['url_id']; $paymentexpensereportstatic->fk_expensereport = $links[$key]['url_id']; @@ -418,14 +418,17 @@ if (! $error && $action == 'writebookkeeping') { $objmid = $db->fetch_object($resultmid); $bookkeeping->doc_ref = $objmid->ref; // Ref of expensereport } - } else if ($tabtype[$key] == 'payment_vat') { - $bookkeeping->code_tiers = ''; - $bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat payment - } else if ($tabtype[$key] == 'payment_donation') { - $bookkeeping->code_tiers = ''; - $bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation - } - + } else if ($tabtype[$key] == 'payment_vat') { + $bookkeeping->code_tiers = ''; + $bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat payment + } else if ($tabtype[$key] == 'payment_donation') { + $bookkeeping->code_tiers = ''; + $bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation + } else if ($tabtype[$key] == 'payment_salary') { + $bookkeeping->code_tiers = ''; + $bookkeeping->doc_ref = $langs->trans("PaymentSalary") . ' (' . $val["paymentsalid"] . ')'; // Ref of salary payment + } + $result = $bookkeeping->create($user); if ($result < 0) { if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists @@ -495,19 +498,23 @@ if (! $error && $action == 'writebookkeeping') { $objmid = $db->fetch_object($resultmid); $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')'; } - $bookkeeping->code_tiers = $tabcompany[$key]['code_compta']; - $bookkeeping->numero_compte = $k; - } else if ($tabtype[$key] == 'payment_vat') { - $bookkeeping->code_tiers = ''; - $bookkeeping->numero_compte = $k; - $bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat - } else if ($tabtype[$key] == 'payment_donation') { - $bookkeeping->code_tiers = ''; - $bookkeeping->numero_compte = $k; - $bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation - } else if ($tabtype[$key] == 'banktransfert') { - $bookkeeping->code_tiers = ''; - $bookkeeping->numero_compte = $k; + $bookkeeping->code_tiers = $tabcompany[$key]['code_compta']; + $bookkeeping->numero_compte = $k; + } else if ($tabtype[$key] == 'payment_vat') { + $bookkeeping->code_tiers = ''; + $bookkeeping->numero_compte = $k; + $bookkeeping->doc_ref = $langs->trans("PaymentVat") . ' (' . $val["paymentvatid"] . ')'; // Rowid of vat + } else if ($tabtype[$key] == 'payment_donation') { + $bookkeeping->code_tiers = ''; + $bookkeeping->numero_compte = $k; + $bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation + } else if ($tabtype[$key] == 'payment_salary') { + $bookkeeping->code_tiers = $tabuser[$key]['accountancy_code']; + $bookkeeping->numero_compte = $k; + $bookkeeping->doc_ref = $langs->trans("PaymentSalary") . ' (' . $val["paymentsalid"] . ')'; // Rowid of salary payment + } else if ($tabtype[$key] == 'banktransfert') { + $bookkeeping->code_tiers = ''; + $bookkeeping->numero_compte = $k; } else { // FIXME Should be a temporary account ??? $bookkeeping->doc_ref = $k; @@ -740,8 +747,9 @@ if (empty($action) || $action == 'view') { $invoicestatic = new Facture($db); $invoicesupplierstatic = new FactureFournisseur($db); $expensereportstatic = new ExpenseReport($db); - $vatstatic = new Tva($db); + $vatstatic = new Tva($db); $donationstatic = new Don($db); + $salarystatic = new PaymentSalary($db); llxHeader('', $langs->trans("FinanceJournal")); @@ -896,6 +904,20 @@ if (empty($action) || $action == 'view') { } else dol_print_error($db); } + elseif ($tabtype[$key] == 'payment_salary') + { + $sqlmid = 'SELECT s.rowid as id'; + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s"; + $sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"]; + dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $salarystatic->fetch($objmid->id); + $ref=$langs->trans("SalaryPayment").' '.$salarystatic->getNomUrl(1); + } + else dol_print_error($db); + } /*$invoicestatic->id = $key; From 2281850abfb912282aa9e6b7763fabed2ee31e5f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 5 Jun 2017 14:56:14 +0200 Subject: [PATCH 3/3] Fix label and name --- htdocs/accountancy/journal/bankjournal.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 35d4112ebc9..306fa4d2cab 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -63,7 +63,7 @@ $langs->load('bills'); $langs->load('donations'); $langs->load("accountancy"); $langs->load("trips"); -$langs->load("hrm"); +$langs->load("salaries"); // Old system menu $id_bank_account = GETPOST('id_account', 'int'); @@ -114,7 +114,7 @@ $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 .= " ba.courant, ba.ref as baref, ba.account_number,"; $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 lastname, u.firstname as firstname, bu2.type as typeop"; $sql .= " FROM " . MAIN_DB_PREFIX . "bank as b"; $sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; @@ -201,9 +201,8 @@ if ($result) { $tabuser[$obj->rowid] = array ( 'id' => $obj->userid, - 'lastname' => $obj->lastname, - 'firstname' => $obj->firstname, - 'accountancy_code' => $compta_user, + 'name' => $obj->firstname.' '.$obj->lastname, + 'accountancy_code' => $compta_user, ); // Variable bookkeeping @@ -426,7 +425,8 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation } else if ($tabtype[$key] == 'payment_salary') { $bookkeeping->code_tiers = ''; - $bookkeeping->doc_ref = $langs->trans("PaymentSalary") . ' (' . $val["paymentsalid"] . ')'; // Ref of salary payment + $bookkeeping->label_compte = $tabuser[$key]['name']; + $bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Ref of salary payment } $result = $bookkeeping->create($user); @@ -510,8 +510,9 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->doc_ref = $langs->trans("Donation") . ' (' . $val["paymentdonationid"] . ')'; // Rowid of donation } else if ($tabtype[$key] == 'payment_salary') { $bookkeeping->code_tiers = $tabuser[$key]['accountancy_code']; - $bookkeeping->numero_compte = $k; - $bookkeeping->doc_ref = $langs->trans("PaymentSalary") . ' (' . $val["paymentsalid"] . ')'; // Rowid of salary payment + $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + $bookkeeping->label_compte = $tabuser[$key]['name']; + $bookkeeping->doc_ref = $langs->trans("SalaryPayment") . ' (' . $val["paymentsalid"] . ')'; // Rowid of salary payment } else if ($tabtype[$key] == 'banktransfert') { $bookkeeping->code_tiers = ''; $bookkeeping->numero_compte = $k;