From cacd6f2e218974c7271b595bcdebf77b7bd37469 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 25 Nov 2014 19:55:56 +0100 Subject: [PATCH] =?UTF-8?q?Task=20#986=20-=20Mise=20=C3=A0=20jour=20automa?= =?UTF-8?q?tique=20du=20field=20B=C3=A9n=C3=A9ficiaire=20lorsqu'un=20monta?= =?UTF-8?q?nt=20est=20lettr=C3=A9=20dans=20Import=20Banque=20&=20Tr=C3=A9s?= =?UTF-8?q?orerie=20Update=20fields=20supplier=20or=20customer=20with=20th?= =?UTF-8?q?e=20person=20who=20makes=20the=20payment=20+=20new=20function?= =?UTF-8?q?=20select=5Fdepot=20for=20#1055?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/js/scripts.js | 29 ++++++++++++--- include/class_acc_ledger.php | 37 ++++++++++++++++++-- include/class_acc_ledger_fin.php | 1 + include/class_iconcerned.php | 5 ++- include/search.inc.php | 3 +- include/template/card_result.php | 2 +- include/template/result_cat_card_summary.php | 2 +- 7 files changed, 67 insertions(+), 12 deletions(-) diff --git a/html/js/scripts.js b/html/js/scripts.js index 2c7f8f7e9..5d463773a 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -1190,11 +1190,18 @@ function save_predf_op(obj) return false; } + /** *ctl_concern is the widget to update - *amount_id is either a html obj. or an amount + *amount_id is either a html obj. or an amount and the field tiers if given + * @param {type} dossier + * @param {type} ctl_concern + * @param {type} amount_id + * @param {type} ledger + * @param {type} p_id_target + * @returns {undefined} */ -function search_reconcile(dossier, ctl_concern, amount_id, ledger) +function search_reconcile(dossier, ctl_concern, amount_id, ledger,p_id_target) { var dossier = g('gDossier').value; if (amount_id === undefined) @@ -1227,7 +1234,8 @@ function search_reconcile(dossier, ctl_concern, amount_id, ledger) ctl: target, ac: 'JSSEARCH', amount_id: amount_id, - ledger: ledger}; + ledger: ledger, + target : p_id_target}; var qs = encodeJSON(target); @@ -1272,14 +1280,20 @@ function search_operation(obj) alert(e.message); } } - +/** + * Update the field e_concerned, from class_iconcerned + * Value is the field where to put the quick-code but only if one checkbox has been + * selected + * @param {type} obj + * @returns {undefined} + */ function set_reconcile(obj) { try { var ctlc = obj.elements['ctlc']; - + var target=obj.elements['target'].value; for (var e = 0; e < obj.elements.length; e++) { @@ -1292,6 +1306,11 @@ function set_reconcile(obj) var nValue = str_name.replace("jr_concerned", ""); if ($(ctlc.value).value != '') { $(ctlc.value).value += ','; + + } else { + if ( target !="" && $(target).value == "") { + $(target).value=elmt.value; + } } $(ctlc.value).value += nValue; } diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 44a54b066..03c2097f9 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -626,7 +626,7 @@ class Acc_Ledger extends jrn_def_sql * @return HTML string */ - public function list_operation_to_reconcile($sql) + public function list_operation_to_reconcile($sql,$p_target) { global $g_parameter, $g_user; $gDossier = dossier::id(); @@ -650,7 +650,7 @@ class Acc_Ledger extends jrn_def_sql if ($Max == 0) return array(0, _("Aucun enregistrement trouvé")); - + $r.=HtmlInput::hidden("target", $p_target); $r.=''; @@ -689,7 +689,7 @@ class Acc_Ledger extends jrn_def_sql // Radiobox // - $r.=''; + $r.=''; //internal code // button modify $r.=" diff --git a/include/template/result_cat_card_summary.php b/include/template/result_cat_card_summary.php index 09c3f5ee4..29a359585 100644 --- a/include/template/result_cat_card_summary.php +++ b/include/template/result_cat_card_summary.php @@ -19,7 +19,7 @@ for ($i=0;$i'.$aHeading[$i]->ad_text.$span.''; + echo ''; endfor; ?>
"; @@ -3825,6 +3825,37 @@ class Acc_Ledger extends jrn_def_sql $lib=$this->db->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1',array($p_value)); return $lib; } + /** + * Let you select the repository before confirming a sale or a purchase. + * Returns an empty string if the company doesn't use stock + * @brief Let you select the repository before confirming a sale or a purchase. + * @global type $g_parameter check if company is using stock + * @param type $p_readonly + * @param type $p_repo + * @return string + */ + public function select_depot($p_readonly, $p_repo) + { + global $g_parameter; + $r='
'; + // Show the available repository + if ($g_parameter->MY_STOCK=='Y') + { + $sel=HtmlInput::select_stock($this->db, 'repo', 'W'); + $sel->readOnly=$p_readonly; + if ($p_readonly==true) + $sel->selected=$p_repo; + $r.="

"._('Dans le dépôt')." : "; + $r.=$sel->input(); + $r.='

'; + } else + { + $r.=''.'Stock non utilisé'.''; + } + $r.='
'; + return $r; + + } } ?> \ No newline at end of file diff --git a/include/class_acc_ledger_fin.php b/include/class_acc_ledger_fin.php index 284e354b6..8dc9423b8 100644 --- a/include/class_acc_ledger_fin.php +++ b/include/class_acc_ledger_fin.php @@ -431,6 +431,7 @@ class Acc_Ledger_Fin extends Acc_Ledger ${"e_concerned" . $i} = (isset(${"e_concerned" . $i})) ? ${"e_concerned" . $i} : "" ; $wConcerned = new IConcerned("e_concerned" . $i, ${"e_concerned" . $i}); + $wConcerned->tiers="e_other" . $i; $wConcerned->setReadOnly($pview_only); $wConcerned->amount_id = "e_other" . $i . "_amount"; diff --git a/include/class_iconcerned.php b/include/class_iconcerned.php index bae88eef2..f6da04187 100644 --- a/include/class_iconcerned.php +++ b/include/class_iconcerned.php @@ -36,6 +36,7 @@ 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 } /*!\brief show the html input of the widget*/ public function input($p_name=null,$p_value=null) @@ -48,7 +49,8 @@ class IConcerned extends HtmlInput $r=sprintf(" - + + @@ -56,6 +58,7 @@ class IConcerned extends HtmlInput $this->name, $this->amount_id, $this->paid, + $this->tiers, $this->name, $this->id, $this->value, diff --git a/include/search.inc.php b/include/search.inc.php index 017c20ed0..66c812335 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -107,7 +107,8 @@ if ( isset ($_GET['viewsearch']) ) list($sql,$where)=$ledger->build_search_sql($array); // Count nb of line $max_line=$cn->count_sql($sql); - list($count,$content)=$ledger->list_operation_to_reconcile($sql); + $target=HtmlInput::default_value_get("target", ""); + list($count,$content)=$ledger->list_operation_to_reconcile($sql,$target); $bar=navigation_bar($offset,$max_line,$step,$page); if (! $inside ) { diff --git a/include/template/card_result.php b/include/template/card_result.php index 828b0fa01..3bf77d4a5 100644 --- a/include/template/card_result.php +++ b/include/template/card_result.php @@ -10,7 +10,7 @@
- + '.$aHeading[$i]->ad_text.$span.'