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
18 changes: 11 additions & 7 deletions include/SugarObjects/templates/company/language/ca_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,23 @@
'LBL_SHIPPING_ADDRESS' => 'Adreça d\'enviament:',

'LBL_STATE' => 'Estat o regió:',
'LBL_TICKER_SYMBOL' => 'Sigla Bursàtil:',
'LBL_TICKER_SYMBOL' => 'Sigla bursàtil:',
'LBL_TYPE' => 'Tipus:',
'LBL_WEBSITE' => 'Lloc Web:',
'LBL_WEBSITE' => 'Lloc web:',

'LNK_ACCOUNT_LIST' => 'Comptes',
'LNK_NEW_ACCOUNT' => 'Nou Compte',

'MSG_DUPLICATE' => 'La creació d\'aquest compte pot produir un compte duplicat. Pot elegir un compte existent de la llista inferior o fer clic a Desar per continuar la creació d\'un nou compte amb les dades introduïdes prèviament.',
'MSG_SHOW_DUPLICATES' => 'La creació d\'aquest compte pot crear un duplicat. Pot fer clic a Desar per continuar amb la creació d\'aquest nou compte amb les dades prèviament introduïdes o pot fer clic en Cancel·lar.',
'MSG_DUPLICATE' => 'La creació d\'aquest compte pot produir un compte duplicat. Podeu escollir un compte existent de la llista següent o fer clic a Desa per continuar la creació d\'un nou compte amb les dades introduïdes prèviament.',
'MSG_SHOW_DUPLICATES' => 'La creació d\'aquest compte pot crear un compte duplicat. Podeu fer clic a Desa per continuar amb la creació d\'un nou compte amb les dades prèviament introduïdes o podeu fer clic a Cancel·la.',

'NTC_DELETE_CONFIRMATION' => 'Està segur de que vol suprimir aquest registre?',
'NTC_DELETE_CONFIRMATION' => 'Segur que voleu suprimir aquest registre?',

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

);
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
12 changes: 8 additions & 4 deletions include/SugarObjects/templates/file/language/ca_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,18 @@
'DEF_CREATE_LOG' => 'Document Creat',

//error messages
'ERR_DOC_NAME' => 'Nom de Document',
'ERR_DOC_NAME' => 'Nom del Document',
'ERR_DOC_ACTIVE_DATE' => 'Data de Publicació',
'ERR_FILENAME' => 'Nom d\'Arxiu',

//sub-panel vardefs.
'LBL_LIST_DOCUMENT_NAME' => 'Nom de Document',
'LBL_LIST_DOCUMENT_NAME' => 'Nom del Document',

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

);
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
8 changes: 6 additions & 2 deletions include/SugarObjects/templates/issue/language/ca_ES.lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@
'LBL_TYPE' => 'Tipus:',
'LBL_SUBJECT' => 'Assumpte:',

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

);
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',

);
Loading
Loading