Commit cb97b661 authored by Florian Azizian's avatar Florian Azizian

Merge branch 'develop' into 'master'

Develop

See merge request maarch/MaarchCourrier!135
parents 0c1a0a1c 41061bd9
......@@ -65,9 +65,14 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
$templatesControler = new templates_controler();
$templates = array();
$stmt = $db->query("SELECT destination FROM res_letterbox WHERE res_id = (?)", [$res_id]);
$resultDest = $stmt->fetchObject();
$destination = $resultDest->destination;
if(is_integer($res_id)){
$stmt = $db->query("SELECT destination FROM res_letterbox WHERE res_id = (?)", [$res_id]);
$resultDest = $stmt->fetchObject();
$destination = $resultDest->destination;
} else {
$destination = '';
}
if ($destination <> '') {
$templates = $templatesControler->getAllTemplatesForProcess($destination);
} else {
......
......@@ -287,8 +287,6 @@ function get_value_fields($values, $field)
function hasAttachmentError()
{
$isMailingAttach = \Attachment\controllers\AttachmentController::isMailingAttach(["resIdMaster" => $_SESSION['doc_id'], "userId" => $_SESSION['user']['UserId']]);
if (!empty($_SESSION['stockCheckbox'])) {
$resIds = $_SESSION['stockCheckbox'];
} else {
......
......@@ -1057,20 +1057,22 @@ abstract class lists_Abstract extends Database
return _WRONG_PARAM_FOR_LOAD_VALUE;
} else {
$column = $my_explode[1];
for ($i = 0; $i <= count($resultTheLine); ++$i) {
if ($resultTheLine[$i]['column'] == $column) {
if (is_bool($resultTheLine[$i]['value'])) {
//If boolean (convert to string)
if ($resultTheLine[$i]['value']) {
return 'true';
} else {
return 'false';
}
} else {
if ($resultTheLine[$i]['column'] == 'subject') {
return preg_replace('/\s+/', ' ', $resultTheLine[$i]['value']);
if (is_array($resultTheLine)) {
for ($i = 0; $i <= count($resultTheLine); ++$i) {
if ($resultTheLine[$i]['column'] == $column) {
if (is_bool($resultTheLine[$i]['value'])) {
//If boolean (convert to string)
if ($resultTheLine[$i]['value']) {
return 'true';
} else {
return 'false';
}
} else {
return $resultTheLine[$i]['value'];
if ($resultTheLine[$i]['column'] == 'subject') {
return preg_replace('/\s+/', ' ', $resultTheLine[$i]['value']);
} else {
return $resultTheLine[$i]['value'];
}
}
}
}
......@@ -1089,9 +1091,11 @@ abstract class lists_Abstract extends Database
{
//Get the ListKey value
$keyValue = '';
for ($i = 0; $i <= count($resultTheLine); ++$i) {
if ($resultTheLine[$i]['column'] == $listKey) {
$keyValue = $resultTheLine[$i]['value'];
if (is_array($resultTheLine)) {
for ($i = 0; $i <= count($resultTheLine); ++$i) {
if ($resultTheLine[$i]['column'] == $listKey) {
$keyValue = $resultTheLine[$i]['value'];
}
}
}
......@@ -1144,9 +1148,11 @@ abstract class lists_Abstract extends Database
//Get the ListKey value
$keyValue = '';
for ($i = 0; $i <= count($resultTheLine); ++$i) {
if ($resultTheLine[$i]['column'] == $listKey) {
$keyValue = $resultTheLine[$i]['value'];
if (is_array($resultTheLine)) {
for ($i = 0; $i <= count($resultTheLine); ++$i) {
if ($resultTheLine[$i]['column'] == $listKey) {
$keyValue = $resultTheLine[$i]['value'];
}
}
}
//If radio button is activated (is it important if template???)
......@@ -1176,20 +1182,23 @@ abstract class lists_Abstract extends Database
protected function _tmplt_showIconDocument($resultTheLine, $listKey)
{
$core = new core_tools();
$return = '';
//Show document icon
foreach ($resultTheLine as $r) {
if (isset($r['res_id'])) {
$res_id = $r['res_id'];
break;
if (is_array($resultTheLine)) {
foreach ($resultTheLine as $r) {
if (isset($r['res_id'])) {
$res_id = $r['res_id'];
break;
}
}
}
$isAttachment = false;
foreach ($resultTheLine as $r) {
if ($r['column'] === 'attachment_type') {
$isAttachment = true;
break;
if (is_array($resultTheLine)) {
foreach ($resultTheLine as $r) {
if ($r['column'] === 'attachment_type') {
$isAttachment = true;
break;
}
}
}
......@@ -1413,9 +1422,11 @@ abstract class lists_Abstract extends Database
) {
//Get the ListKey value
$keyValue = '';
for ($i = 0; $i <= count($resultTheLine); ++$i) {
if ($resultTheLine[$i]['column'] == $listKey) {
$keyValue = $resultTheLine[$i]['value'];
if (is_array($resultTheLine)) {
for ($i = 0; $i <= count($resultTheLine); ++$i) {
if ($resultTheLine[$i]['column'] == $listKey) {
$keyValue = $resultTheLine[$i]['value'];
}
}
}
$sAction = \Action\models\ActionModel::getActionPageById(['id' => $this->params['defaultAction']]);
......@@ -1633,7 +1644,7 @@ abstract class lists_Abstract extends Database
public function tmplt_func_bool_see_multi_contacts($resultTheLine)
{
$return = '';
$nbresult_I = count($resultTheLine);
$nbresult_I = is_array($resultTheLine) ? count($resultTheLine) : 0;
for ($iresults = 0; $iresults < $nbresult_I; ++$iresults) {
if ($resultTheLine[$iresults]['is_multi_contacts']) {
......@@ -1956,9 +1967,11 @@ abstract class lists_Abstract extends Database
if (!empty($listKey)) {
//Get the ListKey value
$keyValue = '';
for ($i = 0; $i <= count($resultTheLine); ++$i) {
if ($resultTheLine[$i]['column'] == $listKey) {
$keyValue = $resultTheLine[$i]['value'];
if (is_array($resultTheLine)) {
for ($i = 0; $i <= count($resultTheLine); ++$i) {
if ($resultTheLine[$i]['column'] == $listKey) {
$keyValue = $resultTheLine[$i]['value'];
}
}
}
$link .= '&id='.$keyValue;
......
......@@ -3907,4 +3907,10 @@ function openSenderInfoContact(id, type) {
}
window.open('index.php?display=true&dir=my_contacts&page=info_contact_iframe&mode=editDetailSender&editDetailSender&popup&sender_recipient_id='+id+'&sender_recipient_type='+type, 'contact_info', 'height='+height+', width=1000,scrollbars=yes,resizable=yes');
}
}
\ No newline at end of file
}
function displayAddMailing() {
if ($j("#mailingInfo").is(":visible")) {
$j("#addMailing").show();
}
}
......@@ -5079,3 +5079,6 @@ if (!defined('_SENDMAIL_PARAM')) {
if (!defined('_ACCESS_SMARTPHONE')) {
define('_ACCESS_SMARTPHONE', 'Go to mobile mode ?');
}
if (!defined('_MAILING_CONFIRMATION')) {
define('_MAILING_CONFIRMATION', 'Do you want to generate all attachments ?');
}
......@@ -5241,3 +5241,6 @@ if (!defined('_SENDMAIL_PARAM')) {
if (!defined('_ACCESS_SMARTPHONE')) {
define('_ACCESS_SMARTPHONE', 'Accéder à la version mobile ?');
}
if (!defined('_MAILING_CONFIRMATION')) {
define('_MAILING_CONFIRMATION', 'Voulez-vous générer toutes les pièces jointes ?');
}
......@@ -1719,4 +1719,7 @@ if (!defined('_SENDMAIL_PARAM')) {
}
if (!defined('_ACCESS_SMARTPHONE')) {
define('_ACCESS_SMARTPHONE', '_TO_TRANSLATE');
}
\ No newline at end of file
}
if (!defined('_MAILING_CONFIRMATION')) {
define('_MAILING_CONFIRMATION', 'Do you want to generate all attachments ? TO TRANSLATE');
}
......@@ -735,7 +735,7 @@ class functions
* Returns a string without the escaping characters
*
* @param $string string String to format
* @return Formated string
* @return string
*/
public static function show_string($string, $replace_CR = false, $chars_to_escape = array(), $databasetype = '', $escape_quote = true)
{
......
This diff is collapsed.
......@@ -251,6 +251,7 @@ function loadSelectedContact() {
if (ContactAndAddress == 'mailing') {
$j("#contactDiv").hide();
$j("#addMailing").show();
$j("#newAttachDiv").hide();
$j('#contactidAttach').val('mailing');
$j('#mailingInfo').slideToggle("slow");
......@@ -258,6 +259,7 @@ function loadSelectedContact() {
if ($j('#mailingInfo').is(':visible')) {
$j('#mailingInfo').slideToggle("slow");
}
$j("#addMailing").hide();
$j("#contactDiv").show();
$j("#newAttachDiv").show();
var value = ContactAndAddress.split("#");
......@@ -269,6 +271,7 @@ function loadSelectedContact() {
if ($j("#choose_file").css("display") !== "inline-block") {
$j("#add").hide();
$j("#addMailing").hide();
}
if ($j("#templateOffice option:selected").val() !== "" && $j("#templateOffice_edit").css("display") == "none") {
......
......@@ -212,7 +212,7 @@ if (!defined('_MAILING_INFO_2')) {
define('_MAILING_INFO_2', 'A <b>master</b> attachment will be created without <b>contacts</b> and <b>chrono</b> merge fields.');
}
if (!defined('_MAILING_INFO_3')) {
define('_MAILING_INFO_3', 'Attachments will be generated <b>AFTER</b> validation by <b>visa users</b> in visa circuit.');
define('_MAILING_INFO_3', 'If you click Mailing, attachments are going to be generated <b>NOW</b>.<br>If you click on Validate, attachments will be generated <b>AFTER</b> validation by <b>visa users</b> in visa circuit.');
}
if (!defined('_MAILING_INFO_4')) {
define('_MAILING_INFO_4', '<b>1</b> attachment will be generated <b>each contact</b> linked to document.');
......
......@@ -298,7 +298,7 @@ if (!defined('_MAILING_INFO_2')) {
define('_MAILING_INFO_2', 'Un attachement <b>maître</b> sera créé sans les champs de fusion <b>contacts</b> et <b>chrono</b>.');
}
if (!defined('_MAILING_INFO_3')) {
define('_MAILING_INFO_3', 'Les attachements seront générés <b>APRÈS</b> validation des <b>viseurs</b> du circuit de visa.');
define('_MAILING_INFO_3', 'Si vous cliquez sur Publipostage, les attachements seront générés <b>TOUT DE SUITE</b>.<br>Si vous cliquez sur Valider ils seront générés <b>APRÈS</b> validation des <b>viseurs</b> du circuit de visa.');
}
if (!defined('_MAILING_INFO_4')) {
define('_MAILING_INFO_4', '<b>Un</b> attachement sera généré <b>par contact</b> associé au courrier.');
......
......@@ -261,7 +261,7 @@ if (!defined('_MAILING_INFO_2')) {
define('_MAILING_INFO_2', 'Een <b>hoofd</b> bijlage zal aangemaakt worden zonder de fusievelden <b>contacten</b> en <b>chrono</b>.');
}
if (!defined('_MAILING_INFO_3')) {
define('_MAILING_INFO_3', 'De bijlagen zullen aangemaakt worden <b>NA</b> validering van de <b>goedkeurders</b> van het goedkeuringscircuit.');
define('_MAILING_INFO_3', 'De bijlagen zullen aangemaakt worden <b>NA</b> validering van de <b>goedkeurders</b> van het goedkeuringscircuit. TO TRANSLATE');
}
if (!defined('_MAILING_INFO_4')) {
define('_MAILING_INFO_4', '<b>Er zal een</b> bijlage aangemaakt worden <b>per contact</b> dat aan de brief gekoppeld is.');
......
......@@ -85,6 +85,10 @@ function checkEditingDoc(elem, userId) {
target.prop('disabled', false);
target.css({"opacity":"1"});
target.val('Valider');
if ($j("#mailingInfo").is(":visible")) {
$j("#addMailing").show();
$j("#editMailing").show();
}
//UNLOCK EDIT BUTTON (IF MULTI ATTACHMENT)
$j("[name=templateOffice_edit\\[\\]], #edit").css({"opacity":"1"});
......
......@@ -455,7 +455,8 @@ abstract class fileplan_Abstract
protected function _getChildrensTree($fileplan_id, $positions, $parent = '', $tabspace = '') {
$db = new Database();
if (functions::protect_string_db(trim($parent)) == '') {
$f = new functions();
if ($f->protect_string_db(trim($parent)) == '') {
$stmt = $db->query(
"select position_id, position_label, parent_id, count_document from "
......@@ -482,7 +483,7 @@ abstract class fileplan_Abstract
$positions,
array(
'ID' =>$line->position_id,
'LABEL' => $espace.functions::show_string($line->position_label),
'LABEL' => $espace. $f->show_string($line->position_label),
'PARENT_ID' =>$line->parent_id,
'COUNT_DOCUMENT' => $line->count_document
)
......
......@@ -74,7 +74,7 @@ if (!empty($res_id)) {
$datasources['res_letterbox_contact'][] = $stmt->fetch(PDO::FETCH_ASSOC);
if (empty($params['mailing'])) {
if ($datasources['res_letterbox_contact'][0]['contact_id'] != '' && $_SESSION['attachmentInfo'][$_SESSION['attachmentInfo']['attachNum']]['contactId'] != '') {
if ($datasources['res_letterbox_contact'][0]['contact_id'] != '' && $_SESSION['attachmentInfo'][$_SESSION['attachmentInfo']['attachNum']]['contactId'] != '' && $_SESSION['attachmentInfo'][$_SESSION['attachmentInfo']['attachNum']]['contactId'] != 'mailing') {
// $datasources['contact'] = array();
$attachNum = $_SESSION['attachmentInfo']['attachNum'];
$stmt = $dbDatasource->query('SELECT * FROM view_contacts WHERE contact_id = ? and ca_id = ? ', array($_SESSION['attachmentInfo'][$attachNum]['contactId'], $_SESSION['attachmentInfo'][$attachNum]['addressId']));
......
......@@ -201,7 +201,7 @@ $app->get('/res/{resId}/listinstance', \Entity\controllers\ListInstanceControlle
$app->get('/res/{resId}/visaCircuit', \Entity\controllers\ListInstanceController::class . ':getVisaCircuitByResId');
$app->get('/res/{resId}/avisCircuit', \Entity\controllers\ListInstanceController::class . ':getAvisCircuitByResId');
$app->get('/listinstances/dest/itemId/{itemId}', \Entity\controllers\ListInstanceController::class . ':getListWhereUserIsDest');
$app->put('/listinstances', \Entity\controllers\ListInstanceController::class . ':updateListInstance');
$app->put('/listinstances', \Entity\controllers\ListInstanceController::class . ':update');
//ListTemplates
$app->get('/listTemplates', \Entity\controllers\ListTemplateController::class . ':get');
......
......@@ -19,9 +19,9 @@ ALTER TABLE groupbasket_status DROP COLUMN IF EXISTS "order";
ALTER TABLE groupbasket_status ADD COLUMN "order" integer;
UPDATE groupbasket_status SET "order" = 0 WHERE status_id = 'NEW';
UPDATE groupbasket_status SET "order" = 1 WHERE status_id != 'NEW';
UPDATE baskets SET basket_res_order = 'res_id' WHERE basket_res_order IS NULL;
UPDATE baskets SET basket_res_order = 'res_id desc' WHERE basket_res_order IS NULL;
ALTER TABLE baskets ALTER COLUMN basket_res_order SET NOT NULL;
ALTER TABLE baskets ALTER COLUMN basket_res_order SET DEFAULT 'res_id';
ALTER TABLE baskets ALTER COLUMN basket_res_order SET DEFAULT 'res_id desc';
ALTER TABLE groupbasket_status ALTER COLUMN "order" SET NOT NULL;
DO $$ BEGIN
IF (SELECT count(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'users_baskets') = 1 THEN
......
......@@ -493,7 +493,7 @@ class AttachmentController
return ['success' => 'success'];
}
public function isMailingAttach(array $aArgs)
public static function isMailingAttach(array $aArgs)
{
if (!Validator::intVal()->validate($aArgs['resIdMaster']) || !ResController::hasRightByResId(['resId' => $aArgs['resIdMaster'], 'userId' => $aArgs['userId']])) {
return ['errors' => 'Document out of perimeter'];
......
......@@ -95,23 +95,25 @@ class ListInstanceController
return $response->withJson(['listinstances' => $listinstances]);
}
public function updateListInstance(Request $request, Response $response)
public function update(Request $request, Response $response)
{
$data = $request->getParams();
if(empty($data['listinstances'])) {
return $response->withStatus(400)->withJson(['errors' => 'listinstance is missing or is empty']);
}
DatabaseModel::beginTransaction();
foreach ($data['listinstances'] as $ListInstanceByRes) {
foreach($ListInstanceByRes['listinstances'] as $instance) {
//check if basic data is empty
if( empty($instance['res_id']) || empty($instance['item_id']) || empty($instance['item_type']) || empty($instance['item_mode']) || empty($instance['difflist_type']) ) {
DatabaseModel::rollbackTransaction();
return $response->withStatus(400)->withJson(['errors' => 'Some data are empty']);
}
//delete in database if exist
if( isset($instance['listinstance_id']) && !empty($instance['listinstance_id']) ) {
$check = ListInstanceModel::getById(['select' => ['listinstance_id'], 'id' => $instance['listinstance_id']]);
if( !$check) {
......@@ -121,27 +123,19 @@ class ListInstanceController
ListInstanceModel::delete(['listinstance_id' => $instance['listinstance_id']]);
}
//check if redirect login already exist
$user = UserModel::getByLogin(['login' => $instance['item_id']]);
if (empty($user)) {
if (empty($user) || $user['status'] != "OK") {
DatabaseModel::rollbackTransaction();
return $response->withStatus(400)->withJson(['errors' => 'User not found']);
return $response->withStatus(400)->withJson(['errors' => 'User not found or not active']);
}
//Create in database
if( isset($instance['listinstance_id'])) {
unset($instance['listinstance_id']);
}
if( isset($instance['requested_signature'])) {
unset($instance['requested_signature']);
}
if( isset($instance['signatory'])) {
unset($instance['signatory']);
}
unset($instance['listinstance_id']);
unset($instance['requested_signature']);
unset($instance['signatory']);
ListInstanceModel::create($instance);
//update res_letterbox
if($instance['item_mode'] == 'dest') {
ResModel::update([
'set' => ['dest_user' => $instance['item_id']],
......@@ -150,7 +144,6 @@ class ListInstanceController
]);
}
}
}
DatabaseModel::commitTransaction();
......
......@@ -273,10 +273,14 @@ class ListTemplateController
{
$data = $request->getParams();
DatabaseModel::beginTransaction();
foreach ($data['redirectListModels'] as $listModel) {
//check if user exist
$user = UserModel::getByLogin(['login' => $listModel['redirectUserId']]);
if (empty($user)) {
return $response->withStatus(400)->withJson(['errors' => 'User not found']);
if (empty($user) || $user['status'] != "OK") {
DatabaseModel::rollbackTransaction();
return $response->withStatus(400)->withJson(['errors' => 'User not found or not active']);
}
ListTemplateModel::update([
......@@ -286,6 +290,8 @@ class ListTemplateController
]);
}
DatabaseModel::commitTransaction();
return $response->withJson(['success' => 'success']);
}
......
......@@ -31,6 +31,7 @@ abstract class ListInstanceModelAbstract
'where' => $aArgs['where'],
'data' => $aArgs['data'],
'order_by' => $aArgs['orderBy'],
'groupBy' => $aArgs['groupBy'],
'limit' => $aArgs['limit']
]);
......
......@@ -66,13 +66,18 @@ class ResController
$data = $request->getParams();
$check = Validator::notEmpty()->validate($data['encodedFile']);
$check = $check && Validator::stringType()->notEmpty()->validate($data['format']);
$check = $check && Validator::stringType()->notEmpty()->validate($data['status']);
$check = $check && Validator::intVal()->notEmpty()->validate($data['type_id']);
$check = $check && Validator::stringType()->notEmpty()->validate($data['category_id']);
if (!$check) {
return $response->withStatus(400)->withJson(['errors' => 'Bad Request']);
if (empty($data)) {
return $response->withStatus(400)->withJson(['errors' => 'Data is not set or empty']);
} elseif (!Validator::notEmpty()->validate($data['encodedFile'])) {
return $response->withStatus(400)->withJson(['errors' => 'Data[encodedFile] is empty']);
} elseif (!Validator::stringType()->notEmpty()->validate($data['format'])) {
return $response->withStatus(400)->withJson(['errors' => 'Data[format] is empty or not a string']);
} elseif (!Validator::stringType()->notEmpty()->validate($data['status'])) {
return $response->withStatus(400)->withJson(['errors' => 'Data[status] is empty or not a string']);
} elseif (!Validator::intVal()->notEmpty()->validate($data['type_id'])) {
return $response->withStatus(400)->withJson(['errors' => 'Data[type_id] is empty or not an integer']);
} elseif (!Validator::stringType()->notEmpty()->validate($data['category_id'])) {
return $response->withStatus(400)->withJson(['errors' => 'Data[category_id] is empty or not a string']);
}
$resId = StoreController::storeResource($data);
......
......@@ -17,19 +17,23 @@ namespace Resource\controllers;
use Basket\models\BasketModel;
use chillerlan\QRCode\QRCode;
use chillerlan\QRCode\QROptions;
use Contact\models\ContactModel;
use Entity\models\EntityModel;
use Entity\models\ListInstanceModel;
use Note\models\NoteEntityModel;
use Note\models\NoteModel;
use Priority\models\PriorityModel;
use Resource\models\ResModel;
use Resource\models\ResourceContactModel;
use Resource\models\ResourceListModel;
use Respect\Validation\Validator;
use setasign\Fpdi\Tcpdf\Fpdi;
use Slim\Http\Request;
use Slim\Http\Response;
use SrcCore\controllers\AutoCompleteController;
use SrcCore\controllers\PreparedClauseController;
use SrcCore\models\CoreConfigModel;
use SrcCore\models\DatabaseModel;
use SrcCore\models\TextFormatModel;
use SrcCore\models\ValidatorModel;
use Status\models\StatusModel;
......@@ -215,6 +219,77 @@ class SummarySheetController
$pdf->MultiCell($widthNoMargins / 2, 20, _STATUS . " : {$status}", 1, 'L', false, 1, '', '', true, 0, true);
$pdf->MultiCell($widthNoMargins / 2, 20, _PRIORITY . " : {$priority}", 1, 'L', false, 0, '', '', true, 0, true);
$pdf->MultiCell($widthNoMargins / 2, 20, _PROCESS_LIMIT_DATE . " : {$processLimitDate}", 1, 'L', false, 1, '', '', true, 0, true);
} elseif ($unit['unit'] == 'senderRecipientInformations') {
$ext = ResModel::getExtById(['select' => ['category_id', 'address_id', 'exp_user_id', 'dest_user_id', 'is_multicontacts'], 'resId' => $resource['res_id']]);
if (!empty($ext)) {
$resourcesContacts = ResourceContactModel::getFormattedByResId(['resId' => $resource['res_id']]);
$oldContacts = [];
$rawContacts = [];
if ($ext['is_multicontacts'] == 'Y') {
$multiContacts = DatabaseModel::select([
'select' => ['contact_id', 'address_id'],
'table' => ['contacts_res'],
'where' => ['res_id = ?', 'mode = ?'],
'data' => [$resource['res_id'], 'multi']
]);
foreach ($multiContacts as $multiContact) {
$rawContacts[] = [
'login' => $multiContact['contact_id'],
'address_id' => $multiContact['address_id'],
];
}
} else {
$rawContacts[] = [
'login' => $ext['dest_user_id'],
'address_id' => $ext['address_id'],
];
}
foreach ($rawContacts as $rawContact) {
if (!empty($rawContact['address_id'])) {
$contact = ContactModel::getOnView([
'select' => [
'is_corporate_person', 'lastname', 'firstname', 'address_num', 'address_street', 'address_town', 'address_postal_code',
'ca_id', 'society', 'contact_firstname', 'contact_lastname', 'address_country'
],
'where' => ['ca_id = ?'],
'data' => [$rawContact['address_id']]
]);
if (isset($contact[0])) {
$contact = AutoCompleteController::getFormattedContact(['contact' => $contact[0]]);
$oldContacts[] = ['format' => $contact['contact']['otherInfo']];
}
} else {
$oldContacts[] = ['format' => UserModel::getLabelledUserById(['login' => $rawContact['login']])];
}
}
if ($ext['category_id'] == 'outgoing') {
$senders = $resourcesContacts;
$recipients = $oldContacts;
} else {
$senders = $oldContacts;
$recipients = $resourcesContacts;
}
$pdf->SetY($pdf->GetY() + 40);
if (($pdf->GetY() + 57) > $bottomHeight) {
$pdf->AddPage();
}
$pdf->SetFont('', 'B', 11);
$pdf->Cell(0, 15, $unit['label'], 0, 2, 'L', false);
$pdf->SetY($pdf->GetY() + 2);
$pdf->SetFont('', '', 10);
$pdf->Cell($widthNoMargins / 10 * 4.5, 15, empty($senders) ? '' : _SENDERS, empty($senders) ? 0 : 1, 0, 'C', false);
$pdf->Cell($widthNoMargins / 10, 15, '', 0, 0, 'C', false);
$pdf->Cell($widthNoMargins / 10 * 4.5, 15, empty($recipients) ? '' : _RECIPIENTS, empty($recipients) ? 0 : 1, 1, 'C', false);
for ($i = 0; !empty($senders[$i]) || !empty($recipients[$i]); $i++) {
$pdf->MultiCell($widthNoMargins / 10 * 4.5, 40, empty($senders[$i]['format']) ? '' : $senders[$i]['format'], empty($senders[$i]['format']) ? 0 : 1, 'L', false, 0, '', '', true, 0, true);
$pdf->MultiCell($widthNoMargins / 10, 40, '', 0, 'L', false, 0, '', '', true, 0, true);
$pdf->MultiCell($widthNoMargins / 10 * 4.5, 40, empty($recipients[$i]['format']) ? '' : $recipients[$i]['format'], empty($recipients[$i]['format']) ? 0 : 1, 'L', false, 1, '', '', true, 0, true);
}
}
} elseif ($unit['unit'] == 'diffusionList') {
$assignee = '';
$copies = [];
......@@ -384,7 +459,7 @@ class SummarySheetController
$pdf->SetY($pdf->GetY() + 5);
}
}
} elseif (strpos($unit['unit'], 'freeField') !== false) {
} elseif ($unit['unit'] == 'freeField') {
$pdf->SetY($pdf->GetY() + 40);
if (($pdf->GetY() + 77) > $bottomHeight) {
$pdf->AddPage();
......
......@@ -78,18 +78,30 @@ class UserController
}
$listModels = ListTemplateModel::get(['select' => ['item_id'], 'where' => ['item_id in (?)', 'object_type = ?', 'item_mode = ?'], 'data' => [$usersIds, 'entity_id', 'dest']]);
$listInstances = ListInstanceModel::get(['select' => ['item_id'], 'where' => ['item_id in (?)', 'item_mode = ?'], 'data' => [$usersIds, 'dest'], 'groupBy' => ['item_id']]);
$usersListModels = [];
foreach ($listModels as $value) {
$usersListModels[] = $value['item_id'];
}
$usersListInstances = [];
foreach ($listInstances as $value) {
$usersListInstances[] = $value['item_id'];
}
foreach ($users as $key => $value) {
if (in_array($value['user_id'], $usersListModels)) {
$users[$key]['inDiffListDest'] = true;
} else {
$users[$key]['inDiffListDest'] = false;
}
if (in_array($value['user_id'], $usersListInstances)) {
$users[$key]['isResDestUser'] = true;
} else {
$users[$key]['isResDestUser'] = false;
}
}
$quota = [];
......
......@@ -529,11 +529,14 @@ class AutoCompleteController
if (!empty($aArgs['contact']['address_street'])) {
$address.= $aArgs['contact']['address_street'] . ' ';
}
if (!empty($aArgs['contact']['address_postal_code'])) {
$address.= $aArgs['contact']['address_postal_code'] . ' ';
}
if (!empty($aArgs['contact']['address_town'])) {
$address.= $aArgs['contact']['address_town'] . ' ';
}
if (!empty($aArgs['contact']['address_postal_code'])) {
$address.= $aArgs['contact']['address_postal_code'] . ' ';
if (!empty($aArgs['contact']['address_country'])) {
$address.= $aArgs['contact']['address_country'];
}
$otherInfo = empty($address) ? "{$aArgs['contact']['society']}" : "{$aArgs['contact']['society']} - {$address}";
$contact = [
......@@ -552,11 +555,14 @@ class AutoCompleteController
if (!empty($aArgs['contact']['address_street'])) {
$address.= $aArgs['contact']['address_street'] . ' ';
}
if (!empty($aArgs['contact']['address_postal_code'])) {
$address.= $aArgs['contact']['address_postal_code'] . ' ';
}
if (!empty($aArgs['contact']['address_town'])) {
$address.= $aArgs['contact']['address_town'] . ' ';
}
if (!empty($aArgs['contact']['address_postal_code'])) {
$address.= $aArgs['contact']['address_postal_code'] . ' ';
if (!empty($aArgs['contact']['address_country'])) {
$address.= $aArgs['contact']['address_country'];
}
$contactToDisplay = "{$aArgs['contact']['contact_firstname']} {$aArgs['contact']['contact_lastname']}";
if (!empty($aArgs['contact']['society'])) {
......
......@@ -42,6 +42,9 @@ define('_DOCSERVER_ADDED', 'Docserver added');
define('_DOCSERVER_UPDATED', 'Docserver updated');
define('_DOCSERVER_DELETED', 'Docserver deleted');
define('_DOCSERVER_ACTIVATED_EXISTS', 'A docserver with this type and this collection is already activated');