diff --git a/modules/sendmail/acknowledgementReceiptsList.php b/modules/sendmail/acknowledgementReceiptsList.php deleted file mode 100644 index 5bb4a09959a77a3abeac6b75e6f0c96ca1e3b40b..0000000000000000000000000000000000000000 --- a/modules/sendmail/acknowledgementReceiptsList.php +++ /dev/null @@ -1,154 +0,0 @@ -<?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", - "docserver_id" -); - -//Where clause -$where_tab = array(); -// -$where_tab[] = " res_id = ? "; - -//Build where -$where = implode(' and ', $where_tab); - - -//Order -$list->setOrderField('send_date'); -$orderstr = 'order by send_date desc NULLS LAST'; -//Request -$tab=$request->PDOselect($select, $where, [$identifier], $orderstr, $_SESSION['config']['databasetype'], 50000); - -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; - $user = _UNDEFINED; - if (!empty($tab[$i][$j]["value"])) { - $userInfo = \User\models\UserModel::getById(['id' => $tab[$i][$j]["value"]]); - $user = $userInfo['firstname'] . " " . $userInfo['lastname']; - } - $tab[$i][$j]["value"] = $user; - $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 = _UNDEFINED; - $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"] = false; - } - 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['bool_showBottomToolbar'] = false; - $paramsTab['urlParameters'] = 'identifier='.$identifier.'&origin=acknowledgement&display=true'.$parameters; //Parametres d'url supplementaires - $paramsTab['listHeight'] = '100%'; //Hauteur de la liste - $paramsTab['listCss'] = $css; //CSS - $paramsTab['linesToShow'] = $_SESSION['save_list']['full_count']; - - - //Action icons array - $paramsTab['actionIcons'] = array(); - - // TO DO : LINK ROUTE - $download = array( - "script" => "window.open('../../rest/res/".$identifier."/acknowledgementReceipt/@@id@@','acknowledgementReceipt');", - "icon" => 'eye', - "tooltip" => _VIEW_DOC, - "disabledRules" => "empty(@@id@@) || empty(@@docserver_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/class/class_modules_tools_Abstract.php b/modules/sendmail/class/class_modules_tools_Abstract.php index 2c983b9fd068327d1d748f5b2acc7d5055663075..7425600b29fca03ae4caaf1ff98463909891c835 100755 --- a/modules/sendmail/class/class_modules_tools_Abstract.php +++ b/modules/sendmail/class/class_modules_tools_Abstract.php @@ -526,103 +526,6 @@ abstract class SendmailAbstract extends Database return $filename; } - public function createNotesFile($coll_id, $id, $notesArray) - { - include_once "modules" . DIRECTORY_SEPARATOR . "notes" . DIRECTORY_SEPARATOR - . "class" . DIRECTORY_SEPARATOR - . "class_modules_tools.php"; - $notes_tools = new notes(); - - $db = new Database(); - - if (count($notesArray) > 0) { - //Format - $format = 'html'; - //Mime type - $mimeType = 'text/html'; - //Filename - $fileName = "notes_".date(dmY_Hi).".".$format; - //File path - $fileNameOnTmp = 'tmp_file_' . rand() - . '.' . strtolower($format); - $filePathOnTmp = $_SESSION['config'] - ['tmppath'] . DIRECTORY_SEPARATOR - . $fileNameOnTmp; - - //Create file - if (file_exists($filePathOnTmp)) { - unlink($filePathOnTmp); - } - - //File content - $content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' - . '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >'; - $content .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">'; - $content .= "<head><title>Maarch Notes</title><meta http-equiv='Content-Type' " - . "content='text/html; charset=UTF-8' /><meta content='fr' " - . "http-equiv='Content-Language'/><meta http-equiv='cache-control' " - . "content='no-cache'/><meta http-equiv='pragma' content='no-cache'>" - . "<meta http-equiv='Expires' content='0'></head>"; - $content .= "<body onload='javascript:window.print();' style='font-size:8pt'>"; - $content .= "<h2>"._NOTES."</h2>"; - $content .= "<table cellpadding='4' cellspacing='0' border='1' width='100%'>"; - - for ($i=0; $i < count($notesArray); $i++) { - $stmt = $db->query( - "select n.creation_date, n.note_text, u.lastname, " - . "u.firstname from " . NOTES_TABLE . " n inner join ". USERS_TABLE - . " u on n.user_id = u.user_id where n.id = ? and identifier = ? order by creation_date desc", - array($notesArray[$i], $id) - ); - - if ($stmt->rowCount() > 0) { - $line = $stmt->fetchObject(); - - $user = functions::show_string($line->firstname . " " . $line->lastname); - $notes = functions::show_string($line->note_text); - $date = functions::dateformat($line->creation_date); - - $content .= "<tr height='130px'>"; - $content .= "<td width='15%'>"; - $content .= "<h3>"._USER.": ". $user."</h3>"; - $content .= "<h3>"._DATE.": ". $date."</h3>"; - $content .= "</td>"; - $content .= "<td width='85%'>"; - $content .= $notes; - $content .= "</td>"; - $content .= "</tr>"; - } - } - - $content .= "</table>"; - $content .= "</body></html>"; - //Write file - $inF = fopen($filePathOnTmp, "w"); - fwrite($inF, $content); - fclose($inF); - - $viewAttachmentArr = array( - 'status' => 'ok', - 'label' => '', - 'mime_type' => $mimeType, - 'ext' => $format, - 'file_content' => '', - 'tmp_path' => $_SESSION['config'] - ['tmppath'], - 'file_path' => $filePathOnTmp, - 'filename' => $fileName, - 'called_by_ws' => '', - 'error' => '' - ); - - // $this->show_array($viewAttachmentArr); - - return $viewAttachmentArr; - } else { - return false; - } - } - public function getAttachedEntitiesMails($user_id="") { $db = new Database; @@ -736,17 +639,4 @@ abstract class SendmailAbstract extends Database return _EMAIL_DRAFT; } } - - public function messageExchangeStatus(array $args) - { - if ($args['status'] == 'S') { - return _EMAIL_SENT; - } elseif ($args['status'] == 'E') { - return _EMAIL_ERROR; - } elseif ($args['status'] == 'W') { - return _EMAIL_WAIT; - } else { - return _EMAIL_DRAFT; - } - } } diff --git a/modules/sendmail/messageExchangeList.php b/modules/sendmail/messageExchangeList.php deleted file mode 100755 index 4f1b23138fd12c7d8cc9e68722b8dea28613a879..0000000000000000000000000000000000000000 --- a/modules/sendmail/messageExchangeList.php +++ /dev/null @@ -1,186 +0,0 @@ -<?php - -//Table or view -$select = []; -$select["message_exchange"] = []; - -//Fields -array_push( - $select["message_exchange"], - "message_id", - "date", - "reference", - "type", - "sender_org_name", - "account_id", - "recipient_org_identifier", - "recipient_org_name", - "reception_date", - "operation_date", - "data", - "res_id_master", - "filename", - 'status as status_label' -); - -//Where clause -$where_tab = array(); - -$where_tab[] = " res_id_master = ? "; -$where_tab[] = " (type = 'ArchiveTransfer' or reference like '%_ReplySent')"; - -//Build where -$where = implode(' and ', $where_tab); - -//Order - $orderstr = "order by 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]=="message_id") { - $tab[$i][$j]["message_id"] = $tab[$i][$j]['value']; - $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"] = 'message_id'; - } - if ($tab[$i][$j][$value]=="date") { - $tab[$i][$j]["label"] = _CREATION_DATE; - $tab[$i][$j]["size"] = "9"; - $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"] = 'date'; - } - if ($tab[$i][$j][$value]=="reference") { - $tab[$i][$j]["label"] = _IDENTIFIER; - $tab[$i][$j]["size"] = "9"; - $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"] = 'reference'; - } - if ($tab[$i][$j][$value]=="type") { - $tab[$i][$j]["value"] = constant('_M2M_'.strtoupper($tab[$i][$j]["value"])); - $tab[$i][$j]["label"] = _TYPE; - $tab[$i][$j]["size"] = "8"; - $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]=="operation_date") { - $tab[$i][$j]["value"] = $request->dateformat($tab[$i][$j]["value"]); - $tab[$i][$j]["label"] = _OPERATION_DATE; - $tab[$i][$j]["size"] = "9"; - $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"] = 'operation_date'; - } - if ($tab[$i][$j][$value]=="reception_date") { - $tab[$i][$j]["value"] = $request->dateformat($tab[$i][$j]["value"]); - $tab[$i][$j]["label"] = _RECEPTION_DATE; - $tab[$i][$j]["size"] = "9"; - $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"] = 'reception_date'; - } - if ($tab[$i][$j][$value]=="recipient_org_name") { - $tab[$i][$j]["value"] = $tab[$i][$j]["value"] . " (" . $recipient_org_identifier . ")"; - $tab[$i][$j]["label"] = _RECIPIENT; - $tab[$i][$j]["size"] = "20"; - $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"] = 'recipient_org_name'; - } - if ($tab[$i][$j][$value]=="sender_org_name") { - $sender_org_name = $tab[$i][$j]["value"]; - $tab[$i][$j]["show"] = false; - } - if ($tab[$i][$j][$value]=="recipient_org_identifier") { - $recipient_org_identifier = $tab[$i][$j]["value"]; - $tab[$i][$j]["show"] = false; - } - if ($tab[$i][$j][$value]=="account_id") { - $userInfo = \User\models\UserModel::getByLogin(['login' => $tab[$i][$j]["value"]]); - $senderName = ''; - if (!empty($sender_org_name)) { - $senderName = ' ('.$sender_org_name.')'; - } - $tab[$i][$j]["value"] = $userInfo['firstname'] . " " . $userInfo['lastname'] . $senderName; - $tab[$i][$j]["label"] = _SENDER; - $tab[$i][$j]["size"] = "20"; - $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"] = 'account_id'; - } - if ($tab[$i][$j][$value]=="status_label") { - $tab[$i][$j]['value'] = $sendmail_tools->messageExchangeStatus(['status' => $tab[$i][$j]['value']]); - $tab[$i][$j]["label"] = _STATUS; - $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"] = 'status_label'; - } - } - } - } - - //List - $listKey = 'message_id'; // Cle de la liste - $paramsTab = array(); // Initialiser le tableau de parametres - $paramsTab['bool_sortColumn'] = false; // Affichage Tri - $paramsTab['pageTitle'] = '<br><br>'._NUMERIC_PACKAGE_SENT; // Titre de la page - $paramsTab['bool_bigPageTitle'] = false; // Affichage du titre en grand - $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(); - $read = array( - "script" => "showEmailForm('".$_SESSION['config']['businessappurl'] - ."index.php?display=true&module=sendmail&page=sendmail_ajax_content" - ."&mode=read&id=@@message_id@@&identifier=".$identifier."&origin=".$origin.'&formContent=messageExchange' - . $parameters."');", - "icon" => 'eye', - "tooltip" => _READ - ); - array_push($paramsTab['actionIcons'], $read); - - $download = array( - "script" => "window.location = 'index.php?display=true&module=sendmail&page=sendmail_ajax_content" - ."&mode=download&id=@@message_id@@&identifier=".$identifier."&origin=".$origin."&formContent=messageExchange" - . $parameters."';", - "icon" => 'download', - "tooltip" => _SIMPLE_DOWNLOAD, - "disabledRules" => "empty(@@filename@@)" - ); - array_push($paramsTab['actionIcons'], $download); - - //Output - $status = 0; - $contentMessageExchange = $list->showList($tab, $paramsTab, $listKey); -} diff --git a/modules/sendmail/sendmail.php b/modules/sendmail/sendmail.php index 38f1fb0e14ae5760cddbfd75b44ec612e39e62ca..0abda462117e1aecf64d6b3aeab91e750061cb7c 100755 --- a/modules/sendmail/sendmail.php +++ b/modules/sendmail/sendmail.php @@ -358,9 +358,9 @@ if (isset($_REQUEST['load'])) { $content .= '<script>loadToolbarBadge(\'sendmail_tab\',\''.$toolbarBagde_script.'\');</script>'; - /********* MESSAGE EXCHANGE PART ***************/ - include_once 'modules/sendmail/messageExchangeList.php'; - include_once 'modules/sendmail/acknowledgementReceiptsList.php'; + // /********* MESSAGE EXCHANGE PART ***************/ + // include_once 'modules/sendmail/messageExchangeList.php'; + // include_once 'modules/sendmail/acknowledgementReceiptsList.php'; echo '{status : '.$status.", content : '".addslashes($debug.$content.$contentMessageExchange.$contentAcknowledgementReceipts)."', error : '".addslashes($error)."'}"; } diff --git a/src/app/email/models/EmailModel.php b/src/app/email/models/EmailModel.php index 14825554498efb6f7cb3b26feed1d6e7e008ff7b..0173cf78506e56b1404075ae982a6966a6109abb 100644 --- a/src/app/email/models/EmailModel.php +++ b/src/app/email/models/EmailModel.php @@ -115,25 +115,4 @@ class EmailModel return true; } - - public static function hasJoinFiles(array $aArgs) - { - ValidatorModel::notEmpty($aArgs, ['id']); - ValidatorModel::intVal($aArgs, ['id']); - - $email = DatabaseModel::select([ - 'select' => ['document'], - 'table' => ['emails'], - 'where' => ['id = ?'], - 'data' => [$aArgs['id']], - ]); - - $document = (array)json_decode($email[0]['document']); - - if ($document['isLinked'] || !empty($document['attachments']) || !empty($document['notes'])) { - return true; - } else { - return false; - } - } }