diff --git a/include/anc_pa.inc.php b/include/anc_pa.inc.php index 4945546c8..7ab1e18a1 100644 --- a/include/anc_pa.inc.php +++ b/include/anc_pa.inc.php @@ -43,8 +43,8 @@ if ( isset($_REQUEST['sa'])) $new=new Anc_Plan($cn); if ( $new->isAppend() == true) { - $ret.= '
'; - $ret.= '

'._("Nouveau plan").'

'; + $ret.= '
'; + $ret.=HtmlInput::title_box(_('Nouveau plan'),'','none'); $ret.= '
'; $ret.=dossier::hidden(); $ret.= $new->form(); @@ -55,11 +55,12 @@ if ( isset($_REQUEST['sa'])) } else { - $ret.= '
'. - '

'. + $ret.= '
'. + '

'. _("Maximum de plan analytique est atteint"). "

"; } + $sa="anc_menu"; } // Add if ( $sa == "pa_write") @@ -69,7 +70,7 @@ if ( isset($_REQUEST['sa'])) if ( $new->isAppend() == false) { - $ret.= '

'. + $ret.= '

'. _("Maximum de plan analytique est atteint"). "

"; } @@ -80,6 +81,98 @@ if ( isset($_REQUEST['sa'])) $new->description=$_POST['pa_description']; $new->add(); } + $sa="anc_menu"; + } + + // Update the PA + if ( $sa == "pa_update" ) + { + $new=new Anc_Plan($cn,$_GET['pa_id']); + $new->name=$_POST['pa_name']; + $new->description=$_POST['pa_description']; + $new->update(); + $ret='
'; + $ret.='

'._('Mis à jour').'

'; + $ret.="
"; + $sa="anc_menu"; + } + // show the form for add a poste + if ( $sa=='po_add') + { + $po=new Anc_Account($cn); + $po->pa_id=$_REQUEST['pa_id']; + $wSa=HtmlInput::hidden("sa","po_write"); + $ret.='
'; + $ret.=''; + $ret.=dossier::hidden(); + $ret.=$po->form(); + $ret.=$wSa; + $ret.=HtmlInput::submit("add",_("Ajout")); + $ret.=""; + $ret.="
"; + + } + // record the poste + if ( $sa=="po_write") + { + // var_dump($_POST); + $po=new Anc_Account($cn); + $po->get_from_array($_POST); + $po->add(); + $sa="pa_detail"; + + + } + /* delete pa */ + if ( $sa == "pa_delete") + { + $delete=new Anc_Plan($cn,$_GET['pa_id']); + $delete->delete(); + $sa="anc_menu"; + } + /* po detail + *---> in ajax : montre detail d'un poste analytique + * + */ + if ( $sa=="po_detail") + { + $po=new Anc_Account($cn,$_GET['po_id']); + $po->get_by_id(); + $ret.='
'; + $ret.='
'; + $ret.=dossier::hidden(); + + $ret.=$po->form(); + $ret.=HtmlInput::hidden('sa','po_update'); + $ret.=HtmlInput::submit('Correction','Correction'); + $ret.=sprintf(''. + '', + $po->id, + $_REQUEST['pa_id'] + ); + + $ret.='
'; + $ret.='
'; + $sa=""; + } + /** + * mise à jour po + */ + if ( $sa=="po_update") + { + $po=new Anc_Account($cn); + $po->get_from_array($_POST); + $po->update(); + $sa="pa_detail"; + } + /** + * Efface po + */ + if ( $sa=="po_delete") + { + $po=new Anc_Account($cn,$_REQUEST['po_id']); + $po->delete(); + $sa="pa_detail"; } // show the detail if ( $sa == "pa_detail" ) @@ -89,7 +182,7 @@ if ( isset($_REQUEST['sa'])) $new->get(); - $ret.= '
'; + $ret.= '
'; $ret.= '

'._("Mise à jour").'

'; $ret.= '
'; $ret.=dossier::hidden(); @@ -97,98 +190,17 @@ if ( isset($_REQUEST['sa'])) $ret.= $new->form(); $ret.= $wSa; $ret.=HtmlInput::submit("submit",_("Enregistre")); - $ret.=HtmlInput::button_anchor(_('Efface'),"?ac=".$_REQUEST['ac']."&pa_id=".$_GET['pa_id']."&sa=pa_delete&$str_dossier",'Efface','onclick="return confirm(\'Effacer ?\')"'); + $ret.=HtmlInput::button_anchor(_('Efface'),"?ac=".$_REQUEST['ac']."&pa_id=".$_GET['pa_id']."&sa=pa_delete&$str_dossier",_('Efface'),'onclick="return confirm(\'Effacer ?\')"','smallbutton'); $ret.= '
'; - $ret.= '
'; - - } - // Update the PA - if ( $sa == "pa_update" ) - { - $new=new Anc_Plan($cn,$_GET['pa_id']); - $new->name=$_POST['pa_name']; - $new->description=$_POST['pa_description']; - $new->update(); - $ret='
'; - $ret.='

'._('Mis à jour').'

'; - $ret.="
"; - } - // show the form for add a poste - if ( $sa=='po_add') - { - $po=new Anc_Account($cn); - $po->pa_id=$_REQUEST['pa_id']; - $wSa=HtmlInput::hidden("sa","po_write"); - $ret.='
'; - $ret.='
'; - $ret.=dossier::hidden(); - $ret.=$po->form(); - $ret.=$wSa; - $ret.=HtmlInput::submit("add",_("Ajout")); - $ret.="
"; - $ret.="
"; - } - // record the poste - if ( $sa=="po_write") - { - // var_dump($_POST); - $po=new Anc_Account($cn); - $po->get_from_array($_POST); - $po->add(); - $sa="list"; - - } - /* delete pa */ - if ( $sa == "pa_delete") - { - $delete=new Anc_Plan($cn,$_GET['pa_id']); - $delete->delete(); - } - /* po detail - * - */ - if ( $sa=="po_detail") - { - $po=new Anc_Account($cn,$_GET['po_id']); - $po->get_by_id(); - $ret.='
'; - $ret.='
'; - $ret.=dossier::hidden(); - - $ret.=$po->form(); - $ret.=HtmlInput::hidden('sa','po_update'); - $ret.=HtmlInput::submit('Correction','Correction'); - $ret.=sprintf(''. - '', - $po->id, - $_REQUEST['pa_id'] - ); - - $ret.='
'; - $ret.='
'; - } - if ( $sa=="po_update") - { - $po=new Anc_Account($cn); - $po->get_from_array($_POST); - $po->update(); - $sa="list"; - } - if ( $sa=="po_delete") - { - $po=new Anc_Account($cn,$_REQUEST['po_id']); - $po->delete(); - $sa="list"; - } - /* List poste */ - if ( $sa == "list" ) - { - $count=0; + /** + * Detail now + */ + $count=0; $new=new Anc_Plan($cn,$_REQUEST['pa_id']); $new->get(); $array=$new->get_poste_analytique(" order by po_name"); - $ret.='
'; + $ret.='
'; $ret.=''; $ret.=""; $ret.="
"._("Nom")." "; @@ -222,76 +234,76 @@ if ( isset($_REQUEST['sa'])) } $ret.="
"; - $ret.=HtmlInput::button_anchor(_('Ajout'),"?ac=".$_REQUEST['ac']."&sa=po_add&pa_id=".$_GET['pa_id']."&".$str_dossier); - $ret.='
'; - + // ---> montre form pour ajouter po + $ret.=HtmlInput::button_anchor(_('Ajout'),"?ac=".$_REQUEST['ac']."&sa=po_add&pa_id=".$_GET['pa_id']."&".$str_dossier,'','','smallbutton'); + $href=http_build_query(array('ac'=>$_REQUEST['ac'],'gDossier'=>$_REQUEST['gDossier'])); + $ret.= ''._('Retour').''; + $ret.= '
'; + } - } - +else { + $sa="anc_menu"; +} //--------------------------------------------------------------------------- // Show lmenu // //--------------------------------------------------------------------------- -$obj=new Anc_Plan($cn); -$list=$obj->get_list(); - - - - -if ( empty($list) ) +if ($sa=='anc_menu') { - echo ''; - if ( ! isset ( $_REQUEST['sa'])) - echo '
'. - _("Aucun plan analytique n'est défini"). - '
'; + $obj=new Anc_Plan($cn); + $list=$obj->get_list(); -} -else -{ - echo ''; + } } //--------------------------------------------------------------------------- -// show the redcontent part +// show the content part // // //--------------------------------------------------------------------------- diff --git a/include/cfgledger.inc.php b/include/cfgledger.inc.php index 6ddbfaa68..03abf1b6c 100644 --- a/include/cfgledger.inc.php +++ b/include/cfgledger.inc.php @@ -36,7 +36,7 @@ require_once 'class_acc_ledger.php'; $gDossier=dossier::id(); global $cn; - +$show_menu=1; $ledger=new Acc_Ledger($cn,-1); $sa=HtmlInput::default_value("sa","",$_REQUEST); ////////////////////////////////////////////////////////////////////////// @@ -50,6 +50,7 @@ if (isset($_POST['update'])) if ( $ledger->load() == -1) throw new Exception (_('Journal inexistant')); $ledger->verify_ledger($_POST); $ledger->update($_POST); + $show_menu=1; } catch (Exception $e) { alert($e->getMessage()); @@ -71,6 +72,7 @@ if (isset($_POST['efface'])) echo '
'; echo '

'.h($name). " est effacé"."

"; echo '
'; + $show_menu=1; } catch (Exception $e) { @@ -90,6 +92,7 @@ if (isset($_POST['add'])) $ledger->save_new($_POST); $sa="detail"; $_REQUEST['p_jrn']=$ledger->jrn_def_id; + $show_menu=1; } catch (Exception $e) { @@ -97,12 +100,7 @@ if (isset($_POST['add'])) } } -////////////////////////////////////////////////////////////////////////// -// Display list of ledgers -////////////////////////////////////////////////////////////////////////// -echo ''; + @@ -116,14 +114,17 @@ switch ($sa) try { $ledger->id=$_REQUEST['p_jrn']; - echo '
'; + echo '
'; echo '
'; echo $ledger->display_ledger(); - echo ' - - '; + echo ' + + '; + $href=http_build_query(array('ac'=>$_REQUEST['ac'],'gDossier'=>$_REQUEST['gDossier'])); + echo ''._('Retour').''; echo '
'; echo "
"; + $show_menu=0; } catch (Exception $e) { @@ -131,17 +132,24 @@ switch ($sa) } break; case 'add': /* Add a new ledger */ - echo '
'; + echo '
'; echo '
'; $ledger->input_new(); - echo HtmlInput::submit('add','Sauver'); - echo ''; + echo HtmlInput::submit('add',_('Sauver')); + echo ''; echo '
'; echo "
"; + $show_menu=0; } - - +////////////////////////////////////////////////////////////////////////// +// Display list of ledgers +////////////////////////////////////////////////////////////////////////// +if ( $show_menu == 1 ) { + echo '
'; + echo $ledger->listing(); + echo '
'; +} html_page_stop(); diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 03e258db8..44a54b066 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -3358,8 +3358,9 @@ class Acc_Ledger extends jrn_def_sql $base_url = "?" . dossier::get() . "&ac=" . $_REQUEST['ac']; $r = ""; - $r.=''; - $r.=''; + $r.=_('Filtre')." ".HtmlInput::filter_table("cfgledger_table_id", "0", "1"); + $r.='
' . _('Création') . '
'; + $r.=''; $ret = $this->db->exec_sql("select distinct jrn_def_id,jrn_def_name, jrn_def_class_deb,jrn_def_class_cred,jrn_def_type from jrn_def order by jrn_def_name"); @@ -3370,7 +3371,7 @@ class Acc_Ledger extends jrn_def_sql { $l_line = Database::fetch_array($ret, $i); $url = $base_url . "&sa=detail&p_jrn=" . $l_line['jrn_def_id']; - $r.=sprintf('', $url, h($l_line['jrn_def_name'])); + $r.=sprintf('', $url, h($l_line['jrn_def_name']).' ('.$l_line['jrn_def_type'].')'); } $r.= "
' . _('Ajout journal') . '
%s
%s
"; return $r; diff --git a/include/class_acc_ledger_sold.php b/include/class_acc_ledger_sold.php index 5d01d2b5d..3d98b1fab 100644 --- a/include/class_acc_ledger_sold.php +++ b/include/class_acc_ledger_sold.php @@ -40,6 +40,7 @@ require_once('class_own.php'); require_once('class_itva_popup.php'); require_once('class_acc_ledger_fin.php'); require_once 'class_stock_goods.php'; +require_once 'class_acc_ledger.php'; /* !\brief Handle the ledger of sold, * @@ -1356,6 +1357,6 @@ class Acc_Ledger_Sold extends Acc_Ledger { $a = new Acc_Ledger_Sold($cn, 2); echo $a->input(); } - -} + + }