Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ptibogxiv committed Oct 31, 2024
1 parent 8620070 commit 27c71fa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions functions/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ function doliaddtocart($product, $mstock, $quantity, $price, $timestart = null,
$oldquantity = $quantity;
$quantity = $mstock['m2'];
}
$thirdparty = callDoliApi("GET", "/thirdparties/".doliconnector($current_user, 'fk_soc'), null, dolidelay('thirdparty'));
$thirdparty = doliConnect('thirdparty', $current_user, false);
if ( empty($orderid) ) {
$rdr = [
'socid' => doliconnector($current_user, 'fk_soc'),
'socid' => $thirdparty->id,
'date' => time(),
'demand_reason_id' => 1,
'cond_reglement_id' => $thirdparty->cond_reglement_id,
Expand Down Expand Up @@ -489,7 +489,7 @@ function doliProductPrice($product, $quantity = null, $refresh = false, $nohtml
global $current_user;
$button = null;
$price = array();
$thirdparty = callDoliApi("GET", "/thirdparties/".doliconnector($current_user, 'fk_soc'), null, dolidelay('thirdparty'));
$thirdparty = doliConnect('thirdparty', $current_user, false);
if (isset($thirdparty->tva_assuj) && empty($thirdparty->tva_assuj)) {
if (isset($product->tva_tx)) $product->tva_tx = 0;
}
Expand Down
34 changes: 17 additions & 17 deletions functions/tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,8 @@ function doliline($object, $refresh = false, $refreshstock = false, $wishlist =
global $current_user;
$doliline = null;
//$doliline .= var_dump($object);
if ( isset($object) && is_object($object) && isset($object->lines) && $object->lines != null && (doliconnector($current_user, 'fk_soc') == $object->socid) ) {
$thirdparty = doliConnect('thirdparty', $current_user, false, $refresh);
if ( isset($object) && is_object($object) && isset($object->lines) && $object->lines != null && ($thirdparty->id == $object->socid) ) {
foreach ( $object->lines as $line ) {
if ( $line->fk_product > 0 ) {
if ($refresh || $refreshstock) $refreshstock = true;
Expand Down Expand Up @@ -1914,24 +1915,23 @@ function doliShipmentMethods($id, $refresh = false) {
function doliconnect_paymentmethods($object = null, $module = null, $url = null, $refresh = false, $array = array()) {
global $current_user;

$request = "/doliconnector/".doliconnector($current_user, 'fk_soc')."/paymentmethods";

if ( !empty($module) && is_object($object) && isset($object->id) ) {
if ($module == 'orders') { $module2 = 'order'; }
elseif ($module == 'invoices') { $module2 = 'invoice'; }
elseif ($module == 'donations') { $module2 = 'donation'; }
else { $module2 = $module; }
$request .= "?type=".$module2."&rowid=".$object->id;
$currency=strtolower($object->multicurrency_code?$object->multicurrency_code:'eur');
$stripeAmount=($object->multicurrency_total_ttc?$object->multicurrency_total_ttc:$object->total_ttc)*100;
}
$thirdparty = doliConnect('thirdparty', $current_user, false, $refresh);
$request = "/doliconnector/".$thirdparty->id."/paymentmethods";

if ( !empty($module) && is_object($object) && isset($object->id) ) {
if ($module == 'orders') { $module2 = 'order'; }
elseif ($module == 'invoices') { $module2 = 'invoice'; }
elseif ($module == 'donations') { $module2 = 'donation'; }
else { $module2 = $module; }
$request .= "?type=".$module2."&rowid=".$object->id;
$currency=strtolower($object->multicurrency_code?$object->multicurrency_code:'eur');
$stripeAmount=($object->multicurrency_total_ttc?$object->multicurrency_total_ttc:$object->total_ttc)*100;
}

$listpaymentmethods = callDoliApi("GET", $request, null, dolidelay('paymentmethods', $refresh));
//print var_dump($listpaymentmethods);
$thirdparty = callDoliApi("GET", "/thirdparties/".doliconnector($current_user, 'fk_soc'), null, dolidelay('thirdparty', $refresh));
//print $thirdparty;
$listpaymentmethods = callDoliApi("GET", $request, null, dolidelay('paymentmethods', $refresh));
//print var_dump($listpaymentmethods);

$paymentmethods = '';
$paymentmethods = '';

if ( isset($listpaymentmethods->stripe) ) {
$paymentmethods .= '<script src="https://js.stripe.com/v3/"></script>';
Expand Down

0 comments on commit 27c71fa

Please sign in to comment.