Restructure files , move show_document.php to export_document.php
This commit is contained in:
parent
c59cca605b
commit
9da5661d42
5 changed files with 81 additions and 41 deletions
|
|
@ -33,9 +33,14 @@
|
||||||
*/
|
*/
|
||||||
function remove_document(p_dossier,p_id)
|
function remove_document(p_dossier,p_id)
|
||||||
{
|
{
|
||||||
var queryString="gDossier="+p_dossier+"&a=rm&d_id="+p_id;
|
var queryString={
|
||||||
|
"gDossier":p_dossier,
|
||||||
|
"a":"rm",
|
||||||
|
"d_id":p_id,
|
||||||
|
'act':'RAW:document'
|
||||||
|
};
|
||||||
var action=new Ajax.Request (
|
var action=new Ajax.Request (
|
||||||
"show_document.php",
|
"export.php",
|
||||||
{
|
{
|
||||||
method:'get',
|
method:'get',
|
||||||
parameters:queryString,
|
parameters:queryString,
|
||||||
|
|
@ -53,10 +58,15 @@ function remove_document(p_dossier,p_id)
|
||||||
*/
|
*/
|
||||||
function update_document(p_dossier,p_id)
|
function update_document(p_dossier,p_id)
|
||||||
{
|
{
|
||||||
var queryString="gDossier="+p_dossier+"&a=upd_doc&d_id="+p_id;
|
var queryString={
|
||||||
queryString+="&value="+$('input_desc_txt'+p_id).value;
|
"gDossier":p_dossier,
|
||||||
|
"a":"upd_doc",
|
||||||
|
"d_id":p_id,
|
||||||
|
'act':'RAW:document',
|
||||||
|
'value':$('input_desc_txt'+p_id).value
|
||||||
|
};
|
||||||
var action=new Ajax.Request (
|
var action=new Ajax.Request (
|
||||||
"show_document.php",
|
"export.php",
|
||||||
{
|
{
|
||||||
method:'get',
|
method:'get',
|
||||||
parameters:queryString,
|
parameters:queryString,
|
||||||
|
|
@ -79,9 +89,14 @@ function update_document(p_dossier,p_id)
|
||||||
*/
|
*/
|
||||||
function remove_operation(p_dossier,p_id)
|
function remove_operation(p_dossier,p_id)
|
||||||
{
|
{
|
||||||
var queryString="gDossier="+p_dossier+"&a=rmop&id="+p_id;
|
var queryString={
|
||||||
|
"gDossier":p_dossier,
|
||||||
|
"a":"rmop",
|
||||||
|
"id":p_id,
|
||||||
|
'act':'RAW:document'
|
||||||
|
};
|
||||||
var action=new Ajax.Request (
|
var action=new Ajax.Request (
|
||||||
"show_document.php",
|
"export.php",
|
||||||
{
|
{
|
||||||
method:'get',
|
method:'get',
|
||||||
parameters:queryString,
|
parameters:queryString,
|
||||||
|
|
@ -115,9 +130,15 @@ function successRemoveOp(request,json)
|
||||||
*/
|
*/
|
||||||
function remove_action(p_dossier,p_id,ag_id)
|
function remove_action(p_dossier,p_id,ag_id)
|
||||||
{
|
{
|
||||||
queryString="gDossier="+p_dossier+"&a=rmaction&id="+p_id+"&ag_id="+ag_id;
|
var queryString={
|
||||||
|
"gDossier":p_dossier,
|
||||||
|
"a":"rmaction",
|
||||||
|
"id":p_id,
|
||||||
|
"ag_id":ag_id,
|
||||||
|
'act':'RAW:document'
|
||||||
|
};
|
||||||
var action=new Ajax.Request (
|
var action=new Ajax.Request (
|
||||||
"show_document.php",
|
"export.php",
|
||||||
{
|
{
|
||||||
method:'get',
|
method:'get',
|
||||||
parameters:queryString,
|
parameters:queryString,
|
||||||
|
|
@ -146,9 +167,14 @@ function remove_action(p_dossier,p_id,ag_id)
|
||||||
*/
|
*/
|
||||||
function remove_comment(p_dossier,p_id)
|
function remove_comment(p_dossier,p_id)
|
||||||
{
|
{
|
||||||
queryString="gDossier="+p_dossier+"&a=rmcomment&id="+p_id;
|
var queryString={
|
||||||
|
"gDossier":p_dossier,
|
||||||
|
"a":"rmcomment",
|
||||||
|
"id":p_id,
|
||||||
|
'act':'RAW:document'
|
||||||
|
};
|
||||||
var action=new Ajax.Request (
|
var action=new Ajax.Request (
|
||||||
"show_document.php",
|
"export.php",
|
||||||
{
|
{
|
||||||
method:'get',
|
method:'get',
|
||||||
parameters:queryString,
|
parameters:queryString,
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,8 @@ class Document
|
||||||
}
|
}
|
||||||
$this->SaveGenerated($dirname.DIRECTORY_SEPARATOR.$file_to_parse);
|
$this->SaveGenerated($dirname.DIRECTORY_SEPARATOR.$file_to_parse);
|
||||||
// Invoice
|
// Invoice
|
||||||
$ret='<A class="mtitle" HREF="show_document.php?d_id='.$this->d_id.'&'.dossier::get().'">Document généré</A>';
|
$href=http_build_query(array('gDossier'=>Dossier::id(),"d_id"=>$this->d_id,'act'=>'RAW:document'));
|
||||||
|
$ret='<A class="mtitle" HREF="export.php?'.$href.'">Document généré</A>';
|
||||||
@rmdir($dirname);
|
@rmdir($dirname);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
@ -409,7 +410,9 @@ class Document
|
||||||
return '';
|
return '';
|
||||||
$image='<IMG SRC="image/insert_table.gif" title="'.$this->d_filename.'" border="0">';
|
$image='<IMG SRC="image/insert_table.gif" title="'.$this->d_filename.'" border="0">';
|
||||||
$r="";
|
$r="";
|
||||||
$r='<A class="mtitle" HREF="show_document.php?d_id='.$this->d_id.'&'.dossier::get().'">'.$image.'</A>';
|
$href=http_build_query(array('gDossier'=>Dossier::id(),"d_id"=>$this->d_id,'act'=>'RAW:document'));
|
||||||
|
|
||||||
|
$r='<A class="mtitle" HREF="export.php?'.$href.'">'.$image.'</A>';
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
/** Get
|
/** Get
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ class Follow_Up
|
||||||
$upload->readOnly=$readonly;
|
$upload->readOnly=$readonly;
|
||||||
$upload->value="";
|
$upload->value="";
|
||||||
$aAttachedFile=$this->db->get_array('select d_id,d_filename,d_description,d_mimetype,'.
|
$aAttachedFile=$this->db->get_array('select d_id,d_filename,d_description,d_mimetype,'.
|
||||||
'\'show_document.php?'.
|
'\'export.php?act=RAW:document&'.
|
||||||
Dossier::get().'&d_id=\'||d_id as link'.
|
Dossier::get().'&d_id=\'||d_id as link'.
|
||||||
' from document where ag_id=$1', array($this->ag_id));
|
' from document where ag_id=$1', array($this->ag_id));
|
||||||
/* create the select for document */
|
/* create the select for document */
|
||||||
|
|
|
||||||
|
|
@ -19,31 +19,36 @@
|
||||||
*/
|
*/
|
||||||
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
// Copyright Author Dany De Bontridder danydb@aevalys.eu
|
||||||
// Verify parameters
|
// Verify parameters
|
||||||
/** \file
|
/**
|
||||||
|
* \file
|
||||||
* \brief retrieve a document
|
* \brief retrieve a document
|
||||||
*/
|
*/
|
||||||
require_once '../include/constant.php';
|
if ( ! defined ('ALLOWED')) die (_('Non autorisé'));
|
||||||
require_once NOALYSS_INCLUDE.'/lib/class_database.php';
|
|
||||||
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
|
||||||
require_once NOALYSS_INCLUDE.'/class/class_document.php';
|
require_once NOALYSS_INCLUDE.'/class/class_document.php';
|
||||||
require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
|
require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
|
||||||
$gDossier = dossier::id();
|
|
||||||
$cn = Dossier::connect();
|
|
||||||
$action = (isset($_REQUEST['a'])) ? $_REQUEST['a'] : 'sh';
|
$action = (isset($_REQUEST['a'])) ? $_REQUEST['a'] : 'sh';
|
||||||
|
|
||||||
require_once NOALYSS_INCLUDE.'/class/class_user.php';
|
$d_id=HtmlInput::default_value_request('d_id',0);
|
||||||
global $g_user;
|
$id=HtmlInput::default_value_request('id',0);
|
||||||
$g_user = new User($cn);
|
$ag_id=HtmlInput::default_value_request('ag_id',0);
|
||||||
$g_user->Check();
|
$value=HtmlInput::default_value_request('value', null);
|
||||||
$g_user->check_dossier($gDossier);
|
|
||||||
set_language();
|
if ( isNumber($id) == 0 ||
|
||||||
|
isNumber($ag_id) == 0 ||
|
||||||
|
isNumber($d_id) == 0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
die (_('Données invalides'));
|
||||||
|
}
|
||||||
/* Show the document */
|
/* Show the document */
|
||||||
if ($action == 'sh')
|
if ($action == 'sh')
|
||||||
{
|
{
|
||||||
if ($g_user->check_action(VIEWDOC) == 1)
|
if ($g_user->check_action(VIEWDOC) == 1)
|
||||||
{
|
{
|
||||||
// retrieve the document
|
// retrieve the document
|
||||||
$doc = new Document($cn, $_REQUEST['d_id']);
|
$doc = new Document($cn, $d_id);
|
||||||
$doc->Send();
|
$doc->Send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -53,9 +58,9 @@ if ($action == 'rm')
|
||||||
$json='{"d_id":"-1"}';
|
$json='{"d_id":"-1"}';
|
||||||
if ($g_user->check_action(RMDOC) == 1)
|
if ($g_user->check_action(RMDOC) == 1)
|
||||||
{
|
{
|
||||||
$doc = new Document($cn, $_REQUEST['d_id']);
|
$doc = new Document($cn, $d_id);
|
||||||
$doc->remove();
|
$doc->remove();
|
||||||
$json = sprintf('{"d_id":"%s"}', $_REQUEST['d_id']);
|
$json = sprintf('{"d_id":"%s"}', $d_id);
|
||||||
}
|
}
|
||||||
header("Content-type: text/html; charset: utf8", true);
|
header("Content-type: text/html; charset: utf8", true);
|
||||||
print $json;
|
print $json;
|
||||||
|
|
@ -65,11 +70,11 @@ if ( $action == "upd_doc")
|
||||||
{
|
{
|
||||||
if ($g_user->check_action(VIEWDOC) == 1)
|
if ($g_user->check_action(VIEWDOC) == 1)
|
||||||
{
|
{
|
||||||
$doc = new Document($cn, $_REQUEST['d_id']);
|
$doc = new Document($cn, $d_id);
|
||||||
$doc->get();
|
$doc->get();
|
||||||
if ( $g_user->can_write_action($doc->ag_id))
|
if ( $g_user->can_write_action($doc->ag_id))
|
||||||
// retrieve the document
|
// retrieve the document
|
||||||
$doc->update_description(strip_tags ($_REQUEST['value']));
|
$doc->update_description(strip_tags ($value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -77,11 +82,11 @@ if ( $action == "upd_doc")
|
||||||
if ($action == 'rmop')
|
if ($action == 'rmop')
|
||||||
{
|
{
|
||||||
$json = '{"ago_id":"-1"}';
|
$json = '{"ago_id":"-1"}';
|
||||||
$dt_id = $cn->get_value("select ag_id from action_gestion_operation where ago_id=$1",array( $_REQUEST['id']));
|
$dt_id = $cn->get_value("select ag_id from action_gestion_operation where ago_id=$1",array( $id));
|
||||||
if ($g_user->check_action(RMDOC) == 1 && $g_user->can_write_action($dt_id) == true)
|
if ($g_user->check_action(RMDOC) == 1 && $g_user->can_write_action($dt_id) == true)
|
||||||
{
|
{
|
||||||
$cn->exec_sql("delete from action_gestion_operation where ago_id=$1", array($_REQUEST['id']));
|
$cn->exec_sql("delete from action_gestion_operation where ago_id=$1", array($id));
|
||||||
$json = sprintf('{"ago_id":"%s"}', $_REQUEST['id']);
|
$json = sprintf('{"ago_id":"%s"}', $id);
|
||||||
}
|
}
|
||||||
header("Content-type: text/html; charset: utf8", true);
|
header("Content-type: text/html; charset: utf8", true);
|
||||||
print $json;
|
print $json;
|
||||||
|
|
@ -90,11 +95,11 @@ if ($action == 'rmop')
|
||||||
if ($action == 'rmcomment')
|
if ($action == 'rmcomment')
|
||||||
{
|
{
|
||||||
$json = '{"agc_id":"-1"}';
|
$json = '{"agc_id":"-1"}';
|
||||||
$dt_id = $cn->get_value("select ag_id from action_gestion_comment where agc_id=$1", array($_REQUEST['id']));
|
$dt_id = $cn->get_value("select ag_id from action_gestion_comment where agc_id=$1", array($id));
|
||||||
if ($g_user->check_action(RMDOC) == 1 && $g_user->can_write_action($dt_id) == true)
|
if ($g_user->check_action(RMDOC) == 1 && $g_user->can_write_action($dt_id) == true)
|
||||||
{
|
{
|
||||||
$cn->exec_sql("delete from action_gestion_comment where agc_id=$1", array($_REQUEST['id']));
|
$cn->exec_sql("delete from action_gestion_comment where agc_id=$1", array($id));
|
||||||
$json = sprintf('{"agc_id":"%s"}', $_REQUEST['id']);
|
$json = sprintf('{"agc_id":"%s"}', $id);
|
||||||
}
|
}
|
||||||
header("Content-type: text/html; charset: utf8", true);
|
header("Content-type: text/html; charset: utf8", true);
|
||||||
print $json;
|
print $json;
|
||||||
|
|
@ -103,11 +108,11 @@ if ($action == 'rmcomment')
|
||||||
if ($action == 'rmaction')
|
if ($action == 'rmaction')
|
||||||
{
|
{
|
||||||
$json = '{"act_id":"-1"}';
|
$json = '{"act_id":"-1"}';
|
||||||
if ($g_user->check_action(RMDOC) == 1 && $g_user->can_write_action($_REQUEST['id']) == true && $g_user->can_write_action($_REQUEST['ag_id']) == true)
|
if ($g_user->check_action(RMDOC) == 1 && $g_user->can_write_action($id) == true && $g_user->can_write_action($ag_id) == true)
|
||||||
{
|
{
|
||||||
$cn->exec_sql("delete from action_gestion_related where aga_least=$1 and aga_greatest=$2", array($_REQUEST['id'], $_REQUEST['ag_id']));
|
$cn->exec_sql("delete from action_gestion_related where aga_least=$1 and aga_greatest=$2", array($id, $ag_id));
|
||||||
$cn->exec_sql("delete from action_gestion_related where aga_least=$2 and aga_greatest=$1", array($_REQUEST['id'], $_REQUEST['ag_id']));
|
$cn->exec_sql("delete from action_gestion_related where aga_least=$2 and aga_greatest=$1", array($id, $ag_id));
|
||||||
$json = sprintf('{"act_id":"%s"}', $_REQUEST['id']);
|
$json = sprintf('{"act_id":"%s"}', $id);
|
||||||
}
|
}
|
||||||
header("Content-type: text/html; charset: utf8", true);
|
header("Content-type: text/html; charset: utf8", true);
|
||||||
print $json;
|
print $json;
|
||||||
|
|
@ -9,4 +9,10 @@ CREATE TRIGGER fiche_detail_upd_trg
|
||||||
insert into menu_ref(me_code,me_file,me_menu,me_description,me_type)
|
insert into menu_ref(me_code,me_file,me_menu,me_description,me_type)
|
||||||
values ('RAW:receipt','export_receipt.php','Export la pièce','export la pièce justificative d''une opération','PR');
|
values ('RAW:receipt','export_receipt.php','Export la pièce','export la pièce justificative d''une opération','PR');
|
||||||
|
|
||||||
insert into profile_menu (me_code,p_id,p_type_display) select 'RAW:receipt',p_id,'P' from profile where p_id > 0;
|
insert into profile_menu (me_code,p_id,p_type_display) select 'RAW:receipt',p_id,'P' from profile where p_id > 0;
|
||||||
|
|
||||||
|
|
||||||
|
insert into menu_ref(me_code,me_file,me_menu,me_description,me_type)
|
||||||
|
values ('RAW:document','export_document.php','Export le document','export le document d''une événement','PR');
|
||||||
|
|
||||||
|
insert into profile_menu (me_code,p_id,p_type_display) select 'RAW:document',p_id,'P' from profile where p_id > 0;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue