Fix: predefined operation with overflow for details
Follow Up : operation detail moved from Follow_up to Follow_Up_Detail Add Option for Follow Up Add option for contact in follow up rename cfgcat to cfgaction rewriting of cfgcatdoc
This commit is contained in:
parent
c5127f64c3
commit
47cb4285d9
18 changed files with 771 additions and 493 deletions
|
|
@ -257,7 +257,11 @@ $path = array(
|
|||
// payment_method
|
||||
"payment_method"=>"ajax_payment_method",
|
||||
// update list of predefined operation if ledger changes
|
||||
"up_predef"=>"ajax_update_predef"
|
||||
"up_predef"=>"ajax_update_predef",
|
||||
// cfgaction type of document
|
||||
"cfgaction"=>'ajax_cfgaction',
|
||||
// list options for multiple contact
|
||||
"contact_option_list"=>'ajax_contact_option_list'
|
||||
) ;
|
||||
|
||||
if (array_key_exists($op, $path)) {
|
||||
|
|
@ -388,58 +392,8 @@ EOF;
|
|||
</data>
|
||||
EOF;
|
||||
break;
|
||||
/* rem a cat of document */
|
||||
case 'rem_cat_doc':
|
||||
require_once NOALYSS_INCLUDE.'/class/document_type.class.php';
|
||||
// if user can not return error message
|
||||
$message="";
|
||||
if ($g_user->check_action(PARCATDOC) == 0)
|
||||
{
|
||||
$html = "nok";
|
||||
$message=_('Action non autorisée');
|
||||
header('Content-type: text/xml; charset=UTF-8');
|
||||
echo <<<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<data>
|
||||
<dtid>$html</dtid>
|
||||
<message>$message</message>
|
||||
</data>
|
||||
EOF;
|
||||
return;
|
||||
}
|
||||
// remove the cat if no action
|
||||
$count_md = $cn->get_value('select count(*) from document_modele where md_type=$1', array($dt_id));
|
||||
$count_a = $cn->get_value('select count(*) from action_gestion where ag_type=$1', array($dt_id));
|
||||
|
||||
|
||||
if ($count_md != 0 || $count_a != 0)
|
||||
{
|
||||
$message=_('Des actions dépendent de cette catégorie');
|
||||
$html = "nok";
|
||||
header('Content-type: text/xml; charset=UTF-8');
|
||||
echo <<<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<data>
|
||||
<dtid>$html</dtid>
|
||||
<message>$message</message>
|
||||
</data>
|
||||
EOF;
|
||||
exit;
|
||||
}
|
||||
$cn->exec_sql('delete from document_type where dt_id=$1', array($dt_id));
|
||||
$html = $dt_id;
|
||||
header('Content-type: text/xml; charset=UTF-8');
|
||||
echo <<<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<data>
|
||||
<dtid>$html</dtid>
|
||||
<message>$message</message>
|
||||
</data>
|
||||
EOF;
|
||||
return;
|
||||
break;
|
||||
case 'mod_cat_doc':
|
||||
require_once NOALYSS_TEMPLATE.'/document_mod_change.php';
|
||||
break;
|
||||
case 'dsp_tva':
|
||||
$cn = Dossier::connect();
|
||||
// Filter the VAT
|
||||
|
|
|
|||
|
|
@ -26,7 +26,25 @@
|
|||
var ask_reload = 0;
|
||||
var tag_choose = '';
|
||||
var aDraggableElement = new Array();
|
||||
|
||||
/**
|
||||
* return undefined if nothing is found , otherwise return the DOM elemnt
|
||||
* @param {type} p_name_dom
|
||||
* @param {type} name_child
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function in_child(p_element,name_child) {
|
||||
var element=p_element
|
||||
if ( typeof p_element !== "object" ) {
|
||||
element=document.getElementById(p_element);
|
||||
|
||||
}
|
||||
if ( ! element ) return undefined;
|
||||
for ( var e=0; e < element.childElementCount;e++) {
|
||||
if ( element.childNodes[e].id == name_child) {
|
||||
return element.childNodes[e];
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* callback function when we just need to update a hidden div with an info
|
||||
* message
|
||||
|
|
@ -2115,7 +2133,13 @@ function view_action(ag_id, dossier, modify)
|
|||
});
|
||||
$(id).innerHTML = code_html;
|
||||
if (ctl_txt == 'ok') {
|
||||
compute_all_ledger();
|
||||
// compute detail
|
||||
var detail=in_child(id,"follow_up_detail");
|
||||
if (detail) {
|
||||
compute_all_ledger();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
code_html.evalScripts();
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -1,90 +0,0 @@
|
|||
<?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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/*!\file
|
||||
* \brief this file is included to perform modification on category of document
|
||||
* table document_type
|
||||
*/
|
||||
|
||||
// show list of document
|
||||
if (!defined('ALLOWED'))
|
||||
die('Appel direct ne sont pas permis');
|
||||
require_once NOALYSS_INCLUDE.'/class/document_type.class.php';
|
||||
|
||||
global $http;
|
||||
|
||||
if (isset($_POST['add']))
|
||||
{
|
||||
$catDoc=new Document_Type($cn);
|
||||
try
|
||||
{
|
||||
$cat=$http->post('cat');
|
||||
$prefix=$http->post('prefix');
|
||||
$catDoc->insert($cat, $prefix);
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
echo $exc->getMessage();
|
||||
error_log($exc->getTraceAsString());
|
||||
}
|
||||
}
|
||||
if (isset($_POST['save']))
|
||||
{
|
||||
try
|
||||
{
|
||||
$dt_id=$http->post("dt_id", "number");
|
||||
$name=
|
||||
$prefix=
|
||||
$catDoc=new Document_Type($cn, $dt_id);
|
||||
$catDoc->get();
|
||||
$catDoc->dt_value=trim($http->post("dt_name"));;
|
||||
$catDoc->dt_prefix=trim($http->post("dt_prefix"));
|
||||
if ($catDoc->dt_value=="")
|
||||
{
|
||||
alert(_("Le nom ne peut pas être vide"));
|
||||
}
|
||||
else
|
||||
{
|
||||
$catDoc->update();
|
||||
}
|
||||
if ($_POST['seq']!=0&&isNumber($_POST['seq'])==1)
|
||||
{
|
||||
$catDoc->set_number($_POST['seq']);
|
||||
}
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
alert ($exc->getMessage());
|
||||
error_log($exc->getTraceAsString());
|
||||
}
|
||||
}
|
||||
$aList=Document_Type::get_list($cn);
|
||||
$addCat=new IText('cat');
|
||||
$addPrefix=new IText('prefix');
|
||||
$str_addCat=$addCat->input();
|
||||
$str_addPrefix=$addPrefix->input();
|
||||
$str_submit=HtmlInput::submit('add', _('Ajout'));
|
||||
echo '<div class="content">';
|
||||
require_once NOALYSS_TEMPLATE.'/list_category_document.php';
|
||||
|
||||
echo '</div>';
|
||||
?>
|
||||
44
include/cfg_action.inc.php
Normal file
44
include/cfg_action.inc.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/*!\file
|
||||
* \brief this file is included to perform modification on category of document (= action)
|
||||
* table document_type
|
||||
*/
|
||||
|
||||
// show list of document
|
||||
if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
|
||||
require_once NOALYSS_INCLUDE."/class/action_document_type_mtable.class.php";
|
||||
echo '<div class="content">';
|
||||
$doc_type=new Document_type_SQL($cn);
|
||||
$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->create_js_script();
|
||||
$action_document_type->display_table("order by dt_value");
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
190
include/class/action_document_type_mtable.class.php
Normal file
190
include/class/action_document_type_mtable.class.php
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
<?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>
|
||||
|
||||
/* @file
|
||||
* @brief display and allow to update , add , delete document_type for the follow up
|
||||
*
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php";
|
||||
require_once NOALYSS_INCLUDE."/database/document_type_sql.class.php";
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @brief display , modify and add document_type for follow up
|
||||
* @see include/ajax/ajax_cfgaction.php
|
||||
* @see include/cfg_action.inc.php
|
||||
*/
|
||||
class Action_Document_Type_MTable extends Manage_Table_SQL
|
||||
{
|
||||
|
||||
private $other; //!< Other value
|
||||
|
||||
public function __construct(Document_type_SQL $doc_type)
|
||||
{
|
||||
parent::__construct($doc_type);
|
||||
$this->set_order(["dt_id", "dt_prefix", "dt_value",]);
|
||||
$this->set_property_updatable("dt_id", false);
|
||||
$this->set_property_visible("dt_id", false);
|
||||
$this->set_property_updatable("dt_value", true);
|
||||
$this->set_property_updatable("dt_prefix", true);
|
||||
$this->set_col_label("dt_value", _("Nom"));
|
||||
$this->set_col_label("dt_prefix", _("Préfixe document"));
|
||||
$this->other=array();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@code
|
||||
table "public.document_type"
|
||||
ctl_id "dtr"
|
||||
gDossier "74"
|
||||
op "cfgaction"
|
||||
p_id "28"
|
||||
action "save"
|
||||
ctl "tbl5f785d403b123"
|
||||
dt_prefix "ABO.HEB"
|
||||
dt_value "Abonnements+PhpCompta"
|
||||
seq "0"
|
||||
det_op "1"
|
||||
det_contact_mul "1"
|
||||
update "OK"
|
||||
@endcode
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function from_request()
|
||||
{
|
||||
$http=new HttpInput();
|
||||
$this->table->dt_value=$http->request('dt_value');
|
||||
$this->table->dt_prefix=$http->request('dt_prefix');
|
||||
$this->other['detail_operation']=$http->request("detail_operation", "string", 0);
|
||||
$this->other['contact_multiple']=$http->request("det_contact_mul", "string", 0);
|
||||
$this->other['make_invoice']=$http->request("make_invoice", "string", 0);
|
||||
$this->other['seq']=$http->request("seq", "string", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$table=$this->get_table();
|
||||
$error=0;
|
||||
if (empty(trim($table->dt_value)))
|
||||
{
|
||||
$this->set_error("dt_value", _("Nom ne peut être vide"));
|
||||
$error++;
|
||||
}
|
||||
if (empty(trim($table->dt_prefix)))
|
||||
{
|
||||
$this->set_error("dt_prefix", _("Préfixe ne peut être vide"));
|
||||
$error++;
|
||||
}
|
||||
// Check doublon
|
||||
if ($table->cn->get_value('select count(*) from document_type where upper(dt_value)=upper($1) and dt_id <> $2',
|
||||
[$table->dt_value, $table->dt_id])>0)
|
||||
{
|
||||
$this->set_error("dt_value", _("Doublon, ce nom existe déjà "));
|
||||
$error++;
|
||||
}
|
||||
// Check doublon
|
||||
if ($table->cn->get_value('select count(*) from document_type where upper(dt_prefix)=upper($1) and dt_id <> $2',
|
||||
[$table->dt_prefix, $table->dt_id])>0)
|
||||
{
|
||||
$this->set_error("dt_value", _("Doublon, ce préfixe existe déjà "));
|
||||
$error++;
|
||||
}
|
||||
if ($error>0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
$table=$this->get_table();
|
||||
try
|
||||
{
|
||||
// remove the cat if no action
|
||||
$count_md=$table->cn->get_value('select count(*) from document_modele where md_type=$1',
|
||||
array($table->dt_id));
|
||||
$count_a=$table->cn->get_value('select count(*) from action_gestion where ag_type=$1', array($table->dt_id));
|
||||
|
||||
if ($count_md!=0||$count_a!=0)
|
||||
{
|
||||
throw new Exception(_('Des actions dépendent de cette catégorie'), 1300);
|
||||
}
|
||||
$table->delete();
|
||||
}
|
||||
catch (Exception $exc)
|
||||
{
|
||||
if ($exc->getCode()!=1300)
|
||||
{
|
||||
record_log("ADTM01".$exc->getTrace());
|
||||
}
|
||||
throw new Exception($exc->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief display the box for adding, the name for p_id , are in the form
|
||||
*/
|
||||
function input()
|
||||
{
|
||||
parent::input();
|
||||
require NOALYSS_TEMPLATE."/action_document_type_mtable_input.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* save
|
||||
*/
|
||||
function save()
|
||||
{
|
||||
parent::save();
|
||||
$cn=Dossier::connect();
|
||||
$object_sql=$this->get_table();
|
||||
// restart sequence
|
||||
if ($this->other['seq']!=0)
|
||||
{
|
||||
$doc_type=new Document_type($cn, $object_sql->dt_id);
|
||||
$doc_type->set_number($this->other['seq']);
|
||||
}
|
||||
// Save detail operation
|
||||
$cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3)
|
||||
on conflict on constraint document_option_un
|
||||
do update set do_enable=$3", ["detail_operation", $object_sql->dt_id, $this->other['detail_operation']]);
|
||||
|
||||
// Save contact_multiple
|
||||
$cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3)
|
||||
on conflict on constraint document_option_un
|
||||
do update set do_enable=$3 ", ["contact_multiple", $object_sql->dt_id, $this->other['contact_multiple']]);
|
||||
|
||||
// Save make invoice
|
||||
$cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3)
|
||||
on conflict on constraint document_option_un
|
||||
do update set do_enable=$3 ", ["make_invoice", $object_sql->dt_id, $this->other['make_invoice']]);
|
||||
}
|
||||
|
||||
}
|
||||
88
include/class/document_option.class.php
Normal file
88
include/class/document_option.class.php
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
<?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>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @brief
|
||||
*/
|
||||
class Document_Option
|
||||
{
|
||||
|
||||
/**
|
||||
* returns true if the operation_detail is enable, otherwise false
|
||||
*
|
||||
* @param int $p_document_type Document_Type.dt_id
|
||||
* @return boolean
|
||||
*/
|
||||
static function is_enable_operation_detail($p_document_type)
|
||||
{
|
||||
$display_operation=false;
|
||||
$cn=Dossier::connect();
|
||||
if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2",
|
||||
[$p_document_type, 'detail_operation'])=='1')
|
||||
{
|
||||
$display_operation=true;
|
||||
}
|
||||
return $display_operation;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns true if the operation_detail is enable, otherwise false
|
||||
*
|
||||
* @param int $p_document_type Document_Type.dt_id
|
||||
* @return boolean
|
||||
*/
|
||||
static function is_enable_contact_multiple($p_document_type)
|
||||
{
|
||||
$return=false;
|
||||
$cn=Dossier::connect();
|
||||
if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2",
|
||||
[$p_document_type, 'contact_multiple'])=='1')
|
||||
{
|
||||
$return=true;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns true if the operation_detail is enable, otherwise false
|
||||
*
|
||||
* @param int $p_document_type Document_Type.dt_id
|
||||
* @return boolean
|
||||
*/
|
||||
static function is_enable_make_invoice($p_document_type)
|
||||
{
|
||||
$return=false;
|
||||
$cn=Dossier::connect();
|
||||
if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2",
|
||||
[$p_document_type, 'make_invoice'])=='1')
|
||||
{
|
||||
$return=true;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -23,7 +23,9 @@
|
|||
* \brief class for the table document_type
|
||||
*/
|
||||
|
||||
/** \brief class for the table document_type
|
||||
/** \
|
||||
*@brief class for the table document_type , a document_type is a kind of action in the follow up
|
||||
*
|
||||
* < dt_id pk document_type
|
||||
* < dt_value value
|
||||
*/
|
||||
|
|
@ -91,40 +93,10 @@ class Document_type
|
|||
return $array;
|
||||
}
|
||||
|
||||
function insert($p_value, $p_prefix)
|
||||
{
|
||||
$sql = "insert into document_type(dt_value,dt_prefix) values ($1,$2)";
|
||||
try
|
||||
{
|
||||
if ($this->db->count_sql('select * from document_type where upper(dt_value)=upper(trim($1))', array($p_value)) > 0)
|
||||
throw new Exception('Nom en double');
|
||||
if (strlen(trim($p_value)) > 0)
|
||||
$this->db->exec_sql($sql, array($p_value, $p_prefix));
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
record_log($e);
|
||||
alert(j(_("Impossible d'ajouter [$p_value] ") . $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update
|
||||
*/
|
||||
function update()
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->db->exec_sql("update document_type set dt_value=$1,dt_prefix=$2 where dt_id=$3", array($this->dt_value,
|
||||
$this->dt_prefix, $this->dt_id));
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
record_log($e);
|
||||
alert(" Erreur " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart the increment of the document
|
||||
* @param type $p_int
|
||||
*/
|
||||
function set_number($p_int)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
|
|||
require_once NOALYSS_INCLUDE.'/class/document.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/document_type.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/document_modele.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/document_option.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/user_common.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/follow_up_detail.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/inum.class.php';
|
||||
|
|
@ -152,7 +153,7 @@ class Follow_Up
|
|||
*
|
||||
* \return string containing the html code
|
||||
*/
|
||||
function Display($p_view, $p_gen, $p_base, $retour="")
|
||||
function display($p_view, $p_gen, $p_base, $retour="")
|
||||
{
|
||||
global $g_user;
|
||||
if ($p_view=='UPD')
|
||||
|
|
@ -175,6 +176,8 @@ class Follow_Up
|
|||
{
|
||||
throw new Exception('class_action'.__LINE__.'Follow_Up::Display error unknown parameter'.$p_view);
|
||||
}
|
||||
|
||||
|
||||
// Compute the widget
|
||||
// Date
|
||||
$date=new IDate();
|
||||
|
|
@ -428,108 +431,9 @@ class Follow_Up
|
|||
$text=new IText();
|
||||
$num=new INum();
|
||||
|
||||
/* TVA */
|
||||
$itva=new ITva_Popup($this->db);
|
||||
$itva->in_table=true;
|
||||
$aCard=array();
|
||||
/* create aArticle for the detail section */
|
||||
$article_count=(count($this->aAction_detail)==0)?MAX_ARTICLE:count($this->aAction_detail);
|
||||
/* Compute total */
|
||||
$tot_item=0;
|
||||
$tot_vat=0;
|
||||
for ($i=0; $i<$article_count; $i++)
|
||||
{
|
||||
/* fid = Icard */
|
||||
$icard=new ICard();
|
||||
$icard->jrn=0;
|
||||
$icard->table=0;
|
||||
$icard->noadd="no";
|
||||
$icard->extra='all';
|
||||
$icard->name="e_march".$i;
|
||||
$tmp_ad=(isset($this->aAction_detail[$i]))?$this->aAction_detail[$i]:false;
|
||||
$icard->readOnly=$readonly;
|
||||
$icard->value='';
|
||||
$aCard[$i]=0;
|
||||
if ($tmp_ad)
|
||||
{
|
||||
$march=new Fiche($this->db);
|
||||
$f=$tmp_ad->get_parameter('qcode');
|
||||
if ($f!=0)
|
||||
{
|
||||
$march->id=$f;
|
||||
$icard->value=$march->get_quick_code();
|
||||
$aCard[$i]=$f;
|
||||
}
|
||||
}
|
||||
$icard->set_dblclick("fill_ipopcard(this);");
|
||||
// name of the field to update with the name of the card
|
||||
$icard->set_attribute('label', "e_march".$i."_label");
|
||||
// name of the field to update with the name of the card
|
||||
$icard->set_attribute('typecard', $icard->extra);
|
||||
$icard->set_attribute('ipopup', 'ipopcard');
|
||||
$icard->set_function('fill_data');
|
||||
$icard->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $icard->name);
|
||||
|
||||
$aArticle[$i]['fid']=$icard->search().$icard->input();
|
||||
|
||||
$text->javascript=' onchange="clean_tva('.$i.');compute_ledger('.$i.')"';
|
||||
$text->css_size="100%";
|
||||
$text->name="e_march".$i."_label";
|
||||
$text->id="e_march".$i."_label";
|
||||
$text->size=40;
|
||||
$text->value=($tmp_ad)?$tmp_ad->get_parameter('text'):"";
|
||||
$text->readOnly=$readonly;
|
||||
$aArticle[$i]['desc']=$text->input();
|
||||
|
||||
$num->javascript=' onchange="format_number(this,4);clean_tva('.$i.');compute_ledger('.$i.')"';
|
||||
$num->name="e_march".$i."_price";
|
||||
$num->id="e_march".$i."_price";
|
||||
$num->size=8;
|
||||
$num->readOnly=$readonly;
|
||||
$num->value=($tmp_ad)?$tmp_ad->get_parameter('price_unit'):0;
|
||||
$aArticle[$i]['pu']=$num->input();
|
||||
|
||||
$num->name="e_quant".$i;
|
||||
$num->id="e_quant".$i;
|
||||
$num->size=8;
|
||||
$num->value=($tmp_ad)?$tmp_ad->get_parameter('quantity'):0;
|
||||
$aArticle[$i]['quant']=$num->input();
|
||||
|
||||
$itva->name='e_march'.$i.'_tva_id';
|
||||
$itva->id='e_march'.$i.'_tva_id';
|
||||
$itva->value=($tmp_ad)?$tmp_ad->get_parameter('tva_id'):0;
|
||||
$itva->readOnly=$readonly;
|
||||
$itva->js=' onchange="format_number(this);clean_tva('.$i.');compute_ledger('.$i.')"';
|
||||
$itva->set_attribute('compute', $i);
|
||||
|
||||
$aArticle[$i]['tvaid']=$itva->input();
|
||||
|
||||
$num->name="e_march".$i."_tva_amount";
|
||||
$num->id="e_march".$i."_tva_amount";
|
||||
$num->value=($tmp_ad)?$tmp_ad->get_parameter('tva_amount'):0;
|
||||
$num->javascript=" onchange=\"compute_ledger('".$i." ')\"";
|
||||
$num->size=8;
|
||||
$aArticle[$i]['tva']=$num->input();
|
||||
$tot_vat=bcadd($tot_vat,$num->value);
|
||||
|
||||
$num->name="tvac_march".$i;
|
||||
$num->id="tvac_march".$i;
|
||||
$num->value=($tmp_ad)?$tmp_ad->get_parameter('total'):0;
|
||||
$num->size=8;
|
||||
$aArticle[$i]['tvac']=$num->input();
|
||||
$tot_item=bcadd($tot_item,$num->value);
|
||||
|
||||
$aArticle[$i]['hidden_htva']=HtmlInput::hidden('htva_march'.$i, 0);
|
||||
$aArticle[$i]['hidden_tva']=HtmlInput::hidden('tva_march'.$i, 0);
|
||||
$aArticle[$i]['ad_id']=($tmp_ad)?HtmlInput::hidden('ad_id'.$i, $tmp_ad->get_parameter('id')):HtmlInput::hidden('ad_id'.$i, 0);
|
||||
}
|
||||
|
||||
/* Add the needed hidden values */
|
||||
$r.=dossier::hidden();
|
||||
|
||||
/* add the number of item */
|
||||
$Hid=new IHidden();
|
||||
$r.=$Hid->input("nb_item", $article_count);
|
||||
$r.=HtmlInput::request_to_hidden(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag"));
|
||||
$a_tag=$this->tag_get();
|
||||
$menu=new Default_Menu();
|
||||
|
|
@ -671,9 +575,10 @@ class Follow_Up
|
|||
$this->ag_remind_date /* 13 */
|
||||
)
|
||||
);
|
||||
|
||||
$http=new HttpInput();
|
||||
$nb_item=$http->post("nb_item","number",0);
|
||||
/* insert also the details */
|
||||
for ($i=0; $i<$_POST['nb_item']; $i++)
|
||||
for ($i=0; $i<$nb_item; $i++)
|
||||
{
|
||||
$act=new Follow_Up_Detail($this->db);
|
||||
$act->from_array($_POST, $i);
|
||||
|
|
@ -861,7 +766,7 @@ class Follow_Up
|
|||
*
|
||||
* \return true on success otherwise false
|
||||
*/
|
||||
function Update()
|
||||
function update()
|
||||
{
|
||||
|
||||
// if ag_id == 0 nothing to do
|
||||
|
|
|
|||
|
|
@ -233,6 +233,11 @@ class Follow_Up_Detail
|
|||
if (trim($this->ad_total_amount)==""||isNumber($this->ad_total_amount)==0) $this->ad_total_amount=0;
|
||||
if (trim($this->ad_tva_id)=="" || isNumber($this->ad_tva_id)==0) $this->ad_tva_id=0;
|
||||
}
|
||||
|
||||
public static function display(Follow_Up $p_follow_up,$p_view)
|
||||
{
|
||||
require NOALYSS_TEMPLATE."/follow_up_detail_display.php";
|
||||
}
|
||||
/*!\brief
|
||||
*\param
|
||||
*\return
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class Operation_Predef_MTable extends Manage_Table_SQL
|
|||
// create our own "Append button"
|
||||
$this->set_append_row(false);
|
||||
$this->set_dialog_box("prdfop");
|
||||
$this->set_dialogbox_style(["position"=>"absolute","top"=>"5%","width:auto","min-width"=>"80%"]);
|
||||
$this->set_dialogbox_style(["position"=>"fixed","top"=>"5%","width:auto","min-width"=>"80%"]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -191,8 +191,8 @@ class Pre_Op_Advanced extends Pre_operation_detail
|
|||
$ret.=HtmlInput::hidden('jrn_type', "ODS");
|
||||
$info = Icon_Action::infobulle(0);
|
||||
$info_poste = Icon_Action::infobulle(9);
|
||||
if ($g_user->check_action(FICADD) == 1)
|
||||
$ret.=$f_add_button->input();
|
||||
if ($g_user->check_action(FICADD) == 1) $ret.=$f_add_button->input();
|
||||
$ret.='<div class="fieldset" style="overflow:auto;height:400px">';
|
||||
$ret.='<table id="quick_item" style="width:100%">';
|
||||
$ret.='<tr>' .
|
||||
'<th style="text-align:left">Quickcode' . $info . '</th>' .
|
||||
|
|
@ -287,6 +287,7 @@ class Pre_Op_Advanced extends Pre_operation_detail
|
|||
// If readonly == 1 then show CA
|
||||
}
|
||||
$ret.='</table>';
|
||||
$ret.="</div>";
|
||||
$ret.=Html_Input_Noalyss::ledger_add_item("M");
|
||||
return $ret;
|
||||
}
|
||||
|
|
|
|||
66
include/database/contact_option_ref_sql.class.php
Normal file
66
include/database/contact_option_ref_sql.class.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?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
|
||||
*/
|
||||
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
|
||||
|
||||
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/class/database.class.php';
|
||||
|
||||
/**
|
||||
* class_contact_option_ref_sql.php
|
||||
*
|
||||
* @file
|
||||
* @brief abstract of the table public.contact_option_ref */
|
||||
class Contact_option_ref_SQL extends Noalyss_SQL
|
||||
{
|
||||
|
||||
function __construct(Database $p_cn, $p_id=-1)
|
||||
{
|
||||
$this->table="public.contact_option_ref";
|
||||
$this->primary_key="cor_id";
|
||||
/*
|
||||
* List of columns
|
||||
*/
|
||||
$this->name=array(
|
||||
"cor_id"=>"cor_id"
|
||||
, "cor_label"=>"cor_label"
|
||||
, "cor_type"=>"cor_type"
|
||||
, "cor_value_select"=>"cor_value_select"
|
||||
);
|
||||
/*
|
||||
* Type of columns
|
||||
*/
|
||||
$this->type=array(
|
||||
"cor_id"=>"numeric"
|
||||
, "cor_label"=>"text"
|
||||
, "cor_type"=>"numeric"
|
||||
, "cor_value_select"=>"text"
|
||||
);
|
||||
|
||||
|
||||
$this->default=array(
|
||||
"cor_id"=>"auto"
|
||||
);
|
||||
|
||||
$this->date_format="DD.MM.YYYY";
|
||||
parent::__construct($p_cn, $p_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -61,6 +61,7 @@
|
|||
* @see sorttable.js
|
||||
*
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE."/lib/http_input.class.php";
|
||||
|
||||
class Manage_Table_SQL
|
||||
{
|
||||
|
|
@ -258,7 +259,7 @@ class Manage_Table_SQL
|
|||
}
|
||||
|
||||
/**
|
||||
* This function can be overrided to check the data before
|
||||
* @brief This function can be overrided to check the data before
|
||||
* inserting , updating or removing, above an example of an overidden check.
|
||||
*
|
||||
* Usually , you get the row of the table (get_table) , you check the conditions
|
||||
|
|
@ -268,7 +269,8 @@ class Manage_Table_SQL
|
|||
*
|
||||
* @see set_error get_error count_error
|
||||
* @return boolean
|
||||
* @code
|
||||
*
|
||||
@code
|
||||
function check()
|
||||
{
|
||||
global $cn;
|
||||
|
|
@ -292,7 +294,7 @@ function check()
|
|||
if ( $is_error > 0 ) return false;
|
||||
return true;
|
||||
}
|
||||
* @endcode
|
||||
@endcode
|
||||
*/
|
||||
function check()
|
||||
{
|
||||
|
|
@ -776,6 +778,7 @@ function check()
|
|||
function from_request()
|
||||
{
|
||||
$nb=count($this->a_order);
|
||||
$http=new HttpInput();
|
||||
for ($i=0; $i<$nb; $i++)
|
||||
{
|
||||
|
||||
|
|
@ -783,7 +786,7 @@ function check()
|
|||
if ($this->get_property_visible($key)==TRUE&&$this->get_property_updatable($key)
|
||||
==TRUE)
|
||||
{
|
||||
$v=HtmlInput::default_value_request($this->a_order[$i], "");
|
||||
$v=$http->request($this->a_order[$i],"string","");
|
||||
$this->table->$key=strip_tags($v);
|
||||
}
|
||||
}
|
||||
|
|
@ -1094,7 +1097,7 @@ function check()
|
|||
|
||||
ob_start();
|
||||
|
||||
echo HtmlInput::title_box("Donnée", $this->dialog_box,"close","","y");
|
||||
echo HtmlInput::title_box(_("Donnée"), $this->dialog_box,"close","","y");
|
||||
printf('<form id="frm%s_%s" method="POST" onsubmit="%s.save(\'frm%s_%s\');return false;">',
|
||||
$this->object_name, $this->table->get_pk_value(),
|
||||
$this->object_name, $this->object_name,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ $uniq=uniqid("tab",TRUE);
|
|||
|
||||
|
||||
<table>
|
||||
<tr class="highlight">
|
||||
<tr class="highlight">
|
||||
<TD>
|
||||
<?php echo _('N° document')?>
|
||||
</TD>
|
||||
|
|
@ -57,6 +57,7 @@ $uniq=uniqid("tab",TRUE);
|
|||
echo _('Pas de catégorie de contact');
|
||||
endif;
|
||||
endif;
|
||||
|
||||
?>
|
||||
</td>
|
||||
</Tr>
|
||||
|
|
@ -65,7 +66,7 @@ $uniq=uniqid("tab",TRUE);
|
|||
<?php echo $spcontact->input(); ?>
|
||||
</td>
|
||||
</Tr>
|
||||
<?php if ($this->ag_id > 0 ): ?>
|
||||
<?php if ($this->ag_id > 0 && Document_Option::is_enable_contact_multiple($this->dt_id)): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo _('Autres concernés')?>
|
||||
|
|
@ -280,132 +281,52 @@ echo '</span>';
|
|||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( $p_view !='READ' ) :?>
|
||||
<input type='button' class="button" class="noprint" value="<?php echo _('Montrer articles');?>" id="toggleButton" onclick='toggleShowDetail()'>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
/**
|
||||
* check if there card to show,
|
||||
*/
|
||||
$show_row=0;
|
||||
for ($i=0;$i<count($aArticle);$i++) :
|
||||
if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'){ $show_row=1;break;}
|
||||
endfor;
|
||||
<?php
|
||||
/**********************************************************************************************************************
|
||||
* START BLOCK Display Detail of follow up
|
||||
*
|
||||
**********************************************************************************************************************/
|
||||
?>
|
||||
<?php
|
||||
/*
|
||||
* display detail if there card or if we are in UPDATE or NEW mode
|
||||
*/
|
||||
if ($show_row !=0 ) :
|
||||
// Display detail if detail_operation is set
|
||||
if ( $this->ag_id > 0 && Document_Option::is_enable_operation_detail($this->dt_id)) Follow_Up_Detail::display($this,$p_view);
|
||||
|
||||
?>
|
||||
<div id="fldDetail" class="myfieldset" style='padding-bottom: 100px;display:block;top:2px'>
|
||||
<LEGEND> <?php echo _('Détail')?>
|
||||
</LEGEND>
|
||||
<?php // hidden fields
|
||||
$show_row=0;
|
||||
for ($i=0;$i<count($aArticle);$i++) :
|
||||
echo $aArticle[$i]['ad_id'];
|
||||
echo $aArticle[$i]['hidden_tva'];
|
||||
echo $aArticle[$i]['hidden_htva'];
|
||||
if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'){ $show_row=1;}
|
||||
endfor;
|
||||
?>
|
||||
<div>
|
||||
<table style="width:100%" id="art" >
|
||||
<tr>
|
||||
<th><?php echo _('Fiche')?></th>
|
||||
<th><?php echo _('Description')?></th>
|
||||
<th><?php echo _('prix unitaire')?></th>
|
||||
<th><?php echo _('quantité')?></th>
|
||||
<th><?php echo _('Code TVA')?></th>
|
||||
<th><?php echo _('Montant TVA')?></th>
|
||||
<th><?php echo _('Montant TVAC')?></th>
|
||||
<?php
|
||||
/**********************************************************************************************************************
|
||||
* END BLOCK Display Detail of follow up
|
||||
**********************************************************************************************************************/
|
||||
?>
|
||||
|
||||
<div style="clear:both"></div>
|
||||
|
||||
</tr>
|
||||
<?php for ($i=0;$i<count($aArticle);$i++): ?>
|
||||
<?php
|
||||
if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'):
|
||||
$show_row++;
|
||||
?>
|
||||
<TR>
|
||||
<TD><?php echo $aArticle[$i]['fid'] ?></TD>
|
||||
<TD><?php echo $aArticle[$i]['desc'] ?></TD>
|
||||
<TD class="num"><?php echo $aArticle[$i]['pu'] ?></TD>
|
||||
<TD class="num"><?php echo $aArticle[$i]['quant'] ?></TD>
|
||||
<TD class="num"><?php echo $aArticle[$i]['tvaid'] ?></TD>
|
||||
<TD class="num"><?php echo $aArticle[$i]['tva'] ?></TD>
|
||||
<TD class="num"><?php echo $aArticle[$i]['tvac'] ?></TD>
|
||||
</TR>
|
||||
<?php endif; ?>
|
||||
<?php endfor; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($p_view != "READ" ): ?>
|
||||
<script language="JavaScript">
|
||||
if ( $('e_march0') && $('e_march0').value =='') { toggleShowDetail();}
|
||||
function toggleShowDetail() {
|
||||
try {var detail=g('fldDetail');
|
||||
var but=g('toggleButton');
|
||||
if (detail.style.display=='block' ) { but.value="<?php echo _("Montrer les détails")?>";detail.style.display='none';}
|
||||
else { but.value="<?php echo _("Cacher les détails")?>";detail.style.display='block';} }
|
||||
catch (error) {alert(error);}
|
||||
}
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
<?php if ( $show_row != 0 ): ?>
|
||||
<div>
|
||||
|
||||
<div style=" float:right;margin-right: 2px" id="sum">
|
||||
<br><span style="text-align: right;" class="highlight" id="htva"><?php echo bcsub($tot_item,$tot_vat) ?></span>
|
||||
<br><span style="text-align: right" class="highlight" id="tva"><?php echo $tot_vat?></span>
|
||||
<br><span style="text-align: right" class="highlight" id="tvac"><?php echo $tot_item?></span>
|
||||
</div>
|
||||
|
||||
<div style="float:right;margin-right: 230px" >
|
||||
<br>Total HTVA
|
||||
<br>Total TVA
|
||||
<br>Total TVAC
|
||||
</div>
|
||||
<div class="myfieldset" id="div_action_attached_doc">
|
||||
<legend>
|
||||
<?php echo _('Pièces attachées')?>
|
||||
</legend>
|
||||
<div class="noprint">
|
||||
<?php
|
||||
/**********************************************************************************************************************
|
||||
* start BLOCK generate document
|
||||
**********************************************************************************************************************/
|
||||
?>
|
||||
|
||||
<?php if ( ! $readonly ) : ?>
|
||||
<div style="float:right" >
|
||||
<input name="act" id="act_bt" class="smallbutton" value="<?php echo _('Actualiser')?>" onclick="compute_all_ledger();" type="button">
|
||||
<input type="button" class="smallbutton" onclick="gestion_add_row()" value="<?php echo _("Ajouter une ligne")?>">
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php if ($p_view != 'READ' && $str_select_doc != '') : ?>
|
||||
<?php if ($p_view != 'READ' && $str_select_doc != '') : ?>
|
||||
<?php echo _('Document à générer')?>
|
||||
</legend>
|
||||
<?php echo $str_select_doc;
|
||||
echo $str_submit_generate;
|
||||
|
||||
endif; ?>
|
||||
<legend>
|
||||
</div>
|
||||
<?php if ( $this->ag_id != 0 && ! $readonly) : ?>
|
||||
<div >
|
||||
<p>
|
||||
<?php
|
||||
$query= http_build_query(array('gDossier'=>Dossier::id(),'ag_id'=>$this->ag_id,'create_invoice'=>1,'ac'=>$menu->get('code_invoice')));
|
||||
echo HtmlInput::button_anchor(_("Transformer en facture"),"do.php?".$query,"create_invoice", ' target="_blank" ',"button");
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div style="clear:both"></div>
|
||||
|
||||
|
||||
|
||||
<div class="myfieldset" id="div_action_attached_doc">
|
||||
<legend>
|
||||
<?php echo _('Pièces attachées')?>
|
||||
</legend>
|
||||
|
||||
<?php
|
||||
/**********************************************************************************************************************
|
||||
* end BLOCK generate document
|
||||
**********************************************************************************************************************/
|
||||
?>
|
||||
</div>
|
||||
<div class="print">
|
||||
<table>
|
||||
<?php
|
||||
|
|
@ -483,7 +404,7 @@ Document créé le <?php echo $this->ag_timestamp ?> par <?php echo $this->ag_ow
|
|||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<script>compute_all_ledger()</script>
|
||||
|
||||
<script>
|
||||
$('related_action_tab<?php echo $uniq?>').onclick=function() {
|
||||
$('related_action_tab<?php echo $uniq?>').className='tabs_selected';
|
||||
|
|
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
<?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.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||
|
||||
/**\file
|
||||
* \brief this file respond to an ajax request to modify a type of document
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE.'/class/document_type.class.php';
|
||||
echo HtmlInput::title_box(_('Type de document'),'change_doc_div');
|
||||
|
||||
$doc_type=new Document_type($cn,$dt_id);
|
||||
$doc_type->get();
|
||||
?>
|
||||
<form method="POST" id="cat_doc_f" onsubmit="cat_doc_change_record('cat_doc_f');">
|
||||
<?php echo HtmlInput::request_to_hidden(array("ac","gDossier","dt_id"))?>
|
||||
<table>
|
||||
<tr>
|
||||
<td> <?php echo _('Nom')?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$name=new IText('dt_name',$doc_type->dt_value);
|
||||
echo $name->input();
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo _('Préfixe')?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$prefix=new IText('dt_prefix',$doc_type->dt_prefix);
|
||||
echo $prefix->input();
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo _('numéro actuel')?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$ret= $cn->get_array("select last_value,is_called from seq_doc_type_".$doc_type->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;
|
||||
?>
|
||||
</td>
|
||||
<tr>
|
||||
<td><?php echo _('Prochain numéro')?>
|
||||
<?php echo
|
||||
Icon_Action::infobulle(15);
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$seq=new INum('seq',0);
|
||||
echo $seq->input();
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<?php echo HtmlInput::submit("save",_('Sauver'));?>
|
||||
</form>
|
||||
191
include/template/follow_up_detail_display.php
Normal file
191
include/template/follow_up_detail_display.php
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
<?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>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Called from Follow_Up_Detail for displaying detail
|
||||
* @see Follow_Up_Detail::display
|
||||
*/
|
||||
// Number of articles
|
||||
$article_count=(count($p_follow_up->aAction_detail)==0)?MAX_ARTICLE:count($p_follow_up->aAction_detail);
|
||||
// total item and vat
|
||||
$tot_item=0;
|
||||
$tot_vat=0;
|
||||
$text=new IText();
|
||||
$num=new INum();
|
||||
$itva=new ITva_Popup();
|
||||
$readonly=$p_view;
|
||||
|
||||
// default menu for invoice
|
||||
$menu=new Default_Menu();
|
||||
?>
|
||||
<div id="follow_up_detail">
|
||||
<?php echo HtmlInput::hidden("nb_item", $article_count); ?>
|
||||
|
||||
<table style="width:100%" id="sold_item">
|
||||
<tr>
|
||||
<th><?php echo _('Fiche') ?></th>
|
||||
<th><?php echo _('Description') ?></th>
|
||||
<th><?php echo _('prix unitaire') ?></th>
|
||||
<th><?php echo _('quantité') ?></th>
|
||||
<th><?php echo _('Code TVA') ?></th>
|
||||
<th><?php echo _('Montant TVA') ?></th>
|
||||
<th><?php echo _('Montant TVAC') ?></th>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
for ($i=0; $i<$article_count; $i++):
|
||||
/* fid = Icard */
|
||||
$icard=new ICard();
|
||||
$icard->jrn=0;
|
||||
$icard->table=0;
|
||||
$icard->noadd="no";
|
||||
$icard->extra='all';
|
||||
$icard->name="e_march".$i;
|
||||
$tmp_ad=(isset($p_follow_up->aAction_detail[$i]))?$p_follow_up->aAction_detail[$i]:$readonly;
|
||||
$icard->readOnly=$readonly;
|
||||
$icard->value='';
|
||||
$aCard[$i]=0;
|
||||
if ($tmp_ad)
|
||||
{
|
||||
$march=new Fiche($p_follow_up->db);
|
||||
$f=$tmp_ad->get_parameter('qcode');
|
||||
if ($f!=0)
|
||||
{
|
||||
$march->id=$f;
|
||||
$icard->value=$march->get_quick_code();
|
||||
$aCard[$i]=$f;
|
||||
}
|
||||
}
|
||||
$icard->set_dblclick("fill_ipopcard(this);");
|
||||
// name of the field to update with the name of the card
|
||||
$icard->set_attribute('label', "e_march".$i."_label");
|
||||
// name of the field to update with the name of the card
|
||||
$icard->set_attribute('typecard', $icard->extra);
|
||||
$icard->set_attribute('ipopup', 'ipopcard');
|
||||
$icard->set_function('fill_data');
|
||||
$icard->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $icard->name);
|
||||
|
||||
$aArticle[$i]['fid']=$icard->search().$icard->input();
|
||||
|
||||
$text->javascript=' onchange="clean_tva('.$i.');compute_ledger('.$i.')"';
|
||||
$text->css_size="100%";
|
||||
$text->name="e_march".$i."_label";
|
||||
$text->id="e_march".$i."_label";
|
||||
$text->size=40;
|
||||
$text->value=($tmp_ad)?$tmp_ad->get_parameter('text'):"";
|
||||
$text->readOnly=$readonly;
|
||||
$aArticle[$i]['desc']=$text->input();
|
||||
|
||||
$num->javascript=' onchange="format_number(this,4);clean_tva('.$i.');compute_ledger('.$i.')"';
|
||||
$num->name="e_march".$i."_price";
|
||||
$num->id="e_march".$i."_price";
|
||||
$num->size=8;
|
||||
$num->readOnly=$readonly;
|
||||
$num->value=($tmp_ad)?$tmp_ad->get_parameter('price_unit'):0;
|
||||
$aArticle[$i]['pu']=$num->input();
|
||||
|
||||
$num->name="e_quant".$i;
|
||||
$num->id="e_quant".$i;
|
||||
$num->size=8;
|
||||
$num->value=($tmp_ad)?$tmp_ad->get_parameter('quantity'):0;
|
||||
$aArticle[$i]['quant']=$num->input();
|
||||
|
||||
$itva->name='e_march'.$i.'_tva_id';
|
||||
$itva->id='e_march'.$i.'_tva_id';
|
||||
$itva->value=($tmp_ad)?$tmp_ad->get_parameter('tva_id'):0;
|
||||
$itva->readOnly=$readonly;
|
||||
$itva->js=' onchange="format_number(this);clean_tva('.$i.');compute_ledger('.$i.')"';
|
||||
$itva->set_attribute('compute', $i);
|
||||
|
||||
$aArticle[$i]['tvaid']=$itva->input();
|
||||
|
||||
$num->name="e_march".$i."_tva_amount";
|
||||
$num->id="e_march".$i."_tva_amount";
|
||||
$num->value=($tmp_ad)?$tmp_ad->get_parameter('tva_amount'):0;
|
||||
$num->javascript=" onchange=\"compute_ledger('".$i." ')\"";
|
||||
$num->size=8;
|
||||
$aArticle[$i]['tva']=$num->input();
|
||||
$tot_vat=bcadd($tot_vat, $num->value);
|
||||
|
||||
$num->name="tvac_march".$i;
|
||||
$num->id="tvac_march".$i;
|
||||
$num->value=($tmp_ad)?$tmp_ad->get_parameter('total'):0;
|
||||
$num->size=8;
|
||||
$aArticle[$i]['tvac']=$num->input();
|
||||
$tot_item=bcadd($tot_item, $num->value);
|
||||
|
||||
$aArticle[$i]['hidden_htva']=HtmlInput::hidden('htva_march'.$i, 0);
|
||||
$aArticle[$i]['hidden_tva']=HtmlInput::hidden('tva_march'.$i, 0);
|
||||
$aArticle[$i]['ad_id']=($tmp_ad)?HtmlInput::hidden('ad_id'.$i, $tmp_ad->get_parameter('id')):HtmlInput::hidden('ad_id'.$i,
|
||||
0);
|
||||
?>
|
||||
|
||||
<TR>
|
||||
<TD><?php echo $aArticle[$i]['fid'] ?></TD>
|
||||
<TD><?php echo $aArticle[$i]['desc'] ?></TD>
|
||||
<TD class="num"><?php echo $aArticle[$i]['pu'] ?></TD>
|
||||
<TD class="num"><?php echo $aArticle[$i]['quant'] ?></TD>
|
||||
<TD class="num"><?php echo $aArticle[$i]['tvaid'] ?></TD>
|
||||
<TD class="num"><?php echo $aArticle[$i]['tva'] ?></TD>
|
||||
<TD class="num"><?php echo $aArticle[$i]['tvac'] ?>
|
||||
<?php echo $aArticle[$i]['hidden_tva']; ?>
|
||||
<?php echo $aArticle[$i]['hidden_htva']; ?>
|
||||
<?php echo $aArticle[$i]['ad_id']; ?>
|
||||
</TD>
|
||||
</TR>
|
||||
<?php
|
||||
endfor;
|
||||
?>
|
||||
</table>
|
||||
<div>
|
||||
|
||||
<div style=" float:right;margin-right: 2px" id="sum">
|
||||
<br><span style="text-align: right;" class="highlight" id="htva"><?php echo bcsub($tot_item, $tot_vat) ?></span>
|
||||
<br><span style="text-align: right" class="highlight" id="tva"><?php echo $tot_vat ?></span>
|
||||
<br><span style="text-align: right" class="highlight" id="tvac"><?php echo $tot_item ?></span>
|
||||
</div>
|
||||
|
||||
<div style="float:right;margin-right: 230px" >
|
||||
<br>Total HTVA
|
||||
<br>Total TVA
|
||||
<br>Total TVAC
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="d_add_rows">
|
||||
<?php echo Html_Input_Noalyss::ledger_add_item("O"); ?>
|
||||
|
||||
<?php echo HtmlInput::button('actualiser', _('Recalculer'), ' onClick="compute_all_ledger();"'); ?>
|
||||
</div>
|
||||
<script>compute_all_ledger()</script>
|
||||
<?php
|
||||
if (Document_Option::is_enable_make_invoice($p_follow_up->dt_id)):
|
||||
?>
|
||||
<p id="follow_up_detail_invoice">
|
||||
<?php
|
||||
$query=http_build_query(array('gDossier'=>Dossier::id(), 'ag_id'=>$p_follow_up->ag_id, 'create_invoice'=>1, 'ac'=>$menu->get('code_invoice')));
|
||||
echo HtmlInput::button_anchor(_("Transformer en facture"), "do.php?".$query, "create_invoice",
|
||||
' target="_blank" ', "button");
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
<?php echo $str_add_button?>
|
||||
</fieldset>
|
||||
|
||||
<div class="fieldset">
|
||||
<div class="fieldset" style="overflow:auto;height:400px">
|
||||
<h1 class="fiedset"><?php echo $f_legend_detail?></h1>
|
||||
|
||||
<table id="sold_item" width="100%" border="0">
|
||||
|
|
|
|||
|
|
@ -49,3 +49,94 @@ LANGUAGE plpgsql;
|
|||
ALTER TABLE public.user_sec_action_profile drop CONSTRAINT user_sec_action_profile_ua_right_check;
|
||||
ALTER TABLE public.user_sec_action_profile ADD CONSTRAINT user_sec_action_profile_ua_right_check check (ua_right in ('R','W','X','O'));
|
||||
|
||||
-- extension CRM : definition des options qu'on peut ajouter
|
||||
-- public.document_option_ref definition
|
||||
|
||||
-- Drop table
|
||||
|
||||
-- DROP TABLE public.document_option_ref;
|
||||
|
||||
CREATE TABLE public.document_option_ref (
|
||||
do_id bigserial NOT NULL,
|
||||
do_code varchar(20) NOT NULL, -- Code of the option to add
|
||||
document_type_id int8 NULL, -- FK to document_type
|
||||
CONSTRAINT document_option_ref_pk PRIMARY KEY (do_id)
|
||||
);
|
||||
COMMENT ON TABLE public.document_option_ref IS 'Reference of option of document_type';
|
||||
|
||||
-- Column comments
|
||||
|
||||
COMMENT ON COLUMN public.document_option_ref.do_code IS 'Code of the option to add';
|
||||
COMMENT ON COLUMN public.document_option_ref.document_type_id IS 'FK to document_type';
|
||||
|
||||
|
||||
-- public.document_option_ref foreign keys
|
||||
|
||||
ALTER TABLE public.document_option_ref ADD CONSTRAINT document_option_ref_fk FOREIGN KEY (document_type_id) REFERENCES document_type(dt_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
|
||||
-- Drop table
|
||||
|
||||
CREATE TABLE public.contact_option_ref (
|
||||
cor_id bigserial NOT NULL,
|
||||
cor_label varchar NOT NULL, -- Label de l'option
|
||||
cor_type int4 NOT NULL DEFAULT 0, -- 0 text , 1 select ,2 nombre , 3 date
|
||||
cor_value_json json NULL, -- json object if cor_type is a select
|
||||
document_option_id int8 NOT NULL, -- FK to document_option
|
||||
CONSTRAINT contact_option_ref_pk PRIMARY KEY (cor_id),
|
||||
CONSTRAINT contact_option_ref_fk FOREIGN KEY (document_option_id) REFERENCES document_option(do_id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
COMMENT ON TABLE public.contact_option_ref IS 'Option for the contact';
|
||||
|
||||
-- Column comments
|
||||
|
||||
COMMENT ON COLUMN public.contact_option_ref.cor_label IS 'Label de l''option';
|
||||
COMMENT ON COLUMN public.contact_option_ref.cor_type IS '0 text , 1 select ,2 nombre , 3 date';
|
||||
COMMENT ON COLUMN public.contact_option_ref.cor_value_json IS 'json object if cor_type is a select';
|
||||
COMMENT ON COLUMN public.contact_option_ref.document_option_id IS 'FK to document_option';
|
||||
|
||||
|
||||
CREATE TABLE public.action_person_option (
|
||||
ap_id bigserial NOT NULL,
|
||||
ap_value varchar NULL, -- Value of the option
|
||||
contact_option_ref_id int8 NOT NULL,
|
||||
action_person_id int8 NOT NULL,
|
||||
CONSTRAINT action_person_option_pk PRIMARY KEY (ap_id),
|
||||
CONSTRAINT action_person_option_fk FOREIGN KEY (action_person_id) REFERENCES action_person(ap_id) ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
CONSTRAINT contact_option_ref_fk FOREIGN KEY (contact_option_ref_id) REFERENCES contact_option_ref(cor_id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
COMMENT ON TABLE public.action_person_option IS 'option for each contact';
|
||||
|
||||
-- Column comments
|
||||
|
||||
COMMENT ON COLUMN public.action_person_option.ap_value IS 'Value of the option';
|
||||
|
||||
-- renomme le menu
|
||||
update menu_ref set me_description = 'Configuration des documents dans le suivi' ,me_file='cfg_action.inc.php' ,
|
||||
me_description_etendue ='Vous permet d''ajouter de nouveaux type de documents pour le suivi (bordereau de livraison, devis..)',me_code='CFGACTION',
|
||||
me_menu='Document Suivi'
|
||||
where me_code='CFGCATDOC';
|
||||
|
||||
|
||||
ALTER TABLE public.document_option ADD do_activate int NOT NULL DEFAULT 1;
|
||||
COMMENT ON COLUMN public.document_option.do_activate IS '1 the option is activated, 0 is inativated';
|
||||
|
||||
ALTER TABLE public.document_option ADD CONSTRAINT document_option_un UNIQUE (do_code,document_type_id);
|
||||
ALTER TABLE public.document_option RENAME COLUMN do_activate TO do_enable;
|
||||
|
||||
-- ajoute un menu pour les options de contacts
|
||||
INSERT INTO public.menu_ref (me_code,me_menu,me_file,me_url,me_description,me_parameter,me_javascript,me_type,me_description_etendue) VALUES
|
||||
('CFGCONTACT','Contact','contact_option_ref.inc.php',NULL,'Configure les options pours les contacts multiples',NULL,NULL,'ME',NULL)
|
||||
;
|
||||
|
||||
INSERT INTO public.profile_menu (me_code,me_code_dep,p_id,p_order,p_type_display,pm_default,pm_id_dep) VALUES
|
||||
('CFGCONTACT','DIVPARM',1,85,'E',0,56)
|
||||
;
|
||||
|
||||
-- contact option globale pour toutes les actions
|
||||
ALTER TABLE public.contact_option_ref DROP COLUMN document_option_id;
|
||||
|
||||
-- on utilise un varchar pour stocker les possibilités
|
||||
ALTER TABLE public.contact_option_ref DROP COLUMN cor_value_json;
|
||||
ALTER TABLE public.contact_option_ref ADD cor_value_select varchar NULL;
|
||||
COMMENT ON COLUMN public.contact_option_ref.cor_value_select IS 'Select values';
|
||||
Loading…
Add table
Add a link
Reference in a new issue