[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 15/29: Document_State : rewriting
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 15/29: Document_State : rewriting |
Date: |
Wed, 4 Nov 2020 11:08:42 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit c4d8630c5c24023698d309d1a2f4752c66694ba1
Author: Dany wm De Bontridder <danydb@noalyss.eu>
AuthorDate: Sun Nov 1 13:03:55 2020 +0100
Document_State : rewriting
---
html/ajax_misc.php | 4 +-
include/ajax/ajax_document_state.php | 65 +++++++++++++++++++++++++++
include/class/document_state_mtable.php | 58 ++++++++++++++++++++++++
include/database/document_state_sql.class.php | 62 +++++++++++++++++++++++++
include/doc_state.inc.php | 48 +++-----------------
5 files changed, 195 insertions(+), 42 deletions(-)
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 713444d..77f49a0 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -267,7 +267,9 @@ $path = array(
// Add group of tags
'tag_group'=>'ajax_tag_group',
// set the group for a tag
- 'tag_set_group'=>"ajax_tag_set_group"
+ 'tag_set_group'=>"ajax_tag_set_group",
+ // Document_state
+ "document_state"=>"ajax_document_state"
) ;
if (array_key_exists($op, $path)) {
diff --git a/include/ajax/ajax_document_state.php
b/include/ajax/ajax_document_state.php
new file mode 100644
index 0000000..d5cfed6
--- /dev/null
+++ b/include/ajax/ajax_document_state.php
@@ -0,0 +1,65 @@
+<?php
+
+/*
+ * This file is part of NOALYSS.
+ *
+ * Noalyss is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpCompta is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with PhpCompta; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
+
+if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
+
+require_once NOALYSS_INCLUDE."/class/document_state_mtable.php";
+global $g_user;
+
+$g_user->check_action('CFGDOCST',2);
+
+/**
+ * @file
+ * @brief Manage Document_State
+ */
+try {
+ $table=$http->request('table');
+ $action=$http->request('action');
+ $p_id=$http->request('p_id', "number");
+ $ctl_id=$http->request('ctl');
+
+} catch(Exception $e) {
+ echo $e->getMessage();
+ return;
+}
+
+
+$document_state_sql=new Document_State_SQL($cn,$p_id);
+$mtable=new Document_State_MTable($document_state_sql);
+$mtable->build();
+$mtable->set_object_name($ctl_id);
+if ($action=="input")
+{
+
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $mtable->ajax_input()->saveXML();
+ return;
+}
+elseif ($action=="save")
+{
+ $xml=$mtable->ajax_save();
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $xml->saveXML();
+}
+elseif ($action=="delete")
+{
+ return;
+}
\ No newline at end of file
diff --git a/include/class/document_state_mtable.php
b/include/class/document_state_mtable.php
new file mode 100644
index 0000000..41f5be4
--- /dev/null
+++ b/include/class/document_state_mtable.php
@@ -0,0 +1,58 @@
+<?php
+/*
+ * Copyright (C) 2017 Dany De Bontridder <dany@alchimerys.be>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Part of Noalyss (2002-2020)
+ */
+
+
+/***
+ * @file
+ * @brief class Document_State_MTable
+ * @see Manage_Table_SQL
+ *
+ */
+require_once NOALYSS_INCLUDE.'/database/document_state_sql.class.php';
+require_once NOALYSS_INCLUDE.'/lib/manage_table_sql.class.php';
+/**
+ * @brief this instance extends Manage_Table_SQL and aims to manage
+ * the Table tmp_pcmn thanks a web interface (add , delete, display...)
+ *
+ * @see Document_State_SQL
+ */
+
+class Document_State_MTable extends Manage_Table_SQL
+{
+ function __construct(Document_State_SQL $p_table)
+ {
+ parent::__construct($p_table);
+ $this->set_col_label("s_value", _("Label"));
+ $this->set_col_label('s_status',_('Action'));
+ $this->set_delete_row(false);
+ $this->set_col_type('s_status','select',array(
+ array('value'=>'C','label'=>_('Ferme')),
+ array('value'=>'','label'=>_('Aucune')))
+ );
+ $this->set_property_visible('s_id',false);
+ $this->set_property_updatable('s_id',false);
+ }
+ function build()
+ {
+ $this->set_callback("ajax_misc.php");
+ $this->add_json_param("op", "document_state");
+ }
+}
\ No newline at end of file
diff --git a/include/database/document_state_sql.class.php
b/include/database/document_state_sql.class.php
new file mode 100644
index 0000000..8b6ae7f
--- /dev/null
+++ b/include/database/document_state_sql.class.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * Autogenerated file
+ * This file is part of NOALYSS.
+ *
+ * NOALYSS is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * NOALYSS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with NOALYSS; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
+
+/**
+ * class_attr_def_sql.php
+ *
+ * @file
+ * @brief abstract of the table public.document_state */
+class Document_State_SQL extends Noalyss_SQL
+{
+
+ function __construct(Database $p_cn, $p_id=-1)
+ {
+ $this->table="public.document_state";
+ $this->primary_key="s_id";
+ /*
+ * List of columns
+ */
+ $this->name=array(
+ "s_id"=>"s_id"
+ , "s_value"=>"s_value"
+ , "s_status"=>"s_status"
+ );
+ /*
+ * Type of columns
+ */
+ $this->type=array(
+ "s_id"=>"numeric"
+ , "s_value"=>"text"
+ , "s_status"=>"text"
+ );
+
+
+ $this->default=array(
+ "s_id"=>"auto"
+ );
+
+ $this->date_format="DD.MM.YYYY";
+ parent::__construct($p_cn, $p_id);
+ }
+
+}
diff --git a/include/doc_state.inc.php b/include/doc_state.inc.php
index 4ea6eaf..4734316 100644
--- a/include/doc_state.inc.php
+++ b/include/doc_state.inc.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-// Copyright Author Dany De Bontridder danydb@aevalys.eu
+// Copyright Author Dany De Bontridder danydb@noalyss.eu
/**
* @file
@@ -26,47 +26,13 @@
*
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-global $cn;
-if ( isset($_POST['add']))
-{
- if (trim ($_POST['s_value'])!="")
- {
- if ( isset($_POST['s_state']))
- {
- $cn->exec_sql('insert into
document_state(s_value,s_status) values ($1,$2)',array($_POST['s_value'],'C'));
- }
- else
- {
- $cn->exec_sql('insert into document_state(s_value)
values ($1)',array($_POST['s_value']));
- }
- }
-}
-$a_stat=$cn->get_array("select s_value,s_status from document_state order by
1");
-?>
+require_once NOALYSS_INCLUDE."/class/document_state_mtable.php";
-<table>
- <?php for ($i=0;$i<count($a_stat);$i++):?>
+$document_state_sql=new Document_State_SQL($cn);
+$mtable=new Document_State_MTable($document_state_sql);
- <tr>
- <td>
- <?php echo h($a_stat[$i]['s_value'])?>
- </td>
+$mtable->build();
+$mtable->create_js_script();
+echo $mtable->display_table();
- <td>
- <?php if ($a_stat[$i]['s_status']=='C') { echo _("Ferme
l'action"); } ?>
- </td>
- </tr>
- <?php endfor;?>
-</table>
-<h2>Ajout d'un état</h2>
-<form method="post" id='etat_add_frm' onsubmit="return confirm_box(this,'Vous
confirmez ?'); ">
- <p>
- Nom de l'état <?php $value=new IText("s_value",""); echo
$value->input()?>
- </p>
- <p>
- Cochez la case si cet état ferme une action <?php $state=new
ICheckBox("s_state",""); echo $state->input()?>
- <input type='hidden' name='add' value='1'>
- <?php echo HtmlInput::submit("addbt", "Ajouter")?>
- </p>
-</form>
\ No newline at end of file
- [Noalyss-commit] [noalyss] 07/29: 0001827: Delta des opérations liées basé sur le montant d'une seule opération, (continued)
- [Noalyss-commit] [noalyss] 07/29: 0001827: Delta des opérations liées basé sur le montant d'une seule opération, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 09/29: Adapt for Textarea, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 04/29: Followup : change moyenne par normale, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 08/29: FollowUp commentaire unique et modifiable, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 18/29: Follow UP detail do not show the "Add Rows button" in READ mode, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 23/29: Cosmetic : ledger name, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 24/29: Contact : navigation bar was not correct, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 29/29: Merge branch 'checkbox-range', Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 28/29: Task #0001861: Plage de cases à cocher, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 12/29: Suivi : description modifiable, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 15/29: Document_State : rewriting,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 17/29: Security For document_state and tag_group, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 14/29: cosmetic : set the total and compute button outside of the frame, Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 26/29: Cosmetic : add waiting box when searching by card category for Management customer, supplier, ..., Dany De Bontridder, 2020/11/04
- [Noalyss-commit] [noalyss] 27/29: code : fix deprecated unparenthized (a)?b:c?e:x, Dany De Bontridder, 2020/11/04