diff --git a/html/js/scripts.js b/html/js/scripts.js
index 59d78ad31..d4e8290c7 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -1306,7 +1306,7 @@ function search_reconcile(dossier, ctl_concern, amount_id, ledger, p_id_target,p
var str_style = fixed_position(77, 99);
str_style += ";width:92%;overflow:auto;";
waiting_box();
-
+ var hide_operation=$(ctl_concern).getAttribute("hide_operation");
var param_send = {gDossier: dossier,
ctlc: ctl_concern,
@@ -1315,7 +1315,8 @@ function search_reconcile(dossier, ctl_concern, amount_id, ledger, p_id_target,p
amount_id: amount_id,
ledger: ledger,
target: target,
- tiers:tiers
+ tiers:tiers,
+ hide_operation:hide_operation
};
var qs = encodeJSON(param_send);
diff --git a/include/ajax/ajax_search_operation.php b/include/ajax/ajax_search_operation.php
index a279e5585..446c9beb4 100644
--- a/include/ajax/ajax_search_operation.php
+++ b/include/ajax/ajax_search_operation.php
@@ -50,6 +50,8 @@ if (isset($_GET['amount_id']))
));
}
$target=$http->get("target", "string", "");
+$hide_operation=$http->get("hide_operation","string","");
+
$ledger=new Acc_Ledger_Search('ALL', 1, $target);
if ($base=='recherche.php'||$base=='do.php')
@@ -103,7 +105,7 @@ if (isset($_GET['viewsearch']))
// get first date of current exercice
list($array['date_start'], $array['date_end'])=$g_user->get_limit_current_exercice();
}
-
+ $array['hide_operation']=$hide_operation;
list($sql, $where)=$ledger->build_search_sql($array);
// Count nb of line
$max_line=$cn->count_sql($sql);
diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php
index f2fdb2b8a..8dd53fabf 100644
--- a/include/class/acc_ledger_search.class.php
+++ b/include/class/acc_ledger_search.class.php
@@ -211,6 +211,8 @@ class Acc_Ledger_Search
$r.=HtmlInput::hidden('ledger_type', $this->type,
$this->div."ledger_type");
$r.=HtmlInput::hidden('ac', $_REQUEST['ac']);
+ if (isset($_REQUEST['hide_operation']))
+ $r.=HtmlInput::hidden("hide_operation", $_REQUEST['hide_operation']);
ob_start();
$search_filter=$this->build_search_filter();
require_once NOALYSS_TEMPLATE.'/ledger_search.php';
@@ -383,6 +385,7 @@ class Acc_Ledger_Search
$fil_account='';
$fil_paid='';
$fil_date_paid='';
+ $fil_hide_operation='';
$and='';
$g_user=new User($this->cn);
@@ -519,6 +522,11 @@ class Acc_Ledger_Search
$fil_paid=$and.SQL_LIST_UNPAID_INVOICE;
$and=" and ";
}
+ if ( isset ($hide_operation) && trim($hide_operation) !="")
+ {
+ $fil_hide_operation=$and.sprintf( ' jr_id not in (%s)',sql_string($hide_operation));
+ $and=" and ";
+ }
global $g_user;
if ($g_user->admin==0&&$g_user->is_local_admin()==0 && $g_user->get_status_security_ledger()==1 )
{
@@ -528,7 +536,8 @@ class Acc_Ledger_Search
" uj_login='".sql_string($_SESSION['g_user'])."'".
" and uj_priv in ('R','W'))";
}
- $where=$fil_ledger.$fil_amount.$fil_date.$fil_desc.$fil_sec.$fil_amount.$fil_qcode.$fil_paid.$fil_account.$fil_date_paid;
+ $where=$fil_ledger.$fil_amount.$fil_date.$fil_desc.$fil_sec.$fil_amount.
+ $fil_qcode.$fil_paid.$fil_account.$fil_date_paid.$fil_hide_operation;
$sql.=" where ".$where;
return array($sql, $where);
}
@@ -558,6 +567,7 @@ class Acc_Ledger_Search
$r.=HtmlInput::hidden('ac', $_REQUEST['ac']);
+
/* when called from commercial.php some hidden values are needed */
if (isset($_REQUEST['sa']))
$r.=HtmlInput::hidden("sa", $_REQUEST['sa']);
@@ -568,6 +578,9 @@ class Acc_Ledger_Search
if (isset($_REQUEST['f_id']))
$r.=HtmlInput::hidden("f_id", $_REQUEST['f_id']);
+
+
+
$r.='';
$r.='';
diff --git a/include/lib/iconcerned.class.php b/include/lib/iconcerned.class.php
index c296804d2..d43fa3e4c 100644
--- a/include/lib/iconcerned.class.php
+++ b/include/lib/iconcerned.class.php
@@ -28,6 +28,7 @@
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
class IConcerned extends HtmlInput
{
+ private $hideOperation; //!< string of j_id to hide, separated by comma to avoid to reconcile an operation with itself
public function __construct($p_name='',$p_value='',$p_id="")
{
@@ -36,8 +37,9 @@ class IConcerned extends HtmlInput
$this->amount_id=null;
$this->paid='';
$this->id=$p_id;
- $this->tiers=""; // id of the field for the tiers to be updated
- $this->div=""; // Dom Element to show the search result
+ $this->tiers=""; // id of the field for the tiers to be updated
+ $this->div=""; // Dom Element to show the search result
+ $this->hideOperation=""; // string of j_id to hide, separated by comma to avoid to reconcile an operation with itself
}
/*!\brief show the html input of the widget*/
public function input($p_name=null,$p_value=null)
@@ -55,17 +57,27 @@ class IConcerned extends HtmlInput
$this->tiers );
$r=Icon_Action::icon_magnifier(uniqid(), $javascript);
$r.=sprintf("
-
+
",
$this->name,
$this->id,
$this->value,
+ $this->hideOperation,
$this->id
);
return $r;
}
+
+ /**
+ * setter
+ * @param $p_string
+ */
+ function set_hideOperation($p_string)
+ {
+ $this->hideOperation=strip_tags($p_string);
+ }
/*!\brief print in html the readonly value of the widget*/
public function display()
{
diff --git a/include/template/ledger_detail_bottom.php b/include/template/ledger_detail_bottom.php
index 91b4f7c9c..85c93f19e 100644
--- a/include/template/ledger_detail_bottom.php
+++ b/include/template/ledger_detail_bottom.php
@@ -26,9 +26,9 @@ $aRap=$oRap->get();
// find out exercice
$periode_id=new Periode($cn,$detail->det->jr_tech_per);
$exercice=$periode_id->get_exercice();
-
-
- $nb_document=($detail->det->jr_pj_name != "")?1:0;
+
+
+$nb_document=($detail->det->jr_pj_name != "")?1:0;
$nb_aRap=(is_array($aRap))?count($aRap):0;
// Array of tab
@@ -225,6 +225,7 @@ if ( $access=='W') {
$wConcerned=new IConcerned("rapt".$div);
$wConcerned->amount_id=$obj->det->jr_montant;
$wConcerned->div="search_reconcile";
+ $wConcerned->set_hideOperation( $obj->jr_id);
echo $wConcerned->input();
}