From 87f6fe7cf250475bc4eff2d511af78f8d378c485 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 24 Feb 2018 13:40:42 +0100 Subject: [PATCH] PLANANC : fix bug when creating first plan --- include/anc_pa.inc.php | 16 ++++++++++------ include/class/anc_plan.class.php | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/include/anc_pa.inc.php b/include/anc_pa.inc.php index d721e64f0..a5461e083 100644 --- a/include/anc_pa.inc.php +++ b/include/anc_pa.inc.php @@ -52,7 +52,7 @@ if ($sa=="add_pa") $ret.=HtmlInput::title_box(_('Nouveau plan'), 'anc_div_add', 'hide'); $ret.= '
'; $ret.=dossier::hidden(); - $ret.= $new->form(); + $ret.= $new->form_new(); $ret.= HtmlInput::hidden("sa", "pa_write"); $ret.=HtmlInput::submit("submit", _("Enregistre")); $ret.=HtmlInput::button_hide("anc_div_add"); @@ -111,11 +111,12 @@ if ($sa=="pa_delete") $delete->delete(); $sa="anc_menu"; } - -// show the detail +//-------------------------------------------------------------------------------------------------- +// show the detail of an analytic axis (=plan) +// +//-------------------------------------------------------------------------------------------------- if ($sa=="pa_detail") { - $pa_id=$http->get("pa_id","number"); $new=new Anc_Plan($cn, $pa_id); @@ -127,9 +128,11 @@ if ($sa=="pa_detail") $ret.= $new->form(); $ret.= $wSa; + $ret.="

"; $ret.=HtmlInput::button_anchor(_('Efface ce plan'), '', 'remove_analytic_plan', 'onclick="return confirm_box(\'remove_analytic_plan\',\'Effacer ?\',function () {window.location=\'do.php?ac='.$_REQUEST['ac'].'&pa_id='.$_GET['pa_id'].'&sa=pa_delete&'.$str_dossier.'\';})"', 'smallbutton'); + $ret.="

"; //--------------------------------------------------------------------- // Detail now // Use Manage_Table @@ -145,6 +148,7 @@ if ($sa=="pa_detail") $accounting->set_callback("ajax_misc.php"); $accounting->add_json_param("op", "anc_accounting"); $accounting->add_json_param("pa_id", $pa_id); + $accounting->set_sort_column("po_name"); ob_start(); $accounting->display_table(" where pa_id = $1 order by po_name ",array($pa_id)); $accounting->create_js_script(); @@ -170,8 +174,8 @@ if ($sa=='anc_menu') $url=http_build_query(array("sa"=>"add_pa","ac"=>$ac, "gDossier"=>Dossier::id())); echo '
'; - echo ''; - echo '
'; + echo ''; + echo ''; echo '
'; echo ''._("Ajout d'un plan comptable").''; echo '
'; diff --git a/include/class/anc_plan.class.php b/include/class/anc_plan.class.php index f7ee13570..b55e8a951 100644 --- a/include/class/anc_plan.class.php +++ b/include/class/anc_plan.class.php @@ -139,6 +139,23 @@ class Anc_Plan $ret.="
"; $ret.=$wId->input(); return $ret; + } + /** + * @brief add a new plan + */ + function form_new() + { + $wName=new IText("pa_name"); + $wDescription=new IText("pa_description"); + $wDescription->size=80; + + $ret=""; + $ret.=''.td(_('Nom')).''.''; + $ret.="".td(_('Description')).''.""; + $ret.="
'.$wName->input().'
'.$wDescription->input().'
"; + return $ret; + + } function isAppend() {