From e284a11ea61908dc1f39ab31f70d2e34baa16d7d Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 2 Feb 2019 13:31:35 +0100 Subject: [PATCH] Mantis #1596: Dans le plan comptable, fiches non cliquables Les fiches sont cliquable dans Plan Comptable , PCMNCFG et dans la liste des postes, en plus on peut obtenir toutes les fiches d'un poste --- html/ajax_misc.php | 4 +- html/js/accounting_item.js | 25 +++++++++++ html/js/scripts.js | 7 ++++ include/ajax/ajax_display_all_card.php | 56 +++++++++++++++++++++++++ include/ajax/ajax_poste.php | 5 ++- include/class/acc_bilan.class.php | 4 +- include/class/acc_plan_mtable.class.php | 35 ++++++++++++++-- include/lib/icon_action.class.php | 14 +++++++ include/template/account_result.php | 2 +- 9 files changed, 143 insertions(+), 9 deletions(-) create mode 100644 include/ajax/ajax_display_all_card.php diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 66e68779a..39371f252 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -244,7 +244,9 @@ $path = array( // From FollowUp , update a comment on a file 'update_comment_followUp'=>'ajax_follow_up', // TVA param - "tva_parameter"=>"ajax_tva_parameter" + "tva_parameter"=>"ajax_tva_parameter", + // Display all cards using an accounting + "display_all_card"=>"ajax_display_all_card" ) ; if (array_key_exists($op, $path)) { diff --git a/html/js/accounting_item.js b/html/js/accounting_item.js index 80cae00f4..41f3a34ff 100644 --- a/html/js/accounting_item.js +++ b/html/js/accounting_item.js @@ -244,3 +244,28 @@ function pausecomp(millis) do { curDate = new Date(); } while(curDate-date < millis); } +/** + * Display the list of card using a given accounting + * @param dossier + * @param accounting + * + */ +function display_all_card(p_dossier,p_accounting) +{ + waiting_box(); + var div_dest=add_div({id:'info_card_accounting',cssclass:"inner_box",style:fixed_position(100,250)+";width:auto"}); + var action=new Ajax.Request ( 'ajax_misc.php', + { + method:'get', + parameters:{op:"display_all_card", + gDossier:p_dossier, + p_accounting:p_accounting + }, + onSuccess:function (req) + { + div_dest.innerHTML=req.responseText; + remove_waiting_box(); + } + } + ); +} \ No newline at end of file diff --git a/html/js/scripts.js b/html/js/scripts.js index 59575a8c0..694f3f358 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -26,6 +26,10 @@ var ask_reload = 0; var tag_choose = ''; var aDraggableElement=new Array(); +var viewport = document.viewport.getDimensions(); // Gets the viewport as an object literal +var width = viewport.width; // Usable window width +var height = viewport.height; + /** * callback function when we just need to update a hidden div with an info * message @@ -1486,6 +1490,9 @@ function calcy(p_sy) { sy = document.documentElement.scrollTop + p_sy; } + if ( width < 801 ) { + sy=sy/2; + } return sy; } diff --git a/include/ajax/ajax_display_all_card.php b/include/ajax/ajax_display_all_card.php new file mode 100644 index 000000000..4f9b5168e --- /dev/null +++ b/include/ajax/ajax_display_all_card.php @@ -0,0 +1,56 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); + +/** + * @file + * @brief Display all cards using an accounting + */ +$accounting=$http->get("p_accounting"); + +$a_card=$cn->get_array(" + select f1.f_id,f3.ad_value as qcode, f2.ad_value as name + from fiche_detail as f1 + join fiche_detail as f2 on (f1.f_id=f2.f_id and f2.ad_id=1) + join fiche_detail as f3 on (f1.f_id=f3.f_id and f3.ad_id=23) + where + f1.ad_id=5 and f1.ad_value=$1 + order by 3", [$accounting]); +$nb_card=count($a_card); +echo HtmlInput::title_box($accounting, "info_card_accounting"); +echo '
'; +echo '
    '; +for ($i=0; $i<$nb_card; $i++) +{ + echo '
  1. '; + echo HtmlInput::card_detail($a_card[$i]['qcode'], $a_card[$i]['name']); + echo '
  2. '; +} +echo '
'; +echo ''; + +echo '
'; \ No newline at end of file diff --git a/include/ajax/ajax_poste.php b/include/ajax/ajax_poste.php index a178c3be8..d7c96dfd3 100644 --- a/include/ajax/ajax_poste.php +++ b/include/ajax/ajax_poste.php @@ -43,8 +43,9 @@ mb_internal_encoding("UTF-8"); extract($_REQUEST, EXTR_SKIP); -if ($g_user->check_dossier(dossier::id()) == 'X') exit(); +$dossier_id=Dossier::id(); +if ($g_user->check_dossier($dossier_id) == 'X') exit(); switch ($op2) { /*---------------------------------------------------------------------- @@ -141,7 +142,7 @@ case "sf": $array[$i]['javascript']=$str; } ob_start(); - + require_once NOALYSS_TEMPLATE.'/account_result.php'; $r.=ob_get_contents(); ob_end_clean(); diff --git a/include/class/acc_bilan.class.php b/include/class/acc_bilan.class.php index 8f17f63e5..9585cfdee 100644 --- a/include/class/acc_bilan.class.php +++ b/include/class/acc_bilan.class.php @@ -195,7 +195,9 @@ class Acc_Bilan /* debit Actif */ $res=$this->db->execute("sqlAccount",array('ACT','ACTINV')); - $result=Database::fetch_array($res, 0); + $result=Database::fetch_array($res, 0); + + /* Show detail */ $debit_actif=($result === false)?0:$result['amount_debit']; /* Credit Actif */ diff --git a/include/class/acc_plan_mtable.class.php b/include/class/acc_plan_mtable.class.php index 26e68bf7b..c9ba7d795 100644 --- a/include/class/acc_plan_mtable.class.php +++ b/include/class/acc_plan_mtable.class.php @@ -77,7 +77,7 @@ class Acc_Plan_MTable extends Manage_Table_SQL $p_row[$this->table->primary_key]) ; - + $dossier_id=Dossier::id(); $nb_order=count($this->a_order); for ($i=0; $i<$nb_order; $i++) { @@ -97,8 +97,25 @@ class Acc_Plan_MTable extends Manage_Table_SQL elseif ($v == "fiche_qcode") { $count=$this->table->cn->get_value("select count(*) from fiche_detail where ad_id=5 and ad_value=$1",array($p_row['pcm_val'])); if ($count == 0) echo td(""); - elseif ($count == 1 ) { echo td($p_row[$v]) ; } - elseif ($count > 1) { echo td($p_row[$v] . " ($count) ");} + elseif ($count == 1 ) { + echo ''; + echo HtmlInput::card_detail($p_row[$v]) ; + echo ''; + + } + elseif ($count > 1) { + echo ''; + $a_code=explode(",",$p_row[$v]); + $nb_code=count($a_code); + for ($xx = 0;$xx < $nb_code;$xx++) + { + echo HtmlInput::card_detail($a_code[$xx]) ; + } + echo " ($count) "; + echo Icon_Action::detail(uniqid(), sprintf("display_all_card('%s','%s')",$dossier_id,$p_row["pcm_val"])); + echo ''; + + } } elseif ($v=="pcm_lib") { @@ -160,6 +177,16 @@ class Acc_Plan_MTable extends Manage_Table_SQL return true; } - + /** + * @brief display into a dialog box the datarow in order + * to be appended or modified. Can be override if you need + * a more complex form + */ + function input() + { + parent::input(); + $dossier_id=Dossier::id(); + echo HtmlInput::button_action(_("Toutes les fiches") , sprintf("display_all_card('%s','%s')",$dossier_id,$this->table->pcm_val)); + } } diff --git a/include/lib/icon_action.class.php b/include/lib/icon_action.class.php index ad9a30bb9..8d31bc801 100644 --- a/include/lib/icon_action.class.php +++ b/include/lib/icon_action.class.php @@ -229,4 +229,18 @@ class Icon_Action return $r; } + static function detail($p_id,$p_javascript) + { + $r=sprintf('', + $p_id, + $p_javascript); + return $r; + } + static function more($p_id,$p_javascript) + { + $r=sprintf('...', + $p_id, + $p_javascript); + return $r; + } } diff --git a/include/template/account_result.php b/include/template/account_result.php index d196bd50d..550535c27 100644 --- a/include/template/account_result.php +++ b/include/template/account_result.php @@ -42,7 +42,7 @@ $sep=" , "; } if ($max < count($det_qcode)) { - echo "..."; + echo Icon_Action::detail(uniqid(), sprintf("display_all_card('%s','%s')",$dossier_id,$array[$i]['pcm_val'])); } } else { echo HtmlInput::card_detail($array[$i]['acode']);