Contact option : export CSV
This commit is contained in:
parent
d3a05bfa18
commit
75190f41e1
5 changed files with 83 additions and 3 deletions
|
|
@ -50,6 +50,7 @@ if ( $action=='X' || $g_user->check_print($action)==0 )
|
|||
|
||||
$prfile=$cn->get_value("select me_file from menu_ref where me_code=$1",array($action));
|
||||
if ( $prfile == "") {
|
||||
print $action;
|
||||
die (_('Export impossible'));
|
||||
}
|
||||
require_once NOALYSS_INCLUDE."/export/$prfile";
|
||||
|
|
|
|||
|
|
@ -209,9 +209,11 @@ if ($sub_action == 'detail')
|
|||
$act->ag_id = $ag_id;
|
||||
echo $act->get();
|
||||
}
|
||||
|
||||
|
||||
if ($g_user->can_write_action($ag_id) == true)
|
||||
{
|
||||
|
||||
echo '<form enctype="multipart/form-data" id="action_common_frm" class="print" action="do.php" method="post" >';
|
||||
echo $supl_hidden;
|
||||
echo HtmlInput::hidden('ac', $http->request('ac'));
|
||||
|
|
@ -221,6 +223,7 @@ if ($sub_action == 'detail')
|
|||
echo '<input type="hidden" id="delete" name="delete" value="0">';
|
||||
echo HtmlInput::submit("save", "Sauve",' onclick="$(\'delete\').value=0"');
|
||||
echo HtmlInput::submit("add_action_here", _("Ajoute un événement à celui-ci"),' onclick="$(\'delete\').value=0"');
|
||||
|
||||
//
|
||||
if ($g_user->can_delete_action($ag_id))
|
||||
{
|
||||
|
|
|
|||
68
include/export/export_follow_up_contact_csv.php
Normal file
68
include/export/export_follow_up_contact_csv.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?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/follow_up.class.php';
|
||||
require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php';
|
||||
|
||||
$http=new HttpInput();
|
||||
$ag_id=$http->get("ag_id", "number");
|
||||
|
||||
if ( $g_user->can_read_action($ag_id) == false ) return;
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief export a follow up in CSV
|
||||
*/
|
||||
$csv=new Noalyss_CSV("followup".$ag_id);
|
||||
$csv->send_header();
|
||||
|
||||
$document=new Follow_Up($cn);
|
||||
echo $document->export_csv(["tdoc"=>$ag_id]);
|
||||
|
||||
$ret=$cn->exec_sql("select f_id,(select ad_value from fiche_detail where f_id=a.f_id and ad_id=25) as company,
|
||||
(select ad_value from fiche_detail where f_id=a.f_id and ad_id=1) as name,
|
||||
(select ad_value from fiche_detail where f_id=a.f_id and ad_id=32) as first_name,
|
||||
(select ad_value from fiche_detail where f_id=a.f_id and ad_id=23) as quick_code,
|
||||
cor.cor_label,
|
||||
apo.ap_value
|
||||
from action_person a
|
||||
left join action_person_option apo ON (a.ap_id=apo.action_person_id)
|
||||
left join contact_option_ref cor on (apo.contact_option_ref_id=cor.cor_id)
|
||||
where ag_id=$1",[$ag_id]);
|
||||
$aTitle= array (
|
||||
array("title"=>_("fiche_id"), "type"=>"string"),
|
||||
array("title"=>_("société"), "type"=>"string"),
|
||||
array("title"=>_("nom"), "type"=>"string"),
|
||||
array("title"=>_("prénom"), "type"=>"string"),
|
||||
array("title"=>_("qcode"), "type"=>"string"),
|
||||
array("title"=>_("option"), "type"=>"string"),
|
||||
array("title"=>_("valeur"), "type"=>"string"));
|
||||
$cn->query_to_csv($ret,$aTitle);
|
||||
|
||||
$ret=$cn->exec_sql('select t_tag,t_description from action_tags join tags using (t_id) where ag_id=$1',[$ag_id]);
|
||||
$aTitle=array(
|
||||
array('title'=>_('Etiquette'),"type"=>"string"),
|
||||
array('title'=>_("Description"),"type"=>"string")
|
||||
);
|
||||
$cn->query_to_csv($ret,$aTitle);
|
||||
|
|
@ -80,7 +80,13 @@ $uniq=uniqid("tab",TRUE);
|
|||
?>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<?php
|
||||
$csv="export.php?".
|
||||
http_build_query(["gDossier"=>Dossier::id(),
|
||||
"act"=>"CSV:FollowUpContactOption",
|
||||
"ag_id"=>$ag_id]);
|
||||
echo HtmlInput::anchor(_("Export CSV"), $csv);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
|
@ -149,7 +155,7 @@ $uniq=uniqid("tab",TRUE);
|
|||
<?php if ($this->ag_id > 0 ): ?>
|
||||
<tr>
|
||||
<TD>
|
||||
Dossier / tags
|
||||
Dossier / Etiquette
|
||||
</TD>
|
||||
|
||||
<td id="action_tag_td">
|
||||
|
|
|
|||
|
|
@ -20,4 +20,6 @@ ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_optio
|
|||
insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (54,'Actif','check','1');
|
||||
insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ;
|
||||
insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id,54,30 from fiche_def;
|
||||
insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1;
|
||||
insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1;
|
||||
insert into menu_ref(me_code,me_menu,me_file,me_type) values ('CSV:FollowUpContactOption','Export action suivi','export_follow_up_contact_csv.php','PR');
|
||||
insert into profile_menu (me_code,p_id,p_type_display) select 'CSV:FollowUpContactOption',p_id,'P' from profile;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue