Changeset 1608660
- Timestamp:
- 03/06/2017 12:14:30 PM (9 years ago)
- Location:
- appointment-buddy-online-appointment-booking-by-accrete/trunk
- Files:
-
- 9 edited
-
admctrlfd/admin-calendar.php (modified) (1 diff)
-
admctrlfd/admin-general-profile.php (modified) (2 diffs)
-
admctrlfd/admin-holiday.php (modified) (1 diff)
-
admctrlfd/admin-list-treatments.php (modified) (1 diff)
-
admctrlfd/admin-time-slot.php (modified) (1 diff)
-
admctrlfd/admin-treatments.php (modified) (1 diff)
-
admctrlfd/admin-working-days.php (modified) (1 diff)
-
admctrlfd/functions.php (modified) (30 diffs)
-
includes/form.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
appointment-buddy-online-appointment-booking-by-accrete/trunk/admctrlfd/admin-calendar.php
r1605128 r1608660 74 74 selectable: true, 75 75 selectHelper: true, 76 editable: true,76 editable: false, 77 77 eventLimit: true, 78 78 eventRender: function(event, element, view) { -
appointment-buddy-online-appointment-booking-by-accrete/trunk/admctrlfd/admin-general-profile.php
r1605128 r1608660 29 29 <tr> 30 30 <th scope="row"><label for="name">Name</label><span class="star-red"> * </span></th> 31 <td><input name="name" id="name" class="regular-text alphaNumeric" type="text" maxlength="50" placeholder="Full Name" value="<?php if($getGeneralProfileResult[0]['name'] != '') { echo stripTextContent($getGeneralProfileResult[0]['name']); } else { echo ''; }?>"></td>31 <td><input name="name" id="name" class="regular-text alphaNumeric" type="text" maxlength="50" placeholder="Full Name" value="<?php if($getGeneralProfileResult[0]['name'] != '') { echo apbud_stripTextContent($getGeneralProfileResult[0]['name']); } else { echo ''; }?>"></td> 32 32 </tr> 33 33 <tr> 34 34 <th scope="row"><label for="address">Address</label><span class="star-red"> * </span></th> 35 35 <td> 36 <textarea name="address" id="address" class="regular-text" rows="5" cols="50" placeholder="Full Address...."><?php if($getGeneralProfileResult[0]['address'] != '') { echo stripTextContent($getGeneralProfileResult[0]['address']); } else { echo ''; }?></textarea>36 <textarea name="address" id="address" class="regular-text" rows="5" cols="50" placeholder="Full Address...."><?php if($getGeneralProfileResult[0]['address'] != '') { echo apbud_stripTextContent($getGeneralProfileResult[0]['address']); } else { echo ''; }?></textarea> 37 37 </td> 38 38 </tr> … … 78 78 <td> 79 79 <select name="timeZoneValue" id="timeZoneValue" class="regular-text"> 80 <?php foreach( timeZone_list() as $timeZone) { ?>80 <?php foreach(apbud_timeZone_list() as $timeZone) { ?> 81 81 <option value="<?php echo $timeZone['zone']; ?>" <?php if( $timeZone['zone'] == $abTimeZone ) { ?> selected="selected" <?php } ?>> 82 82 <?php echo $timeZone['zone']; ?> -
appointment-buddy-online-appointment-booking-by-accrete/trunk/admctrlfd/admin-holiday.php
r1605128 r1608660 67 67 <tr id="tag-1" onClick="Drow(this)" class="search-fade"> 68 68 <td class="name column-name has-row-actions column-primary" data-colname="Name"> 69 <span><?php echo stripTextContent($trRes['holidayName']); ?></span>69 <span><?php echo apbud_stripTextContent($trRes['holidayName']); ?></span> 70 70 </td> 71 71 <td class="description column-description" data-colname="Description"> 72 <p><?php echo changeDateToReadableFormatWithoutTime($trRes['holidayDate']); ?></p>72 <p><?php echo apbud_changeDateToReadableFormatWithoutTime($trRes['holidayDate']); ?></p> 73 73 </td> 74 74 <?php /*?><td class="edit" data-colname="Edit"> -
appointment-buddy-online-appointment-booking-by-accrete/trunk/admctrlfd/admin-list-treatments.php
r1605128 r1608660 43 43 <tr id="tag-1" onClick="Drow(this)" class="search-fade"> 44 44 <td class="name column-name has-row-actions column-primary" data-colname="Name"> 45 <span><?php echo stripTextContent($trRes['serviceName']); ?></span>45 <span><?php echo apbud_stripTextContent($trRes['serviceName']); ?></span> 46 46 </td> 47 47 <td class="description column-description" data-colname="Description"> 48 <p><?php $content = stripTextContent($trRes['serviceDescription']); echo substr($content, 0, 55)."..."; ?></p>48 <p><?php $content = apbud_stripTextContent($trRes['serviceDescription']); echo substr($content, 0, 55)."..."; ?></p> 49 49 </td> 50 50 <td class="edit" data-colname="Edit"> -
appointment-buddy-online-appointment-booking-by-accrete/trunk/admctrlfd/admin-time-slot.php
r1605128 r1608660 58 58 <tr class="slot-row" data-slot-id=""> 59 59 <td><strong></strong></td> 60 <td><input type="text" name="slotName_" class="inputTimeSlots alphaNumeric" value="<?php if(!empty($result["slotName"])){echo stripTextContent($result["slotName"]);}?>" id="slotName" data-msg="Please select Slot Name" maxlength="20" autocomplete="off"/></td>60 <td><input type="text" name="slotName_" class="inputTimeSlots alphaNumeric" value="<?php if(!empty($result["slotName"])){echo apbud_stripTextContent($result["slotName"]);}?>" id="slotName" data-msg="Please select Slot Name" maxlength="20" autocomplete="off"/></td> 61 61 <td><input type="text" class="timedropper validateStartTimeSlot inputTimeSlots" name="start_time_slot_" value="<?php if(!empty($result["slotStartTime"])){echo $result["slotStartTime"];}?>" data-msg="Please select Start Time" autocomplete="off"></td> 62 62 <td><input type="text" class="timedropper validateEndTimeSlot inputTimeSlots endTimeSlot" name="end_time_slot_" value="<?php if(!empty($result["slotEndTime"])){echo $result["slotEndTime"];}?>" data-msg="Please select End Time" autocomplete="off"></td> -
appointment-buddy-online-appointment-booking-by-accrete/trunk/admctrlfd/admin-treatments.php
r1605128 r1608660 94 94 jQuery('html, body').animate({scrollTop : 0}, 800); 95 95 setTimeout( function() { 96 //location.reload(true);97 jQuery('#displayTreametents').load(document.URL + ' #displayTreametents');96 location.reload(true); 97 //jQuery('#displayTreametents').load(document.URL + ' #displayTreametents'); 98 98 tabapi.switch(4); 99 jQuery('#treatmentsForm').trigger("reset");100 jQuery('#serviceDesc').val('');99 //jQuery('#treatmentsForm').trigger("reset"); 100 //jQuery('#serviceDesc').val(''); 101 101 }, 2000); 102 102 } -
appointment-buddy-online-appointment-booking-by-accrete/trunk/admctrlfd/admin-working-days.php
r1605128 r1608660 65 65 ?> 66 66 <tr> 67 <td><?php if(!empty($result["slotName"])){echo stripTextContent($result["slotName"]);}?>67 <td><?php if(!empty($result["slotName"])){echo apbud_stripTextContent($result["slotName"]);}?> 68 68 <input type="hidden" id="slotId" name="slotId" value="<?php if(!empty($result["slotId"])){echo $result["slotId"];}?>" data-id="<?php // $final = array_column($fetchWorkingDays,"slotId"); if(in_array($result["slotId"],$final)){echo "true";} ?>" /> 69 69 </td> -
appointment-buddy-online-appointment-booking-by-accrete/trunk/admctrlfd/functions.php
r1605128 r1608660 5 5 <?php 6 6 //VALIDATION FUNCTION 7 function validateTextarea($data)7 function apbud_validateTextarea($data) 8 8 { 9 9 global $wpdb; … … 13 13 } 14 14 15 function stripContent($data)15 function apbud_stripContent($data) 16 16 { 17 17 $data=stripslashes(html_entity_decode(stripslashes($data))); … … 19 19 } 20 20 21 function stripTextContent($data)21 function apbud_stripTextContent($data) 22 22 { 23 23 $data=stripslashes(wp_specialchars_decode(stripslashes($data))); … … 25 25 } 26 26 27 function validateTextContent($data) 28 { 29 global $wpdb; 30 $data=$wpdb->_real_escape(esc_attr(sanitize_text_field($data))); //wpdb::_real_escape(esc_attr(sanitize_text_field($data))); 27 function apbud_validateTextContent($data) 28 { 29 $data=sanitize_text_field($data); //wpdb::_real_escape(esc_attr(sanitize_text_field($data))); 31 30 return $data; 32 31 } 33 32 34 33 //Date Validation Functions 35 function changeTimeFormat($timefmt)34 function apbud_changeTimeFormat($timefmt) 36 35 { 37 36 $time = date("g:i a", strtotime($timefmt)); … … 39 38 } 40 39 41 function changeDateFormat($dateValue)40 function apbud_changeDateFormat($dateValue) 42 41 { 43 42 $date = date_create($dateValue); … … 46 45 } 47 46 48 function changeDateToReadableFormat($dateValue)47 function apbud_changeDateToReadableFormat($dateValue) 49 48 { 50 49 $date = date_create($dateValue); … … 53 52 } 54 53 55 function changeDateFormatWithoutTime($dateValue)54 function apbud_changeDateFormatWithoutTime($dateValue) 56 55 { 57 56 $date = date_create($dateValue); … … 60 59 } 61 60 62 function changeDateToReadableFormatWithoutTime($dateValue)61 function apbud_changeDateToReadableFormatWithoutTime($dateValue) 63 62 { 64 63 $date = date_create($dateValue); … … 68 67 69 68 //Get IP Address Function 70 function getIp()69 function apbud_getIp() 71 70 { 72 71 $ip = ""; … … 93 92 94 93 //function to get time zone 95 function timeZone_list()94 function apbud_timeZone_list() 96 95 { 97 96 $zones_array = array(); … … 116 115 global $wpdb; 117 116 117 118 118 $checkNonce = check_ajax_referer( 'apbud_add_general_profile', 'ajax_nonce' ); 119 119 120 if($checkNonce) 120 121 { //if-1 … … 122 123 parse_str($_POST['stringValues'], $stringValueArray); 123 124 124 /*return print_r($stringValueArray); 125 return print_r($_POST); 125 /*return print_r($stringValueArray) ."<br>". print_r($_POST); 126 126 die();*/ 127 127 128 $wp_abAdminProfileDetails = $wpdb->prefix .'abAdminProfileDetails'; 128 129 $user = get_current_user_id(); 129 $ip = getIp();130 $ip = apbud_getIp(); 130 131 131 132 if($stringValueArray['name'] == '') … … 169 170 { //if-2 170 171 //echo "11"; 172 171 173 $generalProfileArray = array( 172 "name" => "". validateTextContent($stringValueArray['name'])."",173 "address" => "". validateTextarea($stringValueArray['address'])."",174 "name" => "".apbud_validateTextContent($stringValueArray['name'])."", 175 "address" => "".apbud_validateTextarea($stringValueArray['address'])."", 174 176 "emailId" => "".sanitize_email($stringValueArray['emailId'])."", 175 "mobileNo" => "". validateTextContent($stringValueArray['mobileNo'])."",176 "officePhoneNo" => "". validateTextContent($stringValueArray['officePhoneNo'])."",177 "mobileNo" => "".apbud_validateTextContent($stringValueArray['mobileNo'])."", 178 "officePhoneNo" => "".apbud_validateTextContent($stringValueArray['officePhoneNo'])."", 177 179 "websiteLink" => "".esc_url($stringValueArray['websiteLink'])."", 178 180 "facebookLink" => "".esc_url($stringValueArray['facebookLink'])."", … … 221 223 222 224 $generalProfileUpdateArray = array( 223 "name" => "". validateTextContent($stringValueArray['name'])."",224 "address" => "". validateTextarea($stringValueArray['address'])."",225 "name" => "".apbud_validateTextContent($stringValueArray['name'])."", 226 "address" => "".apbud_validateTextarea($stringValueArray['address'])."", 225 227 "emailId" => "".sanitize_email($stringValueArray['emailId'])."", 226 "mobileNo" => "". validateTextContent($stringValueArray['mobileNo'])."",227 "officePhoneNo" => "". validateTextContent($stringValueArray['officePhoneNo'])."",228 "mobileNo" => "".apbud_validateTextContent($stringValueArray['mobileNo'])."", 229 "officePhoneNo" => "".apbud_validateTextContent($stringValueArray['officePhoneNo'])."", 228 230 "websiteLink" => "".esc_url($stringValueArray['websiteLink'])."", 229 231 "facebookLink" => "".esc_url($stringValueArray['facebookLink'])."", … … 280 282 $wp_abServiceMst = $wpdb->prefix .'abServiceMst'; 281 283 $user = get_current_user_id(); 282 $ip = getIp();284 $ip = apbud_getIp(); 283 285 284 286 if($crudAction == 'addTreatments' || $crudAction == 'updateTreatments') … … 300 302 { //if-2 301 303 $serviceArray = array( 302 "serviceName" => "". validateTextContent($treatmentValueArray['serviceName'])."",303 "serviceDescription" => "". validateTextarea($treatmentValueArray['serviceDesc'])."",304 "serviceName" => "".apbud_validateTextContent($treatmentValueArray['serviceName'])."", 305 "serviceDescription" => "".apbud_validateTextarea($treatmentValueArray['serviceDesc'])."", 304 306 "createdDate" => "".AB_CURRENT_TIMEZONE."", 305 307 "createdBy" => "".$user."", … … 336 338 337 339 $updateServiceArray = array( 338 "serviceName" => "". validateTextContent($treatmentValueArray['serviceName'])."",339 "serviceDescription" => "". validateTextarea($treatmentValueArray['serviceDesc'])."",340 "serviceName" => "".apbud_validateTextContent($treatmentValueArray['serviceName'])."", 341 "serviceDescription" => "".apbud_validateTextarea($treatmentValueArray['serviceDesc'])."", 340 342 "modifiedDate" => "".AB_CURRENT_TIMEZONE."", 341 343 "modifiedBy" => "".$user."", … … 439 441 $wp_abHolidayMst = $wpdb->prefix .'abHolidayMst'; 440 442 $user = get_current_user_id(); 441 $ip = getIp();443 $ip = apbud_getIp(); 442 444 443 445 … … 453 455 } 454 456 455 //echo "Select count(*) from ".$wp_abHolidayMst." where isDeleted=0 AND (holidayDate='". changeDateFormatWithoutTime($holidayValueArray['holidayDate'])."' OR holidayName='".$holidayValueArray['holidayName']."')";456 $exists = $wpdb->get_var("Select count(*) from ".$wp_abHolidayMst." where isDeleted=0 AND (holidayDate='". changeDateFormatWithoutTime($holidayValueArray['holidayDate'])."' OR holidayName='".sanitize_text_field($holidayValueArray['holidayName'])."')");457 //echo "Select count(*) from ".$wp_abHolidayMst." where isDeleted=0 AND (holidayDate='".apbud_changeDateFormatWithoutTime($holidayValueArray['holidayDate'])."' OR holidayName='".$holidayValueArray['holidayName']."')"; 458 $exists = $wpdb->get_var("Select count(*) from ".$wp_abHolidayMst." where isDeleted=0 AND (holidayDate='".apbud_changeDateFormatWithoutTime($holidayValueArray['holidayDate'])."' OR holidayName='".sanitize_text_field($holidayValueArray['holidayName'])."')"); 457 459 458 460 //echo $exists; … … 475 477 { //if-2 476 478 $holidayArray = array( 477 "holidayName" => "". validateTextContent($holidayValueArray['holidayName'])."",478 "holidayDate" => "". changeDateFormatWithoutTime($holidayValueArray['holidayDate'])."",479 "holidayName" => "".apbud_validateTextContent($holidayValueArray['holidayName'])."", 480 "holidayDate" => "".apbud_changeDateFormatWithoutTime($holidayValueArray['holidayDate'])."", 479 481 "createdDate" => "".AB_CURRENT_TIMEZONE."", 480 482 "createdBy" => "".$user."", … … 562 564 <tr id="tag-1" onClick="Drow(this)" class="search-fade"> 563 565 <td class="name column-name has-row-actions column-primary" data-colname="Name"> 564 <span><?php echo stripTextContent($trRes['holidayName']); ?></span>566 <span><?php echo apbud_stripTextContent($trRes['holidayName']); ?></span> 565 567 </td> 566 568 <td class="description column-description" data-colname="Description"> 567 <p><?php echo changeDateToReadableFormatWithoutTime($trRes['holidayDate']); ?></p>569 <p><?php echo apbud_changeDateToReadableFormatWithoutTime($trRes['holidayDate']); ?></p> 568 570 </td> 569 571 <?php /*?><td class="edit" data-colname="Edit"> … … 604 606 $wp_abSlotMappingDetails = $wpdb->prefix .'abSlotMappingDetails'; 605 607 $user = get_current_user_id(); 606 $ip = getIp();608 $ip = apbud_getIp(); 607 609 $currDate = date("Y-m-d H:i:s"); 608 610 /************************************************For Multiple Record *****************************************/ … … 631 633 $slotMaxApppointments=${"slot_max_appointments_".$i}; 632 634 633 if( validateTextContent($slotName) == "")635 if(apbud_validateTextContent($slotName) == "") 634 636 {//if-3 starts 635 637 return wp_send_json_error("Please enter Slot Name"); … … 660 662 die();*/ 661 663 662 $done = $wpdb->query("update ".$wp_abTimeSlotMst." set slotName='". validateTextContent($slotName)."',slotStartTime='".$startTime."', slotEndTime='".$endTime."',maxAppointmentsPerSlot=".absint($slotMaxApppointments).",modifiedBy='".$user."',modifiedDate='".$currDate."',ipAddress='".$ip."' where slotId=".$exists[0]['slotId']." and663 not exists (select slotName from (select * from ".$wp_abTimeSlotMst.") as timeSlotTable where SlotName='". validateTextContent($slotName)."' and slotId <>".$exists[0]['slotId']." and isDeleted=0)");664 $done = $wpdb->query("update ".$wp_abTimeSlotMst." set slotName='".apbud_validateTextContent($slotName)."',slotStartTime='".$startTime."', slotEndTime='".$endTime."',maxAppointmentsPerSlot=".absint($slotMaxApppointments).",modifiedBy='".$user."',modifiedDate='".$currDate."',ipAddress='".$ip."' where slotId=".$exists[0]['slotId']." and 665 not exists (select slotName from (select * from ".$wp_abTimeSlotMst.") as timeSlotTable where SlotName='".apbud_validateTextContent($slotName)."' and slotId <>".$exists[0]['slotId']." and isDeleted=0)"); 664 666 //$lastId = $wpdb->insert_id; 665 667 if($done==FALSE ) … … 675 677 { //Single Record Insert code 676 678 $insertArray1 = array( 677 'slotName'=> validateTextContent($slotName),679 'slotName'=>apbud_validateTextContent($slotName), 678 680 'slotStartTime'=>$startTime, 679 681 'slotEndTime'=>$endTime, … … 791 793 $one = 1; 792 794 $zero = 0; 793 $ip = getIp();795 $ip = apbud_getIp(); 794 796 $user = get_current_user_id(); 795 797 $crTime = date("Y-m-d H:i:s"); … … 906 908 else 907 909 { //else-2 908 //echo "SELECT smd.slotId, ts.slotName, DATE_FORMAT(ts.slotStartTime, '%H:%i') as slotStartTime, DATE_FORMAT(ts.slotEndTime, '%H:%i') as slotEndTime FROM ".$abSlotMappingDetails." smd INNER JOIN ".$abTimeSlotMst." ts on ts.slotId = smd.slotId And ts.isDeleted=0 where smd.workingDay=".medicinal_validateTextContent($appointmentDay)." And smd.isDeleted=0"; 909 910 $getTimeSlotResult = $wpdb->get_results("SELECT count(am.appointmentSlotMappingId) as tapp, am.appointmentDate, smd.workingDay, smd.slotId, smd.slotMappingId, ts.slotName, ts.maxAppointmentsPerSlot, DATE_FORMAT(ts.slotStartTime, '%H:%i') as slotStartTime, DATE_FORMAT(ts.slotEndTime, '%H:%i') as slotEndTime 911 FROM ".$abSlotMappingDetails." smd 912 inner join ".$abTimeSlotMst." ts on ts.slotId = smd.slotId And ts.isDeleted=0 913 left join ".$abAppointmentMst." am on smd.slotId = am.appointmentSlotMappingId and am.appointmentDate = '".changeDateFormatWithoutTime($appointmentDate)."' 914 where smd.workingDay=".validateTextContent($appointmentDay)." And smd.isDeleted=0 915 group by am.appointmentDate, ts.slotId, smd.workingDay having tapp < ts.maxAppointmentsPerSlot", ARRAY_A); 916 917 /*$getTimeSlotResult = $wpdb->get_results("SELECT count(am.appointmentSlotMappingId) as tapp, am.appointmentDate, smd.workingDay, smd.slotId, smd.slotMappingId, ts.slotName, ts.maxAppointmentsPerSlot, DATE_FORMAT(ts.slotStartTime, '%H:%i') as slotStartTime, DATE_FORMAT(ts.slotEndTime, '%H:%i') as slotEndTime 918 FROM wp_abSlotMappingDetails smd 919 inner join wp_abTimeSlotMst ts on ts.slotId = smd.slotId And ts.isDeleted=0 920 left join wp_abAppointmentMst am on smd.slotId = am.appointmentSlotMappingId and am.appointmentDate = '".medicinal_changeDateFormatWithoutTime($appointmentDate)."' 921 where smd.workingDay=".medicinal_validateTextContent($appointmentDay)." And smd.isDeleted=0 922 group by am.appointmentDate, smd.slotId, smd.workingDay having tapp < ts.maxAppointmentsPerSlot", ARRAY_A);*/ 923 910 911 /*echo "SELECT am.appointmentDate, count(am.appointmentSlotMappingId) AS tapp, smd.workingDay, smd.slotId, smd.slotMappingId, ts.slotName, ts.maxAppointmentsPerSlot, DATE_FORMAT(ts.slotStartTime, '%H:%i') as slotStartTime, DATE_FORMAT(ts.slotEndTime, '%H:%i') as slotEndTime 912 from ".$abSlotMappingDetails." smd 913 inner join ".$abTimeSlotMst." ts on ts.slotId = smd.slotId and ts.isDeleted=0 914 left join ".$abAppointmentMst." am on am.appointmentSlotMappingId = smd.slotMappingId and am.appointmentDate = '".apbud_changeDateFormatWithoutTime($appointmentDate)."' 915 where smd.workingDay=".apbud_validateTextContent($appointmentDay)." and smd.isDeleted=0 916 group by am.appointmentDate, ts.slotId, smd.workingDay 917 having tapp < ts.maxAppointmentsPerSlot"; 918 die();*/ 919 920 $getTimeSlotResult = $wpdb->get_results("SELECT am.appointmentDate, count(am.appointmentSlotMappingId) AS tapp, smd.workingDay, smd.slotId, smd.slotMappingId, ts.slotName, ts.maxAppointmentsPerSlot, DATE_FORMAT(ts.slotStartTime, '%H:%i') as slotStartTime, DATE_FORMAT(ts.slotEndTime, '%H:%i') as slotEndTime 921 from ".$abSlotMappingDetails." smd 922 inner join ".$abTimeSlotMst." ts on ts.slotId = smd.slotId and ts.isDeleted=0 923 left join ".$abAppointmentMst." am on am.appointmentSlotMappingId = smd.slotMappingId and am.appointmentDate = '".apbud_changeDateFormatWithoutTime($appointmentDate)."' 924 where smd.workingDay=".apbud_validateTextContent($appointmentDay)." and smd.isDeleted=0 925 group by am.appointmentDate, ts.slotId, smd.workingDay 926 having tapp < ts.maxAppointmentsPerSlot", ARRAY_A); 927 924 928 if(!$getTimeSlotResult) 925 929 { … … 986 990 $abAdminProfileDetails = $wpdb->prefix .'abAdminProfileDetails'; 987 991 $abHolidayMst = $wpdb->prefix .'abHolidayMst'; 992 $abSlotMappingDetails = $wpdb->prefix . "abSlotMappingDetails"; 993 $abTimeSlotMst = $wpdb->prefix . "abTimeSlotMst"; 988 994 989 995 $user = get_current_user_id(); 990 $ip = getIp();996 $ip = apbud_getIp(); 991 997 992 998 if($dataStringArray['appointmentDate'] == '') … … 1015 1021 } 1016 1022 1017 $holidayResult = $wpdb->get_results("SELECT holidayName FROM ".$abHolidayMst." where holidayDate='". changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."'");1023 $holidayResult = $wpdb->get_results("SELECT holidayName FROM ".$abHolidayMst." where holidayDate='".apbud_changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."'"); 1018 1024 if(!empty($holidayResult)) 1019 1025 { … … 1045 1051 } 1046 1052 } 1047 // echo "SELECT count(appointmentId) FROM ".$abAppointmentMst." WHERE isDeleted=0 AND personEmailId = '".sanitize_email($dataStringArray['personEmailId'])."' AND personMobileNo = '".validateTextContent($dataStringArray['personMobileNo'])."' AND appointmentDate = '".changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."'"; 1048 1049 $exists = $wpdb->get_var("SELECT count(appointmentId) FROM ".$abAppointmentMst." WHERE isDeleted=0 AND personEmailId = '".sanitize_email($dataStringArray['personEmailId'])."' AND personMobileNo = '".validateTextContent($dataStringArray['personMobileNo'])."' AND appointmentDate = '".changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."'"); 1053 1054 $exists = $wpdb->get_var("SELECT count(appointmentId) FROM ".$abAppointmentMst." WHERE isDeleted=0 AND personEmailId = '".sanitize_email($dataStringArray['personEmailId'])."' AND personMobileNo = '".apbud_validateTextContent($dataStringArray['personMobileNo'])."' AND appointmentDate = '".apbud_changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."'"); 1055 1056 $getTimeSlotRes = $wpdb->get_results("SELECT count(am.appointmentSlotMappingId) AS tapp, ts.maxAppointmentsPerSlot, smd.slotMappingId 1057 from ".$abSlotMappingDetails." smd 1058 inner join ".$abTimeSlotMst." ts on ts.slotId = smd.slotId and ts.isDeleted=0 1059 left join ".$abAppointmentMst." am on am.appointmentSlotMappingId = smd.slotMappingId and am.appointmentDate = '".apbud_changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."' 1060 where smd.isDeleted=0 and smd.workingDay=DATE_FORMAT('".apbud_changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."', '%w') and smd.slotMappingId = '".$dataStringArray['appointmentSlotMappingId']."' 1061 group by am.appointmentDate, ts.slotId 1062 having tapp < ts.maxAppointmentsPerSlot", ARRAY_A); 1063 1064 /*echo "SELECT count(am.appointmentSlotMappingId) AS tapp, ts.maxAppointmentsPerSlot, smd.slotMappingId 1065 from ".$abSlotMappingDetails." smd 1066 inner join ".$abTimeSlotMst." ts on ts.slotId = smd.slotId and ts.isDeleted=0 1067 left join ".$abAppointmentMst." am on am.appointmentSlotMappingId = smd.slotMappingId and am.appointmentDate = '".apbud_changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."' 1068 where smd.isDeleted=0 and smd.workingDay=DATE_FORMAT('".apbud_changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."', '%w') and smd.slotMappingId = '".$dataStringArray['appointmentSlotMappingId']."' 1069 group by am.appointmentDate, ts.slotId 1070 having tapp < ts.maxAppointmentsPerSlot"; 1071 1072 die();*/ 1050 1073 1051 1074 if($exists > 0) 1052 1075 { //if-5 1053 1076 return wp_send_json_error("Sorry !! You have already booked appointment for ".$dataStringArray['appointmentDate']); 1077 } 1078 else if(!$getTimeSlotRes) 1079 { 1080 return wp_send_json_error("You have selected wrong time slot."); 1054 1081 } 1055 1082 else 1056 1083 { 1057 1084 $appointmentArray = array( 1058 "personName" => "". validateTextContent($dataStringArray['personName'])."",1085 "personName" => "".apbud_validateTextContent($dataStringArray['personName'])."", 1059 1086 "personEmailId" => "".sanitize_email($dataStringArray['personEmailId'])."", 1060 "personMobileNo" => "". validateTextContent($dataStringArray['personMobileNo'])."",1061 "personAddress" => "". validateTextarea($dataStringArray['personAddress'])."",1087 "personMobileNo" => "".apbud_validateTextContent($dataStringArray['personMobileNo'])."", 1088 "personAddress" => "".apbud_validateTextarea($dataStringArray['personAddress'])."", 1062 1089 "serviceId" => "".sanitize_text_field($dataStringArray['serviceId'])."", 1063 "appointmentDate" => "". changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."",1090 "appointmentDate" => "".apbud_changeDateFormatWithoutTime($dataStringArray['appointmentDate'])."", 1064 1091 "appointmentSlotMappingId" => "".sanitize_text_field($dataStringArray['appointmentSlotMappingId'])."", 1065 "remarks" => "". validateTextarea($dataStringArray['remarks'])."",1092 "remarks" => "".apbud_validateTextarea($dataStringArray['remarks'])."", 1066 1093 "createdDate" => "".AB_CURRENT_TIMEZONE."", 1067 1094 "createdBy" => "".$user."", -
appointment-buddy-online-appointment-booking-by-accrete/trunk/includes/form.php
r1605128 r1608660 28 28 if(!empty($minDate) && !empty($maxDate)) 29 29 {//if-2 starts 30 $holidayResult = $wpdb->get_results("SELECT DATE_FORMAT(holidayDate,'%d-%m-%Y') as holidayDate FROM ".$abHolidayMst." WHERE holidayDate BETWEEN '". changeDateFormatWithoutTime($minDate)."' AND '".changeDateFormatWithoutTime($maxDate)."' AND isDeleted=0",ARRAY_A);30 $holidayResult = $wpdb->get_results("SELECT DATE_FORMAT(holidayDate,'%d-%m-%Y') as holidayDate FROM ".$abHolidayMst." WHERE holidayDate BETWEEN '".apbud_changeDateFormatWithoutTime($minDate)."' AND '".apbud_changeDateFormatWithoutTime($maxDate)."' AND isDeleted=0",ARRAY_A); 31 31 $holidayArray=array(); 32 32 if($holidayResult) … … 167 167 var newDate=appointDate2[1]+","+appointDate2[0]+","+appointDate2[2]; 168 168 var getSelectedDay = new Date(newDate).getDay(); 169 console.log(getSelectedDay);170 console.log(appointDate);169 //console.log(getSelectedDay); 170 //console.log(appointDate); 171 171 //alert(getSelectedDay); 172 172 … … 280 280 }, 281 281 submitHandler:function(){ 282 282 283 jQuery.ajax({ 283 type: "post", 284 url:'<?php echo apbud_AJAX_URL; ?>', 285 data: { 286 action: 'apbud_add_appointments', 287 dataString: jQuery('#bookingForm').serialize() , 288 ajax_nonce: '<?php echo wp_create_nonce('apbud_add_appointments'); ?>' 289 }, 290 dataType: 'html', 291 success: function(response){ //so, if data is retrieved, store it in html 292 /* var result=JSON.parse(response); */ 293 // alert(response); 294 //alert(JSON.stringify(response)); 295 if(jQuery.parseJSON(response).success === false) 296 { 297 abAlertMessage(response); 284 type: "post", 285 url:'<?php echo apbud_AJAX_URL; ?>', 286 data: { 287 action: 'apbud_add_appointments', 288 dataString: jQuery('#bookingForm').serialize() , 289 ajax_nonce: '<?php echo wp_create_nonce('apbud_add_appointments'); ?>' 290 }, 291 dataType: 'html', 292 success: function(response){ //so, if data is retrieved, store it in html 293 /* var result=JSON.parse(response); */ 294 // alert(response); 295 //alert(JSON.stringify(response)); 296 if(jQuery.parseJSON(response).success === false) 297 { 298 abAlertMessage(response); 299 } 300 else 301 { 302 abAlertMessage(response); 303 setTimeout(function() { 304 //window.location.reload(true); 305 jQuery("#bookingForm").trigger('reset'); 306 }, 2000); 307 } 298 308 } 299 else 300 { 301 abAlertMessage(response); 302 setTimeout(function() { 303 //window.location.reload(true); 304 jQuery("#bookingForm").trigger('reset'); 305 }, 2000); 306 } 307 } 308 }); //close jQuery.ajax 309 }); //close jQuery.ajax 309 310 } 310 311 });
Note: See TracChangeset
for help on using the changeset viewer.