From 759c98bd7a2a13daf86356af95c4b05ba3cb7056 Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Thu, 28 Feb 2019 16:25:38 +0100 Subject: [PATCH] FEAT #9514 add list ar v1 --- apps/maarch_entreprise/lang/en.php | 6 + apps/maarch_entreprise/lang/fr.php | 6 + apps/maarch_entreprise/lang/nl.php | 6 + .../sendmail/acknowledgementReceiptsList.php | 145 ++++++++++++++++++ modules/sendmail/sendmail.php | 3 +- 5 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 modules/sendmail/acknowledgementReceiptsList.php diff --git a/apps/maarch_entreprise/lang/en.php b/apps/maarch_entreprise/lang/en.php index b536aef3614..75e3bbf0ccc 100755 --- a/apps/maarch_entreprise/lang/en.php +++ b/apps/maarch_entreprise/lang/en.php @@ -5070,3 +5070,9 @@ if (!defined('_ACCESS_SMARTPHONE')) { if (!defined('_MAILING_CONFIRMATION')) { define('_MAILING_CONFIRMATION', 'Do you want to generate all attachments ?'); } +if (!defined('_ELECTRONIC')) { + define('_ELECTRONIC', 'Electronic'); +} +if (!defined('_ACKNOWLEDGEMENT_RECEIPTS')) { + define('_ACKNOWLEDGEMENT_RECEIPTS', 'Acknowledgement of receipts'); +} diff --git a/apps/maarch_entreprise/lang/fr.php b/apps/maarch_entreprise/lang/fr.php index 25baec74a73..2625c77c98e 100755 --- a/apps/maarch_entreprise/lang/fr.php +++ b/apps/maarch_entreprise/lang/fr.php @@ -5232,3 +5232,9 @@ if (!defined('_ACCESS_SMARTPHONE')) { if (!defined('_MAILING_CONFIRMATION')) { define('_MAILING_CONFIRMATION', 'Voulez-vous générer toutes les pièces jointes ?'); } +if (!defined('_ELECTRONIC')) { + define('_ELECTRONIC', 'Électronique'); +} +if (!defined('_ACKNOWLEDGEMENT_RECEIPTS')) { + define('_ACKNOWLEDGEMENT_RECEIPTS', 'Accusés de réception'); +} diff --git a/apps/maarch_entreprise/lang/nl.php b/apps/maarch_entreprise/lang/nl.php index 58360d0bf3a..09963ed5664 100755 --- a/apps/maarch_entreprise/lang/nl.php +++ b/apps/maarch_entreprise/lang/nl.php @@ -1719,3 +1719,9 @@ if (!defined('_ACCESS_SMARTPHONE')) { if (!defined('_MAILING_CONFIRMATION')) { define('_MAILING_CONFIRMATION', 'Do you want to generate all attachments ? TO TRANSLATE'); } +if (!defined('_ELECTRONIC')) { + define('_ELECTRONIC', 'Electronic'); +} +if (!defined('_ACKNOWLEDGEMENT_RECEIPTS')) { + define('_ACKNOWLEDGEMENT_RECEIPTS', 'Acknowledgement of receipts'); +} \ No newline at end of file diff --git a/modules/sendmail/acknowledgementReceiptsList.php b/modules/sendmail/acknowledgementReceiptsList.php new file mode 100644 index 00000000000..5db69c62aed --- /dev/null +++ b/modules/sendmail/acknowledgementReceiptsList.php @@ -0,0 +1,145 @@ +<?php + +//Table or view +$select = []; +$select["acknowledgement_receipts"] = []; + +//Fields +array_push( + $select["acknowledgement_receipts"], + "id", + "type", + "format", + "user_id", + "contact_address_id", + "creation_date", + "send_date" +); + +//Where clause +$where_tab = array(); +// +$where_tab[] = " res_id = ? "; + +//Build where +$where = implode(' and ', $where_tab); + +//Order +$orderstr = "order by send_date desc"; + +//Request +$tab=$request->PDOselect($select, $where, [$identifier], $orderstr, $_SESSION['config']['databasetype']); + +if (!empty($tab)) { + //Result Array + for ($i=0;$i<count($tab);$i++) { + for ($j=0;$j<count($tab[$i]);$j++) { + foreach (array_keys($tab[$i][$j]) as $value) { + if ($tab[$i][$j][$value]=="id") { + $tab[$i][$j]["label"] = 'id'; + $tab[$i][$j]["size"] = "1"; + $tab[$i][$j]["label_align"] = "left"; + $tab[$i][$j]["align"] = "left"; + $tab[$i][$j]["valign"] = "bottom"; + $tab[$i][$j]["show"] = false; + $tab[$i][$j]["order"] = 'id'; + } + if ($tab[$i][$j][$value]=="type") { + $tab[$i][$j]["label"] = _TYPE; + $tab[$i][$j]["size"] = "1"; + $tab[$i][$j]["label_align"] = "left"; + $tab[$i][$j]["align"] = "left"; + $tab[$i][$j]["valign"] = "bottom"; + $tab[$i][$j]["show"] = true; + $tab[$i][$j]["order"] = 'type'; + } + if ($tab[$i][$j][$value]=="format") { + $tab[$i][$j]["label"] = _FORMAT; + if ($tab[$i][$j]["value"] == 'html') { + $tab[$i][$j]["value"] = _ELECTRONIC; + } else { + $tab[$i][$j]["value"] = _ISPAPER; + } + $tab[$i][$j]["size"] = "1"; + $tab[$i][$j]["label_align"] = "left"; + $tab[$i][$j]["align"] = "left"; + $tab[$i][$j]["valign"] = "bottom"; + $tab[$i][$j]["show"] = true; + $tab[$i][$j]["order"] = 'format'; + } + if ($tab[$i][$j][$value]=="user_id") { + $tab[$i][$j]["label"] = _CREATE_BY; + $userInfo = \User\models\UserModel::getById(['id' => $tab[$i][$j]["value"]]); + $tab[$i][$j]["value"] = $userInfo['firstname'] . " " . $userInfo['lastname']; + $tab[$i][$j]["size"] = "3"; + $tab[$i][$j]["label_align"] = "left"; + $tab[$i][$j]["align"] = "left"; + $tab[$i][$j]["valign"] = "bottom"; + $tab[$i][$j]["show"] = true; + $tab[$i][$j]["order"] = 'user_id'; + } + if ($tab[$i][$j][$value]=="contact_address_id") { + $tab[$i][$j]["label"] = _CONTACT; + $contactInfo = \Contact\models\ContactModel::getContactFullLabel(['addressId' => $tab[$i][$j]["value"]]); + $tab[$i][$j]["value"] = $contactInfo; + $tab[$i][$j]["size"] = "4"; + $tab[$i][$j]["label_align"] = "left"; + $tab[$i][$j]["align"] = "left"; + $tab[$i][$j]["valign"] = "bottom"; + $tab[$i][$j]["show"] = true; + $tab[$i][$j]["order"] = 'contact_address_id'; + } + if ($tab[$i][$j][$value]=="creation_date") { + $tab[$i][$j]["label"] = _CREATION_DATE; + $tab[$i][$j]["value"] = $request->dateformat($tab[$i][$j]["value"]); + $tab[$i][$j]["size"] = "1"; + $tab[$i][$j]["label_align"] = "left"; + $tab[$i][$j]["align"] = "left"; + $tab[$i][$j]["valign"] = "bottom"; + $tab[$i][$j]["show"] = true; + $tab[$i][$j]["order"] = 'creation_date'; + } + if ($tab[$i][$j][$value]=="send_date") { + $tab[$i][$j]["label"] = _SENT_DATE; + $tab[$i][$j]["value"] = $request->dateformat($tab[$i][$j]["value"]); + $tab[$i][$j]["size"] = "1"; + $tab[$i][$j]["label_align"] = "left"; + $tab[$i][$j]["align"] = "left"; + $tab[$i][$j]["valign"] = "bottom"; + $tab[$i][$j]["show"] = true; + $tab[$i][$j]["order"] = 'send_date'; + } + } + } + } + + //List + $listKey = 'id'; //Cle de la liste + $paramsTab = array(); //Initialiser le tableau de parametres + $paramsTab['bool_sortColumn'] = false; //Affichage Tri + $paramsTab['pageTitle'] = '<br><br>'._ACKNOWLEDGEMENT_RECEIPTS; //Titre de la page + $paramsTab['bool_bigPageTitle'] = false; //Affichage du titre en grand + $paramsTab['bool_showToolbar'] = false; //Affichage de la toolbar + $paramsTab['urlParameters'] = 'identifier='.$identifier."&origin=".$origin.'&display=true'.$parameters; //Parametres d'url supplementaires + $paramsTab['listHeight'] = '100%'; //Hauteur de la liste + $paramsTab['listCss'] = $css; //CSS + + //Action icons array + $paramsTab['actionIcons'] = array(); + + // TO DO : LINK ROUTE + $download = array( + "script" => "window.open('../../rest/res/".$identifier."/content','_blank');", + "icon" => 'eye', + "tooltip" => _VIEW_DOC, + "disabledRules" => "empty(@@id@@)" + ); + array_push($paramsTab['actionIcons'], $download); + + $paramsTab['visualizeDocumentLink'] = $_SESSION['config']['businessappurl'].'index.php?display=true&module=attachments&page=view_attachment&res_id_master='.$_SESSION['doc_id'].'&viewpdf=true'; + + + //Output + $status = 0; + $contentAcknowledgementReceipts = $list->showList($tab, $paramsTab, $listKey); +} diff --git a/modules/sendmail/sendmail.php b/modules/sendmail/sendmail.php index 567ac7867bb..ccfff2752fd 100755 --- a/modules/sendmail/sendmail.php +++ b/modules/sendmail/sendmail.php @@ -405,6 +405,7 @@ if (isset($_REQUEST['start']) && !empty($_REQUEST['start'])) { /********* MESSAGE EXCHANGE PART ***************/ include_once 'modules/sendmail/messageExchangeList.php'; + include_once 'modules/sendmail/acknowledgementReceiptsList.php'; - echo '{status : '.$status.", content : '".addslashes($debug.$content.$contentMessageExchange)."', error : '".addslashes($error)."'}"; + echo '{status : '.$status.", content : '".addslashes($debug.$content.$contentMessageExchange.$contentAcknowledgementReceipts)."', error : '".addslashes($error)."'}"; } -- GitLab