From 34f26e806019d31ab889b09f0980667c3f793d3b Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 22 Jul 2017 20:13:07 +0200 Subject: [PATCH] Update test with new architecture --- scenario/ajax-add-card-category.php | 5 +- scenario/ajax-detail-operation1.php | 4 +- scenario/ajax-detail-operation2.php | 4 +- scenario/ajax-detail-operation3.php | 4 +- scenario/ajax-detail-operation4.php | 4 +- scenario/ajax-save-operation.php | 3 +- scenario/comptabilite_analytique.php | 2 +- scenario/pdf_operation.php | 2 +- scenario/scenario-1415995185.php | 2 +- scenario/scenario-1415995188.php | 2 +- scenario/scenario-1415995229.php | 2 +- scenario/scenario-1415995238.php | 2 +- scenario/scenario-1415995254.php | 2 +- scenario/scenario-1415995262.php | 2 +- scenario/scenario-1415995277.php | 7 +- scenario/scenario-1415996970.php | 2 +- scenario/test_manage_table_sql.php | 106 +++++++++++++++------------ 17 files changed, 87 insertions(+), 68 deletions(-) diff --git a/scenario/ajax-add-card-category.php b/scenario/ajax-add-card-category.php index 3988aeb40..10aeab903 100644 --- a/scenario/ajax-add-card-category.php +++ b/scenario/ajax-add-card-category.php @@ -3,7 +3,8 @@ $_GET=array ( 'gDossier' => '42', 'ctl' => 'select_card_div', - 'op' => 'st', + 'op' => 'card', + 'op2'=>'st', 'fil' => '-1', 'ledger' => '2', ); @@ -12,4 +13,4 @@ $_POST=array ( $_POST['gDossier']=$gDossierLogInput; $_GET['gDossier']=$gDossierLogInput; $_REQUEST=array_merge($_GET,$_POST); -include 'ajax_card.php'; +include NOALYSS_HOME.'/ajax_misc.php'; diff --git a/scenario/ajax-detail-operation1.php b/scenario/ajax-detail-operation1.php index 8245ac14d..8874afe42 100644 --- a/scenario/ajax-detail-operation1.php +++ b/scenario/ajax-detail-operation1.php @@ -1,7 +1,7 @@ '27', + 'op' => 'ledger', 'act' => 'de', 'jr_id' => '2856', 'div' => 'det2', @@ -11,4 +11,4 @@ $_POST=array ( $_POST['gDossier']=$gDossierLogInput; $_GET['gDossier']=$gDossierLogInput; $_REQUEST=array_merge($_GET,$_POST); -include 'ajax_ledger.php'; +include 'ajax_misc.php'; diff --git a/scenario/ajax-detail-operation2.php b/scenario/ajax-detail-operation2.php index 851d0f88c..1ef2ce551 100644 --- a/scenario/ajax-detail-operation2.php +++ b/scenario/ajax-detail-operation2.php @@ -1,7 +1,7 @@ '27', + 'op' => 'ledger', 'act' => 'de', 'jr_id' => '2870', 'div' => 'det2', @@ -11,4 +11,4 @@ $_POST=array ( $_POST['gDossier']=$gDossierLogInput; $_GET['gDossier']=$gDossierLogInput; $_REQUEST=array_merge($_GET,$_POST); -include 'ajax_ledger.php'; +include 'ajax_misc.php'; diff --git a/scenario/ajax-detail-operation3.php b/scenario/ajax-detail-operation3.php index 9a99ed696..a14539381 100644 --- a/scenario/ajax-detail-operation3.php +++ b/scenario/ajax-detail-operation3.php @@ -1,7 +1,7 @@ '27', + 'op' => 'ledger', 'act' => 'de', 'jr_id' => '3532', 'div' => 'det2', @@ -11,4 +11,4 @@ $_POST=array ( $_POST['gDossier']=$gDossierLogInput; $_GET['gDossier']=$gDossierLogInput; $_REQUEST=array_merge($_GET,$_POST); -include 'ajax_ledger.php'; +include 'ajax_misc.php'; diff --git a/scenario/ajax-detail-operation4.php b/scenario/ajax-detail-operation4.php index aaa24285c..92f1ca8f3 100644 --- a/scenario/ajax-detail-operation4.php +++ b/scenario/ajax-detail-operation4.php @@ -1,7 +1,7 @@ '27', + 'op'=>"ledger", 'act' => 'de', 'jr_id' => '2826', 'div' => 'det2', @@ -11,4 +11,4 @@ $_POST=array ( $_POST['gDossier']=$gDossierLogInput; $_GET['gDossier']=$gDossierLogInput; $_REQUEST=array_merge($_GET,$_POST); -include 'ajax_ledger.php'; +include 'ajax_misc.php'; diff --git a/scenario/ajax-save-operation.php b/scenario/ajax-save-operation.php index c12c38acb..6149ee7b8 100644 --- a/scenario/ajax-save-operation.php +++ b/scenario/ajax-save-operation.php @@ -28,8 +28,9 @@ $_POST=array ( 'rapt' => '', 'div' => 'det2', 'act' => 'save', + 'op'=>'ledger' ); $_POST['gDossier']=$gDossierLogInput; $_GET['gDossier']=$gDossierLogInput; $_REQUEST=array_merge($_GET,$_POST); -include 'ajax_ledger.php'; +include 'ajax_misc.php'; diff --git a/scenario/comptabilite_analytique.php b/scenario/comptabilite_analytique.php index 3daa71fb8..508a814a6 100644 --- a/scenario/comptabilite_analytique.php +++ b/scenario/comptabilite_analytique.php @@ -29,7 +29,7 @@ $a_jrnxId = $cn->get_array( "select j_id from jrnx join jrn on (jr_grpt_id=j_grpt) where jr_id=$1 - ", array(4677)); + ", array(48)); $nb = count($a_jrnxId); for ($i = 0; $i<$nb; $i++) { diff --git a/scenario/pdf_operation.php b/scenario/pdf_operation.php index 655ed0e3a..9a513f91c 100644 --- a/scenario/pdf_operation.php +++ b/scenario/pdf_operation.php @@ -22,7 +22,7 @@ require_once NOALYSS_INCLUDE."/class/pdf_operation.class.php"; -$pdf=new PDF_Operation ($cn,4677); +$pdf=new PDF_Operation ($cn,61); //$pdf=new PDF_Operation ($cn,47); //$pdf=new PDF_Operation ($cn,4638); diff --git a/scenario/scenario-1415995185.php b/scenario/scenario-1415995185.php index 1accb4392..d86305fa8 100644 --- a/scenario/scenario-1415995185.php +++ b/scenario/scenario-1415995185.php @@ -11,7 +11,7 @@ $_POST=array ( 'gDossier' => '42', 'nb_item' => '2', 'p_jrn' => '2', - 'e_date' => '14.11.2014', + 'e_date' => '14.11.2016', 'e_ech' => '', 'e_client' => 'CLIENT1 ', 'e_pj' => 'VEN1', diff --git a/scenario/scenario-1415995188.php b/scenario/scenario-1415995188.php index 5a4f1d28d..5c119ee4b 100644 --- a/scenario/scenario-1415995188.php +++ b/scenario/scenario-1415995188.php @@ -13,7 +13,7 @@ $_POST=array ( 'p_jrn' => '2', 'mt' => '1415995185.7619', 'e_comm' => 'Première vente', - 'e_date' => '14.11.2014', + 'e_date' => '14.11.2016', 'e_ech' => '', 'e_pj' => 'VEN1', 'e_pj_suggest' => 'VEN1', diff --git a/scenario/scenario-1415995229.php b/scenario/scenario-1415995229.php index 89776e0af..48501bb35 100644 --- a/scenario/scenario-1415995229.php +++ b/scenario/scenario-1415995229.php @@ -8,7 +8,7 @@ $_POST=array ( 'gDossier' => '42', 'nb_item' => '1', 'p_jrn' => '3', - 'e_date' => '01.03.2014', + 'e_date' => '01.03.2016', 'e_ech' => '', 'e_client' => 'IMMOB', 'e_pj' => 'ACH1', diff --git a/scenario/scenario-1415995238.php b/scenario/scenario-1415995238.php index 82d40e5b0..1f967707d 100644 --- a/scenario/scenario-1415995238.php +++ b/scenario/scenario-1415995238.php @@ -8,7 +8,7 @@ $_POST=array ( 'gDossier' => '42', 'nb_item' => '1', 'p_jrn' => '3', - 'e_date' => '01.01.2014', + 'e_date' => '01.01.2017', 'e_ech' => '', 'e_client' => 'IMMOB', 'e_pj' => 'ACH1', diff --git a/scenario/scenario-1415995254.php b/scenario/scenario-1415995254.php index 6f70f6bba..063b75537 100644 --- a/scenario/scenario-1415995254.php +++ b/scenario/scenario-1415995254.php @@ -10,7 +10,7 @@ $_POST=array ( 'nb_item' => '1', 'p_jrn' => '3', 'e_comm' => 'Loyer', - 'e_date' => '01.01.2014', + 'e_date' => '01.01.2017', 'e_ech' => '', 'jrn_type' => 'ACH', 'e_pj' => 'ACH1', diff --git a/scenario/scenario-1415995262.php b/scenario/scenario-1415995262.php index 8401f523f..d801c3b00 100644 --- a/scenario/scenario-1415995262.php +++ b/scenario/scenario-1415995262.php @@ -10,7 +10,7 @@ $_POST=array ( 'gDossier' => '42', 'nb_item' => '10', 'p_jrn' => '3', - 'e_date' => '01.01.2014', + 'e_date' => '01.01.2017', 'e_ech' => '', 'e_client' => 'IMMOB', 'e_pj' => 'ACH2', diff --git a/scenario/scenario-1415995277.php b/scenario/scenario-1415995277.php index 64dc92465..a26270d99 100644 --- a/scenario/scenario-1415995277.php +++ b/scenario/scenario-1415995277.php @@ -10,13 +10,14 @@ $_POST=array ( 'gDossier' => '42', 'nb_item' => '10', 'p_jrn' => '3', - 'e_date' => '01.02.2014', + 'e_date' => '01.02.2016', 'e_ech' => '', - 'e_client' => 'IMMOB', + 'e_client' => 'DIV', 'e_pj' => 'ACH2', 'e_pj_suggest' => 'ACH2', 'e_comm' => 'Paiement loyer', - 'e_march0' => 'LOYER', + 'e_march0' => 'FID15', + 'e_march0_label' => 'TEST', 'e_march0_price' => '2560.0000', 'e_quant0' => '1.0000', 'htva_march0' => '2560', diff --git a/scenario/scenario-1415996970.php b/scenario/scenario-1415996970.php index 335ec53ff..efb976484 100644 --- a/scenario/scenario-1415996970.php +++ b/scenario/scenario-1415996970.php @@ -8,7 +8,7 @@ $_POST=array ( 'gDossier' => '42', 'ac' => 'COMPTA/MENUODS/ODS', 'p_jrn' => '4', - 'e_date' => '14.11.2014', + 'e_date' => '14.11.2016', 'e_pj' => 'ODS1', 'e_pj_suggest' => 'ODS1', 'desc' => 'TVA', diff --git a/scenario/test_manage_table_sql.php b/scenario/test_manage_table_sql.php index 7dc619388..d0a9f2bd3 100644 --- a/scenario/test_manage_table_sql.php +++ b/scenario/test_manage_table_sql.php @@ -22,66 +22,82 @@ //@description:Test the class manage_table_sql and javascript $_GET=array ( - 'gDossier' => '10079', ); $_POST=array ( ); $_POST['gDossier']=$gDossierLogInput; $_GET['gDossier']=$gDossierLogInput; $_REQUEST=array_merge($_GET,$_POST); -require_once NOALYSS_INCLUDE."/database/menu_ref_sql.class.php"; +require_once NOALYSS_INCLUDE."/database/acc_plan_sql.class.php"; require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php"; -$jrn=new Menu_Ref_SQL($cn); +$jrn=new Acc_Plan_SQL($cn); $manage_table=new Manage_Table_SQL($jrn); -$manage_table->set_callback("ajax_misc.php"); +$manage_table->set_callback("ajax_test.php"); + +echo $manage_table->get_json(); +echo " Function add_json_param : add param TestAjaxFile"; +$manage_table->add_json_param("TestAjaxFile",NOALYSS_HOME."/../scenario/ajax_manage_table_sql.php"); +echo "
"; +$r =json_decode($manage_table->get_json(),TRUE); +if ( isset($r['TestAjaxFile']) && $r['TestAjaxFile'] == NOALYSS_HOME."/../scenario/ajax_manage_table_sql.php") { echo "$g_succeed ok
";} else {echo "$g_failed not ok";} +echo "
"; + + $manage_table->create_js_script(); -?> - -set_col_label('me_code', "Code"); -$manage_table->set_col_label('me_menu', "Menu"); -$manage_table->set_col_label('me_file', "Fichier"); -$manage_table->set_col_label('me_description', "Description"); -$manage_table->set_col_label('me_description_etendue', "Detail"); +$manage_table->set_col_label('pcm_val', "Poste"); +$manage_table->set_col_label('parent_accounting', "Dépend"); +$manage_table->set_col_label('pcm_lib', "Libellé"); +$manage_table->set_col_label('pcm_type', "Type de menu".HtmlInput::infobulle(33)); // Change visible property -$manage_table->set_property_visible("me_javascript", false); -$manage_table->set_property_visible("me_url", false); +function test_visible_update(Manage_Table_SQL $p_manage_table,$p_property,$p_visible,$p_update) { + global $g_failed,$g_succeed; + // test visibility + $p_manage_table->set_property_visible($p_property, $p_visible); + + echo "$p_property VISIBLE ($p_visible)" .$p_manage_table->get_property_visible($p_property); + if ( $p_manage_table->get_property_visible($p_property) == $p_visible) echo "$g_succeed OK"; else echo " $g_failed FAIL";echo "
"; + + // test update + echo "$p_property UPDATE ($p_update)" .$p_manage_table->get_property_updatable($p_property); + $p_manage_table->set_property_updatable($p_property, $p_update); + if ( $p_manage_table->get_property_updatable($p_property) == $p_update) echo "$g_succeed OK"; else echo "$g_failed FAIL";echo "
"; +} + +test_visible_update($manage_table, "pcm_type", FALSE, FALSE); +test_visible_update($manage_table, "pcm_type", FALSE, TRUE); +test_visible_update($manage_table, "pcm_type", TRUE, FALSE); +test_visible_update($manage_table, "pcm_type", TRUE, TRUE); +test_visible_update($manage_table, "parent_accounting", FALSE, FALSE); +test_visible_update($manage_table, "parent_accounting", FALSE, TRUE); +test_visible_update($manage_table, "parent_accounting", TRUE, FALSE); +test_visible_update($manage_table, "parent_accounting", TRUE, TRUE); + +echo "

"."Icon MODIFY place"."

"; +echo "

"." Mod left"."

"; +$manage_table->set_icon_mod("left"); +$manage_table->display_table(" order by pcm_val::text limit 10"); + +echo "

"." Mod right"."

"; +$manage_table->set_icon_mod("right"); +$manage_table->display_table(" order by pcm_val::text limit 10"); + +echo "

"." Mod first"."

"; +$manage_table->set_icon_mod("first"); +$manage_table->display_table(" order by pcm_val::text limit 10"); + +echo "

"."Icon DELETE place"."

"; +echo "

"." Delete left"."

"; +$manage_table->set_icon_del("left"); +$manage_table->display_table(" order by pcm_val::text limit 10"); + +echo "

"." Delete right"."

"; +$manage_table->set_icon_del("right"); +$manage_table->display_table(" order by pcm_val::text limit 10"); - - -// Change update property -$manage_table->set_property_updatable("me_type", false); -$manage_table->set_property_updatable("me_parameter", false); - -// Check - -echo "me_javascript Visible (false)" .$manage_table->get_property_visible("me_javascript"); -if ( ! $manage_table->get_property_visible("me_javascript")) echo "OK"; else echo "FAIL";echo "
"; -echo "me_javascript updatable (true)" .$manage_table->get_property_updatable("me_javascript"); -if ( $manage_table->get_property_updatable("me_javascript")) echo "OK"; else echo "FAIL";echo "
"; -echo "me_url Visible (false)" .$manage_table->get_property_visible("me_url"); -if ( ! $manage_table->get_property_visible("me_url")) echo "OK"; else echo "FAIL";echo "
"; -echo "me_url updatable (true)" .$manage_table->get_property_updatable("me_url"); -if ( $manage_table->get_property_updatable("me_url")) echo "OK"; else echo "FAIL";echo "
"; - -echo "me_type Visible (true)" ; -if ( $manage_table->get_property_visible("me_type")) echo "OK"; else echo "FAIL";echo "
"; -echo "me_type updatable (false)" ; -if ( ! $manage_table->get_property_updatable("me_type")) echo "OK"; else echo "FAIL";echo "
"; - -echo "me_parameter Visible (true)" ; -if ( $manage_table->get_property_visible("me_parameter")) echo "OK"; else echo "FAIL";echo "
"; -echo "me_parameter updatable (false)" ; -if ( ! $manage_table->get_property_updatable("me_parameter")) echo "OK"; else echo "FAIL";echo "
"; - -$manage_table->display_table(); - ?>