[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 22/28: Search operation : all, paid or unpaid
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 22/28: Search operation : all, paid or unpaid, including the CSV export and the filter |
Date: |
Sat, 30 Nov 2019 07:51:25 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 9e5b19d6d3bdea8f76ad748a85220e0db89985e2
Author: Dany De Bontridder <address@hidden>
Date: Sun Nov 24 20:53:23 2019 +0100
Search operation : all, paid or unpaid, including the CSV export and
the filter
---
html/js/acc_ledger.js | 20 ++++++---------
include/ajax/ajax_search_filter.php | 2 +-
include/class/acc_ledger_search.class.php | 40 +++++++++++++++++++++++-------
include/constant.php | 2 +-
include/database/user_filter_sql.class.php | 4 +--
include/template/ledger_search.php | 2 +-
6 files changed, 44 insertions(+), 26 deletions(-)
diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index 2c7315e..d6b2882 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -1298,7 +1298,9 @@ function manage_search_filter(p_obj) {
* @see Acc_Ledger_Search
*/
function save_filter(p_div,p_dossier) {
- var
elt=['ledger_type','nb_jrn','date_start','date_end','date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting'];
+ var elt=['ledger_type','nb_jrn','date_start','date_end',
+
'date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting',
+ 'operation_filter'];
var eltValue={};
eltValue['gDossier']=p_dossier;
eltValue['op']="save_filter";
@@ -1322,8 +1324,6 @@ function save_filter(p_div,p_dossier) {
}
}
- //unpaid
- eltValue['unpaid']=$(p_div+"unpaid").checked;
new Ajax.Request('ajax_misc.php', {
method:"POST",
parameters:eltValue,
@@ -1361,7 +1361,8 @@ function load_filter(p_div,p_dossier,p_filter_id) {
try {
var answer=req.responseJSON;
console.log(answer);
- var
elt=['ledger_type','date_start','date_end','date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting'];
+ var
elt=['ledger_type','date_start','date_end','date_paid_start','date_paid_end',
+
'desc','amount_min','amount_max','qcode','accounting','operation_filter'];
for (var i=0;i<elt.length;i++) {
var idx=elt[i];
$(p_div+idx).value=answer[elt[i]];
@@ -1386,12 +1387,7 @@ function load_filter(p_div,p_dossier,p_filter_id) {
eltHidden.setAttribute("value",answer.r_jrn[i]);
eltLedgerId.appendChild(eltHidden);
}
- if ( answer.unpaid == 'false') {
- $(p_div+"unpaid").checked=false;
- }
- if ( answer.unpaid == 'true') {
- $(p_div+"unpaid").checked=true;
- }
+
} catch (e) {
@@ -1411,7 +1407,7 @@ identification element UL manage{div}
*/
function delete_filter (p_div,p_dossier,p_filter_id) {
- new Ajax.Request("ajax_misc",{
+ new Ajax.Request("ajax_misc.php",{
parameters:{"gDossier":p_dossier,"div":p_div,"filter_id":p_filter_id,'op':"delete_search_operation"},
method:"POST",
onSuccess:function (req) {
@@ -1456,5 +1452,5 @@ function reset_filter(p_div) {
eltLedgerId.appendChild(eltHidden);
// By default , unpaid is uncked
- $(p_div+"unpaid").checked=false;
+ $(p_div+"operation_filter").value="all";
}
\ No newline at end of file
diff --git a/include/ajax/ajax_search_filter.php
b/include/ajax/ajax_search_filter.php
index 8d9419c..7f6a8ea 100644
--- a/include/ajax/ajax_search_filter.php
+++ b/include/ajax/ajax_search_filter.php
@@ -59,7 +59,7 @@ if ($op=='save_filter')
$http->post("date_paid_start", 'string', NULL));
$new->setp("date_paid_end", $http->post("date_paid_end", 'string',
NULL));
$new->setp("ledger_type", $http->post("ledger_type", 'string'));
- $new->setp("unpaid", $http->post("unpaid", 'string', NULL));
+ $new->setp("operation_filter", $http->post("operation_filter",
'string', NULL));
$new->setp("filter_name", h($http->post("filter_name", 'string')));
$aJrn=[];
$max=$http->post("nb_jrn");
diff --git a/include/class/acc_ledger_search.class.php
b/include/class/acc_ledger_search.class.php
index f9891a1..9ffc292 100644
--- a/include/class/acc_ledger_search.class.php
+++ b/include/class/acc_ledger_search.class.php
@@ -204,15 +204,23 @@ class Acc_Ledger_Search
$f_accounting->set_attribute('account', $this->div.'accounting');
$info=Icon_Action::infobulle(13);
- $f_paid=new ICheckbox('unpaid', null, $this->div.'unpaid');
- $f_paid->selected=(isset($_REQUEST['unpaid']))?true:false;
+ // Status of the operation : paid, unpaid or all
+ $f_paid=new ISelect('operation_filter', null,
$this->div.'operation_filter');
+ $f_paid->value=array(["value"=>'all',"label"=>_("Toutes")],
+ ["value"=>'unpaid',"label"=>_("Non payées")],
+ ["value"=>'paid',"label"=>_("Payées")]
+ );
+ $f_paid->selected=$http->request("operation_filter","string","all");
$r.=dossier::hidden();
$r.=HtmlInput::hidden('ledger_type', $this->type,
$this->div."ledger_type");
- $r.=HtmlInput::hidden('ac', $_REQUEST['ac']);
+ $r.=HtmlInput::hidden('ac', $http->request('ac'));
+
+ // to avoid to find a given operation
if (isset($_REQUEST['hide_operation']))
- $r.=HtmlInput::hidden("hide_operation",
$_REQUEST['hide_operation']);
+ $r.=HtmlInput::hidden("hide_operation",
$http->request('hide_operation'));
+
ob_start();
$search_filter=$this->build_search_filter();
require_once NOALYSS_TEMPLATE.'/ledger_search.php';
@@ -526,12 +534,26 @@ class Acc_Ledger_Search
$and=" and ";
}
- // Only the unpaid
- if (isset($unpaid))
- {
- $fil_paid=$and.SQL_LIST_UNPAID_INVOICE;
- $and=" and ";
+ // Only the unpaid, paid or all
+ if ( isset($operation_filter)) {
+ switch ($operation_filter) {
+ case "unpaid":
+ $fil_paid=$and."(jr_rapt is null or jr_rapt = '') and
jr_valid = true ";
+ $and=" and ";
+ break;
+ case "all":
+ $fil_paid="";
+ break;
+ case "paid":
+ $fil_paid=$and."(jr_rapt is not null or jr_rapt = 'paid')
and jr_valid = true ";
+ $and=" and ";
+ break;
+ default:
+ throw new Exception(_("ALS01 Etat inconnu"),10);
+
+ }
}
+ // Operations which must not be seen in the result
if ( isset ($hide_operation) && trim($hide_operation) !="")
{
$fil_hide_operation=$and.sprintf( ' jr_id not in
(%s)',sql_string($hide_operation));
diff --git a/include/constant.php b/include/constant.php
index 5f5dc71..e033001 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -108,7 +108,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
if ( ! defined ("SYSINFO_DISPLAY")) {
define ("SYSINFO_DISPLAY",TRUE);
}
-define ("DBVERSION",140);
+define ("DBVERSION",141);
define ("MONO_DATABASE",25);
define ("DBVERSIONREPO",18);
define ('NOTFOUND','--not found--');
diff --git a/include/database/user_filter_sql.class.php
b/include/database/user_filter_sql.class.php
index 4f5e569..72ebb83 100644
--- a/include/database/user_filter_sql.class.php
+++ b/include/database/user_filter_sql.class.php
@@ -54,7 +54,7 @@ class User_filter_SQL extends Noalyss_SQL
, "date_paid_end"=>"date_paid_end"
, "ledger_type"=>"ledger_type"
, "all_ledger"=>"all_ledger"
- ,"unpaid"=>"unpaid"
+ ,"operation_filter"=>"operation_filter"
,'filter_name'=>"filter_name"
);
/*
@@ -76,7 +76,7 @@ class User_filter_SQL extends Noalyss_SQL
, "date_paid_end"=>"text"
, "ledger_type"=>"text"
, "all_ledger"=>"numeric"
- ,"unpaid"=>"text"
+ ,"operation_filter"=>"text"
,"filter_name"=>"text"
);
diff --git a/include/template/ledger_search.php
b/include/template/ledger_search.php
index 8d7b827..c22dd20 100644
--- a/include/template/ledger_search.php
+++ b/include/template/ledger_search.php
@@ -80,7 +80,7 @@ echo $f_accounting->input(); ?>
<tr>
<td style="text-align:right;width:30em">
- <?php echo _('Et uniquement non payées')?>
+ <?php echo _('Statut')?>
</td>
<td>
- [Noalyss-commit] [noalyss] 05/28: rename test files:, (continued)
- [Noalyss-commit] [noalyss] 05/28: rename test files:, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 11/28: In Acc_Ledger, the type shouldn't be overrided , create new attr ledger_type, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 19/28: Data_SQL Function prefix turn an object to an array but key can have a prefix, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 06/28: PDFTK Convert in PDF if working from home, see http://wiki.noalyss.eu/doku.php?id=menu:ancgl, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 14/28: Bug PHP : confuse NULL and 0, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 13/28: cosmetid add a button close for the "forget-email-box", Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 15/28: Bug Array to string conversion error, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 16/28: Bug : when e_march is null it is considered as an empty string instead of 0, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 17/28: Cosmetic, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 12/28: Improve PHPUNIT test, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 22/28: Search operation : all, paid or unpaid, including the CSV export and the filter,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 10/28: Correct report amount, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 21/28: Fix problem with Acc_Ledger_purchase or sold and quantity or vat amount were an empty string, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 24/28: Merge branch 'dev-7200', Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 26/28: warning about session_start, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 28/28: Merge branch 'dev-7200', Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 02/28: Task #0001762: TVA France , add the possibility to compute VAT at the date of operation , payment. PRINTTVA : Add feature summary of VAT depending of operation date, payment date or VAT setting, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 03/28: Task #1762 , printtva peut mettre donner les totaux de tva suivant l'exigibilité configuré par Code TVA , par date de paiement ou par date d'opération, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 25/28: Acc_Ledger_Search , fix small bug + Test file, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 23/28: File to restore for testing, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 20/28: PHPUNIT Suppress risky test, Dany De Bontridder, 2019/11/30