Skip to content

Commit

Permalink
SinergiaCRM 1.6.3 Release Merge (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
enricsinergia authored Jul 24, 2024
2 parents 1dd2da0 + 4e20ca4 commit b3eeec3
Show file tree
Hide file tree
Showing 25 changed files with 214 additions and 49 deletions.
4 changes: 2 additions & 2 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@

// STIC Custom 20231124 JBL - SemVer in SinergiaCRM
// STIC#1319
'sinergiacrm_version' => '1.6.2',
'js_custom_version' => 8,
'sinergiacrm_version' => '1.6.3',
'js_custom_version' => 9,
'stic_show_update_alert' => 0,
// END STIC

Expand Down
1 change: 1 addition & 0 deletions custom/modules/Calendar/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ protected function filterSticFollowUps($activitiesArray)

/**
* STIC-Custom 20240222 MHP - Includes/excludes the stic_Work_Calendar records from the activities array according to filters values.
* https://github.com/SinergiaTIC/SinergiaCRM/pull/114
*
* Current existing filters:
* - stic_work_calendar_type
Expand Down
6 changes: 4 additions & 2 deletions custom/themes/SuiteP/modules/Calendar/tpls/settings.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ $(function() {
</tr>
<tr>
<td scope="row" valign="top" width="55%">
<!-- STIC-Custom 20240222 MHP - Add information icon and informational popup -->
<!-- STIC-Custom 20240222 MHP - Add information icon and informational popup
https://github.com/SinergiaTIC/SinergiaCRM/pull/114 -->
<!-- {$MOD.LBL_SETTINGS_DISPLAY_SHARED_CALENDAR_SEPARATE} -->
{$MOD.LBL_SETTINGS_DISPLAY_SHARED_CALENDAR_SEPARATE}
<i class="inline-help glyphicon glyphicon-info-sign"></i>
Expand Down Expand Up @@ -210,7 +211,8 @@ $(function() {
<th>Module</th><th>Body</th><th>Border</th><th>Text</th>
</tr>
{foreach from=$activity key=name item=def}
<!-- STIC-Custom 20240222 MHP - The work calendar records are colored depending on whether they are work type or not. -->
<!-- STIC-Custom 20240222 MHP - The work calendar records are colored depending on whether they are work type or not.
https://github.com/SinergiaTIC/SinergiaCRM/pull/114 -->
{if $name != 'stic_Work_Calendar'}
<tr>
<td>{$def.label}</td>
Expand Down
8 changes: 6 additions & 2 deletions custom/themes/SuiteP/tpls/_head.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
<script type="text/javascript" src='{sugar_getjspath file="themes/SuiteP/js/jscolor.js"}'></script>
<script type="text/javascript" src='{sugar_getjspath file="cache/include/javascript/sugar_field_grp.js"}'></script>
<script type="text/javascript" src='{sugar_getjspath file="vendor/tinymce/tinymce/tinymce.min.js"}'></script>
{* STIC-Custom 20240222 MHP - Add CSS and JS for efficient registration button handling *}
{* STIC-Custom 20240222 MHP - Add CSS and JS for efficient registration button handling
https://github.com/SinergiaTIC/SinergiaCRM/pull/114 *}
<link href="modules/stic_Time_Tracker/menuButton/SticTimeTrackerButtonInMainMenu.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src='{sugar_getjspath file="modules/stic_Time_Tracker/menuButton/SticTimeTrackerButtonInMainMenu.js"}'></script>
{literal}
Expand All @@ -102,7 +103,10 @@
// If used, updates the button color based on whether or not there is an active time record for today
$(document).ready(function()
{
checkTimeTrackerButtonStatus();
// Check that it is not the login view
if (!window.location.href.includes('action=Login') && !window.location.href.includes('module=Users')) {
checkTimeTrackerButtonStatus();
}
});
</script>
{/literal}
Expand Down
12 changes: 8 additions & 4 deletions custom/themes/SuiteP/tpls/_headerModuleList.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,8 @@
</form>
</div>
</li>
{* STIC-Custom 20240222 MHP - Adding efficient registration button *}
{* STIC-Custom 20240222 MHP - Adding efficient registration button
https://github.com/SinergiaTIC/SinergiaCRM/pull/114 *}
<li class="time_tracker_button_row no-show-time-tracker-button">
<button class="time_tracker_button btn suitepicon suitepicon-module-tasks"
onclick="showTimeTrackerConfirmBox();"></button>
Expand Down Expand Up @@ -732,7 +733,8 @@
</div>
</form>
</li>
{* STIC-Custom 20240222 MHP - Adding efficient registration button *}
{* STIC-Custom 20240222 MHP - Adding efficient registration button
https://github.com/SinergiaTIC/SinergiaCRM/pull/114 *}
<li class="time_tracker_button_row no-show-time-tracker-button">
<button class="time_tracker_button btn suitepicon suitepicon-module-tasks"
onclick="showTimeTrackerConfirmBox();"></button>
Expand Down Expand Up @@ -854,7 +856,8 @@
</div>
</form>
</li>
{* STIC-Custom 20240222 MHP - Adding efficient registration button *}
{* STIC-Custom 20240222 MHP - Adding efficient registration button
https://github.com/SinergiaTIC/SinergiaCRM/pull/114 *}
<li class="time_tracker_button_row no-show-time-tracker-button">
<button class="time_tracker_button btn suitepicon suitepicon-module-tasks"
onclick="showTimeTrackerConfirmBox();"></button>
Expand Down Expand Up @@ -893,7 +896,8 @@
</ul>
</div>
</nav>
{* STIC-Custom 20240222 MHP - Add registration button dialog *}
{* STIC-Custom 20240222 MHP - Add registration button dialog
https://github.com/SinergiaTIC/SinergiaCRM/pull/114 *}
<div id="time-tracker-dialog-box"></div>
{* END STIC-Custom *}
<!--End Responsive Top Navigation Menu -->
Expand Down
10 changes: 9 additions & 1 deletion include/SugarFields/Fields/Enum/DetailView.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ lists can work. *}
{ {{sugarvar key='options' string=true}} }
{else}
<input type="hidden" class="sugar_field" id="{{sugarvar key='name'}}" value="{ {{sugarvar key='value' string=true}} }">
{ {{sugarvar key='options' string=true}}[{{sugarvar key='value' string=true}}]}
{* STIC-Custom 20240717 MHP - https://github.com/SinergiaTIC/SinergiaCRM/pull/15
Show the value in case it does not belong to the values ​​in the list *}
{* { {{sugarvar key='options' string=true}}[{{sugarvar key='value' string=true}}]} *}
{if !empty({{sugarvar key='options' string=true}}[{{sugarvar key='value' string=true}}])}
{ {{sugarvar key='options' string=true}}[{{sugarvar key='value' string=true}}] }
{else}
{ {{sugarvar key='value' string=true}} }
{/if}
{* END STIC-Custom *}
{/if}
{{if !empty($displayParams.enableConnectors)}}
{{sugarvar_connector view='DetailView'}}
Expand Down
12 changes: 11 additions & 1 deletion include/SugarFields/Fields/Multienum/DetailView.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,17 @@
<input type="hidden" class="sugar_field" id="{{sugarvar key='name'}}" value="{{sugarvar key='value'}}">
{multienum_to_array string={{sugarvar key='value' string=true}} assign="vals"}
{foreach from=$vals item=item}
<li style="margin-left:10px;">{ {{sugarvar key='options' string=true}}.$item }</li>
{* STIC-Custom 20240717 MHP - https://github.com/SinergiaTIC/SinergiaCRM/pull/15
Show the value in case it does not belong to the values ​​in the list *}
{* { <li style="margin-left:10px;">{ {{sugarvar key='options' string=true}}.$item }</li> *}
<li style="margin-left:10px;">
{if !empty({{sugarvar key='options' string=true}}.$item)}
{ {{sugarvar key='options' string=true}}.$item }
{else}
{$item}
{/if}
</li>
{* END STIC-Custom *}
{/foreach}
{{if !empty($displayParams.enableConnectors)}}
{{sugarvar_connector view='DetailView'}}
Expand Down
11 changes: 10 additions & 1 deletion include/SugarFields/Fields/Multienum/ListView.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@
{if !empty($parentFieldArray.$col)}
{multienum_to_array string=$parentFieldArray.$col assign="vals"}
{foreach from=$vals item=item name=multiEnum}
{$vardef.options_list.$item}{if !$smarty.foreach.multiEnum.last},
{* STIC-Custom 20240717 MHP - https://github.com/SinergiaTIC/SinergiaCRM/pull/15
Show the value in case it does not belong to the values ​​in the list *}
{* { {$vardef.options_list.$item}{if !$smarty.foreach.multiEnum.last}, *}
{if $vardef.options_list.$item != ''}
{$vardef.options_list.$item}
{else}
{$item}
{/if}
{if !$smarty.foreach.multiEnum.last},
{* END STIC-Custom *}
{/if}
{/foreach}
{/if}
Expand Down
5 changes: 4 additions & 1 deletion modules/stic_Custom_Views/processor/LogicHooksCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public function after_ui_frame($event, $arguments)
if ($action == "subpanelcreates") {
$view = "quickcreate";
$module = $_POST["target_module"];
} else if ($action == "popup") {
$view = "quickcreate";
}

$availableViews = $GLOBALS['app_list_strings']['stic_custom_views_views_list'];
if (!array_key_exists($view, $availableViews)) {
return "";
Expand Down Expand Up @@ -254,7 +257,7 @@ private function value_to_display($value, $value_type)
case "date":
case "datetime":
case "datetimecombo":
return $timedate->to_display_date_time($value, true, false, $current_user);
return $timedate->asUser($timedate->fromDbFormat($value, TimeDate::DB_DATETIME_FORMAT), $current_user);
}
return $value;
}
Expand Down
72 changes: 64 additions & 8 deletions modules/stic_Custom_Views/processor/js/sticCVUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,28 @@ var sticCVUtils = class sticCVUtils {
show = sticCVUtils.isTrue(show);
$elem.each(function() {
if (show) {
sticCVUtils.removeClass($(this), customView, "hidden");
if (!$(this).hasClass("auto-hidden")) {
sticCVUtils.removeClass($(this), customView, "hidden");
}
} else {
sticCVUtils.addClass($(this), customView, "hidden");
sticCVUtils.removeClass($(this), customView, "auto-hidden");
}
});
}
static show_auto($elem, customView = null, show = true) {
show = sticCVUtils.isTrue(show);
$elem.each(function() {
if (show) {
if ($(this).hasClass("auto-hidden")) {
sticCVUtils.removeClass($(this), customView, "hidden");
sticCVUtils.removeClass($(this), customView, "auto-hidden");
}
} else {
if (!$(this).hasClass("hidden")) {
sticCVUtils.addClass($(this), customView, "hidden");
sticCVUtils.addClass($(this), customView, "auto-hidden");
}
}
});
}
Expand Down Expand Up @@ -268,14 +287,21 @@ var sticCVUtils = class sticCVUtils {

static getValue(fieldContent, value_list) {
var $elem = fieldContent.$editor;
if (fieldContent.customView.view == "detailview" && fieldContent.type != "bool") {
if (
fieldContent.customView.view == "detailview" &&
fieldContent.type != "bool" &&
!fieldContent.$element.hasClass("inlineEditActive")
) {
$elem = fieldContent.$fieldText;
if ($elem.length > 0 && (fieldContent.type == "multienum" || fieldContent.type == "enum")) {
return $elem.val().replaceAll("^", "").split(",").sort().join(",");
}
}
if ($elem.length == 0 || $elem.get(0).parentNode === null) {
$elem = fieldContent.$element;
}

if (fieldContent.customView.view == "detailview") {
if (fieldContent.customView.view == "detailview" && !fieldContent.$element.hasClass("inlineEditActive")) {
if (fieldContent.type == "relate") {
return $elem.attr("data-id-value") + "|" + $elem.text().trim();
}
Expand All @@ -288,7 +314,8 @@ var sticCVUtils = class sticCVUtils {
value_list != "" &&
fieldContent.type != "date" &&
fieldContent.type != "datetime" &&
fieldContent.type != "datetimecombo"
fieldContent.type != "datetimecombo" &&
fieldContent.type != "multienum"
) {
return sticCVUtils.getListValueFromLabel(value_list, text);
}
Expand Down Expand Up @@ -450,16 +477,25 @@ var sticCVUtils = class sticCVUtils {
var oldRequired = sticCVUtils.getRequiredStatus(field);

var customView = field.customView;
sticCVUtils.show(field.header.$element.find("span.required"), customView, false);
if (required) {
sticCVUtils.addClass(field.header.$element, customView, "conditional-required");
sticCVUtils.show(field.header.$element.find("span.required"), customView, false);
removeFromValidate(customView.formName, field.name);
var fieldName = field.header.text();
if (fieldName === null || fieldName === undefined || fieldName.trim() === "") {
fieldName = SUGAR.language.get("app_strings", "ERR_MISSING_REQUIRED_FIELDS");
} else {
fieldName = fieldName.trim();
if (fieldName.endsWith(":")) {
fieldName = fieldName.slice(0, -1);
}
}
addToValidate(
customView.formName,
field.name,
field.content.type,
true,
SUGAR.language.get("app_strings", "ERR_MISSING_REQUIRED_FIELDS")
fieldName
);
if (!oldRequired) {
customView.addUndoFunction(function() {
Expand Down Expand Up @@ -502,12 +538,19 @@ var sticCVUtils = class sticCVUtils {
return false;
}

static createObserverCallback($elem, callback) {
return function() {
sticCVUtils.onChange($elem.find("input"), callback);
callback();
};
}

static onChange($elem, callback) {
$elem.each(function() {
$(this).on("change paste keyup", callback);
YAHOO.util.Event.on($(this)[0], "change", callback);
if (!$(this).is(":input")) {
var observer = new MutationObserver(callback);
var observer = new MutationObserver(sticCVUtils.createObserverCallback($(this), callback));
observer.observe($(this)[0], { attributes: true, childList: true, subtree: true, characterData: true });
}
});
Expand Down Expand Up @@ -536,8 +579,21 @@ var sticCVUtils = class sticCVUtils {
return res;
}

static getMultienumLabelFromKeys(app_list_stringsName, keyValues) {
var keyValueArray = keyValues.replaceAll("^", "").split(",");
var labelValueArray = [];

for (var i = 0; i < keyValueArray.length; i++) {
var label = SUGAR.language.languages.app_list_strings[app_list_stringsName][keyValueArray[i]];
if(label !== undefined) {
labelValueArray.push(label);
}
}
return labelValueArray.join(", ");
}

static isTrue(value) {
return value === true || value === "1" || value === 1;
return value === true || value === "1" || value === 1 || value === "yes" || value === "true";
}

static normalizeToCompare(value) {
Expand Down
3 changes: 3 additions & 0 deletions modules/stic_Custom_Views/processor/js/sticCV_Element_Div.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ var sticCV_Element_Div = class sticCV_Element_Div {
case "visible":
sticCVUtils.show(this.$element, this.customView, action.value);
return this;
case "visible_auto":
sticCVUtils.show_auto(this.$element, this.customView, action.value);
return this;
case "color":
sticCVUtils.color(this.$element, this.customView, action.value);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ var sticCV_Element_FieldContainer = class sticCV_Element_FieldContainer extends
applyAction(action) {
if (action.action == "visible") {
var show = sticCVUtils.isTrue(action.value);
if (!show) {
if (this.customView.view == "editview" || this.customView.view == "quickcreate") {
for (var field of this.getFields()) {
// Hide fields (this make unrequired also)
field.hide();
}
if (this.customView.view == "editview" || this.customView.view == "quickcreate") {
for (var field of this.getFields()) {
// Automatic Hide/Show fields (this make unrequired also)
field.show(show, true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ var sticCV_Record_Container = class sticCV_Record_Container {
this.content = null;
}

show(show = true) {
return this.applyAction({ action: "visible", value: show, element_section: "container" });
show(show = true, automatically = false) {
if (automatically) {
return this.applyAction({ action: "visible_auto", value: show, element_section: "container" });
} else {
return this.applyAction({ action: "visible", value: show, element_section: "container" });
}
}
hide() {
return this.show(false);
hide(automatically = false) {
return this.show(false, automatically);
}

style(style) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var sticCV_Record_Field = class sticCV_Record_Field extends sticCV_Record_Contai
applyAction(action) {
switch (action.action) {
case "visible":
case "visible_auto":
if (action.element_section != "header" && action.element_section != "field_label") {
super.applyAction(action);
sticCVUtils.check_required_visible(this);
Expand Down
Loading

0 comments on commit b3eeec3

Please sign in to comment.