Skip to content

Commit

Permalink
Update dashboard.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ptibogxiv committed Nov 1, 2024
1 parent 21a6e96 commit 3088978
Showing 1 changed file with 21 additions and 24 deletions.
45 changes: 21 additions & 24 deletions dashboard/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -1436,29 +1436,26 @@ function members_menu( $arg ) {
function members_module( $url ) {
global $current_user;

$time = current_time( 'timestamp',1);

$request = "/adherentsplus/".doliconnector($current_user, 'fk_member', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null));
$productadhesion = doliconst("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS");
$requestp = "/products/".$productadhesion."?includesubproducts=true&includetrans=true";
$product = callDoliApi("GET", $requestp, null, dolidelay('product', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null)));

if ( isset($_POST["update_membership"]) && function_exists('doliconnect_membership') ) {
$typeadherent = isset($_POST["typeadherent"]) ? $_POST["typeadherent"] : null;
$adherent = doliconnect_membership($current_user, $_POST["update_membership"], $typeadherent, dolidelay('member', true));
//print var_dump($adherent);
$request = "/adherentsplus/".doliconnector($current_user, 'fk_member', true);
$adherent = callDoliApi("GET", $request, null, dolidelay('member', true));
print dolialert('success', __( 'Your membership has been updated.', 'doliconnect'));
}

print '<div class="card shadow-sm"><div class="card-header">'.__( 'Manage my subscription', 'doliconnect').'</div><div class="card-body">';
$time = current_time( 'timestamp',1);
$adherent = doliConnect('member', $current_user, false, esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null));

$request = "/adherentsplus/".$adherent->id;
$productadhesion = doliconst("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS");
$requestp = "/products/".$productadhesion."?includesubproducts=true&includetrans=true";
$product = callDoliApi("GET", $requestp, null, dolidelay('product', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null)));

if ( isset($_POST["update_membership"]) && function_exists('doliconnect_membership') ) {
$typeadherent = isset($_POST["typeadherent"]) ? $_POST["typeadherent"] : null;
$adherent = doliconnect_membership($current_user, $_POST["update_membership"], $typeadherent, dolidelay('member', true));
//print var_dump($adherent);
$request = "/adherentsplus/".$adherent->id;
$adherent = callDoliApi("GET", $request, null, dolidelay('member', true));
print dolialert('success', __( 'Your membership has been updated.', 'doliconnect'));
}

if ( !empty(doliconnector($current_user, 'fk_member')) && doliconnector($current_user, 'fk_member') > 0 && doliconnector($current_user, 'fk_soc') > 0 ) {
$adherent = callDoliApi("GET", $request, null, dolidelay('member', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null)));
}
print '<div class="card shadow-sm"><div class="card-header">'.__( 'Manage my subscription', 'doliconnect').'</div><div class="card-body">';

if ( !empty(doliconnector($current_user, 'fk_member')) && doliconnector($current_user, 'fk_member') > 0 && !empty($adherent->typeid) ) {
if ( isset($adherent->id) && $adherent->id > 0 && !empty($adherent->typeid) ) {
$request= "/adherentsplus/type/".$adherent->typeid;
$adherenttype = callDoliApi("GET", $request, null, dolidelay('member', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null)));
}
Expand Down Expand Up @@ -1530,7 +1527,7 @@ function members_module( $url ) {
}
}

if ( !empty(doliconnector($current_user, 'fk_member')) && doliconnector($current_user, 'fk_member') > 0 && !empty($adherent->typeid) ) {
if ( isset($adherent->id) && $adherent->id > 0 && !empty($adherent->typeid) ) {
$request= "/adherentsplus/type/".$adherent->typeid;
$adherenttype = callDoliApi("GET", $request, null, dolidelay('member', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null)));
//print var_dump($adherenttype);
Expand Down Expand Up @@ -1580,8 +1577,8 @@ function members_module( $url ) {
print "<ul class='list-group list-group-flush'>";
$limit=12;
$page = doliPG(isset($_GET['pg'])?$_GET['pg']:null);
if (doliconnector($current_user, 'fk_member') > 0) {
$object = callDoliApi("GET", "/subscriptions?sortfield=dateadh&sortorder=DESC&limit=".$limit."&page=".$page."&pagination_data=true&sqlfilters=t.fk_adherent:=:".doliconnector($current_user, 'fk_member'), null, dolidelay('member', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null)));
if (isset($adherent->id) && $adherent->id > 0) {
$object = callDoliApi("GET", "/subscriptions?sortfield=dateadh&sortorder=DESC&limit=".$limit."&page=".$page."&pagination_data=true&sqlfilters=t.fk_adherent:=:".$adherent->id, null, dolidelay('member', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null)));
if ( doliversion('21.0.0') && isset($object->data) ) { $listcotisation = $object->data; } else { $listcotisation = $object; }
}
if ( isset($listcotisation) && !isset($listcotisation->error) && $listcotisation != null ) {
Expand Down

0 comments on commit 3088978

Please sign in to comment.