r69653 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69652‎ | r69653 | r69654 >
Date:00:20, 21 July 2010
Author:kaldari
Status:deferred
Tags:
Comment:
adding needed patches from unstable CiviCRM 3.2
Modified paths:
  • /civicrm/trunk/sites/all/modules/civicrm/CRM/Contribute/Form/AdditionalInfo.php (modified) (history)
  • /civicrm/trunk/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution.php (modified) (history)
  • /civicrm/trunk/sites/all/modules/civicrm/CRM/Utils/Rule.php (modified) (history)
  • /civicrm/trunk/sites/all/modules/civicrm/api/v2/Contribute.php (modified) (history)
  • /civicrm/trunk/sites/all/modules/civicrm/templates/CRM/Contribute/Form/Contribution.tpl (modified) (history)
  • /civicrm/trunk/sites/all/modules/civicrm/templates/CRM/Contribute/Form/ContributionView.tpl (modified) (history)
  • /civicrm/trunk/sites/all/modules/civicrm/templates/CRM/Contribute/Form/Selector.tpl (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/civicrm/CRM/Utils/Rule.php
@@ -161,7 +161,7 @@
162162 {
163163 $result = $default;
164164 if ( is_string( $value ) &&
165 - preg_match( '/^\d\d\d\d-?\d\d-?\d\d(\s\d\d:\d{1,2})?$/', $value ) ) {
 165+ preg_match( '/^\d\d\d\d-?\d\d-?\d\d(\s\d\d:\d\d:\d\d|\d\d\d\d\d\d)?$/', $value ) ) {
166166 $result = $value;
167167 }
168168
Index: civicrm/trunk/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution.php
@@ -494,8 +494,6 @@
495495
496496 if ( $this->_id ) {
497497 $this->_contactID = $defaults['contact_id'];
498 - } else {
499 - list( $defaults['receive_date'] ) = CRM_Utils_Date::setDateDefaults( );
500498 }
501499
502500 require_once 'CRM/Utils/Money.php';
@@ -567,11 +565,17 @@
568566 $dates = array( 'receive_date', 'receipt_date', 'cancel_date', 'thankyou_date' );
569567 foreach( $dates as $key ) {
570568 if ( CRM_Utils_Array::value( $key, $defaults ) ) {
571 - list( $defaults[$key] ) = CRM_Utils_Date::setDateDefaults( CRM_Utils_Array::value( $key, $defaults ) );
 569+ list( $defaults[$key],
 570+ $defaults[$key.'_time'] ) = CRM_Utils_Date::setDateDefaults( CRM_Utils_Array::value( $key, $defaults ), 'activityDateTime' );
572571 }
573572 }
574573
575 - $this->assign( 'receive_date', CRM_Utils_Date::processDate( $defaults['receive_date'] ) );
 574+ if ( !$this->_id && !CRM_Utils_Array::value( 'receive_date', $defaults ) ) {
 575+ list( $defaults['receive_date'],
 576+ $defaults['receive_date_time'] ) = CRM_Utils_Date::setDateDefaults( null, 'activityDateTime' );
 577+ }
 578+
 579+ $this->assign( 'receive_date', CRM_Utils_Date::processDate( $defaults['receive_date'], $params['receive_date_time'] ) );
576580 $this->assign( 'currency', CRM_Utils_Array::value( 'currency', $defaults ) );
577581 $this->assign( 'totalAmount', CRM_Utils_Array::value( 'total_amount', $defaults ) );
578582
Index: civicrm/trunk/sites/all/modules/civicrm/CRM/Contribute/Form/AdditionalInfo.php
@@ -100,7 +100,7 @@
101101
102102 $attributes = CRM_Core_DAO::getAttribute( 'CRM_Contribute_DAO_Contribution' );
103103
104 - $this->addDate( 'thankyou_date', ts('Thank-you Sent'), false, array( 'formatType' => 'activityDate') );
 104+ $this->addDateTime( 'thankyou_date', ts('Thank-you Sent'), false, array( 'formatType' => 'activityDateTime') );
105105
106106 // add various amounts
107107 $element =& $form->add( 'text', 'non_deductible_amount', ts('Non-deductible Amount'),
@@ -254,7 +254,7 @@
255255 }
256256
257257 if ( CRM_Utils_Array::value('thankyou_date', $params ) && ! CRM_Utils_System::isNull( $params['thankyou_date'] ) ) {
258 - $formatted['thankyou_date'] = CRM_Utils_Date::processDate( $params['thankyou_date'] );
 258+ $formatted['thankyou_date'] = CRM_Utils_Date::processDate( $params['thankyou_date'], $params['thankyou_date_time'] );
259259 } else {
260260 $formatted['thankyou_date'] = 'null';
261261 }
Index: civicrm/trunk/sites/all/modules/civicrm/templates/CRM/Contribute/Form/ContributionView.tpl
@@ -70,7 +70,7 @@
7171
7272 <tr>
7373 <td class="label">{ts}Received{/ts}</td>
74 - <td>{if $receive_date}{$receive_date|truncate:10:''|crmDate}{else}({ts}pending{/ts}){/if}</td>
 74+ <td>{if $receive_date}{$receive_date|crmDate}{else}({ts}pending{/ts}){/if}</td>
7575 </tr>
7676 <tr>
7777 <td class="label">{ts}Contribution Status{/ts}</td>
@@ -81,7 +81,7 @@
8282 {if $cancel_date}
8383 <tr>
8484 <td class="label">{ts}Cancelled Date{/ts}</td>
85 - <td>{$cancel_date|truncate:10:''|crmDate}</td>
 85+ <td>{$cancel_date|crmDate}</td>
8686 </tr>
8787 {if $cancel_reason}
8888 <tr>
@@ -108,7 +108,7 @@
109109 {if $receipt_date}
110110 <tr>
111111 <td class="label">{ts}Receipt Sent{/ts}</td>
112 - <td>{$receipt_date|truncate:10:''|crmDate}</td>
 112+ <td>{$receipt_date|crmDate}</td>
113113 </tr>
114114 {/if}
115115 {foreach from=$note item="rec"}
@@ -143,7 +143,7 @@
144144 {if $thankyou_date}
145145 <tr>
146146 <td class="label">{ts}Thank-you Sent{/ts}</td>
147 - <td>{$thankyou_date|truncate:10:''|crmDate}</td>
 147+ <td>{$thankyou_date|crmDate}</td>
148148 </tr>
149149 {/if}
150150
Index: civicrm/trunk/sites/all/modules/civicrm/templates/CRM/Contribute/Form/Contribution.tpl
@@ -123,7 +123,7 @@
124124 {if !$contributionMode}
125125 <tr>
126126 <td class="label">{$form.receive_date.label}</td>
127 - <td{$valueStyle}>{if $hideCalender neq true}{include file="CRM/common/jcalendar.tpl" elementName=receive_date}{else}{$receive_date|truncate:10:''|crmDate}{/if}<br />
 127+ <td{$valueStyle}>{if $hideCalender neq true}{include file="CRM/common/jcalendar.tpl" elementName=receive_date}{else}{$receive_date|crmDate}{/if}<br />
128128 <span class="description">{ts}The date this contribution was received.{/ts}</span>
129129 </td>
130130 </tr>
Index: civicrm/trunk/sites/all/modules/civicrm/templates/CRM/Contribute/Form/Selector.tpl
@@ -65,12 +65,12 @@
6666 </td>
6767 <td>{$row.contribution_type}</td>
6868 <td>{$row.contribution_source}</td>
69 - <td>{$row.receive_date|truncate:10:''|crmDate}</td>
70 - <td>{$row.thankyou_date|truncate:10:''|crmDate}</td>
 69+ <td>{$row.receive_date|crmDate}</td>
 70+ <td>{$row.thankyou_date|crmDate}</td>
7171 <td>
7272 {$row.contribution_status_id}<br />
7373 {if $row.cancel_date}
74 - {$row.cancel_date|truncate:10:''|crmDate}
 74+ {$row.cancel_date|crmDate}
7575 {/if}
7676 </td>
7777 <td>{$row.product_name}</td>
Index: civicrm/trunk/sites/all/modules/civicrm/api/v2/Contribute.php
@@ -62,9 +62,11 @@
6363 return civicrm_create_error( ts( 'Input parameters is not an array' ) );
6464 }
6565
66 - $error = _civicrm_contribute_check_params( $params );
67 - if ( civicrm_error( $error ) ) {
68 - return $error;
 66+ if ( !CRM_Utils_Array::value( 'id', $params ) ) {
 67+ $error = _civicrm_contribute_check_params( $params );
 68+ if ( civicrm_error( $error ) ) {
 69+ return $error;
 70+ }
6971 }
7072
7173 $values = array( );

Status & tagging log