From d6aff1cc3716bc429a042b1f7c19953bda956656 Mon Sep 17 00:00:00 2001 From: Joshua Roy Date: Thu, 18 May 2017 11:32:45 -0400 Subject: [PATCH] Committing Bridgets changes to review them --- template-class.php | 4 +- templates/page-purchasing.php | 41 ++- uc-purchasing.php | 582 +++++++++++++++++++++++++++++++--- 3 files changed, 568 insertions(+), 59 deletions(-) diff --git a/template-class.php b/template-class.php index 49c3516..a3fc99a 100644 --- a/template-class.php +++ b/template-class.php @@ -88,9 +88,7 @@ class Purchasing_Template_Plugin { // Add your templates to this array. $this->templates = array( - 'page-purchasing.php' => __( 'Purchasing', $this->plugin_slug ), - //'page-sample2.php' => __( 'Sample2', $this->plugin_slug ), - //'page-sample3.php' => __( 'Sample3', $this->plugin_slug ), + 'page-purchasing.php' => __( 'Purchasing', $this->plugin_slug ) ); // adding support for theme templates to be merged and shown in dropdown diff --git a/templates/page-purchasing.php b/templates/page-purchasing.php index e32e86c..e59a608 100644 --- a/templates/page-purchasing.php +++ b/templates/page-purchasing.php @@ -83,18 +83,37 @@ get_header(); ?> foreach($vc as $c){ $urlvc .= 'vc[]='.$c.'&'; } - } + } ?> + + + + + + + + + + + + + @@ -193,7 +212,19 @@ get_header(); ?> - + + + + + + + + + + @@ -203,8 +234,10 @@ get_header(); ?> -
Project NumberAward DateProject DescriptionFirm AwardedContract ValueCPCA ContactContract Name Contract No. Expires Vendor Name Contact Name Contact PhoneVendor Characteristics

- + + + +
'', 'title' => __('Title'), - 'contract_number' => __('Contract Number'), + 'contract_number' => __('Contract or Project/Bid Number'), 'contract_vendor_name' => __('Vendor Name'), 'author' => __('Author'), 'date' => __('Date') @@ -193,8 +193,12 @@ add_filter('manage_uc_contract_posts_columns' , 'add_uc_contract_columns'); function uc_contract_columns( $column, $post_id ) { switch ( $column ) { case 'contract_number': - echo get_field( "contract_number", $post_id ); - break; + if(get_field( "contract_number", $post_id ) == ""){ + echo get_field( "cpca_project_number", $post_id ); + } else { + echo get_field( "contract_number", $post_id ); + } + break; case 'contract_vendor_name': echo get_field( "contract_vendor_name", $post_id ); break; @@ -294,6 +298,11 @@ function acf_after_submission( $entry ) update_field( "contract_name", '', $post_id ); } + $value = get_post_meta( $post_id, 'contract_type', $single = true ); + if ( empty($value) ){ + update_field( "contract_type", '', $post_id ); + } + $value = get_post_meta( $post_id, 'contract_number', $single = true ); if ( empty($value) ){ update_field( "contract_number", '', $post_id ); @@ -323,6 +332,43 @@ function acf_after_submission( $entry ) if ( empty($value) ){ update_field( "contract_file", '', $post_id ); } + + //Construction and Professional Awards fields + + $value = get_post_meta( $post_id, 'cpca_project_number', $single = true ); + if ( empty($value) ){ + update_field( "cpca_project_number", '', $post_id ); + } + + $value = get_post_meta( $post_id, 'cpca_award_date', $single = true ); + if ( empty($value) ){ + update_field( "cpca_award_date", '', $post_id ); + } + + $value = get_post_meta( $post_id, 'cpca_award_desc', $single = true ); + if ( empty($value) ){ + update_field( "cpca_award_desc", '', $post_id ); + } + + $value = get_post_meta( $post_id, 'cpca_firm_awarded', $single = true ); + if ( empty($value) ){ + update_field( "cpca_firm_awarded", '', $post_id ); + } + + $value = get_post_meta( $post_id, 'cpca_contract_value', $single = true ); + if ( empty($value) ){ + update_field( "cpca_contract_value", '', $post_id ); + } + + $value = get_post_meta( $post_id, 'cpca_contact_name', $single = true ); + if ( empty($value) ){ + update_field( "cpca_contact_name", '', $post_id ); + } + + $value = get_post_meta( $post_id, 'cpca_contact_phone', $single = true ); + if ( empty($value) ){ + update_field( "cpca_contact_phone", '', $post_id ); + } } add_action( "gform_after_submission", "acf_after_submission", $priority = 10, $args = 1 ); @@ -354,6 +400,7 @@ function acf_after_submission_upload_file( $entry, $form ){ $post = get_post( $entry['post_id'] ); if( is_null( $post ) ){ return; + } } else { return; @@ -522,14 +569,40 @@ add_action( 'pre_get_posts', function( $q ) if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array ( - 'key' => 'group_572b3f3556d00', + 'key' => 'group_5915d82d3b8ee', 'title' => 'Contract', 'fields' => array ( array ( - 'key' => 'field_5784f464937fb', + 'key' => 'field_5915e2349513b', + 'label' => 'Contract Status', + 'name' => 'contract_status', + 'type' => 'select', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => 0, + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'choices' => array ( + 'New' => 'New', + 'Update' => 'Update', + ), + 'default_value' => array ( + ), + 'allow_null' => 0, + 'multiple' => 0, + 'ui' => 0, + 'ajax' => 0, + 'return_format' => 'value', + 'placeholder' => '', + ), + array ( + 'key' => 'field_5915d83a1dcda', 'label' => 'Contract Type', 'name' => 'contract_type', - 'type' => 'text', + 'type' => 'select', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, @@ -538,22 +611,52 @@ acf_add_local_field_group(array ( 'class' => '', 'id' => '', ), - 'default_value' => '', + 'choices' => array ( + '0-100' => 'On-Call S/MBE GC and Trade Contracts (0 – 100k)', + '100-500' => 'On-Call GC and Trade Contracts (100k – 500k)', + 'Professional' => 'On-Call Professional Services Contracts', + 'Construction-Awards' => 'Open-Bid Construction Awards', + 'Professional-Services-Awards' => 'Open-Bid Professional Services Awards', + ), + 'default_value' => array ( + ), + 'allow_null' => 0, + 'multiple' => 0, + 'ui' => 0, + 'ajax' => 0, + 'return_format' => 'value', 'placeholder' => '', - 'prepend' => '', - 'append' => '', - 'maxlength' => '', - 'readonly' => 0, - 'disabled' => 0, ), array ( - 'key' => 'field_57308c3c17696', + 'key' => 'field_5915d86a8679d', 'label' => 'Contract No.', 'name' => 'contract_number', 'type' => 'text', 'instructions' => '', 'required' => 0, - 'conditional_logic' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '0-100', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '100-500', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional', + ), + ), + ), 'wrapper' => array ( 'width' => '', 'class' => '', @@ -564,17 +667,37 @@ acf_add_local_field_group(array ( 'prepend' => '', 'append' => '', 'maxlength' => '', - 'readonly' => 0, - 'disabled' => 0, ), array ( - 'key' => 'field_57308c4e17697', - 'label' => 'Expires', + 'key' => 'field_5915d8818679e', + 'label' => 'Contract Expires', 'name' => 'contract_expires', 'type' => 'date_picker', 'instructions' => '', 'required' => 0, - 'conditional_logic' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '0-100', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '100-500', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional', + ), + ), + ), 'wrapper' => array ( 'width' => '', 'class' => '', @@ -585,13 +708,35 @@ acf_add_local_field_group(array ( 'first_day' => 0, ), array ( - 'key' => 'field_57308c7317698', + 'key' => 'field_5915d8b72f116', 'label' => 'Vendor Name', 'name' => 'contract_vendor_name', 'type' => 'text', 'instructions' => '', 'required' => 0, - 'conditional_logic' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '0-100', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '100-500', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional', + ), + ), + ), 'wrapper' => array ( 'width' => '', 'class' => '', @@ -600,19 +745,40 @@ acf_add_local_field_group(array ( 'default_value' => '', 'placeholder' => '', 'prepend' => '', + 'append' => '', 'maxlength' => '', - 'readonly' => 0, - 'disabled' => 0, ), array ( - 'key' => 'field_57308c8817699', + 'key' => 'field_5915d8c52f117', 'label' => 'Contact Name', 'name' => 'contract_contact_name', 'type' => 'text', 'instructions' => '', 'required' => 0, - 'conditional_logic' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '0-100', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '100-500', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional', + ), + ), + ), 'wrapper' => array ( 'width' => '', 'class' => '', @@ -623,17 +789,212 @@ acf_add_local_field_group(array ( 'prepend' => '', 'append' => '', 'maxlength' => '', - 'readonly' => 0, - 'disabled' => 0, ), array ( - 'key' => 'field_57308c9b1769a', + 'key' => 'field_5915d8eb2f118', 'label' => 'Contact Phone', 'name' => 'contract_contact_phone', 'type' => 'text', 'instructions' => '', 'required' => 0, - 'conditional_logic' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '0-100', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '100-500', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional', + ), + ), + ), + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + 'maxlength' => '', + ), + array ( + 'key' => 'field_5915d95b2f11a', + 'label' => 'Contract File', + 'name' => 'contract_file', + 'type' => 'file', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '0-100', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => '100-500', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional', + ), + ), + ), + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'return_format' => 'array', + 'library' => 'all', + 'min_size' => '', + 'max_size' => '', + 'mime_types' => '', + ), + array ( + 'key' => 'field_5915e03eefff5', + 'label' => 'Project/Bid Number', + 'name' => 'cpca_project_number', + 'type' => 'text', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Construction-Awards', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional-Services-Awards', + ), + ), + ), + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + 'maxlength' => '', + ), + array ( + 'key' => 'field_5915e063efff7', + 'label' => 'Award Date', + 'name' => 'cpca_award_date', + 'type' => 'date_picker', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Construction-Awards', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional-Services-Awards', + ), + ), + ), + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'display_format' => 'Y/m/d', + 'return_format' => 'Y/m/d', + 'first_day' => 0, + ), + array ( + 'key' => 'field_5915e08fefff8', + 'label' => 'Award Description', + 'name' => 'cpca_award_description', + 'type' => 'textarea', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Construction-Awards', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional-Services-Awards', + ), + ), + ), + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'placeholder' => '', + 'maxlength' => '', + 'rows' => '', + 'new_lines' => 'wpautop', + ), + array ( + 'key' => 'field_5915e056efff6', + 'label' => 'Firm Awarded', + 'name' => 'cpca_firm_awarded', + 'type' => 'text', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Construction-Awards', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional-Services-Awards', + ), + ), + ), 'wrapper' => array ( 'width' => '', 'class' => '', @@ -644,11 +1005,144 @@ acf_add_local_field_group(array ( 'prepend' => '', 'append' => '', 'maxlength' => '', - 'readonly' => 0, - 'disabled' => 0, ), array ( - 'key' => 'field_57308cb41769b', + 'key' => 'field_5915e34d39dc2', + 'label' => 'Contract Value', + 'name' => 'cpca_contract_value', + 'type' => 'text', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Construction-Awards', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional-Services-Awards', + ), + ), + ), + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + 'maxlength' => '', + ), + array ( + 'key' => 'field_5915e0d2efff9', + 'label' => 'Contact Name', + 'name' => 'cpca_contact_name', + 'type' => 'text', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Construction-Awards', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional-Services-Awards', + ), + ), + ), + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + 'maxlength' => '', + ), + array ( + 'key' => 'field_5915e0e4efffa', + 'label' => 'Contact Phone', + 'name' => 'cpca_contact_phone', + 'type' => 'text', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Construction-Awards', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional-Services-Awards', + ), + ), + ), + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + 'maxlength' => '', + ), + array ( + 'key' => 'field_5915e0f8efffb', + 'label' => 'Contact Email', + 'name' => 'cpca_contact_email', + 'type' => 'email', + 'instructions' => '', + 'required' => 0, + 'conditional_logic' => array ( + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Construction-Awards', + ), + ), + array ( + array ( + 'field' => 'field_5915d83a1dcda', + 'operator' => '==', + 'value' => 'Professional-Services-Awards', + ), + ), + ), + 'wrapper' => array ( + 'width' => '', + 'class' => '', + 'id' => '', + ), + 'default_value' => '', + 'placeholder' => '', + 'prepend' => '', + 'append' => '', + ), + array ( + 'key' => 'field_5915d90a2f119', 'label' => 'Vendor Characteristics', 'name' => 'contract_vendor_characteristics', 'type' => 'checkbox', @@ -669,29 +1163,13 @@ acf_add_local_field_group(array ( 'SBE' => 'SBE', 'WBE' => 'WBE', ), + 'allow_custom' => 0, + 'save_custom' => 0, 'default_value' => array ( ), 'layout' => 'vertical', 'toggle' => 0, - ), - array ( - 'key' => 'field_57360a43b7bfe', - 'label' => 'Contract File', - 'name' => 'contract_file', - 'type' => 'file', - 'instructions' => '', - 'required' => 0, - 'conditional_logic' => 0, - 'wrapper' => array ( - 'width' => '', - 'class' => '', - 'id' => '', - ), - 'return_format' => 'url', - 'library' => 'all', - 'min_size' => '', - 'max_size' => '', - 'mime_types' => '', + 'return_format' => 'value', ), ), 'location' => array ( @@ -714,5 +1192,5 @@ acf_add_local_field_group(array ( )); endif; -//=============================================================================== + ?> \ No newline at end of file