- moved reset field function outside renew_card file

- created a patch for formbuilder calculation pbm
This commit is contained in:
asus
2024-03-12 21:53:32 +01:00
parent 38f9b0ba72
commit f6e092f67d
4 changed files with 47 additions and 35 deletions

View File

@@ -45,12 +45,15 @@ include_once(PLGNTLS_class::root_path() . 'php/author_restriction.php');
include_once(PLGNTLS_class::root_path() . 'php/filter_mail.php');
include_once(PLGNTLS_class::root_path() . 'php/prof_check_page.php');
include_once(PLGNTLS_class::root_path() . 'php/renew_card.php');
//include_once(PLGNTLS_class::root_path() . 'php/reset_card_form.php');
include_once(PLGNTLS_class::root_path() . 'php/partner_check_page.php');
// form builder patch :
//include_once(PLGNTLS_class::root_path() . 'php/form_builder_patch/url_validation.php');
//include_once(PLGNTLS_class::root_path() . 'php/form_builder_patch/multiple_modals.php');
/*
include_once(PLGNTLS_class::root_path() . 'php/form_builder_patch/url_validation.php');
include_once(PLGNTLS_class::root_path() . 'php/form_builder_patch/multiple_modals.php');
*/
include_once(PLGNTLS_class::root_path() . 'php/form_builder_patch/form_calculation.php');

View File

@@ -10,32 +10,6 @@ if (!defined('ABSPATH')) {
/*
* reset some fields for the form to buy the card
* - cgv
* - paiement
* - livraison
* - tarif
* this action is called if no redirection happens
*
*/
function reset_some_fields_CIPF() {
PLGNTLS_class::debug_infos();
$acf_cgv = PLGNTLS_class::ACF_PROF_CGV;
$acf_payement = PLGNTLS_class::ACF_CARD_PAYMENT_METHOD;
$acf_delivery = PLGNTLS_class::ACF_CARD_PRICE_DELIVERY;
$acf_price = PLGNTLS_class::ACF_CARD_PRICE_CHOICE;
$user_id = get_current_user_id();
update_field($acf_cgv['_name'] , array(""), 'user_'.$user_id);
update_field($acf_payement['_name'], array(""), 'user_'.$user_id);
update_field($acf_delivery['_name'], array(""), 'user_'.$user_id);
update_field($acf_price['_name'] , array(""), 'user_'.$user_id);
}
/*
* on renew page :
@@ -91,12 +65,6 @@ function renew_page_restrictions_CIPF(){
}
}
*/
/*
* if prof can renew its card, reset some form fields before
*
*/
reset_some_fields_CIPF();
}
add_action('template_redirect', 'renew_page_restrictions_CIPF');

View File

@@ -0,0 +1,41 @@
<?php
/*
*
* NOT USEFUL ANYMORE :
* it was to fix pbms in formbuilder with calculation field
* but I made 2 better fixes (css and js)
*
* reset some fields for the form to buy the card
* - cgv
* - paiement
* - livraison
* - tarif
* this action is called after redirection hook
*
*/
function reset_some_fields_CIPF() {
PLGNTLS_class::debug_infos();
$slug_renew_card = PLGNTLS_class::SLUG_RENEW_CARD;
$acf_cgv = PLGNTLS_class::ACF_PROF_CGV;
$acf_payement = PLGNTLS_class::ACF_CARD_PAYMENT_METHOD;
$acf_delivery = PLGNTLS_class::ACF_CARD_PRICE_DELIVERY;
$acf_price = PLGNTLS_class::ACF_CARD_PRICE_CHOICE;
if (!is_page($slug_renew_card))
return;
$user_id = get_current_user_id();
update_field($acf_cgv['_name'] , array(""), 'user_'.$user_id);
update_field($acf_payement['_name'], array(""), 'user_'.$user_id);
update_field($acf_delivery['_name'], array(""), 'user_'.$user_id);
update_field($acf_price['_name'] , array(""), 'user_'.$user_id);
}
add_action('wp', 'reset_some_fields_CIPF');
?>

View File

@@ -368,10 +368,10 @@ class PLGNTLS_class
/*
* uncomment to print all enqueued files, can be usefull
*/
/*
global $wp_scripts;
error_log("wp_scripts->queue:");
error_log(json_encode($wp_scripts->queue));
/*
global $wp_styles;
error_log("wp_styles->queue:");
error_log(json_encode($wp_styles->queue));