From 3e2c0d26f21a01b02f59b5e6eeb8f371bc181069 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Feb 2017 11:59:58 +0100 Subject: [PATCH] Fix MVC --- htdocs/accountancy/bookkeeping/list.php | 137 +++++++++--------- .../journal/expensereportsjournal.php | 1 + htdocs/langs/en_US/trips.lang | 1 + 3 files changed, 70 insertions(+), 69 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index bfbf5e11b32..ae38233afac 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -105,7 +105,6 @@ if ($action != 'export_csv' && ! isset($_POST['begin']) && ! isset($_GET['begin' - /* * Action */ @@ -132,74 +131,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_date_end = ''; } -if ($action == 'delbookkeeping') { - - $import_key = GETPOST('importkey', 'alpha'); - - if (! empty($import_key)) { - $result = $object->deleteByImportkey($import_key); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - Header("Location: list.php"); - exit(); - } -} -if ($action == 'delbookkeepingyearconfirm') { - - $delyear = GETPOST('delyear', 'int'); - if ($delyear==-1) { - $delyear=0; - } - $deljournal = GETPOST('deljournal','alpha'); - if ($deljournal==-1) { - $deljournal=0; - } - - if (! empty($delyear) || ! empty($deljournal)) - { - $result = $object->deleteByYearAndJournal($delyear,$deljournal); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - else - { - setEventMessages("RecordDeleted", null, 'mesgs'); - } - Header("Location: list.php"); - exit; - } - else - { - setEventMessages("NoRecordDeleted", null, 'warnings'); - Header("Location: list.php"); - exit; - } -} -if ($action == 'delmouvconfirm') { - - $mvt_num = GETPOST('mvt_num', 'int'); - - if (! empty($mvt_num)) { - $result = $object->deleteMvtNum($mvt_num); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - else - { - setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); - } - Header("Location: list.php"); - exit; - } -} - - - -/* - * View - */ - +// Must be after the remove filter action, before the export. $param = ''; $filter = array (); if (! empty($search_date_start)) { @@ -266,6 +198,68 @@ if (! empty($search_mvt_num)) { $param .= '&search_mvt_num=' . $search_mvt_num; } +if ($action == 'delbookkeeping') { + + $import_key = GETPOST('importkey', 'alpha'); + + if (! empty($import_key)) { + $result = $object->deleteByImportkey($import_key); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + Header("Location: list.php"); + exit(); + } +} +if ($action == 'delbookkeepingyearconfirm') { + + $delyear = GETPOST('delyear', 'int'); + if ($delyear==-1) { + $delyear=0; + } + $deljournal = GETPOST('deljournal','alpha'); + if ($deljournal==-1) { + $deljournal=0; + } + + if (! empty($delyear) || ! empty($deljournal)) + { + $result = $object->deleteByYearAndJournal($delyear,$deljournal); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + else + { + setEventMessages("RecordDeleted", null, 'mesgs'); + } + Header("Location: list.php"); + exit; + } + else + { + setEventMessages("NoRecordDeleted", null, 'warnings'); + Header("Location: list.php"); + exit; + } +} +if ($action == 'delmouvconfirm') { + + $mvt_num = GETPOST('mvt_num', 'int'); + + if (! empty($mvt_num)) { + $result = $object->deleteMvtNum($mvt_num); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + else + { + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); + } + Header("Location: list.php"); + exit; + } +} + if ($action == 'export_csv') { include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php'; @@ -287,6 +281,11 @@ if ($action == 'export_csv') { } } + +/* + * View + */ + $title_page = $langs->trans("Bookkeeping"); llxHeader('', $title_page); diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 8bc62c27ef6..8d657ee6d11 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -43,6 +43,7 @@ $langs->load("bills"); $langs->load("other"); $langs->load("main"); $langs->load("accountancy"); +$langs->load("trips"); $date_startmonth = GETPOST('date_startmonth'); $date_startday = GETPOST('date_startday'); diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index 9cb992f6af3..e1749b43cd8 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -60,6 +60,7 @@ DATE_SAVE=Validation date DATE_CANCEL=Cancelation date DATE_PAIEMENT=Payment date BROUILLONNER=Reopen +ExpenseReportRef=Ref. expense report ValidateAndSubmit=Validate and submit for approval ValidatedWaitingApproval=Validated (waiting for approval) NOT_AUTHOR=You are not the author of this expense report. Operation cancelled.