11<?php
2+
3+ if (!class_exists ('GFForms ' )){
4+ die ();
5+ }
6+
27class GFEntryDetail{
38
49 public static function lead_detail_page (){
@@ -46,9 +51,14 @@ public static function lead_detail_page(){
4651 $ key = $ key_array [0 ];
4752 $ val = $ key_array [1 ] . ": " . $ val ;
4853 }
54+ $ type = rgget ("type " );
55+ if (empty ($ type )){
56+ $ type = rgget ("field_id " ) == "0 " ? "global " : "field " ;
57+ }
58+
4959 $ search_criteria ["field_filters " ][] = array (
5060 "key " => $ key ,
51- "type " => rgempty ( " type " , $ _GET ) ? " field " : rgget ( " type " ) ,
61+ "type " => $ type ,
5262 "operator " => rgempty ("operator " , $ _GET ) ? "is " : rgget ("operator " ),
5363 "value " => $ val
5464 );
@@ -157,6 +167,8 @@ public static function lead_detail_page(){
157167
158168 case "delete " :
159169 check_admin_referer ('gforms_save_entry ' , 'gforms_save_entry ' );
170+ if (!GFCommon::current_user_can_any ("gravityforms_delete_entries " ))
171+ die (__ ("You don't have adequate permissions to delete entries. " , "gravityforms " ));
160172 RGFormsModel::delete_lead ($ lead ["id " ]);
161173 ?>
162174 <script type="text/javascript">
@@ -321,9 +333,10 @@ function toggleNotificationOverride(isInit) {
321333 <div id="side-info-column" class="inner-sidebar">
322334 <?php do_action ("gform_entry_detail_sidebar_before " , $ form , $ lead ); ?>
323335
336+ <!-- INFO BOX -->
324337 <div id="submitdiv" class="stuffbox">
325338 <h3>
326- <span class="hndle"><?php _e ("Info " , "gravityforms " ); ?> </span>
339+ <span class="hndle"><?php _e ("Entry " , "gravityforms " ); ?> </span>
327340 </h3>
328341 <div class="inside">
329342 <div id="submitcomment" class="submitbox">
@@ -377,10 +390,13 @@ function toggleNotificationOverride(isInit) {
377390 }
378391 }
379392 do_action ("gform_entry_info " , $ form ["id " ], $ lead );
393+
394+ //Placing this hook here temporarily so that addons can switch over to it. Then this hook will be moved to the separate (new) Payment Detail box.
395+ do_action ("gform_payment_details " , $ form ["id " ], $ lead );
380396 ?>
381397 </div>
382398 <div id="major-publishing-actions">
383- <div>
399+ <div id="delete-action" >
384400 <?php
385401 switch ($ lead ["status " ]){
386402 case "spam " :
@@ -445,10 +461,18 @@ function toggleNotificationOverride(isInit) {
445461 }
446462 ?>
447463 </div>
464+ <div class="clear"></div>
448465 </div>
449466 </div>
450467 </div>
451468 </div>
469+
470+ <?php
471+ // if (!empty($lead["payment_status"])) {
472+ // self::payment_details_box($lead, $form);
473+ // }
474+ ?>
475+
452476 <?php do_action ("gform_entry_detail_sidebar_middle " , $ form , $ lead ); ?>
453477
454478 <?php if (GFCommon::current_user_can_any ("gravityforms_edit_entry_notes " ) ) { ?>
@@ -526,7 +550,7 @@ function toggleNotificationOverride(isInit) {
526550 do_action ("gform_entry_detail " , $ form , $ lead );
527551
528552 if (GFCommon::current_user_can_any ("gravityforms_view_entry_notes " )) { ?>
529- <div id="namediv" class="stuffbox ">
553+ <div class="postbox ">
530554 <h3>
531555 <label for="name"><?php _e ("Notes " , "gravityforms " ); ?> </label>
532556 </h3>
@@ -576,7 +600,7 @@ public static function lead_detail_edit($form, $lead){
576600 $ form = apply_filters ("gform_admin_pre_render_ " . $ form ["id " ], apply_filters ("gform_admin_pre_render " , $ form ));
577601 $ form_id = $ form ["id " ];
578602 ?>
579- <div id="namediv" class="stuffbox ">
603+ <div class="postbox ">
580604 <h3>
581605 <label for="name"><?php _e ("Details " , "gravityforms " ); ?> </label>
582606 </h3>
@@ -681,14 +705,15 @@ public static function notes_grid($notes, $is_editable, $emails = null, $autores
681705 <td class="entry-detail-note<?php echo $ is_last ? " lastrow " : "" ?> ">
682706 <?php
683707 }
708+ $ class = $ note ->note_type ? " gforms_note_ {$ note ->note_type }" : "" ;
684709 ?>
685710 <div style="margin-top:4px;">
686- <div class="note-avatar"><?php echo get_avatar ($ note ->user_id , 48 );?> </div>
711+ <div class="note-avatar"><?php echo apply_filters ( " gform_notes_avatar " , get_avatar ($ note ->user_id , 48 ), $ note );?> </div>
687712 <h6 class="note-author"> <?php echo esc_html ($ note ->user_name )?> </h6>
688713 <p style="line-height:130%; text-align:left; margin-top:3px;"><a href="mailto:<?php echo esc_attr ($ note ->user_email )?> "><?php echo esc_html ($ note ->user_email ) ?> </a><br />
689714 <?php _e ("added on " , "gravityforms " ); ?> <?php echo esc_html (GFCommon::format_date ($ note ->date_created , false )) ?> </p>
690715 </div>
691- <div class="detail-note-content"><?php echo esc_html ($ note ->value ) ?> </div>
716+ <div class="detail-note-content<?php echo $ class ?> "><?php echo esc_html ($ note ->value ) ?> </div>
692717 </td>
693718
694719 </tr>
@@ -925,5 +950,60 @@ public static function entry_detail_pagination_link($pos, $label = '', $class =
925950 return '<a ' . $ href . ' class=" ' . $ class . '" title=" ' . $ label . '"><i class="fa-lg ' . $ icon . '"></i></a></li> ' ;
926951 }
927952
953+ /**
954+ * @param $lead
955+ * @param $form
956+ * @return mixed
957+ */
958+ public static function payment_details_box ($ lead , $ form )
959+ {
960+ ?>
961+ <!-- PAYMENT BOX -->
962+ <div id="submitdiv" class="stuffbox">
963+ <h3>
964+ <span
965+ class="hndle"><?php echo $ lead ["transaction_type " ] == 1 ? __ ("Payment Details " , "gravityforms " ) : __ ("Subscription Details " , "gravityforms " ); ?> </span>
966+ </h3>
967+
968+ <div class="inside">
969+ <div id="submitcomment" class="submitbox">
970+ <div id="minor-publishing" style="padding:10px;">
971+ <br/>
972+ <?php
973+ if (!empty ($ lead ["payment_status " ])) {
974+ echo __ ("Status " , "gravityforms " ); ?> : <span
975+ id="gform_payment_status"><?php echo apply_filters ("gform_payment_status " , $ lead ["payment_status " ], $ form , $ lead ) ?> </span>
976+ <br/><br/>
977+ <?php
978+ if (!empty ($ lead ["payment_date " ])) {
979+ echo __ ("Date " , "gravityforms " ) ?> : <?php echo GFCommon::format_date ($ lead ["payment_date " ], false , "Y/m/d " , $ lead ["transaction_type " ] == 1 ) ?>
980+ <br/><br/>
981+ <?php
982+ }
983+
984+ if (!empty ($ lead ["transaction_id " ])) {
985+ echo $ lead ["transaction_type " ] == 1 ? __ ("Transaction Id " , "gravityforms " ) : __ ("Subscription Id " , "gravityforms " ); ?> : <?php echo $ lead ["transaction_id " ] ?>
986+ <br/><br/>
987+ <?php
988+ }
989+
990+ if (!rgblank ($ lead ["payment_amount " ])) {
991+ echo $ lead ["transaction_type " ] == 1 ? __ ("Amount " , "gravityforms " ) : __ ("Recurring Amount " , "gravityforms " ); ?> : <?php echo GFCommon::to_money ($ lead ["payment_amount " ], $ lead ["currency " ]) ?>
992+ <br/><br/>
993+ <?php
994+ }
995+ }
996+ do_action ("gform_payment_details " , $ form ["id " ], $ lead );
997+
998+ ?>
999+ </div>
1000+ </div>
1001+ </div>
1002+ </div>
1003+ <?php
1004+ }
1005+
1006+
1007+
9281008}
9291009?>
0 commit comments