Changeset 2327478
- Timestamp:
- 06/19/2020 01:52:20 PM (6 years ago)
- Location:
- lendingq
- Files:
-
- 23 added
- 4 edited
-
tags/0.96.1 (added)
-
tags/0.96.1/includes (added)
-
tags/0.96.1/includes/jquery.validate.min.js (added)
-
tags/0.96.1/languages (added)
-
tags/0.96.1/lendingq.css (added)
-
tags/0.96.1/lendingq.js (added)
-
tags/0.96.1/lendingq.php (added)
-
tags/0.96.1/readme.txt (added)
-
tags/0.96.1/template_cancel_hold_form.php (added)
-
tags/0.96.1/template_cancel_stock_form.php (added)
-
tags/0.96.1/template_cancel_stock_form_checked_out.php (added)
-
tags/0.96.1/template_check_in_form.php (added)
-
tags/0.96.1/template_check_in_list.php (added)
-
tags/0.96.1/template_check_out_form.php (added)
-
tags/0.96.1/template_check_out_list.php (added)
-
tags/0.96.1/template_contact_hold_form.php (added)
-
tags/0.96.1/template_no_item_types.php (added)
-
tags/0.96.1/template_no_locations.php (added)
-
tags/0.96.1/template_no_stock.php (added)
-
tags/0.96.1/template_post_hold.php (added)
-
tags/0.96.1/template_post_item.php (added)
-
tags/0.96.1/template_quick_widget.php (added)
-
tags/0.96.1/widget.css (added)
-
trunk/lendingq.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/template_check_in_list.php (modified) (1 diff)
-
trunk/template_check_out_form.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lendingq/trunk/lendingq.php
r2325180 r2327478 4 4 Plugin URI: https://wordpress.org/plugins/lendingq/ 5 5 Description: A simple system to manage the lending of items (like hotspots) with an integrated waiting list. 6 Version: 0.96 6 Version: 0.96.1 7 7 License: GPLv2 or later 8 8 Text Domain: lendingq … … 1642 1642 $temp_it = get_the_terms( $post->ID, 'lendingq_item_type' ); 1643 1643 $temp_loc = get_the_terms( $post->ID, 'lendingq_location' ); 1644 $lend['card'] = $post_meta['card'][0]; 1644 1645 1645 1646 $lend['contact'] = $contact; 1646 1647 $lend['item_type'] = current($temp_it)->slug; 1647 1648 $lend['location'] = current($temp_loc)->slug; 1648 $lend['name'] = $post_meta['name'][0]; 1649 $lend['notes'] = $post_meta['notes'][0]; 1650 $lend['staff'] = $post_meta['staff'][0]; 1651 $lend['waiting_date'] = $post_meta['waiting_date'][0]; 1649 1650 foreach( ['card', 'name', 'notes', 'staff', 'waiting_date', 'contact_date', 'contact_staff', 'contact_notes' ] as $key ) 1651 { 1652 $lend[$key] = ( !isset( $post_meta[$key][0] ) ) ? null : $post_meta[$key][0]; 1653 } 1654 1652 1655 require( LENDINGQ_PATH . '/template_check_out_form.php' ); 1653 1656 } // END function lendingq_check_out() -
lendingq/trunk/readme.txt
r2325181 r2327478 5 5 Tested up to: 5.4 6 6 Stable tag: trunk 7 Requires PHP: 5. 57 Requires PHP: 5.6 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 33 33 34 34 == Changelog == 35 = 0.96.1 = 36 * Added contact info to the lend array for the check in page. 37 * Added contact info display on the check in page to show any contact data if it exists. 38 * Fixed the check in page to work in PHP 5 (array_column wasn't working with an array of post objects) so it doesn't always show as empty. 39 35 40 = 0.96 = 36 41 * Added the ability to filter the Check Out page by location. -
lendingq/trunk/template_check_in_list.php
r2325180 r2327478 3 3 4 4 if( !empty( $post_list ) ) { 5 foreach( array_column( $post_list, 'post_status', 'ID' )as $key => $val ) {6 if( $val == 'checked_out' ) $loaned_count++;5 foreach( $post_list as $key => $val ) { 6 if( $val->post_status == 'checked_out' ) $loaned_count++; 7 7 } 8 8 } -
lendingq/trunk/template_check_out_form.php
r2325180 r2327478 3 3 <?php _e( 'Please double check this information before selecting an item to checkout from the drop down below.', 'lendingq'); ?> 4 4 <form action="<?php echo admin_url( 'admin-post.php' ) ?>"> 5 <table class="form-table" role="presentation"> 6 <tbody> 7 <tr> 8 <th scope="row"><?php _e( 'Name', 'lendingq'); ?></th> 9 <td><?php echo $lend['name']; ?></td> 10 </tr> 11 <tr> 12 <th scope="row"><?php _e( 'Card', 'lendingq'); ?></th> 13 <td><?php echo $lend['card']; ?></td> 14 </tr> 15 <tr> 16 <th scope="row"><?php _e( 'Contact', 'lendingq'); ?></th> 17 <td><?php echo $lend['contact']; ?></td> 18 </tr> 19 <tr> 20 <th scope="row"><?php _e( 'Helped by', 'lendingq'); ?></th> 21 <td><?php echo $lend['staff']; ?></td> 22 </tr> 23 <tr> 24 <th scope="row"><?php _e( 'Item Type', 'lendingq'); ?></th> 25 <td><?php echo $item_types[$lend['item_type']]; ?></td> 26 </tr> 27 <tr> 28 <th scope="row"><?php _e( 'Location', 'lendingq'); ?></th> 29 <td><?php echo $locations[$lend['location']]; ?></td> 30 </tr> 31 <tr> 32 <th scope="row"><?php _e( 'Notes', 'lendingq'); ?></th> 33 <td><?php echo $lend['notes']; ?></td> 34 </tr> 35 <tr> 36 <th scope="row"><?php _e( 'Item to Lend', 'lendingq'); ?></th> 37 <td><?php 38 # check there is stock 39 $args = [ 40 'numberposts' => -1, 41 'post_type'=> 'lendingq_stock', 42 'post_status' => 'item_available' 43 ]; 44 $item_list = get_posts( $args ); 45 $available = []; 46 foreach( $item_list as $key => $post ) { 47 $temp = []; 48 $location_raw = get_the_terms( $post->ID, 'lendingq_location' ); 49 $location = $location_raw[0]->slug; 50 $item_type_raw = get_the_terms( $post->ID, 'lendingq_item_type' ); 51 $item_type = $item_type_raw[0]->slug; 52 if( $location == $lend['location'] and $item_type == $lend['item_type'] ) { 53 $available[$post->ID] = $post; 5 <table class="form-table" role="presentation"> 6 <tbody> 7 <tr> 8 <th scope="row"><?php _e( 'Name', 'lendingq'); ?></th> 9 <td><?php echo $lend['name']; ?></td> 10 </tr> 11 <tr> 12 <th scope="row"><?php _e( 'Card', 'lendingq'); ?></th> 13 <td><?php echo $lend['card']; ?></td> 14 </tr> 15 <tr> 16 <th scope="row"><?php _e( 'Contact', 'lendingq'); ?></th> 17 <td><?php echo $lend['contact']; ?></td> 18 </tr> 19 <tr> 20 <th scope="row"><?php _e( 'Helped by', 'lendingq'); ?></th> 21 <td><?php echo $lend['staff']; ?></td> 22 </tr> 23 <tr> 24 <th scope="row"><?php _e( 'Item Type', 'lendingq'); ?></th> 25 <td><?php echo $item_types[$lend['item_type']]; ?></td> 26 </tr> 27 <tr> 28 <th scope="row"><?php _e( 'Location', 'lendingq'); ?></th> 29 <td><?php echo $locations[$lend['location']]; ?></td> 30 </tr> 31 <tr> 32 <th scope="row"><?php _e( 'Notes', 'lendingq'); ?></th> 33 <td><?php echo $lend['notes']; ?></td> 34 </tr> 35 </tbody> 36 </table> 37 <?php 38 if( !empty( $lend['contact_date'] ) ) { 39 ?> 40 <hr style="border: 1px solid grey;"> 41 <table class="form-table" role="presentation"> 42 <tbody> 43 <tr> 44 <th scope="row"><?php _e( 'Contacted by', 'lendingq'); ?></th> 45 <td><?php echo $lend['contact_staff']; ?></td> 46 </tr> 47 <tr> 48 <th scope="row"><?php _e( 'Contact date', 'lendingq'); ?></th> 49 <td><?php echo date_i18n( get_option( 'date_format' ), $lend['contact_date'] ) . ' - ' . date_i18n( get_option( 'time_format' ), $lend['contact_date'] ); ?></td> 50 </tr> 51 <tr> 52 <th scope="row"><?php _e( 'Contact Notes', 'lendingq'); ?></th> 53 <td><?php echo nl2br( $lend['contact_notes'] ); ?></td> 54 </tr> 55 </tbody> 56 </table> 57 <?php 58 } 59 ?> 60 <hr style="border: 1px solid grey;"> 61 <table class="form-table" role="presentation"> 62 <tbody> 63 <tr> 64 <th scope="row"><?php _e( 'Item to Lend', 'lendingq'); ?></th> 65 <td><?php 66 # check there is stock 67 $args = [ 68 'numberposts' => -1, 69 'post_type'=> 'lendingq_stock', 70 'post_status' => 'item_available' 71 ]; 72 $item_list = get_posts( $args ); 73 $available = []; 74 foreach( $item_list as $key => $post ) { 75 $temp = []; 76 $location_raw = get_the_terms( $post->ID, 'lendingq_location' ); 77 $location = $location_raw[0]->slug; 78 $item_type_raw = get_the_terms( $post->ID, 'lendingq_item_type' ); 79 $item_type = $item_type_raw[0]->slug; 80 if( $location == $lend['location'] and $item_type == $lend['item_type'] ) { 81 $available[$post->ID] = $post; 82 } 54 83 } 55 } 56 if( count( $available ) == 0 ) { 57 echo '<strong>'. __( 'There is currently no stock available for this lending.', 'lendingq' ).'</strong>'; 58 } else { 59 echo '<select name="lending_item" id="lending_item">'; 60 foreach( $available as $key => $val ) { 61 echo "<option value=\"{$key}\">{$val->post_title}</option>"; 84 if( count( $available ) == 0 ) { 85 echo '<strong>'. __( 'There is currently no stock available for this lending.', 'lendingq' ).'</strong>'; 86 } else { 87 echo '<select name="lending_item" id="lending_item">'; 88 foreach( $available as $key => $val ) { 89 echo "<option value=\"{$key}\">{$val->post_title}</option>"; 90 } 91 echo '</select>'; 62 92 } 63 echo '</select>'; 64 } 65 ?></td> 66 </tr> 67 </tbody> 68 </table> 93 ?></td> 94 </tr> 95 </tbody> 96 </table> 69 97 <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>"> 70 98 <input type="hidden" name="action" id="action" value="lendingq_checkout">
Note: See TracChangeset
for help on using the changeset viewer.