[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r565 - in trunk/rapport_avance: . include include/templa
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r565 - in trunk/rapport_avance: . include include/template sql |
Date: |
Wed, 6 Nov 2013 16:53:40 +0100 (CET) |
Author: danydb
Date: 2013-11-06 16:53:40 +0100 (Wed, 06 Nov 2013)
New Revision: 565
Added:
trunk/rapport_avance/include/class_rapav_listing.php
trunk/rapport_avance/include/template/rapav_listing_form_add.php
trunk/rapport_avance/include/template/rapav_listing_to_list.php
Modified:
trunk/rapport_avance/ajax.php
trunk/rapport_avance/include/class_rapport_avance_sql.php
trunk/rapport_avance/include/liste.inc.php
trunk/rapport_avance/index.php
trunk/rapport_avance/rapav_javascript.js
trunk/rapport_avance/sql/1-add-listing.sql
Log:
Add listing : not yet the doc. modele
Modified: trunk/rapport_avance/ajax.php
===================================================================
--- trunk/rapport_avance/ajax.php 2013-11-06 15:52:43 UTC (rev 564)
+++ trunk/rapport_avance/ajax.php 2013-11-06 15:53:40 UTC (rev 565)
@@ -3,123 +3,151 @@
global $cn;
switch ($act)
{
- /* *
*******************************************************************************************************
*/
- // Modifie une definition de formulaire
- /* *
*******************************************************************************************************
*/
+ /* *
*******************************************************************************************************
*/
+ // Modifie une definition de formulaire
+ /* *
*******************************************************************************************************
*/
- case 'mod_form':
- require_once 'include/class_rapav_formulaire.php';
- if (!isset($_GET['f_id']) && isNum($_GET['f_id']) == 0)
- exit();
- require_once 'include/formulaire_definition_show.inc.php';
- break;
- /* *
**************************************************************************************************************
- * Ajoute une ligne dans la definition
- *
***************************************************************************************************************
*/
- case 'add_row_definition':
- $type_row = $cn->make_array("select p_type,p_description from
rapport_advanced.type_row order by p_description");
- $type_periode = $cn->make_array("select t_id,t_description from
rapport_advanced.periode_type order by t_description");
- ?>
- <td>
- Nouv.
- </td>
- <td>
- <?php echo HtmlInput::hidden('p_id[]', -1)?>
- <?php
- $p_code = new IText('p_code[]');
- $p_code->size = "10";
- echo $p_code->input();
- ?>
- </td>
- <td>
- <?php
- $p_libelle = new IText('p_libelle[]');
- $p_libelle->css_size = "100%";
- echo $p_libelle->input();
- ?>
- </td>
- <td>
- <?php
- $p_type = new ISelect('p_type[]');
- $p_type->value = $type_row;
- echo $p_type->input();
- ?>
- </td>
- <td>
- <?php
- $p_type_periode = new ISelect('t_id[]');
- $p_type_periode->value = $type_periode;
- echo $p_type_periode->input();
- ?>
- </td>
- <td>
- <?php
- $p_order = new INum('p_order[]');
- $p_order->prec = 0;
- $p_order->size = 4;
- echo $p_order->input();
- ?>
- </td>
- <?php
- break;
- /* *
**************************************************************************************************************
- * Montre le résultat et permet de changer les paramètrages d'un
formulaire
- * uniquement pour ceux ayant un champs de calcul (formule, code
tva+poste comptable + totaux intermédiare
- *
***************************************************************************************************************
*/
- case 'mod_param':
- require_once 'include/class_rapav_formulaire.php';
- if (!isset($_GET['f_id']) && isNum($_GET['f_id']) == 0)
- exit();
- echo '<h1>Paramètre </h1>';
- $form = new RAPAV_formulaire($_REQUEST['f_id']);
- $form->load_definition();
- $form->echo_formulaire();
- $form->input_parameter();
- break;
+ case 'mod_form':
+ require_once 'include/class_rapav_formulaire.php';
+ if (!isset($_GET['f_id']) && isNum($_GET['f_id']) == 0)
+ exit();
+ require_once 'include/formulaire_definition_show.inc.php';
+ break;
+ /* *
**************************************************************************************************************
+ * Ajoute une ligne dans la definition
+ *
***************************************************************************************************************
*/
+ case 'add_row_definition':
+ $type_row = $cn->make_array("select p_type,p_description from
rapport_advanced.type_row order by p_description");
+ $type_periode = $cn->make_array("select t_id,t_description from
rapport_advanced.periode_type order by t_description");
+ ?>
+ <td>
+ Nouv.
+ </td>
+ <td>
+ <?php echo HtmlInput::hidden('p_id[]', -1) ?>
+ <?php
+ $p_code = new IText('p_code[]');
+ $p_code->size = "10";
+ echo $p_code->input();
+ ?>
+ </td>
+ <td>
+ <?php
+ $p_libelle = new IText('p_libelle[]');
+ $p_libelle->css_size = "100%";
+ echo $p_libelle->input();
+ ?>
+ </td>
+ <td>
+ <?php
+ $p_type = new ISelect('p_type[]');
+ $p_type->value = $type_row;
+ echo $p_type->input();
+ ?>
+ </td>
+ <td>
+ <?php
+ $p_type_periode = new ISelect('t_id[]');
+ $p_type_periode->value = $type_periode;
+ echo $p_type_periode->input();
+ ?>
+ </td>
+ <td>
+ <?php
+ $p_order = new INum('p_order[]');
+ $p_order->prec = 0;
+ $p_order->size = 4;
+ echo $p_order->input();
+ ?>
+ </td>
+ <?php
+ break;
+ /* *
**************************************************************************************************************
+ * Montre le résultat et permet de changer les paramètrages d'un formulaire
+ * uniquement pour ceux ayant un champs de calcul (formule, code tva+poste
comptable + totaux intermédiare
+ *
***************************************************************************************************************
*/
+ case 'mod_param':
+ require_once 'include/class_rapav_formulaire.php';
+ if (!isset($_GET['f_id']) && isNum($_GET['f_id']) == 0)
+ exit();
+ echo '<h1>Paramètre </h1>';
+ $form = new RAPAV_formulaire($_REQUEST['f_id']);
+ $form->load_definition();
+ $form->echo_formulaire();
+ $form->input_parameter();
+ break;
- /* *
****************************************************************************************************************
- * Montre un écran pour ajouter une ligne de formulaire dans les
paramètre de formulaires
- */
- case 'add_param_detail':
- include 'ajax_add_param_detail.php';
- break;
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //rapav_search_code cherche les codes du formulaires courants
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- case 'rapav_search_code':
- include 'ajax_search_code.php';
- break;
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Sauve résultat et renvoie un xml
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- case 'save_param_detail':
- include 'ajax_save_param_detail.php';
- break;
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Delete un formulaire_param_detail
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- case 'delete_param_detail':
- $cn->exec_sql("delete from
rapport_advanced.formulaire_param_detail where fp_id=$1", array($fp_id));
- break;
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Display a saved declaration from history
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- case 'rapav_declaration_display':
- include 'ajax_declaration_display.php';
- break;
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Delete a saved declaration (from history)
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- case 'rapav_declaration_delete':
- $cn->exec_sql("delete from rapport_advanced.declaration where
d_id=$1", array($_GET['d_id']));
- break;
-
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Remove a template
-
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- case 'rapav_remove_doc_template':
- require_once 'include/class_rapav_formulaire.php';
- $rapav=new Rapav_Formulaire($_GET['f_id']);
- $rapav->remove_doc_template();
- break;
+ /* *
****************************************************************************************************************
+ * Montre un écran pour ajouter une ligne de formulaire dans les paramètre
de formulaires
+ */
+ case 'add_param_detail':
+ include 'ajax_add_param_detail.php';
+ break;
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //rapav_search_code cherche les codes du formulaires courants
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ case 'rapav_search_code':
+ include 'ajax_search_code.php';
+ break;
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Sauve résultat et renvoie un xml
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ case 'save_param_detail':
+ include 'ajax_save_param_detail.php';
+ break;
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Delete un formulaire_param_detail
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ case 'delete_param_detail':
+ $cn->exec_sql("delete from rapport_advanced.formulaire_param_detail
where fp_id=$1", array($fp_id));
+ break;
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Display a saved declaration from history
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ case 'rapav_declaration_display':
+ include 'ajax_declaration_display.php';
+ break;
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Delete a saved declaration (from history)
+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ case 'rapav_declaration_delete':
+ $cn->exec_sql("delete from rapport_advanced.declaration where
d_id=$1", array($_GET['d_id']));
+ break;
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Remove a template
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ case 'rapav_remove_doc_template':
+ require_once 'include/class_rapav_formulaire.php';
+ $rapav = new Rapav_Formulaire($_GET['f_id']);
+ $rapav->remove_doc_template();
+ break;
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Show a div to enter new listing
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ case 'listing_add':
+ require_once 'include/class_rapav_listing.php';
+ ob_start();
+ echo HtmlInput::title_box("Ajout d'un listing", $cout);
+ echo '<form method="POST" enctype="multipart/form-data"
id="listing_frm" onsubmit="return check_listing_add(\'listing_frm\')">';
+ echo
HtmlInput::request_to_hidden(array('gDossier','ac','plugin_code'));
+ Rapav_Listing::form_add();
+ echo '<p>';
+ echo HtmlInput::submit("listing_add_sb", "Ajout");
+ echo '</p>';
+ echo '</form>';
+ $response = ob_get_clean();
+ ob_end_clean();
+ $html = escape_xml($response);
+ header('Content-type: text/xml; charset=UTF-8');
+ echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<ctl></ctl>
+<code>$html</code>
+</data>
+EOF;
+ exit();
+
+ break;
}
?>
Added: trunk/rapport_avance/include/class_rapav_listing.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing.php
(rev 0)
+++ trunk/rapport_avance/include/class_rapav_listing.php 2013-11-06
15:53:40 UTC (rev 565)
@@ -0,0 +1,70 @@
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of class_rapav_listing
+ *
+ * @author dany
+ */
+require_once 'class_rapport_avance_sql.php';
+class Rapav_Listing
+{
+
+ function __construct($p_id=-1)
+ {
+ $this->Data=new RAPAV_Listing_SQL($p_id);
+ }
+ /**
+ * display a list of the existing list
+ */
+ function to_list()
+ {
+ $res= $this->Data->seek(' order by l_name');
+ require 'template/rapav_listing_to_list.php';
+ }
+ /**
+ * Display a button for adding a new listing
+ */
+ static function Button_Add_Listing()
+ {
+ $arg=array(
+ 'gDossier'=>Dossier::id(),
+ 'ac'=>$_REQUEST['ac'],
+ 'pc'=>$_REQUEST['plugin_code'],
+ 'id'=>0,
+ 'cin'=>'listing_tb_id',
+ 'cout'=>'listing_add_div');
+ $json='listing_add('.str_replace('"',"'",json_encode($arg)).')';
+ echo HtmlInput::button_action("Ajout", $json);
+ }
+ /**
+ * @brief display a form to save a new list
+ *
+ */
+ static function form_add()
+ {
+ global $cn;
+ $name=new IText('name');
+ $description=new ITextArea('description');
+ $file=new IFile('listing_mod');
+ $fichedef=new ISelect('fiche_def');
+ $fichedef->value=$cn->make_array('select fd_id,fd_label from fiche_def
order by fd_label');
+ require 'template/rapav_listing_form_add.php';
+ }
+ function insert($p_array)
+ {
+ if (strlen(trim($p_array['name']))==0) {
+ die ('Le nom ne peut pas être vide');
+ }
+ $this->Data->setp('name',$p_array['name']);
+ $this->Data->setp('description',$p_array['description']);
+ $this->Data->setp('fiche_def_id',$p_array['fiche_def']);
+ $this->Data->insert();
+ }
+
+}
Modified: trunk/rapport_avance/include/class_rapport_avance_sql.php
===================================================================
--- trunk/rapport_avance/include/class_rapport_avance_sql.php 2013-11-06
15:52:43 UTC (rev 564)
+++ trunk/rapport_avance/include/class_rapport_avance_sql.php 2013-11-06
15:53:40 UTC (rev 565)
@@ -280,4 +280,137 @@
parent::__construct($cn, $p_id);
}
}
+class RAPAV_Listing_SQL extends phpcompta_sql
+{
+
+ function __construct($p_id = -1)
+ {
+ $this->table = "rapport_advanced.listing";
+ $this->primary_key = "l_id";
+ $this->name = array(
+ "id" => "l_id",
+ "description" => "l_description",
+ "name"=>'l_name',
+ "lob" => "l_lob",
+ "mimetype" => "l_mimetype",
+ "size" => "l_size",
+ "fiche_def_id" => "fd_id"
+ );
+ $this->type = array(
+ "l_id" => "numeric",
+ "l_name"=>'text',
+ "l_description" => "text",
+ "l_lob" => "oid",
+ "l_mimetype" => "text",
+ "l_size" => "numeric",
+ "fd_id" => "numeric"
+ );
+ $this->default = array(
+ "l_id" => "auto"
+ );
+ global $cn;
+
+ parent::__construct($cn, $p_id);
+ }
+
+}
+
+class RAPAV_Listing_Param_SQL extends Phpcompta_Sql
+{
+
+ function __construct($p_id = -1)
+ {
+
+
+ $this->table = "rapport_advanced.listing_param_detail";
+ $this->primary_key = "fp_id";
+
+ $this->name = array(
+ "lp_id" => "lp_id",
+ "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 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
+ "tmp_val" => "tmp_val",
+ "tva_id" => "tva_id",
+ "formula" => "fp_formula",
+ "signed" => "fp_signed",
+ "jrn_def_type" => "jrn_def_type",
+ "acc_vat_sum" => "tt_id",
+ "formula_type" => "type_detail",
+ "with_tmp_val" => "with_tmp_val",
+ "sum_signed" => "type_sum_account",
+ "operation_pcm_val" => "operation_pcm_val",
+ "jrn_def_id" => "jrn_def_id",
+ "date_paid" => "date_paid",
+ "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",
+ "tmp_val" => "text",
+ "tva_id" => "numeric",
+ "fp_formula" => "text",
+ "fp_signed" => "numeric",
+ "jrn_def_type" => "text",
+ "tt_id" => "numeric",
+ "type_detail" => "numeric",
+ "with_tmp_val" => "text",
+ "type_sum_account" => "numeric",
+ "operation_pcm_val" => "text",
+ "jrn_def_id" => "numeric",
+ "date_paid" => "numeric",
+ "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
+ );
+ global $cn;
+
+ parent::__construct($cn, $p_id);
+ }
+
+}
+
?>
Modified: trunk/rapport_avance/include/liste.inc.php
===================================================================
--- trunk/rapport_avance/include/liste.inc.php 2013-11-06 15:52:43 UTC (rev
564)
+++ trunk/rapport_avance/include/liste.inc.php 2013-11-06 15:53:40 UTC (rev
565)
@@ -1,3 +1,27 @@
<?php
+/**
+ * @file
+ * @brief manage the listing
+ */
+var_dump($_POST);
+require_once 'class_rapav_listing.php';
+global $cn;
+$listing=new Rapav_Listing();
+/**
+ * save new listing
+ */
+if ( isset ($_POST['listing_add_sb']))
+{
+ $new=new Rapav_Listing();
+ $new->insert($_POST);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//Listing
+///////////////////////////////////////////////////////////////////////////////
+$listing->to_list();
+echo '<p>';
+Rapav_Listing::Button_Add_Listing();
+echo '</p>';
?>
Added: trunk/rapport_avance/include/template/rapav_listing_form_add.php
===================================================================
--- trunk/rapport_avance/include/template/rapav_listing_form_add.php
(rev 0)
+++ trunk/rapport_avance/include/template/rapav_listing_form_add.php
2013-11-06 15:53:40 UTC (rev 565)
@@ -0,0 +1,39 @@
+<table>
+ <tr>
+ <td>
+ Nom
+ </td>
+ <td>
+ <?php echo $name->input();?>
+ </td>
+
+ </tr>
+ <tr>
+ <td>
+ Description
+ </td>
+ <td>
+ <?php echo $description->input();?>
+ </td>
+
+ </tr>
+ <tr>
+ <td>
+ Catégorie de fiche
+ </td>
+ <td>
+ <?php echo $fichedef->input();?>
+ </td>
+
+ </tr>
+ <tr>
+ <td>
+ Fichier
+ </td>
+ <td>
+ <?php echo $file->input();?>
+ </td>
+
+ </tr>
+
+</table>
\ No newline at end of file
Added: trunk/rapport_avance/include/template/rapav_listing_to_list.php
===================================================================
--- trunk/rapport_avance/include/template/rapav_listing_to_list.php
(rev 0)
+++ trunk/rapport_avance/include/template/rapav_listing_to_list.php
2013-11-06 15:53:40 UTC (rev 565)
@@ -0,0 +1,35 @@
+
+
+<table class="result" id="listing_tb_id">
+ <tr>
+ <th>
+ Nom
+ </th>
+ <th>
+ Description
+ </th>
+ <th>
+
+ </th>
+ </tr>
+ <?php
+ $max=Database::num_row($res);
+ for ($i=0;$i<$max;$i++):
+ $row= Database::fetch_array($res, $i);
+ ?>
+ <tr>
+ <td>
+ <?php echo h($row['l_name']); ?>
+ </td>
+ <td>
+ <?php echo h($row['l_description']); ?>
+ </td>
+ <td>
+ Action
+ </td>
+ </tr>
+ <?php
+ endfor;
+
+ ?>
+</table>
\ No newline at end of file
Modified: trunk/rapport_avance/index.php
===================================================================
--- trunk/rapport_avance/index.php 2013-11-06 15:52:43 UTC (rev 564)
+++ trunk/rapport_avance/index.php 2013-11-06 15:53:40 UTC (rev 565)
@@ -55,10 +55,10 @@
$url = '?' . dossier::get() . "&plugin_code=" . $_REQUEST['plugin_code'] .
"&ac=" . $_REQUEST['ac'];
$array = array(
-// array($url . '&sa=li', _('Liste'), _('Création, modification, Paramètre
de listes, mailing list'), 0),
+ array($url . '&sa=li', _('Liste'), _('Création, modification, Paramètre
de listes, mailing list'), 0),
array($url . '&sa=fo', _('Formulaire'), _('Création, modification,
Paramètre'), 1),
- array($url . '&sa=de', _('Génération Déclaration '), _('Génération
Déclaration '), 2),
-// array($url . '&sa=de', _('Génération Déclaration / listing'),
_('Génération Déclaration / listing'), 2),
+// array($url . '&sa=de', _('Génération Déclaration '), _('Génération
Déclaration '), 2),
+ array($url . '&sa=de', _('Génération Déclaration / listing'),
_('Génération Déclaration / listing'), 2),
array($url . '&sa=hi', _('Historique'), _('Historique des déclarations
faites'), 3)
);
Modified: trunk/rapport_avance/rapav_javascript.js
===================================================================
--- trunk/rapport_avance/rapav_javascript.js 2013-11-06 15:52:43 UTC (rev
564)
+++ trunk/rapport_avance/rapav_javascript.js 2013-11-06 15:53:40 UTC (rev
565)
@@ -430,3 +430,61 @@
alert(e.message);
}
}
+/**
+ * Receive a json object and display a window to add a new listing
+ * - gDossier is the dossier id
+ * - ac is the AC CODE
+ * - pc is the plugin CODE
+ * - cin the table to be updated after save
+ * - cout the div to display
+ *
+ */
+function listing_add(json)
+{
+ console.log(json)
+ try {
+ var querystring = 'plugin_code=' + json.pc + '&ac=' + json.ac +
'&gDossier=' + json.gDossier + '&act=listing_add' + "&cin=" + json.cin +
'&cout=' + json.cout;
+ waiting_box();
+ var action = new Ajax.Request(
+ "ajax.php",
+ {
+ method: 'get',
+ parameters: querystring,
+ onFailure: error_get_predef,
+ onSuccess: function(req) {
+ try {
+ var answer = req.responseXML;
+ var a = answer.getElementsByTagName('ctl');
+ var html = answer.getElementsByTagName('code');
+ if (a.length == 0) {
+ var rec = req.responseText;
+ throw 'cannot find ctl element';
+ }
+ remove_waiting_box();
+ var code_html = getNodeText(html[0]);
+ code_html = unescape_xml(code_html);
+
add_div({'id':json.cout,'cssclass':'inner_box','drag':1})
+ $(json.cout).innerHTML = code_html;
+ } catch (e) {
+ console.log(e);
+ console.log(code_html);
+ }
+ }
+ }
+ );
+
+ } catch (e)
+ {
+ alert(e.message);
+
+ }
+}
+function check_listing_add(form_id)
+{
+ var str=$(form_id)['name'].value;
+ if ( str.trim()=='') {
+ error_message('Le nom est obligatoire');
+ return false;
+ }
+ return true;
+}
\ 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-06 15:52:43 UTC (rev
564)
+++ trunk/rapport_avance/sql/1-add-listing.sql 2013-11-06 15:53:40 UTC (rev
565)
@@ -1,11 +1,12 @@
create table rapport_advanced.listing
(
l_id serial primary key,
+ l_name text check (length(trim(l_name)) > 0 and l_name is not null),
l_description text,
l_lob oid,
l_mimetype text,
l_size bigint,
- fd_id bigint references fiche_def (fd_id) on update cascade on delete null
+ fd_id bigint references fiche_def (fd_id) on update cascade on delete set
null
);
create table rapport_advanced.listing_param
(
@@ -24,6 +25,28 @@
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 ONLY rapport_advanced.listing_param_detail
- -- ADD CONSTRAINT listing_param_detail_p_type_fkey FOREIGN KEY (p_type)
REFERENCES rapport_advanced.type_row(p_type);
-
+ALTER TABLE rapport_advanced.listing_param_detail
+ ADD CONSTRAINT fk_listing_param_detail_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)
+ 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)
+ 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)
+ 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)
+ REFERENCES rapport_advanced.total_type_account (tt_id) MATCH SIMPLE
+ ON UPDATE SET NULL ON DELETE SET NULL;
+CREATE TRIGGER listing_param_detail_trg
+ BEFORE INSERT OR UPDATE OF jrn_def_id
+ ON rapport_advanced.listing_param_detail
+ FOR EACH ROW
+ EXECUTE PROCEDURE
rapport_advanced.formulaire_param_detail_jrn_def_id_ins_upd();
---
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] r565 - in trunk/rapport_avance: . include include/template sql,
phpcompta-dev <=