From bc030561ace3a2335ad58c959634339c3c6087b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 May 2019 13:48:00 +0200 Subject: [PATCH] Debug various payment --- htdocs/blockedlog/class/blockedlog.class.php | 6 ++-- htdocs/compta/bank/various_payment/card.php | 34 +++++++++++--------- htdocs/compta/bank/various_payment/list.php | 12 +++---- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index ae64665bbfd..d7302a2c795 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -449,7 +449,7 @@ class BlockedLog { if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties if (! in_array($key, array( - 'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines' + 'ref','ref_client','ref_supplier','date','datef','datev','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines' ))) continue; // Discard if not into a dedicated list if ($key == 'lines') { @@ -459,8 +459,8 @@ class BlockedLog $lineid++; foreach($tmpline as $keyline => $valueline) { - if (! in_array($keyline, array( - 'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2' + if (! in_array($keyline, array( + 'ref','multicurrency_code','multicurrency_total_ht','multicurrency_total_tva','multicurrency_total_ttc','qty','product_type','vat_src_code','tva_tx','info_bits','localtax1_tx','localtax2_tx','total_ht','total_tva','total_ttc','total_localtax1','total_localtax2' ))) continue; // Discard if not into a dedicated list if (! is_object($this->object_data->invoiceline[$lineid])) $this->object_data->invoiceline[$lineid] = new stdClass(); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index ab5bd0aee87..2d911b5c6bb 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -37,7 +37,7 @@ if (! empty($conf->projet->enabled)) } // Load translation files required by the page -$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); +$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy", "categories")); // Get parameters $id = GETPOST('id', 'int'); @@ -144,6 +144,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); $error++; } + // TODO Remove this and allow instead to edit a various payment to enter accounting code if (! empty($conf->accounting->enabled) && ! $object->accountancy_code) { $langs->load('errors'); @@ -324,14 +325,6 @@ if ($action == 'create') print ''."\n"; } - // Category - if (is_array($options) && count($options)) - { - print ''.$langs->trans("RubriquesTransactions").''; - print Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1); - print ''; - } - // Project if (! empty($conf->projet->enabled)) { @@ -353,14 +346,20 @@ if ($action == 'create') print $hookmanager->resPrint; print ''; - print ''; - print '
'; - print ''; + // Category + if (is_array($options) && count($options) && $conf->categorie->enabled) + { + print ''; + } + // Accountancy account if (! empty($conf->accounting->enabled)) { - print ''; + // TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code + print ''; print ''; @@ -525,7 +524,6 @@ if ($id) print '
'.$langs->trans("RubriquesTransactions").''; + print Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1); + print '
'.$langs->trans("AccountAccounting").'
'.$langs->trans("AccountAccounting").''; print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1, ''); print '
'; - print ''; print ''; print '
'; @@ -537,7 +535,12 @@ if ($id) * Action buttons */ print '
'."\n"; - if ($object->rappro == 0) + + // TODO + // Add button modify + + // Delete + if (empty($object->rappro)) { if (! empty($user->rights->banque->modifier)) { @@ -552,6 +555,7 @@ if ($id) { print ''.$langs->trans("Delete").''; } + print "
"; } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 537bd6aee66..c9aba472dd8 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -57,7 +57,7 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield="v.datep"; +if (! $sortfield) $sortfield="v.datep,v.rowid"; if (! $sortorder) $sortorder="DESC"; $filtre=GETPOST("filtre", 'alpha'); @@ -110,13 +110,13 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row $sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; // Search criteria -if ($search_ref) $sql.=" AND v.rowid=".$search_ref; +if ($search_ref) $sql.=" AND v.rowid=".$db->escape($search_ref); if ($search_label) $sql.=natural_search(array('v.label'), $search_label); if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); -if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account; -if ($search_date) $sql.=" AND v.datep=".$search_date; -if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$search_accountancy_code; +if ($search_account > 0) $sql.=" AND b.fk_account=".$db->escape($search_account); +if ($search_date) $sql.=" AND v.datep = '".$db->idate($search_date)."'"; +if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$db->escape($search_accountancy_code); if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid; if ($filtre) { $filtre=str_replace(":", "=", $filtre); @@ -234,7 +234,7 @@ if ($result) print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "v.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left '); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');