From a69cf1d18691a805b1d8c9f104d4a00ed4f1cdc4 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 30 Mar 2019 08:13:34 +1100 Subject: [PATCH] Convert the Fullfilled Date field in preimum section on backoffice contribution from from jcalendar to datepicker Fix up defaults --- CRM/Contribute/DAO/ContributionProduct.php | 6 +- CRM/Contribute/Form/AdditionalInfo.php | 7 +- CRM/Contribute/Form/Contribution.php | 2 +- .../Form/AdditionalInfo/Premium.tpl | 115 +++++++++--------- xml/schema/Contribute/ContributionProduct.xml | 4 + 5 files changed, 68 insertions(+), 66 deletions(-) diff --git a/CRM/Contribute/DAO/ContributionProduct.php b/CRM/Contribute/DAO/ContributionProduct.php index 398db85756..a8e344185c 100644 --- a/CRM/Contribute/DAO/ContributionProduct.php +++ b/CRM/Contribute/DAO/ContributionProduct.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/ContributionProduct.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:82892e993d78273218096926fa04282e) + * (GenCodeChecksum:b5a1b3fa2819c4dfe99635fef8583a42) */ /** @@ -193,6 +193,10 @@ class CRM_Contribute_DAO_ContributionProduct extends CRM_Core_DAO { 'entity' => 'ContributionProduct', 'bao' => 'CRM_Contribute_DAO_ContributionProduct', 'localizable' => 0, + 'html' => [ + 'type' => 'Select Date', + 'formatType' => 'activityDate', + ], ], 'contribution_start_date' => [ 'name' => 'start_date', diff --git a/CRM/Contribute/Form/AdditionalInfo.php b/CRM/Contribute/Form/AdditionalInfo.php index ec27855294..8eedeaa8d9 100644 --- a/CRM/Contribute/Form/AdditionalInfo.php +++ b/CRM/Contribute/Form/AdditionalInfo.php @@ -81,7 +81,7 @@ class CRM_Contribute_Form_AdditionalInfo { $js .= "\n"; $form->assign('initHideBoxes', $js); - $form->addDate('fulfilled_date', ts('Fulfilled'), FALSE, array('formatType' => 'activityDate')); + $form->add('datepicker', 'fulfilled_date', ts('Fulfilled'), [], FALSE, array('time' => FALSE)); $form->addElement('text', 'min_amount', ts('Minimum Contribution Amount')); } @@ -192,7 +192,7 @@ class CRM_Contribute_Form_AdditionalInfo { $dao = new CRM_Contribute_DAO_ContributionProduct(); $dao->contribution_id = $contributionID; $dao->product_id = $selectedProductID; - $dao->fulfilled_date = CRM_Utils_Date::processDate($params['fulfilled_date'], NULL, TRUE); + $dao->fulfilled_date = $params['fulfilled_date']; $isDeleted = FALSE; //CRM-11106 @@ -369,9 +369,8 @@ class CRM_Contribute_Form_AdditionalInfo { $params['product_option'] = $form->_options[$productDAO->id][$productOptionID]; } } - if (!empty($params['fulfilled_date'])) { - $form->assign('fulfilled_date', CRM_Utils_Date::processDate($params['fulfilled_date'])); + $form->assign('fulfilled_date', $params['fulfilled_date']); } } diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index cc1f6247e7..8326d73c03 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -412,7 +412,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $defaults['product_name'] = array($this->_productDAO->product_id); } if ($this->_productDAO->fulfilled_date) { - list($defaults['fulfilled_date']) = CRM_Utils_Date::setDateDefaults($this->_productDAO->fulfilled_date); + $defaults['fulfilled_date'] = $this->_productDAO->fulfilled_date; } } diff --git a/templates/CRM/Contribute/Form/AdditionalInfo/Premium.tpl b/templates/CRM/Contribute/Form/AdditionalInfo/Premium.tpl index c5ab2ac887..351e5805c9 100644 --- a/templates/CRM/Contribute/Form/AdditionalInfo/Premium.tpl +++ b/templates/CRM/Contribute/Form/AdditionalInfo/Premium.tpl @@ -24,71 +24,66 @@ +--------------------------------------------------------------------+ *} {* this template is used for adding/editing Premium Information *} -
- - - - - -
{$form.product_name.label}{$form.product_name.html}
+
+ + + + + +
{$form.product_name.label}{$form.product_name.html}
-
- - - - - -
{$form.min_amount.label}{$form.min_amount.html|crmAddClass:'no-border'|crmMoney:$currency}
-
-
+
+ + + + +
{$form.min_amount.label}{$form.min_amount.html|crmAddClass:'no-border'|crmMoney:$currency}
+
+
+ - - - -
{$form.fulfilled_date.label}{include file="CRM/common/jcalendar.tpl" elementName=fulfilled_date}
+ {$form.fulfilled_date.label} + {$form.fulfilled_date.html} + +
- {literal} - - {/literal} -{if $action eq 1 or $action eq 2 or $action eq null } - +{literal} + +{/literal} +{if $action eq 1 or $action eq 2 or $action eq null} + {/if} {if $action ne 2 or $showOption eq true} - {$initHideBoxes} + {$initHideBoxes} {/if} diff --git a/xml/schema/Contribute/ContributionProduct.xml b/xml/schema/Contribute/ContributionProduct.xml index ce6865ec5d..d5ff804a10 100644 --- a/xml/schema/Contribute/ContributionProduct.xml +++ b/xml/schema/Contribute/ContributionProduct.xml @@ -73,6 +73,10 @@ true Optional. Can be used to record the date this product was fulfilled or shipped. 1.4 + + Select Date + activityDate + start_date -- 2.25.1