Commit a69cf1d1 authored by Seamus Lee's avatar Seamus Lee

Convert the Fullfilled Date field in preimum section on backoffice...

Convert the Fullfilled Date field in preimum section on backoffice contribution from from jcalendar to datepicker

Fix up defaults
parent cb7f35b2
......@@ -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',
......
......@@ -81,7 +81,7 @@ class CRM_Contribute_Form_AdditionalInfo {
$js .= "</script>\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']);
}
}
......
......@@ -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;
}
}
......
......@@ -24,71 +24,66 @@
+--------------------------------------------------------------------+
*}
{* this template is used for adding/editing Premium Information *}
<div id="id-premium" class="section-shown crm-contribution-additionalinfo-premium-form-block">
<table class="form-layout-compressed">
<tr class="crm-contribution-form-block-product_name">
<td class="label">{$form.product_name.label}</td>
<td class="html-adjust">{$form.product_name.html}</td>
</tr>
</table>
<div id="id-premium" class="section-shown crm-contribution-additionalinfo-premium-form-block">
<table class="form-layout-compressed">
<tr class="crm-contribution-form-block-product_name">
<td class="label">{$form.product_name.label}</td>
<td class="html-adjust">{$form.product_name.html}</td>
</tr>
</table>
<div id="premium_contri">
<table class="form-layout-compressed">
<tr class="crm-contribution-form-block-min_amount">
<td class="label">{$form.min_amount.label}</td>
<td class="html-adjust">{$form.min_amount.html|crmAddClass:'no-border'|crmMoney:$currency}</td>
</tr>
</table>
<div class="spacer"></div>
</div>
<div id="premium_contri">
<table class="form-layout-compressed">
<tr class="crm-contribution-form-block-min_amount">
<td class="label">{$form.min_amount.label}</td>
<td class="html-adjust">{$form.min_amount.html|crmAddClass:'no-border'|crmMoney:$currency}</td>
</tr>
</table>
<div class="spacer"></div>
</div>
<table class="form-layout-compressed">
<tr class="crm-contribution-form-block-fulfilled_date">
<td class="label">{$form.fulfilled_date.label}</td>
<td class="html-adjust">{include file="CRM/common/jcalendar.tpl" elementName=fulfilled_date}</td>
</tr>
</table>
<td class="label">{$form.fulfilled_date.label}</td>
<td class="html-adjust">{$form.fulfilled_date.html}</td>
</tr>
</table>
</div>
{literal}
<script type="text/javascript">
var min_amount = document.getElementById("min_amount");
min_amount.readOnly = 1;
function showMinContrib( ) {
var product = document.getElementsByName("product_name[0]")[0];
var product_id = product.options[product.selectedIndex].value;
var min_amount = document.getElementById("min_amount");
var amount = [];
amount[0] = '';
if( product_id > 0 ) {
cj('#premium_contri').show();
} else {
cj('#premium_contri').hide();
}
{/literal}
var index = 1;
{foreach from= $mincontribution item=amt key=id}
{literal}amount[index]{/literal} = "{$amt}"
{literal}index = index + 1{/literal}
{/foreach}
{literal}
if(amount[product_id]) {
min_amount.value = amount[product_id];
} else {
min_amount.value = "";
}
}
</script>
{/literal}
{if $action eq 1 or $action eq 2 or $action eq null }
<script type="text/javascript">
showMinContrib( );
</script>
{literal}
<script type="text/javascript">
var min_amount = document.getElementById("min_amount");
min_amount.readOnly = 1;
function showMinContrib( ) {
var product = document.getElementsByName("product_name[0]")[0];
var product_id = product.options[product.selectedIndex].value;
var min_amount = document.getElementById("min_amount");
var amount = [];
amount[0] = '';
if (product_id > 0) {
cj('#premium_contri').show();
} else {
cj('#premium_contri').hide();
}
{/literal}
var index = 1;
{foreach from= $mincontribution item=amt key=id}
{literal}amount[index]{/literal} = "{$amt}"
{literal}index = index + 1{/literal}
{/foreach}
{literal}
if (amount[product_id]) {
min_amount.value = amount[product_id];
} else {
min_amount.value = "";
}
}
</script>
{/literal}
{if $action eq 1 or $action eq 2 or $action eq null}
<script type="text/javascript">
showMinContrib();
</script>
{/if}
{if $action ne 2 or $showOption eq true}
{$initHideBoxes}
{$initHideBoxes}
{/if}
......@@ -73,6 +73,10 @@
<export>true</export>
<comment>Optional. Can be used to record the date this product was fulfilled or shipped.</comment>
<add>1.4</add>
<html>
<type>Select Date</type>
<formatType>activityDate</formatType>
</html>
</field>
<field>
<name>start_date</name>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment