Action and Document Add missing files

This commit is contained in:
Dany De Bontridder 2020-10-05 13:50:06 +02:00
parent 037a423a3b
commit 4bab05f76b
6 changed files with 417 additions and 0 deletions

View file

@ -0,0 +1,82 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta 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');
// check right
if ($g_user->check_action(PARCATDOC)==0)
{
record_log("cfgaction01 security ");
return;
}
require_once NOALYSS_INCLUDE."/class/action_document_type_mtable.class.php";
$http=new HttpInput();
/**
* @file
* @brief call for document_type in follow up
*/
try
{
$table=$http->request('table');
$ctl_id=$http->request('ctl');
$action=$http->request('action');
$p_id=$http->request('p_id', "number");
}
catch (Exception $ex)
{
echo $e->getMessage();
return;
}
$doc_type=new Document_type_SQL($cn,$p_id);
$action_document_type=new Action_Document_Type_MTable($doc_type);
$action_document_type->set_callback("ajax_misc.php");
$action_document_type->add_json_param("op", "cfgaction");
$action_document_type->set_object_name($ctl_id);
if ($action=="input")
{
header('Content-type: text/xml; charset=UTF-8');
echo $action_document_type->ajax_input()->saveXML();
return;
}
elseif ($action=="save")
{
$xml=$action_document_type->ajax_save();
header('Content-type: text/xml; charset=UTF-8');
echo $xml->saveXML();
}
elseif ($action=="delete")
{
$xml=$action_document_type->ajax_delete();
header('Content-type: text/xml; charset=UTF-8');
echo $xml->saveXML();
}

View file

@ -0,0 +1,67 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta 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/contact_option_ref_mtable.class.php";
/**
* @file
* @brief add option for contact
* @see contact_option_list
* @see action_document_type_mtable::input()
*/
try
{
$contact_option_id=$http->request("p_id");
$ctl_id=$http->request("ctl");
$action=$http->request("action");
}
catch (Exception $ex)
{
record_log(__FILE__." no p_id");
return;
}
$cn=Dossier::connect();
// document_option id from document_option where do_code='contact_multiple' and document_type_id=p_id
$obj=new Contact_option_ref_SQL($cn);
$contact_mtable=new Contact_Option_Ref_MTable($obj);
$contact_mtable->set_callback("ajax_misc.php");
$contact_mtable->set_object_name("s_contact_option");
$contact_mtable->set_dialog_box("db_contact_option");
$contact_mtable->add_json_param("op", "contact_option_list");
$contact_mtable->set_object_name($ctl);
$contact_mtable->set_pk($contact_option_id);
if ($action == "input") {
$contact_mtable->send_header();
echo $contact_mtable->ajax_input()->saveXML();
} elseif($action == "save") {
$contact_mtable->send_header();
echo $contact_mtable->ajax_save()->saveXML();
} elseif ($action == "delete") {
$contact_mtable->send_header();
$contact_mtable->ajax_delete();
}

View file

@ -0,0 +1,49 @@
<?php
/*
* Copyright (C) 2020 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.
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @file
* @brief
* @todo to be implemented
*/
require_once NOALYSS_INCLUDE."/database/contact_option_ref_sql.class.php";
require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php";
class Contact_Option_Ref_MTable extends Manage_Table_SQL{
function __construct(Contact_Option_Ref_SQL $obj)
{
parent::__construct($obj);
$this->set_col_label("cor_label", _("Nom"));
$this->set_col_label("cor_type", _("Type "));
$this->set_col_label("document_option_id", _("Action"));
$this->set_col_label("core_value_select",_("Options"));
$this->set_property_visible("cor_id", false);
$this->set_col_type("cor_type","select",[
["label"=>_("Texte"),"value"=>0],
["label"=>_("Nombre"),"value"=>1],
["label"=>_("Choix"),"value"=>3],
["label"=>_("Date"),"value"=>2]
]);
}
}

View file

@ -0,0 +1,58 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta 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/contact_option_ref_mtable.class.php";
echo '<div class="content">';
/**
* @file
* @brief add option for contact
* @see contact_option_list
* @see action_document_type_mtable::input()
*/
$http=new HttpInput();
try
{
$action=$http->request("sa", "string", "list");
}
catch (Exception $ex)
{
record_log(__FILE__." no p_id");
return;
}
$cn=Dossier::connect();
// document_option id from document_option where do_code='contact_multiple' and document_type_id=p_id
$obj=new Contact_option_ref_SQL($cn);
$contact_mtable=new Contact_Option_Ref_MTable($obj);
$contact_mtable->set_callback("ajax_misc.php");
$contact_mtable->set_object_name("s_contact_option");
$contact_mtable->set_dialog_box("db_contact_option");
$contact_mtable->add_json_param("op", "contact_option_list");
$contact_mtable->create_js_script();
$contact_mtable->display_table();
echo '</div>';

View file

@ -0,0 +1,68 @@
<?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_document_type_sql.php
*
* @file
* @brief abstract of the table public.document_type
*/
/**
* @class
* @brief abstract of the table public.document_type
*/
class Document_type_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
{
$this->table="public.document_type";
$this->primary_key="dt_id";
/*
* List of columns
*/
$this->name=array(
"dt_id"=>"dt_id"
, "dt_value"=>"dt_value"
, "dt_prefix"=>"dt_prefix"
);
/*
* Type of columns
*/
$this->type=array(
"dt_id"=>"numeric"
, "dt_value"=>"text"
, "dt_prefix"=>"text"
);
$this->default=array(
"dt_id"=>"auto"
);
$this->date_format="DD.MM.YYYY";
parent::__construct($p_cn, $p_id);
}
}

View file

@ -0,0 +1,93 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta 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-2019) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @file
* @brief called from p_id already set,
* @see action_document_type_mtable::input
*/
// SQL Object Document_Type
$table=$this->get_table();
// db connx
$cn=$table->cn;
?>
<?php echo _('Prochain numéro') ?>
<p class="info" style="display:inline">
(
<?php echo _('numéro actuel') ?>
<?php
$last=0;
if ( $table->dt_id > 0) {
$ret=$cn->get_array("select last_value,is_called from seq_doc_type_".$table->dt_id);
$last=$ret[0]['last_value'];
/* !
* \note With PSQL sequence , the last_value column is 1 when before AND after the first call, to make the difference between them
* I have to check whether the sequence has been already called or not */
if ($ret[0]['is_called']=='f')
$last--;
}
echo $last;
?>
)
</p>
<?php
echo
Icon_Action::infobulle(15);
?>
<?php
$seq=new INum('seq', 0);
echo $seq->input();
?>
<div>
<h3 class="info" sytle="margin-block: 4px"><?php echo _("Détail") ?></h3>
<ul class="tab_row" style="padding-top: 0px">
<li>
<?php
$i=new ICheckBox("detail_operation",1);
if ( Document_Option::is_enable_operation_detail($table->dt_id)) $i->set_check(1);else $i->set_check(0);
echo $i->input();
echo _("Détail opération");
?>
</li>
<li>
<?php
$i=new ICheckBox("det_contact_mul",1);
if ( Document_Option::is_enable_contact_multiple($table->dt_id)) $i->set_check(1); else $i->set_check(0);
echo $i->input();
echo _("Contacts multiples");
?>
</li>
<li>
<?php
$i=new ICheckBox("make_invoice",1);
if ( Document_Option::is_enable_make_invoice($table->dt_id)) $i->set_check(1); else $i->set_check(0);
echo $i->input();
echo _("Création de facture");
?>
</li>
</ul>
</div>