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;

}


}
2 changes: 1 addition & 1 deletion modules/stic_Assessments/metadata/subpanels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Assessments',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Contacts_Relationships',
'width' => '4%',
'default' => true,
Expand Down
2 changes: 1 addition & 1 deletion modules/stic_FollowUps/metadata/subpanels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_FollowUps',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Goals',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Goals',
'width' => '4%',
'default' => true,
Expand Down
2 changes: 1 addition & 1 deletion modules/stic_Goals/metadata/subpanels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Goals',
'width' => '4%',
'default' => true,
Expand Down
2 changes: 1 addition & 1 deletion modules/stic_Grants/metadata/subpanels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => $module_name,
'width' => '4%',
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
),
'edit_button'=>array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => $module_name,
'width' => '4%',
),
Expand Down
2 changes: 1 addition & 1 deletion modules/stic_Medication_Log/metadata/subpanels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
'edit_button' =>
array (
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Medication_Log',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Payment_Commitments',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Payment_Commitments',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Payment_Commitments',
'width' => '4%',
'default' => true,
Expand Down
2 changes: 1 addition & 1 deletion modules/stic_Payments/metadata/subpanels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Payments',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Payments',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
'edit_button' =>
array (
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Personal_Environment',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Personal_Environment',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
'edit_button' =>
array (
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Personal_Environment',
'width' => '4%',
'default' => true,
Expand Down
2 changes: 1 addition & 1 deletion modules/stic_Prescription/metadata/subpanels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
'edit_button' =>
array (
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Prescription',
'width' => '4%',
'default' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Registrations',
'width' => '4%',
'default' => true,
Expand Down
2 changes: 1 addition & 1 deletion modules/stic_Registrations/metadata/subpanels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
),
'edit_button' => array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => 'stic_Registrations',
'width' => '4%',
'default' => true,
Expand Down
2 changes: 1 addition & 1 deletion modules/stic_Sepe_Actions/metadata/subpanels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
),
'edit_button'=>array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => $module_name,
'width' => '4%',
),
Expand Down
2 changes: 1 addition & 1 deletion modules/stic_Sepe_Incidents/metadata/subpanels/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
),
'edit_button'=>array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'widget_class' => 'SubPanelQuickEditButton',
'module' => $module_name,
'width' => '4%',
),
Expand Down
Loading