From e517eb43f44e54452ea1f441598f26e493e71dd1 Mon Sep 17 00:00:00 2001 From: "Matthew Wire (MJW Consulting)" Date: Fri, 21 Dec 2018 12:11:24 +0000 Subject: [PATCH] Remove activitystatus js. Add submitOnce handler for activity create --- CRM/Activity/Form/Activity.php | 31 ++++++------- templates/CRM/Activity/Form/Activity.tpl | 2 - templates/CRM/Activity/Form/ActivityJs.tpl | 51 ---------------------- templates/CRM/Case/Form/Activity.tpl | 4 -- 4 files changed, 13 insertions(+), 75 deletions(-) delete mode 100644 templates/CRM/Activity/Form/ActivityJs.tpl diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 6e261d0672..94f68c1203 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -792,31 +792,26 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { // form should be frozen for view mode $this->freeze(); - $buttons = array(); - $buttons[] = array( - 'type' => 'cancel', - 'name' => ts('Done'), - ); - $this->addButtons($buttons); + $this->addButtons([ + [ + 'type' => 'cancel', + 'name' => ts('Done'), + ], + ]); } else { - $message = array( - 'completed' => ts('Are you sure? This is a COMPLETED activity with the DATE in the FUTURE. Click Cancel to change the date / status. Otherwise, click OK to save.'), - 'scheduled' => ts('Are you sure? This is a SCHEDULED activity with the DATE in the PAST. Click Cancel to change the date / status. Otherwise, click OK to save.'), - ); - $js = array('onclick' => "return activityStatus(" . json_encode($message) . ");"); - $this->addButtons(array( - array( + $this->addButtons([ + [ 'type' => 'upload', 'name' => ts('Save'), - 'js' => $js, 'isDefault' => TRUE, - ), - array( + 'submitOnce' => TRUE, + ], + [ 'type' => 'cancel', 'name' => ts('Cancel'), - ), - )); + ], + ]); } if ($this->_activityTypeFile) { diff --git a/templates/CRM/Activity/Form/Activity.tpl b/templates/CRM/Activity/Form/Activity.tpl index 28f9145495..9069edfc88 100644 --- a/templates/CRM/Activity/Form/Activity.tpl +++ b/templates/CRM/Activity/Form/Activity.tpl @@ -32,8 +32,6 @@ {/if}
{/if} - {* added onload javascript for source contact*} - {include file="CRM/Activity/Form/ActivityJs.tpl" tokenContext="activity"} {if !$action or ( $action eq 1 ) or ( $action eq 2 ) }
{include file="CRM/common/formButtons.tpl" location="top"}
{/if} diff --git a/templates/CRM/Activity/Form/ActivityJs.tpl b/templates/CRM/Activity/Form/ActivityJs.tpl deleted file mode 100644 index d3d517aaed..0000000000 --- a/templates/CRM/Activity/Form/ActivityJs.tpl +++ /dev/null @@ -1,51 +0,0 @@ -{* - +--------------------------------------------------------------------+ - | CiviCRM version 5 | - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2019 | - +--------------------------------------------------------------------+ - | This file is a part of CiviCRM. | - | | - | CiviCRM is free software; you can copy, modify, and distribute it | - | under the terms of the GNU Affero General Public License | - | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | - | | - | CiviCRM 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 and the CiviCRM Licensing Exception along | - | with this program; if not, contact CiviCRM LLC | - | at info[AT]civicrm[DOT]org. If you have questions about the | - | GNU Affero General Public License or the licensing of CiviCRM, | - | see the CiviCRM license FAQ at http://civicrm.org/licensing | - +--------------------------------------------------------------------+ -*} -{* added onload javascript for source contact*} -{literal} - -{/literal} diff --git a/templates/CRM/Case/Form/Activity.tpl b/templates/CRM/Case/Form/Activity.tpl index fff7efa834..dc48f6202e 100644 --- a/templates/CRM/Case/Form/Activity.tpl +++ b/templates/CRM/Case/Form/Activity.tpl @@ -30,10 +30,6 @@ {if $action neq 8 and $action neq 32768 } {* Include form buttons on top for new and edit modes. *}
{include file="CRM/common/formButtons.tpl" location="top"}
- - {* added onload javascript for source contact*} - {include file="CRM/Activity/Form/ActivityJs.tpl" tokenContext="case_activity"} - {/if} {if $action eq 8 or $action eq 32768 } -- 2.25.1