From 4951feeb8f05cdbb21e8b4f5e30d91dd57f985a4 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 1 Nov 2014 07:59:52 +0100 Subject: [PATCH] Correct rights & presentation --- htdocs/accountancy/admin/account.php | 4 +- htdocs/accountancy/bookkeeping/card.php | 38 +++++----- htdocs/accountancy/bookkeeping/list.php | 70 ++++++++++++------- htdocs/accountancy/customer/card.php | 6 +- htdocs/accountancy/customer/index.php | 8 +-- htdocs/accountancy/journal/bankjournal.php | 2 - htdocs/accountancy/journal/cashjournal.php | 2 - htdocs/accountancy/journal/index.php | 2 - .../accountancy/journal/purchasesjournal.php | 2 - htdocs/accountancy/journal/sellsjournal.php | 2 - htdocs/accountancy/supplier/card.php | 7 +- htdocs/accountancy/supplier/index.php | 6 +- 12 files changed, 73 insertions(+), 76 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index fbb8cf84baa9e..36739254d06ef 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -37,7 +37,6 @@ $action = GETPOST('action'); $id = GETPOST('id', 'int'); $rowid = GETPOST('rowid', 'int'); -$search= GETPOST("search"); $search_account = GETPOST("search_account"); $search_label = GETPOST("search_label"); $search_accountparent = GETPOST("search_accountparent"); @@ -91,7 +90,6 @@ if (GETPOST("button_removefilter")) { - $search=""; $search_account=""; $search_label=""; $search_accountparent=""; @@ -169,7 +167,7 @@ print ' '; print ''; print ''; - print '  '; + print ' '; print ''; print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 9e109c7feeb11..608c62cf1d08a 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -35,8 +35,6 @@ $id = GETPOST('id', 'int'); if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); $action = GETPOST('action'); $piece_num = GETPOST("piece_num"); @@ -238,7 +236,9 @@ print ''; print ''; -} else { +} +else +{ $book = new BookKeeping($db); $result = $book->fetch_per_mvt($piece_num); if ($result < 0) { @@ -309,14 +309,12 @@ print ''; print '' . $line->montant . ''; print '' . $line->sens . ''; - print ''; - if ($user->rights->accounting->access) { - print ''; - } + print ''; print ''; print ''; - } else { + } + else { print '' . $line->numero_compte . ''; print '' . $line->code_tiers . ''; print '' . $line->label_compte . ''; @@ -324,16 +322,15 @@ print '' . $line->credit . ''; print '' . $line->montant . ''; print '' . $line->sens . ''; - + print ''; - if ($user->rights->accouting->access) { - print ''; - print img_edit(); - print ' '; - print ''; - print img_delete(); - print ''; - } + print ''; + print img_edit(); + print ' '; + print ''; + print img_delete(); + print ''; + print ''; } print "\n"; @@ -342,7 +339,7 @@ if ($action == "" || $action == 'add') { $var = ! $var; print ""; - + print '
'; print '' . "\n"; print '' . "\n"; @@ -359,14 +356,13 @@ print ''; print ''; print ''; - print ''; } - print ""; } } - } else { + } + else { print_fiche_titre($langs->trans("NoRecords")); } } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index b0e5096699b7a..21da5bacbb9b3 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -36,6 +36,11 @@ $sortorder = GETPOST("sortorder"); $sortfield = GETPOST("sortfield"); $action = GETPOST('action', 'alpha'); +$search_doc_type = GETPOST("search_doc_type"); +$search_doc_ref = GETPOST("search_doc_ref"); +$search_account = GETPOST("search_account"); +$search_thirdparty = GETPOST("search_thirdparty"); +$search_journal = GETPOST("search_journal"); if ($sortorder == "") $sortorder = "ASC"; @@ -46,6 +51,15 @@ $formventilation = new FormVentilation($db); +if (GETPOST("button_removefilter")) +{ + $search_doc_type=""; + $search_doc_ref=""; + $search_account=""; + $search_thirdparty=""; + $search_journal=""; +} + /* * Action */ @@ -100,25 +114,25 @@ $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk"; - if (dol_strlen(trim(GETPOST("search_doc_type")))) { + if (dol_strlen(trim($search_doc_type))) { - $sql .= " WHERE bk.doc_type LIKE '%" . GETPOST("search_doc_type") . "%'"; + $sql .= " WHERE bk.doc_type LIKE '%" . $search_doc_type . "%'"; - if (dol_strlen(trim(GETPOST("search_doc_ref")))) { - $sql .= " AND bk.doc_ref LIKE '%" . GETPOST("search_doc_ref") . "%'"; + if (dol_strlen(trim($search_doc_ref))) { + $sql .= " AND bk.doc_ref LIKE '%" . $search_doc_ref . "%'"; } } - if (dol_strlen(trim(GETPOST("search_doc_ref")))) { - $sql .= " WHERE bk.doc_ref LIKE '%" . GETPOST("search_doc_ref") . "%'"; + if (dol_strlen(trim($search_doc_ref))) { + $sql .= " WHERE bk.doc_ref LIKE '%" . $search_doc_ref . "%'"; } - if (dol_strlen(trim(GETPOST("search_compte")))) { - $sql .= " WHERE bk.numero_compte LIKE '%" . GETPOST("search_compte") . "%'"; + if (dol_strlen(trim($search_account))) { + $sql .= " WHERE bk.numero_compte LIKE '%" . $search_account . "%'"; } - if (dol_strlen(trim(GETPOST("search_tiers")))) { - $sql .= " WHERE bk.code_tiers LIKE '%" . GETPOST("search_tiers") . "%'"; + if (dol_strlen(trim($search_thirdparty))) { + $sql .= " WHERE bk.code_tiers LIKE '%" . $search_thirdparty . "%'"; } - if (dol_strlen(trim(GETPOST("search_journal")))) { - $sql .= " WHERE bk.code_journal LIKE '%" . GETPOST("search_journal") . "%'"; + if (dol_strlen(trim($search_journal))) { + $sql .= " WHERE bk.code_journal LIKE '%" . $search_journal . "%'"; } $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit + 1, $offset); @@ -149,7 +163,7 @@ print ''; print '
'; - print ""; + print '
'; print ''; print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "bk.doc_type", "", "", "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "bk.doc_date", "", "", "", $sortfield, $sortorder); @@ -157,29 +171,31 @@ print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "bk.numero_compte", "", "", "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "bk.code_tiers", "", "", "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", "", "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "bk.debit", "", "", "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "bk.credit", "", "", "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "bk.debit", "", "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "bk.credit", "", "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "bk.code_journal", "", "", "", $sortfield, $sortorder); - print_liste_field_titre(" "); + print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder); print "\n"; print ''; print ''; - print ''; + print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; print ''; print ''; @@ -201,9 +217,9 @@ print ''; print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print "\n"; $i ++; } diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 91a0eb5df8b93..28d3d0c1f7958 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -40,14 +40,12 @@ // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); /* * Actions */ -if ($action == 'ventil' && $user->rights->accounting->access) +if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { if (! GETPOST('cancel', 'alpha')) { @@ -109,7 +107,7 @@ print ''; $linkback=''.$langs->trans("Back").''; - print_fiche_titre($langs->trans('AccountingVentilationCustomer'),$linkback,'setup'); + print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'setup'); print '
      '; - print ''; + print ''; + print ''; + print ' '; + print ''; print '
' . price($obj->debit) . '' . price($obj->credit) . '' . price($obj->montant) . '' . $obj->sens . '' . $obj->sens . '' . $obj->code_journal . '' . img_edit() . '' . img_edit() . '
'; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 9ae070c25e02e..cb40b7b361b0d 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -93,8 +93,8 @@ */ llxHeader('', $langs->trans("CustomersVentilation")); -$textprevyear = "" . img_previous() . ""; -$textnextyear = " " . img_next() . ""; +$textprevyear = '' . img_previous() . ''; +$textnextyear = ' ' . img_next() . ''; print_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); @@ -197,7 +197,7 @@ print "
\n"; print '
'; -print ''; +print ''; print ''; print ''; print ''; @@ -212,7 +212,7 @@ print ''; print ''; -$sql = "SELECT '" . $langs->trans("Vide") . "' AS 'Total',"; +$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS 'Total',"; $sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,fd.total_ht,0)),2) AS 'Janvier',"; $sql .= " ROUND(SUM(IF(MONTH(f.datef)=2,fd.total_ht,0)),2) AS 'Fevrier',"; $sql .= " ROUND(SUM(IF(MONTH(f.datef)=3,fd.total_ht,0)),2) AS 'Mars',"; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index dcd8fca4d4107..1f9b054912174 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -68,8 +68,6 @@ // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); /* * View diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php index 8af84a9ed58a8..fb5a15a513c7b 100644 --- a/htdocs/accountancy/journal/cashjournal.php +++ b/htdocs/accountancy/journal/cashjournal.php @@ -62,8 +62,6 @@ // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); $action = GETPOST('action'); diff --git a/htdocs/accountancy/journal/index.php b/htdocs/accountancy/journal/index.php index 272d76fa20f64..36286ce265e0c 100644 --- a/htdocs/accountancy/journal/index.php +++ b/htdocs/accountancy/journal/index.php @@ -36,8 +36,6 @@ // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); llxHeader('', 'Journaux', ''); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 789aa1111af8a..97d52124c0175 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -55,8 +55,6 @@ // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); $action = GETPOST('action'); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index a7c0266998f13..5bb1f989a9298 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -56,8 +56,6 @@ // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) - accessforbidden(); $action = GETPOST('action'); diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index b0078839b55a1..45c8de9b16557 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -46,10 +46,9 @@ // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->ventilation->dispatch) - accessforbidden(); -if ($action == 'ventil' && $user->rights->accounting->access) { +if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) +{ $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql .= " SET fk_code_ventilation = " . $codeventil; $sql .= " WHERE rowid = " . $id; @@ -103,7 +102,7 @@ print ''; print ''; - print_fiche_titre($langs->trans("Ventilation")); + print_fiche_titre($langs->trans("SuppliersVentilation")); print '
' . $langs->trans("TotalVente") . '
' . $langs->trans("Total") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("DecemberMin") . '' . $langs->trans("Total") . '
'; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 7d633c575f141..edebcfd9d4667 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -92,10 +92,10 @@ llxHeader('', $langs->trans("SuppliersVentilation")); -$textprevyear = "" . img_previous() . ""; -$textnextyear = " " . img_next() . ""; +$textprevyear = '' . img_previous() . ''; +$textnextyear = ' ' . img_next() . ''; -print_fiche_titre($langs->trans("AccountingVentilationSupplier") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); +print_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); print '' . $langs->trans("DescVentilSupplier") . ''; print '
' . $langs->trans("ValidateHistory") . '
';