[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r578 - in trunk/rapport_avance: . include include/templa
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r578 - in trunk/rapport_avance: . include include/template sql |
Date: |
Thu, 14 Nov 2013 18:26:47 +0100 (CET) |
Author: danydb
Date: 2013-11-14 18:26:46 +0100 (Thu, 14 Nov 2013)
New Revision: 578
Modified:
trunk/rapport_avance/ajax_listing_display_definition.php
trunk/rapport_avance/include/class_rapav_listing.php
trunk/rapport_avance/include/class_rapav_listing_param.php
trunk/rapport_avance/include/class_rapport_avance_sql.php
trunk/rapport_avance/include/liste.inc.php
trunk/rapport_avance/include/template/rapav_listing_definition.php
trunk/rapport_avance/rapav_javascript.js
trunk/rapport_avance/sql/1-add-listing.sql
Log:
Listing_Param and Listing_Param_Detail are not only one table
Modified: trunk/rapport_avance/ajax_listing_display_definition.php
===================================================================
--- trunk/rapport_avance/ajax_listing_display_definition.php 2013-11-13
14:58:04 UTC (rev 577)
+++ trunk/rapport_avance/ajax_listing_display_definition.php 2013-11-14
17:26:46 UTC (rev 578)
@@ -4,7 +4,9 @@
$obj=new Rapav_Listing($id);
ob_start();
$obj->display();
+echo '<p>';
$obj->button_add_param();
+echo '</p>';
$response = ob_get_flush();
ob_end_clean();
$html = escape_xml($response);
Modified: trunk/rapport_avance/include/class_rapav_listing.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing.php 2013-11-13
14:58:04 UTC (rev 577)
+++ trunk/rapport_avance/include/class_rapav_listing.php 2013-11-14
17:26:46 UTC (rev 578)
@@ -199,7 +199,10 @@
// Display them avec an anchor to update / delete (javascript)
include_once 'template/rapav_listing_definition.php';
}
-
+ /**
+ * @brief Load the detail of a listing
+ * @throws Exception Undefined object
+ */
function load_detail()
{
if ( $this->Data->getp('id') == -1)
@@ -207,8 +210,21 @@
$this->a_detail=
RAPAV_Listing_Param::get_listing_detail($this->Data->getp('id'));
}
+ /**
+ * @brief Display button for adding detail to a list definition, it means
+ */
function button_add_param()
{
-
+ $button=new IButton('detail_add_bt','Ajout','detail_add_bt');
+ $arg= json_encode(array(
+ 'cin'=>'listing_definition_div_id',
+ 'gDossier'=>Dossier::id(),
+ 'id'=>$this->Data->getp('id'),
+ 'tb_id'=>'definition_tb_id',
+ 'ac'=>$_REQUEST['ac'])
+ );
+ $arg=str_replace('"',"'",$arg);
+ $button->javascript='listing_param_add('.$arg.')';
+ echo $button->input();
}
}
Modified: trunk/rapport_avance/include/class_rapav_listing_param.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing_param.php 2013-11-13
14:58:04 UTC (rev 577)
+++ trunk/rapport_avance/include/class_rapav_listing_param.php 2013-11-14
17:26:46 UTC (rev 578)
@@ -16,7 +16,6 @@
class RAPAV_Listing_Param {
private $Param; /*!< RAPAV_Listing_Param_SQL */
- private $Detail; /*!< RAPAV_Listing_Param_Detail_SQL */
/**
* constructor, initialize Data with a RAPAV_Listing_Param_SQL
@@ -26,11 +25,6 @@
function __construct($p_id=-1) {
global $cn;
$this->Param = new RAPAV_Listing_Param_SQL($p_id);
- $this->Detail=new RAPAV_Listing_Param_Detail_SQL();
- if ( $p_id !=-1)
- {
- $this->load_detail();
- }
}
/**
* Set the id of Param and load from database
@@ -50,35 +44,10 @@
function load()
{
$this->Param->load();
- $this->load_detail();
+ // $this->load_detail();
}
/**
- * Retrieve data from listing_param_detail
- */
- function load_detail()
- {
- $id=$this->Param->getp('id');
-
- if ( $id !=-1)
- {
- $pk_detail=$cn->get_value(' select fp_id from
- rapport_advanced.listing_param_detail
- where
- lp_id = $1',array($id));
-
- if ($cn->count() != 0) {
- $this->Detail->setp('id',-1);
- return;
- }
-
- $this->Detail->setp('id',$pk_detail);
-
- $this->Detail->load();
-
- }
- }
- /**
* Get all data from listing_param and listing_param_detail
* for a listing
* @param $p_id Listing::l_id
Modified: trunk/rapport_avance/include/class_rapport_avance_sql.php
===================================================================
--- trunk/rapport_avance/include/class_rapport_avance_sql.php 2013-11-13
14:58:04 UTC (rev 577)
+++ trunk/rapport_avance/include/class_rapport_avance_sql.php 2013-11-14
17:26:46 UTC (rev 578)
@@ -332,39 +332,7 @@
"listing_id" => "l_id",
"code" => "lp_code",
"comment" => "lp_comment",
- "order" => "l_order"
- );
-
- $this->type = array(
- "lp_id" => "numeric",
- "l_id" => "numeric",
- "lp_code" => "text",
- "lp_comment" => "text",
- "l_order" => "numeric"
- );
-
- $this->default = array(
- "lp_id" => "auto"
- );
- global $cn;
-
- parent::__construct($cn, $p_id);
- }
-
-}
-class RAPAV_Listing_Param_Detail_SQL extends Phpcompta_Sql
-{
-
- function __construct($p_id = -1)
- {
-
-
- $this->table = "rapport_advanced.listing_param_detail";
- $this->primary_key = "fp_id";
-
- $this->name = array(
- "id" => "fp_id",
- "p_id" => "p_id", // always null
+ "order" => "l_order",
"tmp_val" => "tmp_val",
"tva_id" => "tva_id",
"formula" => "fp_formula",
@@ -380,12 +348,14 @@
"attribut_card" => "ad_id",
"card_saldo" => "lp_card_saldo",
"with_card" => "lp_with_card",
- "listing_param_id" => "lp_id"
);
$this->type = array(
- "fp_id" => "numeric",
- "p_id" => "numeric",
+ "lp_id" => "numeric",
+ "l_id" => "numeric",
+ "lp_code" => "text",
+ "lp_comment" => "text",
+ "l_order" => "numeric",
"tmp_val" => "text",
"tva_id" => "numeric",
"fp_formula" => "text",
@@ -401,12 +371,10 @@
"ad_id" => "numeric",
"lp_card_saldo" => "text",
"lp_with_card" => "text",
- "lp_id" => "numeric"
);
$this->default = array(
- "fp_id" => "auto",
- "p_id" => "auto" // always null
+ "lp_id" => "auto"
);
global $cn;
@@ -415,4 +383,5 @@
}
+
?>
Modified: trunk/rapport_avance/include/liste.inc.php
===================================================================
--- trunk/rapport_avance/include/liste.inc.php 2013-11-13 14:58:04 UTC (rev
577)
+++ trunk/rapport_avance/include/liste.inc.php 2013-11-14 17:26:46 UTC (rev
578)
@@ -1,3 +1,4 @@
+<div class="content" id="listing_definition_div_id">
<?php
/**
* @file
@@ -28,3 +29,4 @@
Rapav_Listing::Button_Add_Listing();
echo '</p>';
?>
+</div>
\ No newline at end of file
Modified: trunk/rapport_avance/include/template/rapav_listing_definition.php
===================================================================
--- trunk/rapport_avance/include/template/rapav_listing_definition.php
2013-11-13 14:58:04 UTC (rev 577)
+++ trunk/rapport_avance/include/template/rapav_listing_definition.php
2013-11-14 17:26:46 UTC (rev 578)
@@ -7,7 +7,7 @@
*/
?>
-<table class="result">
+<table class="result" id="definition_tb_id">
<tr>
<th>
Code
Modified: trunk/rapport_avance/rapav_javascript.js
===================================================================
--- trunk/rapport_avance/rapav_javascript.js 2013-11-13 14:58:04 UTC (rev
577)
+++ trunk/rapport_avance/rapav_javascript.js 2013-11-14 17:26:46 UTC (rev
578)
@@ -543,6 +543,18 @@
}
}
+/**
+ * Show the definition of a list in a div
+ * @param json json object
+ * Attributes are
+ * - pc
+ * - ac
+ * - gDossier
+ * - act
+ * - cin
+ * - cout
+ *
+ */
function listing_definition (json)
{
console.log(json)
@@ -582,4 +594,17 @@
alert(e.message);
}
+}
+/**
+ * @brief display a form for adding a parameter to the current listing
+ * @param json
+ * Attributes are
+ * - cin the div to fill
+ * - tb_id the table to update
+ * - gDossier dossier
+ * - ac the AC code
+ */
+function listing_param_add(json)
+{
+ console.log(json);
}
\ No newline at end of file
Modified: trunk/rapport_avance/sql/1-add-listing.sql
===================================================================
--- trunk/rapport_avance/sql/1-add-listing.sql 2013-11-13 14:58:04 UTC (rev
577)
+++ trunk/rapport_avance/sql/1-add-listing.sql 2013-11-14 17:26:46 UTC (rev
578)
@@ -17,39 +17,48 @@
lp_code text not null constraint c_lp_code check (length (trim(lp_code))> 0),
lp_comment text,
l_card int default 0,
- l_order int
+ l_order int,
+ ad_id bigint constraint fk_listing_param_detail_attr_def references attr_def
(ad_id),
+ lp_card_saldo char(1) check (lp_card_saldo in ('C','D','S',NULL)),
+ lp_with_card char (1) check (lp_with_card in ('Y','N')),
+ tmp_val account_type,
+ tva_id integer,
+ fp_formula text,
+ fp_signed integer,
+ jrn_def_type character(3),
+ tt_id integer,
+ type_detail integer,
+ with_tmp_val account_type,
+ type_sum_account bigint,
+ operation_pcm_val account_type,
+ jrn_def_id bigint, -- FK to jrn_def, if null then all the ledgers are
concerned
+ date_paid integer DEFAULT 0
);
-create table rapport_advanced.listing_param_detail
-(
- ad_id bigint constraint fk_listing_param_detail_attr_def references
attr_def (ad_id),
- lp_card_saldo char(1) check (lp_card_saldo in ('C','D','S',NULL)),
- lp_with_card char (1) check (lp_with_card in ('Y','N')),
- lp_id bigint constraint fk_listing_param_detail_listing_param references
rapport_advanced.listing_param (lp_id)
-) inherits (rapport_Advanced.formulaire_param_detail);
-ALTER TABLE rapport_advanced.listing_param_detail
- ADD CONSTRAINT fk_listing_param_detail_type_row_detail FOREIGN KEY
(type_detail)
+
+ALTER TABLE rapport_advanced.listing_param
+ ADD CONSTRAINT fk_listing_param_type_row_detail FOREIGN KEY (type_detail)
REFERENCES rapport_advanced.type_row_detail (tr_id) MATCH SIMPLE
ON UPDATE SET NULL ON DELETE SET NULL;
-ALTER TABLE rapport_advanced.listing_param_detail
- ADD CONSTRAINT listing_param_detail_jrn_def_id_fkey FOREIGN KEY (jrn_def_id)
+ALTER TABLE rapport_advanced.listing_param
+ ADD CONSTRAINT listing_param_jrn_def_id_fkey FOREIGN KEY (jrn_def_id)
REFERENCES jrn_def (jrn_def_id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE rapport_advanced.listing_param_detail
- ADD CONSTRAINT listing_param_detail_tt_id_fkey FOREIGN KEY (tt_id)
+ALTER TABLE rapport_advanced.listing_param
+ ADD CONSTRAINT listing_param_tt_id_fkey FOREIGN KEY (tt_id)
REFERENCES rapport_advanced.total_type (tt_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION;
-ALTER TABLE rapport_advanced.listing_param_detail
- ADD CONSTRAINT listing_param_detail_tva_id_fkey FOREIGN KEY (tva_id)
+ALTER TABLE rapport_advanced.listing_param
+ ADD CONSTRAINT listing_param_tva_id_fkey FOREIGN KEY (tva_id)
REFERENCES tva_rate (tva_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION;
-ALTER TABLE rapport_advanced.listing_param_detail
- ADD CONSTRAINT listing_param_detail_type_sum_account_fkey FOREIGN KEY
(type_sum_account)
+ALTER TABLE rapport_advanced.listing_param
+ ADD CONSTRAINT listing_param_type_sum_account_fkey FOREIGN KEY
(type_sum_account)
REFERENCES rapport_advanced.total_type_account (tt_id) MATCH SIMPLE
ON UPDATE SET NULL ON DELETE SET NULL;
-CREATE TRIGGER listing_param_detail_trg
+CREATE TRIGGER listing_param_trg
BEFORE INSERT OR UPDATE OF jrn_def_id
- ON rapport_advanced.listing_param_detail
+ ON rapport_advanced.listing_param
FOR EACH ROW
EXECUTE PROCEDURE
rapport_advanced.formulaire_param_detail_jrn_def_id_ins_upd();
commit;
\ No newline at end of file
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r578 - in trunk/rapport_avance: . include include/template sql,
phpcompta-dev <=