diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index fcb28f12d..d778550a9 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -3249,7 +3249,16 @@ class Acc_Ledger extends jrn_def_sql return $array; } - function convert_from_follow($p_ag_id) + /** + * @brief convert operations from FOLLOWUP into a SALE , FEENOTE + * or PURCHASE operation into a suitable array + * @param $p_ag_id int PK of ACTION_GESTION + * @param $copy_description int 0 the description of the followup is not copied + * in the note , 1 is copied + * @return array|void|null + * @throws Exception + */ + function convert_from_follow($p_ag_id,$copy_description=0) { global $g_user; if (isNumber($p_ag_id)==0) @@ -3290,6 +3299,13 @@ class Acc_Ledger extends jrn_def_sql $array['e_march'.$i.'_tva_amount']=$a_item[$i]['ad_tva_amount']; $array['e_quant'.$i]=$a_item[$i]['ad_quant']; } + if ( $copy_description == 1) { + $acomment=$this->db->get_array("SELECT agc_id, ag_id, to_char(agc_date,'DD.MM.YYYY HH24:MI') as str_agc_date, agc_comment, agc_comment_raw,tech_user + FROM action_gestion_comment where ag_id=$1 order by agc_id", array($p_ag_id) + ); + if (count ($acomment) > 0) + $array['jrn_note_input']=$acomment[0]['agc_comment']; + } return $array; } diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php index b1389ccb8..e09319a97 100644 --- a/include/compta_ach.inc.php +++ b/include/compta_ach.inc.php @@ -252,7 +252,8 @@ try else if (isset($_GET['create_feenote'])) { $action_id=$http->get('ag_id',"number"); - $array=$Ledger->convert_from_follow($action_id); + $cp=$http->get('cp','number',0); + $array=$Ledger->convert_from_follow($action_id,$cp); echo HtmlInput::hidden("ledger_type", "VEN"); echo HtmlInput::hidden("ac",$http->get('ac')); echo HtmlInput::hidden("sa", "p"); diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php index c904f2130..b4dc5217c 100644 --- a/include/compta_ven.inc.php +++ b/include/compta_ven.inc.php @@ -267,7 +267,8 @@ try else if (isset($_GET['create_invoice'])) { $action_id=$http->get('ag_id',"number"); - $array=$Ledger->convert_from_follow($action_id); + $cp=$http->get('cp','number',0); + $array=$Ledger->convert_from_follow($action_id,$cp); echo HtmlInput::hidden("ledger_type", "VEN"); echo HtmlInput::hidden("ac", $http->get('ac')); echo HtmlInput::hidden("sa", "p"); diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php index 75cf68e44..07af3736a 100755 --- a/include/lib/html_input.class.php +++ b/include/lib/html_input.class.php @@ -248,8 +248,8 @@ class HtmlInput /*!\brief create a button with a ref * \param $p_label the text * \param $p_value the location of the window, - * \param $p_name the id of the span - * \param $p_javascript javascript for this button + * \param $p_name the id of the span (button will be "btn".$p_name + * \param $p_javascript javascript for this button, needed to add the event : onclick,... * \return string with htmlcode */ @@ -259,8 +259,8 @@ class HtmlInput $href=""; if ($p_value!="") $href=sprintf(' href ="%s" ', $p_value); - $r=sprintf(' %s', - $p_name, $href, $p_javascript, $p_label); + $r=sprintf(' %s', + $p_name, $p_name,$href, $p_javascript, $p_label); return $r; } /** diff --git a/include/template/follow_up_detail_display.php b/include/template/follow_up_detail_display.php index e68fa8391..25852f565 100644 --- a/include/template/follow_up_detail_display.php +++ b/include/template/follow_up_detail_display.php @@ -200,8 +200,21 @@ $menu=new Default_Menu(); if (Document_Option::is_enable_make_invoice($p_follow_up->dt_id)): ?>