From 57d4f28cbac4c03a6f5f3c0a8a24e8e101fa7580 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Nov 2017 15:51:28 +0100 Subject: [PATCH] Enhance usability of accounting module --- htdocs/accountancy/customer/card.php | 16 ++++++++++++++-- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 18 +++++++++++++++--- htdocs/accountancy/expensereport/card.php | 16 ++++++++++++++-- htdocs/accountancy/expensereport/lines.php | 2 +- htdocs/accountancy/expensereport/list.php | 18 +++++++++++++++--- htdocs/accountancy/supplier/card.php | 15 +++++++++++++-- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 18 +++++++++++++++--- htdocs/core/class/html.form.class.php | 9 +++++---- 10 files changed, 94 insertions(+), 22 deletions(-) diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index d307169dfcc..92d8f7b1c37 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -33,6 +33,9 @@ $langs->load("bills"); $langs->load("accountancy"); $action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + $codeventil = GETPOST('codeventil'); $id = GETPOST('id'); @@ -40,12 +43,15 @@ $id = GETPOST('id'); if ($user->societe_id > 0) accessforbidden(); + /* * Actions */ -if ($action == 'ventil' && $user->rights->accounting->bind->write) { - if (! GETPOST('cancel', 'alpha')) { +if ($action == 'ventil' && $user->rights->accounting->bind->write) +{ + if (! $cancel) + { if ($codeventil < 0) $codeventil = 0; $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; @@ -59,6 +65,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) { else { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + if ($backtopage) + { + header("Location: ".$backtopage); + exit(); + } } } else { header("Location: ./lines.php"); @@ -109,6 +120,7 @@ if (! empty($id)) { print '
' . "\n"; print ''; print ''; + print ''; print load_fiche_titre($langs->trans('CustomersVentilation'), '', 'title_setup'); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 13602160c48..ed44277d7bf 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -365,7 +365,7 @@ if ($result) { print '' . price($objp->total_ht) . ''; print '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . ''; print ''; - print $codecompta . ' '; + print $codecompta . ' '; print img_edit(); print ''; print ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index dfbc64bbb65..220c0f7cd8a 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -304,7 +304,7 @@ if ($result) { ); //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); + $massactionbutton=$form->selectMassAction('0', $arrayofmassactions, 1); print '' . "\n"; print ''; @@ -463,11 +463,11 @@ if ($result) { // Suggested accounting account print ''; - print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; print ''; - print 'aarowid ? "checked" : "") . '/>'; + print 'aarowid ? "checked" : "") . '/>'; print ''; print ''; $i ++; @@ -480,5 +480,17 @@ if ($result) { print $db->error(); } +// Add code to auto check the box when we select an account +print ''; + llxFooter(); $db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index fee9e0b0057..3b59847d84d 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -38,6 +38,9 @@ $langs->load("accountancy"); $langs->load("trips"); $action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + $codeventil = GETPOST('codeventil'); $id = GETPOST('id'); @@ -45,12 +48,15 @@ $id = GETPOST('id'); if ($user->societe_id > 0) accessforbidden(); + /* * Actions */ -if ($action == 'ventil' && $user->rights->accounting->bind->write) { - if (! GETPOST('cancel', 'alpha')) { +if ($action == 'ventil' && $user->rights->accounting->bind->write) +{ + if (! $cancel) + { if ($codeventil < 0) $codeventil = 0; $sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det"; @@ -64,6 +70,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) { else { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + if ($backtopage) + { + header("Location: ".$backtopage); + exit(); + } } } else { header("Location: ./lines.php"); @@ -111,6 +122,7 @@ if (! empty($id)) { print '' . "\n"; print ''; print ''; + print ''; print load_fiche_titre($langs->trans('ExpenseReportsVentilation'), '', 'title_setup'); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 750a5bc9f25..406e6bcb7c7 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -328,7 +328,7 @@ if ($result) { print '' . $codeCompta . ''; - print ''; + print ''; print img_edit(); print ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index dc8229768d4..b17e5acc9e2 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -268,7 +268,7 @@ if ($result) { ); //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); + $massactionbutton=$form->selectMassAction('0', $arrayofmassactions, 1); print '' . "\n"; @@ -386,11 +386,11 @@ if ($result) { // Suggested accounting account print ''; - print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; print ''; - print 'aarowid ? "checked" : "") . '/>'; + print 'aarowid ? "checked" : "") . '/>'; print ''; print ""; @@ -405,5 +405,17 @@ if ($result) { print $db->error(); } +// Add code to auto check the box when we select an account +print ''; + llxFooter(); $db->close(); diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index d36ae5e2543..f74165251f3 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -37,6 +37,9 @@ $langs->load("bills"); $langs->load("accountancy"); $action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + $codeventil = GETPOST('codeventil'); $id = GETPOST('id'); @@ -49,8 +52,10 @@ if ($user->societe_id > 0) * Actions */ -if ($action == 'ventil' && $user->rights->accounting->bind->write) { - if (! GETPOST('cancel', 'alpha')) { +if ($action == 'ventil' && $user->rights->accounting->bind->write) +{ + if (! $cancel) + { if ($codeventil < 0) $codeventil = 0; $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; @@ -64,6 +69,11 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) { else { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + if ($backtopage) + { + header("Location: ".$backtopage); + exit(); + } } } else { header("Location: ./lines.php"); @@ -111,6 +121,7 @@ if (! empty($id)) { print '' . "\n"; print ''; print ''; + print ''; print load_fiche_titre($langs->trans('SuppliersVentilation'), '', 'title_setup'); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 78b9320fdb1..786df760f6a 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -370,7 +370,7 @@ if ($result) { print '' . price($objp->total_ht) . ''; print '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . ''; print ''; - print $codecompta . ' '; + print $codecompta . ' '; print img_edit(); print ''; print '' . $objp->country .''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 076b0301b74..611a19f3653 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -300,7 +300,7 @@ if ($result) { ); //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); + $massactionbutton=$form->selectMassAction('0', $arrayofmassactions, 1); print '' . "\n"; print ''; @@ -468,12 +468,12 @@ if ($result) { // Suggested accounting account print ''; - print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; // Colonne choix ligne a ventiler print ''; - print 'aarowid ? "checked" : "") . '/>'; + print 'aarowid ? "checked" : "") . '/>'; print ''; print ""; @@ -488,5 +488,17 @@ if ($result) { print $db->error(); } +// Add code to auto check the box when we select an account +print ''; + llxFooter(); $db->close(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 77471d10124..7671fecfd87 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -579,13 +579,14 @@ class Form { $ret.=' ';