[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 117/119: Follow-up export contact option with
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 117/119: Follow-up export contact option with all the the card's attribute |
Date: |
Mon, 26 Oct 2020 18:27:43 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit bfe3db9037671c708391a1173af4fe68113656a8
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Thu Oct 22 14:49:56 2020 +0200
Follow-up export contact option with all the the card's attribute
---
include/export/export_follow_up_contact_csv.php | 95 ++++++++++++++++++-------
1 file changed, 69 insertions(+), 26 deletions(-)
diff --git a/include/export/export_follow_up_contact_csv.php
b/include/export/export_follow_up_contact_csv.php
index 569f94f..d7b4a1e 100644
--- a/include/export/export_follow_up_contact_csv.php
+++ b/include/export/export_follow_up_contact_csv.php
@@ -37,32 +37,75 @@ if ( $g_user->can_read_action($ag_id) == false ) return;
$csv=new Noalyss_CSV("followup".$ag_id);
$csv->send_header();
-$document=new Follow_Up($cn);
-echo $document->export_csv(["tdoc"=>$ag_id]);
+$document_type=$cn->get_value("select ag_type from action_gestion where
ag_id=$1",[$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
+$aRow=$cn->get_array("select
a.f_id,ap_id,ag_id,f.ad_value,f.ad_id,fd.fd_id,jfa.jnt_order
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);
+join fiche f1 on (a.f_id=f1.f_id)
+join fiche_detail f on (a.f_id=f.f_id)
+join fiche_def fd on (fd.fd_id=f1.fd_id)
+join jnt_fic_attr jfa on (fd.fd_id=jfa.fd_id and jfa.ad_id=f.ad_id)
+where ag_id=$1
+order by f1.fd_id, a.f_id,jnt_order;;",[$ag_id]);
-$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);
\ No newline at end of file
+$nb=count($aRow);
+$lastcat=0;$lastcard=0;
+for ($i=0;$i< $nb;$i++)
+{
+
+ // for each card we sent all info
+ if ($lastcard != $aRow[$i]['f_id']) {
+ // Write contact option
+ $aOption=$cn->get_array(" select ap_value
+from
+action_person a
+join action_person_option apo on (a.ap_id=apo.action_person_id)
+join contact_option_ref cor on (cor.cor_id=apo.contact_option_ref_id)
+where ag_id=$1 and f_id=$2 order by cor_id",array($ag_id,$lastcard));
+ $nb_option=count($aOption);
+ for ($h=0;$h < $nb_option;$h++) {
+ $csv->add($h);
+ }
+ $csv->write();
+ $lastcard=$aRow[$i]['f_id'];
+ }
+ // For each category we send the column header
+ if ( $lastcat != $aRow[$i]['fd_id']) {
+ // Get attribut fd
+ $aColHeader = $cn->get_array("select jnt_order,
+ ad_text,
+ ad_type
+ from fiche_def f
+ join jnt_fic_attr jfa using (fd_id)
+ join attr_def ad using (ad_id)
+ where
+ f.fd_id=$1
+ order by jnt_order",[$aRow[$i]['fd_id']]);
+ $aCol=array();
+ $nb_col=count($aColHeader);
+ for ( $j = 0;$j < $nb_col;$j++) {
+ $aCol[]=$aColHeader[$j]['ad_text'];
+ }
+
+ // Add contact header option
+ $aOptionCat=$cn->get_array("select
+ cor.cor_label
+ from
+ public.jnt_document_option_contact jdoc
+ join contact_option_ref cor on
+ (jdoc.contact_option_ref_id = cor_id )
+ where
+ document_type_id = $1
+ and jdoc_enable = 1 order by cor_id",array($document_type));
+ $nb_col=count($aOptionCat);
+ for ( $j = 0;$j < $nb_col;$j++) {
+ $aCol[]=$aOptionCat[$j]['cor_label'];
+ }
+ $csv->write_header($aCol);
+ $lastcat=$aRow[$i]['fd_id'];
+ }
+ $csv->add($aRow[$i]['ad_value']);
+
+}
+
+$csv->write();
\ No newline at end of file
- [Noalyss-commit] [noalyss] 77/119: fix upgrade145.sql , default value must be 1 for actif, sql wrong, (continued)
- [Noalyss-commit] [noalyss] 77/119: fix upgrade145.sql , default value must be 1 for actif, sql wrong, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 78/119: Fix FollowUp : price Purchase or Sale, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 79/119: protect, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 86/119: Follow up cosmetic add title to anchor, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 87/119: Document Type : CFGACTION cannot add new document, fix order in dialog box, Fix= cannot delete action cause cascade on action_person, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 89/119: upgrade db 146, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 91/119: Follow-up correct link, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 97/119: Fix : generate document remove "extract", Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 105/119: Follow-Up Cosmetic, form before creating a new follow-up action, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 109/119: Remove select_dialog file, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 117/119: Follow-up export contact option with all the the card's attribute,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 94/119: typo : tag instead of étiquette, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 71/119: Search on active card for Contact Multiple, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 95/119: fix : select_box search doesn't work, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 12/119: Bug 1834 : duplicate , cannot confirm an duplicated operation because the $_GET is taken in priority, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 16/119: Predefined Operation rewriting, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 21/119: Bug : remove file by error, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 39/119: Bug : remove file by error, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 35/119: Predefined Operation rewriting, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 28/119: Bug : cannot export Follow Up, Dany De Bontridder, 2020/10/26
- [Noalyss-commit] [noalyss] 38/119: documentation, Dany De Bontridder, 2020/10/26