2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2025-07-01 16:22:21 +02:00
parent e2c2f73e9c
commit ac892efb42
7 changed files with 43 additions and 38 deletions

View File

@@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr> /* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@@ -5823,7 +5823,7 @@ class Form
* @param int<0,1> $include [=0] Removed or 1=Keep only * @param int<0,1> $include [=0] Removed or 1=Keep only
* @param string $morecss More CSS * @param string $morecss More CSS
* @param int<0,2> $useempty 0=No empty value, 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. Default is 1. * @param int<0,2> $useempty 0=No empty value, 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. Default is 1.
* @return string|array<int,string>|array<int,array{id:int,fulllabel:string,color:string,picto:string}>|array<int,array{rowid:int,id:int,fk_parent:int,label:string,description:string,color:string,position:string,visible:int,ref_ext:string,picto:string,fullpath:string,fulllabel:string}> String list or Array of categories * @return string|array<int,string>|array<int,array{id:int,fulllabel:string,data-html:?string,color:string,picto:string}>|array<int,array{rowid:int,id:int,fk_parent:int,label:string,description:string,color:string,position:string,visible:int,ref_ext:string,picto:string,fullpath:string,fulllabel:string,data-html:?string}> String list or Array of categories
* @see select_categories() * @see select_categories()
*/ */
public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $fromid = 0, $outputmode = 0, $include = 0, $morecss = '', $useempty = 1) public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $fromid = 0, $outputmode = 0, $include = 0, $morecss = '', $useempty = 1)
@@ -10821,18 +10821,18 @@ class Form
/** /**
* Return HTML code to output a photo * Return HTML code to output a photo
* *
* @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto') * @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto')
* @param Societe|Adherent|Contact|User|CommonObject $object Object containing data to retrieve file name * @param Societe|Adherent|Contact|User|CommonObject $object Object containing data to retrieve file name
* @param int $width Width of photo * @param int $width Width of photo
* @param int $height Height of photo (auto if 0) * @param int $height Height of photo (auto if 0)
* @param int<0,1> $caneditfield Add edit fields * @param int<0,1> $caneditfield Add edit fields
* @param string $cssclass CSS name to use on img for photo * @param string $cssclass CSS name to use on img for photo
* @param string $imagesize 'mini', 'small' or '' (original) * @param string $imagesize 'mini', 'small' or '' (original)
* @param int<0,1> $addlinktofullsize Add link to fullsize image * @param int<0,1> $addlinktofullsize Add link to fullsize image
* @param int<0,1> $cache 1=Accept to use image in cache * @param int<0,1> $cache 1=Accept to use image in cache
* @param ''|'user'|'environment' $forcecapture '', 'user' or 'environment'. Force parameter capture on HTML input file element to ask a smartphone to allow to open camera to take photo. Auto if ''. * @param ''|'user'|'environment' $forcecapture '', 'user' (user-facing camera) or 'environment' ('outward-facing camera'). Force the parameter capture on HTML input file element to ask a smartphone to allow to open camera to take photo. Auto if ''.
* @param int<0,1> $noexternsourceoverwrite No overwrite image with extern source (like 'gravatar' or other module) * @param int<0,1> $noexternsourceoverwrite No overwrite image with extern source (like 'gravatar' or other module)
* @return string HTML code to output photo * @return string HTML code to output photo
* @see getImagePublicURLOfObject() * @see getImagePublicURLOfObject()
*/ */
public static function showphoto($modulepart, $object, $width = 100, $height = 0, $caneditfield = 0, $cssclass = 'photowithmargin', $imagesize = '', $addlinktofullsize = 1, $cache = 0, $forcecapture = '', $noexternsourceoverwrite = 0) public static function showphoto($modulepart, $object, $width = 100, $height = 0, $caneditfield = 0, $cssclass = 'photowithmargin', $imagesize = '', $addlinktofullsize = 1, $cache = 0, $forcecapture = '', $noexternsourceoverwrite = 0)
@@ -11010,7 +11010,7 @@ class Form
if ($maxmin > 0) { if ($maxmin > 0) {
$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file
} }
$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>'; $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . dolPrintHTMLForAttribute($capture) . '"' : '') . '>';
$ret .= '</td></tr>'; $ret .= '</td></tr>';
$ret .= '</table>'; $ret .= '</table>';
} }

View File

@@ -1736,7 +1736,7 @@ function complete_elementList_with_modules(&$elementList)
/** /**
* Show array with constants to edit * Show array with constants to edit
* *
* @param array<string,array{type:string,label:string,?tooltip:string}>|array<int,string> $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label, 'tooltip'=>tooltip) * @param array<string,array{type:string,label:string,tooltip:?string}>|array<int,string> $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label, 'tooltip'=>tooltip)
* where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ... * where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ...
* @param int<2,3> $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all, 3=No form nor button at all and each field has a unique name (form is output by caller, recommended) (typed as int<2,3> to highlight the deprecated values) * @param int<2,3> $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all, 3=No form nor button at all and each field has a unique name (form is output by caller, recommended) (typed as int<2,3> to highlight the deprecated values)
* @param string $helptext Tooltip help to use for the column name of values * @param string $helptext Tooltip help to use for the column name of values

View File

@@ -1657,7 +1657,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
// Photo - Name // Photo - Name
if (!empty($arrayfields['t.name']['checked'])) { if (!empty($arrayfields['t.name']['checked'])) {
print '<td class="tdoverflowmax150">'; print '<td class="tdoverflowmax150">';
print $form->showphoto('contact', $contactstatic, 0, 0, 0, 'photorefnoborder valignmiddle marginrightonly', 'small', 1, 0, '1'); print $form->showphoto('contact', $contactstatic, 0, 0, 0, 'photorefnoborder valignmiddle marginrightonly', 'small', 1, 0, 'user');
print $contactstatic->getNomUrl(0, '', 0, '&backtopage='.urlencode($backtopage)); print $contactstatic->getNomUrl(0, '', 0, '&backtopage='.urlencode($backtopage));
print '</td>'; print '</td>';
} }

View File

@@ -1490,7 +1490,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print $langs->trans('ServiceToUseOnLines'); print $langs->trans('ServiceToUseOnLines');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$form->select_produits(0, 'productid', '1', 0, $projectstatic->thirdparty->price_level, 1, 2, '', 0, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500'); $form->select_produits(0, 'productid', 1, 0, $projectstatic->thirdparty->price_level, 1, 2, '', 0, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@@ -1884,7 +1884,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if (isModEnabled("service") && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { if (isModEnabled("service") && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) {
print '<td class="nowraponall">'; print '<td class="nowraponall">';
print img_picto('', 'service'); print img_picto('', 'service');
print $form->select_produits((GETPOSTISSET('fk_product') ? GETPOSTINT("fk_product") : ''), 'fk_product', '1', 0, $projectstatic->thirdparty->price_level, 1, 2, '', 1, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth150', 0, '', null, 1); print $form->select_produits((GETPOSTISSET('fk_product') ? GETPOSTINT("fk_product") : ''), 'fk_product', 1, 0, $projectstatic->thirdparty->price_level, 1, 2, '', 1, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth150', 0, '', null, 1);
print '</td>'; print '</td>';
} }
} }
@@ -2415,7 +2415,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<td class="nowraponall">'; print '<td class="nowraponall">';
if ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) { if ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) {
print img_picto('', 'service'); print img_picto('', 'service');
print $form->select_produits($task_time->fk_product, 'fk_product', '1', 0, $projectstatic->thirdparty->price_level, 1, 2, '', 1, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500', 0, '', null, 1); print $form->select_produits($task_time->fk_product, 'fk_product', 1, 0, $projectstatic->thirdparty->price_level, 1, 2, '', 1, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500', 0, '', null, 1);
} elseif (!empty($task_time->fk_product)) { } elseif (!empty($task_time->fk_product)) {
$product = new Product($db); $product = new Product($db);
$resultFetch = $product->fetch($task_time->fk_product); $resultFetch = $product->fetch($task_time->fk_product);

View File

@@ -345,22 +345,22 @@ class Stripe extends CommonObject
* Note: This is used when option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on when making a payment from the public/payment/newpayment.php page * Note: This is used when option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on when making a payment from the public/payment/newpayment.php page
* but not when using the STRIPE_USE_NEW_CHECKOUT. * but not when using the STRIPE_USE_NEW_CHECKOUT.
* *
* @param float $amount Amount * @param float $amount Amount
* @param string $currency_code Currency code * @param string $currency_code Currency code
* @param string $tag Tag * @param string $tag Tag
* @param string $description Description * @param string $description Description
* @param ?CommonObject $object Object to pay with Stripe * @param ?CommonObject $object Object to pay with Stripe
* @param ?string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() * @param ?string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe()
* @param ?string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect * @param ?string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect
* @param int<0,1> $status Status (0=test, 1=live) * @param int<0,1> $status Status (0=test, 1=live)
* @param int<0,1> $usethirdpartyemailforreceiptemail 1=use thirdparty email for receipt * @param int<0,1> $usethirdpartyemailforreceiptemail 1=use thirdparty email for receipt
* @param 'automatic'|'manual' $mode automatic=automatic confirmation/payment when conditions are ok, manual=need to call confirm() on intent * @param 'automatic'|'manual'|'terminal' $mode Automatic=automatic confirmation/payment when conditions are ok, manual=need to call confirm() on intent, terminal=manual
* @param bool $confirmnow false=default, true=try to confirm immediately after create (if conditions are ok) * @param bool $confirmnow False=default, true=try to confirm immediately after create (if conditions are ok)
* @param ?string $payment_method 'pm_....' (if known) * @param ?string $payment_method 'pm_....' (if known)
* @param int<0,1> $off_session If we use an already known payment method to pay when customer is not available during the checkout flow. * @param int<0,1> $off_session If we use an already known payment method to pay when customer is not available during the checkout flow.
* @param int<0,1> $noidempotency_key Do not use the idempotency_key when creating the PaymentIntent * @param int<0,1> $noidempotency_key Do not use the idempotency_key when creating the PaymentIntent
* @param int $did ID of an existing line into llx_prelevement_demande (Dolibarr intent). If provided, no new line will be created. * @param int $did ID of an existing line into llx_prelevement_demande (Dolibarr intent). If provided, no new line will be created.
* @return ?\Stripe\PaymentIntent Stripe PaymentIntent or null if not found and failed to create * @return ?\Stripe\PaymentIntent Stripe PaymentIntent or null if not found and failed to create
*/ */
public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0, $noidempotency_key = 1, $did = 0) public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0, $noidempotency_key = 1, $did = 0)
{ {
@@ -454,6 +454,8 @@ class Stripe extends CommonObject
} }
} }
$stripemode = $mode;
// list of payment method types // list of payment method types
$paymentmethodtypes = array("card"); $paymentmethodtypes = array("card");
$descriptor = dol_trunc($tag, 10, 'right', 'UTF-8', 1); $descriptor = dol_trunc($tag, 10, 'right', 'UTF-8', 1);
@@ -476,8 +478,11 @@ class Stripe extends CommonObject
if (getDolGlobalInt('STRIPE_SOFORT')) { if (getDolGlobalInt('STRIPE_SOFORT')) {
$paymentmethodtypes[] = "sofort"; $paymentmethodtypes[] = "sofort";
} }
if (getDolGlobalInt('STRIPE_CARD_PRESENT') && $mode == 'terminal') { if ($mode == 'terminal') {
$paymentmethodtypes = array("card_present"); if (getDolGlobalInt('STRIPE_CARD_PRESENT')) {
$paymentmethodtypes = array("card_present");
}
$stripemode = 'manual';
} }
global $dolibarr_main_url_root; global $dolibarr_main_url_root;
@@ -486,7 +491,7 @@ class Stripe extends CommonObject
$dataforintent = array( $dataforintent = array(
"confirm" => $confirmnow, // try to confirm immediately after create (if conditions are ok) "confirm" => $confirmnow, // try to confirm immediately after create (if conditions are ok)
"confirmation_method" => $mode, "confirmation_method" => $stripemode,
"amount" => $stripeamount, "amount" => $stripeamount,
"currency" => $currency_code, "currency" => $currency_code,
"payment_method_types" => $paymentmethodtypes, // When payment_method_types is set, return_url is not required but payment mode can't be managed from dashboard "payment_method_types" => $paymentmethodtypes, // When payment_method_types is set, return_url is not required but payment mode can't be managed from dashboard

View File

@@ -575,7 +575,6 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
$thirdparty->fax = $thirdpartywithuser['fax']; $thirdparty->fax = $thirdpartywithuser['fax'];
$thirdparty->email = $thirdpartywithuser['email']; $thirdparty->email = $thirdpartywithuser['email'];
$thirdparty->url = $thirdpartywithuser['url']; $thirdparty->url = $thirdpartywithuser['url'];
$thirdparty->ape = $thirdpartywithuser['ape'];
$thirdparty->idprof1 = $thirdpartywithuser['prof1']; $thirdparty->idprof1 = $thirdpartywithuser['prof1'];
$thirdparty->idprof2 = $thirdpartywithuser['prof2']; $thirdparty->idprof2 = $thirdpartywithuser['prof2'];
$thirdparty->idprof3 = $thirdpartywithuser['prof3']; $thirdparty->idprof3 = $thirdpartywithuser['prof3'];