Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - General - Vista de "Edición rápida" #93

Merged
merged 14 commits into from
Feb 22, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php
/**
* This file is part of SinergiaCRM.
* SinergiaCRM is a work developed by SinergiaTIC Association, based on SuiteCRM.
* Copyright (C) 2013 - 2023 SinergiaTIC Association
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SinergiaTIC Association at email address [email protected].
*/

if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}

/**
* This custom class, allows you to create a button in each record of the subpanel
* which open the QuickCreate View to edit the record.
*/
class SugarWidgetSubPanelQuickEditButton extends SugarWidgetField
{
public function displayList(&$layout_def)
{
global $app_strings;
global $subpanel_item_count;
$return_module = $_REQUEST['module'];
$return_id = $_REQUEST['record'];
$module_name = $layout_def['module'];
$record_id = $layout_def['fields']['ID'];
$subpanel = $layout_def['subpanel_id'];
$unique_id = $layout_def['subpanel_id']."_form_".$subpanel_item_count; //bug 51512

// @see SugarWidgetSubPanelTopButtonQuickCreate::get_subpanel_relationship_name()
$relationship_name = '';
if (!empty($layout_def['linked_field'])) {
$relationship_name = $layout_def['linked_field'];
$bean = BeanFactory::getBean($layout_def['module']);
if (!empty($bean->field_defs[$relationship_name]['relationship'])) {
$relationship_name = $bean->field_defs[$relationship_name]['relationship'];
}
}


$subpanel = $layout_def['subpanel_id'];
if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) {
$linked_field= $layout_def['linked_field_set'] ;
} else {
$linked_field = $layout_def['linked_field'];
}

$labelText = "Quick Edit";
$label = null;
if (isset($layout_def['vname'])) {
$label = $layout_def['vname'];
} elseif (isset($layout_def['label'])) {
$label = $layout_def['label'];
}
if ($label != null) {
if (isset($app_strings[$label])) {
$labelText = $app_strings[$label];
} elseif (isset($mod_strings[$label])) {
$labelText = $mod_strings[$label];
}
}

$html = '
<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_'.$subpanel.'\', \'Loading ...\');" action="index.php" method="post" name="form" id="'.$unique_id.'">
<input type="hidden" name="record" value="'.$record_id.'">
<input type="hidden" name="target_module" value="'.$module_name.'">
<input type="hidden" name="tpl" value="QuickCreate.tpl">
<input type="hidden" name="return_module" value="'.$return_module.'">
<input type="hidden" name="return_action" value="SubPanelViewer">
<input type="hidden" name="return_id" value="'.$return_id.'">
<input type="hidden" name="return_relationship" value="'.$relationship_name.'">
<input type="hidden" name="action" value="SubpanelCreates">
<input type="hidden" name="module" value="Home">
<input type="hidden" name="target_action" value="QuickEdit">
<input type="hidden" name="return_name" value="XXXX">
<input type="hidden" name="parent_type" value="'.$return_module.'">
<input type="hidden" name="parent_name" value="XXXX">
<input type="hidden" name="parent_id" value="'.$return_id.'">
<input title="'.$labelText.'" accesskey="N" class="button" type="submit" name="'.$module_name.'_quickedit_button" id="'.$record_id.'_quickedit_button" value="'.$labelText.'">
</form>';


return $html;

}


}
12 changes: 10 additions & 2 deletions include/ListView/ListViewSubPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,11 +495,19 @@ public function process_dynamic_listview_rows($data, $parent_data, $smartyTempla
$widget_contents[$aVal][$field_name] = '&nbsp;';
}
} elseif (preg_match("/button/i", $list_field['name'])) {
if ((($list_field['name'] === 'edit_button' && $field_acl['EditView']) || ($list_field['name'] === 'close_button' && $field_acl['EditView']) || ($list_field['name'] === 'remove_button' && $field_acl['EditView'])) && '' != ($_content = $layout_manager->widgetDisplay($list_field))) {
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
// if ((($list_field['name'] === 'edit_button' && $field_acl['EditView']) || ($list_field['name'] === 'close_button' && $field_acl['EditView']) || ($list_field['name'] === 'remove_button' && $field_acl['EditView'])) && '' != ($_content = $layout_manager->widgetDisplay($list_field))) {
if ((($list_field['name'] === 'edit_button' && $field_acl['EditView']) || ($list_field['name'] === 'quickedit_button' && $field_acl['EditView']) || ($list_field['name'] === 'close_button' && $field_acl['EditView']) || ($list_field['name'] === 'remove_button' && $field_acl['EditView'])) && '' != ($_content = $layout_manager->widgetDisplay($list_field))) {
// END STIC-Custom
$button_contents[$aVal][] = $_content;
unset($_content);
} else {
$doNotProcessTheseActions = array("edit_button", "close_button","remove_button");
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
// $doNotProcessTheseActions = array("edit_button", "close_button","remove_button");
$doNotProcessTheseActions = array("edit_button", "quickedit_button", "close_button","remove_button");
// END STIC-Custom
if (!in_array($list_field['name'], $doNotProcessTheseActions) && '' != ($_content = $layout_manager->widgetDisplay($list_field))) {
$button_contents[$aVal][] = $_content;
unset($_content);
Expand Down
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/basic/language/ca_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
'LBL_MODIFIED_USER' => 'Modificat Per Usuari',
'LBL_LIST_NAME' => 'Nom',
'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Eliminar',

'LBL_ASCENDING' => 'Ascendent',
Expand Down
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/basic/language/en_us.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
'LBL_MODIFIED_USER' => 'Modified by User',
'LBL_LIST_NAME' => 'Name',
'LBL_EDIT_BUTTON' => 'Edit',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Edit',
// END STIC-Custom
'LBL_REMOVE' => 'Remove',

'LBL_ASCENDING' => 'Ascending',
Expand Down
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/basic/language/es_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
'LBL_MODIFIED_USER' => 'Modificado por el Usuario',
'LBL_LIST_NAME' => 'Nombre',
'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Quitar',

'LBL_ASCENDING' => 'Ascendente',
Expand Down
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/basic/language/gl_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
'LBL_MODIFIED_USER' => 'Modificado polo Usuario',
'LBL_LIST_NAME' => 'Nome',
'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Quitar',

'LBL_ASCENDING' => 'Ascendente',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@
'module' => $module_name,
'width' => '4%',
),
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'quickedit_button' => array(
'vname' => 'LBL_QUICKEDIT_BUTTON',
'widget_class' => 'SubPanelQuickEditButton',
'module' => $module_name,
'width' => '4%',
),
// END STIC-Custom
'remove_button' => array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@
'NTC_DELETE_CONFIRMATION' => 'Està segur de que vol suprimir aquest registre?',

'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Eliminar',

);
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@
'NTC_DELETE_CONFIRMATION' => 'Are you sure you want to delete this record?',

'LBL_EDIT_BUTTON' => 'Edit ',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Edit',
// END STIC-Custom
'LBL_REMOVE' => 'Remove',

);
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@
'NTC_DELETE_CONFIRMATION' => '¿Está seguro de que desea eliminar este registro?',

'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Quitar',

);
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@
'NTC_DELETE_CONFIRMATION' => '¿Está seguro de que desexa eliminar este rexistro?',

'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Quitar',

);
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@
'module' => $module_name,
'width' => '4%',
),
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'quickedit_button' => array(
'vname' => 'LBL_QUICKEDIT_BUTTON',
'widget_class' => 'SubPanelQuickEditButton',
'module' => $module_name,
'width' => '4%',
),
// END STIC-Custom
'remove_button' => array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
Expand Down
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/file/language/ca_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@
'LBL_LIST_DOCUMENT_NAME' => 'Nom de Document',

'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Eliminar',

);
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/file/language/en_us.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@
'LBL_LIST_DOCUMENT_NAME' => 'Document Name',

'LBL_EDIT_BUTTON' => 'Edit ',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Edit',
// END STIC-Custom
'LBL_REMOVE' => 'Remove',

);
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/file/language/es_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@
'LBL_LIST_DOCUMENT_NAME' => 'Nombre de Documento',

'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Quitar',

);
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/file/language/gl_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@
'LBL_LIST_DOCUMENT_NAME' => 'Nome de Documento',

'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Quitar',

);
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@
'module' => $module_name,
'width' => '5%',
),
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'quickedit_button' => array(
'vname' => 'LBL_QUICKEDIT_BUTTON',
'widget_class' => 'SubPanelQuickEditButton',
'module' => $module_name,
'width' => '4%',
),
// END STIC-Custom
'remove_button' => array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
Expand Down
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/issue/language/ca_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
'LBL_SUBJECT' => 'Assumpte:',

'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Eliminar',

);
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/issue/language/en_us.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
'LBL_SUBJECT' => 'Subject:',

'LBL_EDIT_BUTTON' => 'Edit',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Edit',
// END STIC-Custom
'LBL_REMOVE' => 'Remove',

);
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/issue/language/es_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
'LBL_SUBJECT' => 'Asunto:',

'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Quitar',

);
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/issue/language/gl_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
'LBL_SUBJECT' => 'Asunto:',

'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Quitar',

);
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@
'module' => $module_name,
'width' => '4%',
),
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'quickedit_button' => array(
'vname' => 'LBL_QUICKEDIT_BUTTON',
'widget_class' => 'SubPanelQuickEditButton',
'module' => $module_name,
'width' => '4%',
),
// END STIC-Custom
'remove_button' => array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
Expand Down
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/person/language/ca_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
'LBL_EMAIL_NON_PRIMARY' => 'Correus electrònics no principals',
'LBL_PHOTO' => 'Foto',
'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Eliminar',

//Lawful Basis labels
Expand Down
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/person/language/en_us.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
'LBL_EMAIL_NON_PRIMARY' => 'Non Primary E-mails',
'LBL_PHOTO' => 'Photo',
'LBL_EDIT_BUTTON' => 'Edit',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Edit',
// END STIC-Custom
'LBL_REMOVE' => 'Remove',

//Lawful Basis labels
Expand Down
4 changes: 4 additions & 0 deletions include/SugarObjects/templates/person/language/es_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
'LBL_EMAIL_NON_PRIMARY' => 'Correos Electrónicos No Principales',
'LBL_PHOTO' => 'Foto',
'LBL_EDIT_BUTTON' => 'Editar',
// STIC-Custom 20240214 JBL - QuickEdit view
// https://github.com/SinergiaTIC/SinergiaCRM/pull/93
'LBL_QUICKEDIT_BUTTON' => '↙ Editar',
// END STIC-Custom
'LBL_REMOVE' => 'Quitar',

//Lawful Basis labels
Expand Down
Loading
Loading