Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2025-11-26 13:29:33 +01:00
commit 1d4333a1ac
13 changed files with 111 additions and 85 deletions

View file

@ -1,6 +1,6 @@
---
# This is a basic workflow to check the lock on major version (to lock some files on certified versions)
name: Check lock of major version
name: Check fileset lock
on: [push, pull_request]
@ -10,7 +10,7 @@ concurrency:
jobs:
checkmajorversion:
name: Check lock of major version with generate_filelist_xml.php
name: Check lock on fileset unalterable_files with generate_filelist_xml.php
runs-on: ubuntu-latest
# Do not run schedule on forks
if: |

View file

@ -93,7 +93,9 @@ if ($action == 'update') {
$res = dolibarr_set_const($db, "MEMBER_MIN_AMOUNT", $minamount, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_SKIP_TABLE", $showtable ? 0 : 1, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "skip -> show"
$res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", $showvoteallowed ? 0 : 1, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show"
if (GETPOSTISSET('MEMBER_HIDE_VOTE_ALLOWED')) {
$res = dolibarr_set_const($db, "MEMBER_HIDE_VOTE_ALLOWED", $showvoteallowed ? 0 : 1, 'chaine', 0, '', $conf->entity); // Logic is reversed for retrocompatibility: "hide -> show"
}
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity);
if ($forcetype < 0) {
$res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity);
@ -225,6 +227,24 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
print '<td></td>';
print "</tr>\n";
// Show the table of all available membership types. If not, show a form (as the default was for Dolibarr <=16.0)
$skiptable = getDolGlobalInt('MEMBER_SKIP_TABLE');
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("MembersShowMembershipTypesTable");
print '</td><td>';
print $form->selectyesno("MEMBER_SHOW_TABLE", (int) !$skiptable, 1, false, 0, 1); // Reverse the logic "hide -> show" for retrocompatibility
print "</td></tr>\n";
// Show "vote allowed" setting for membership types
if (!$skiptable) {
$hidevoteallowed = getDolGlobalInt('MEMBER_HIDE_VOTE_ALLOWED');
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("MembersShowVotesAllowed");
print '</td><td>';
print $form->selectyesno("MEMBER_SHOW_VOTE_ALLOWED", (int) !$hidevoteallowed, 1, false, 0, 1); // Reverse the logic "hide -> show" for retrocompatibility
print "</td></tr>\n";
}
// Force Type
$adht = new AdherentType($db);
print '<tr class="oddeven drag" id="trforcetype"><td>';
@ -272,22 +292,6 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
print $form->selectyesno("MEMBER_COUNTERS_ARE_PUBLIC", getDolGlobalInt('MEMBER_COUNTERS_ARE_PUBLIC'), 1, false, 0, 1);
print "</td></tr>\n";
// Show the table of all available membership types. If not, show a form (as the default was for Dolibarr <=16.0)
$skiptable = getDolGlobalInt('MEMBER_SKIP_TABLE');
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("MembersShowMembershipTypesTable");
print '</td><td>';
print $form->selectyesno("MEMBER_SHOW_TABLE", (int) !$skiptable, 1, false, 0, 1); // Reverse the logic "hide -> show" for retrocompatibility
print "</td></tr>\n";
// Show "vote allowed" setting for membership types
$hidevoteallowed = getDolGlobalInt('MEMBER_HIDE_VOTE_ALLOWED');
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("MembersShowVotesAllowed");
print '</td><td>';
print $form->selectyesno("MEMBER_SHOW_VOTE_ALLOWED", (int) !$hidevoteallowed, 1, false, 0, 1); // Reverse the logic "hide -> show" for retrocompatibility
print "</td></tr>\n";
// Jump to an online payment page
print '<tr class="oddeven" id="trpayment"><td>';
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");

View file

@ -696,7 +696,7 @@ class AdherentType extends CommonObject
while ($i < $nump) {
$obj = $this->db->fetch_object($resql);
$amountbytype[$obj->rowid] = $obj->amount;
$amountbytype[$obj->rowid] = (float) $obj->amount;
$i++;
}
}

View file

@ -485,7 +485,13 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<td class="center">'.yn($objp->subscription).'</td>';
}
if (!empty($arrayfields['t.amount']['checked'])) {
print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
print '<td class="center">';
$amount = (is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount));
print '<span class="amount">'.$amount.'</span>';
if ($amount && $amount < (float) getDolGlobalInt("MEMBER_MIN_AMOUNT")) {
print img_warning('Amount lower than minimum of '.price(getDolGlobalInt("MEMBER_MIN_AMOUNT")).' defined in setup');
}
print '</td>';
}
if (!empty($arrayfields['t.caneditamount']['checked'])) {
print '<td class="center">'.yn($objp->caneditamount).'</td>';
@ -645,7 +651,11 @@ if ($rowid > 0) {
// Amount
print '<tr><td class="titlefield">'.$langs->trans("Amount").'</td><td>';
print((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
$amount = ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
print '<span class="amount">'.$amount.'</span>';
if ($amount && $amount < (float) getDolGlobalInt("MEMBER_MIN_AMOUNT")) {
print ' '.img_warning('Amount lower than minimum of '.price(getDolGlobalInt("MEMBER_MIN_AMOUNT")).' defined in setup');
}
print '</tr>';
print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
@ -944,7 +954,6 @@ if ($rowid > 0) {
$adh->firstname = $objp->firstname;
$adh->datefin = $datefin;
$adh->need_subscription = $objp->subscription;
$adh->statut = $objp->status;
$adh->status = $objp->status;
$adh->email = $objp->email;
$adh->photo = $objp->photo;
@ -1089,8 +1098,9 @@ if ($rowid > 0) {
print '</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>';
$amount = ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
print '<input name="amount" size="5" value="';
print((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
print $amount;
print '">';
print '</td></tr>';

View file

@ -58,6 +58,9 @@ class CLeadStatus extends CommonDict
*/
public $percent;
/**
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int<-5,5>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array<int|string,string>,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}>
*/
public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"),
'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Label of status"),

View file

@ -381,7 +381,7 @@ if ($action == 'dispatch' && $permissiontoreceive) {
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql .= " SET unitprice = ".price2num(GETPOST($pu), 'MU', 2);
$sql .= ", price = ".price2num(GETPOST($pu), 'MU', 2)." * quantity";
$sql .= ", remise_percent = ".price2num((empty($dto) ? 0 : $dto), 3, 2)."'";
$sql .= ", remise_percent = ".price2num((empty($dto) ? 0 : $dto), 3, 2);
$sql .= " WHERE fk_soc = ".((int) $object->socid);
$sql .= " AND fk_product=".((int) $productId);

View file

@ -27,7 +27,7 @@ MembersListNotUpToDate=List of valid members with out-of-date contribution
MembersListExcluded=List of excluded members
MembersListResiliated=List of terminated members
MembersListQualified=List of qualified members
MembersShowMembershipTypesTable=Show a table of all available membership types (if no, show directly the registration form)
MembersShowMembershipTypesTable=Show a table to select its membership types before the registration form (if no, show directly the registration form)
MembersShowVotesAllowed=Show whether votes are allowed, in the table of membership types
MenuMembersToValidate=Draft members
MenuMembersValidated=Validated members
@ -227,7 +227,7 @@ MembershipPaid=Membership paid for current period (until %s)
YouMayFindYourInvoiceInThisEmail=You may find your invoice attached to this email
XMembersClosed=%s member(s) closed
XExternalUserCreated=%s external user(s) created
ForceMemberNature=Force member nature (Individual or Corporation)
ForceMemberNature=Force member nature (Individual or Legal Entity)
CreateDolibarrLoginDesc=The creation of a user login for members allows them to connect to the application. Depending on the authorizations granted, they will be able, for example, to consult or modify their file themselves.
CreateDolibarrThirdPartyDesc=A third party is the legal entity that will be used on the invoice if you decide to generate invoice for each contribution. You will be able to create it later during the process of recording the contribution.
MemberFirstname=Member firstname

View file

@ -1273,13 +1273,15 @@ if (!defined('NOREQUIRETRAN')) {
// accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox
// accesskey is for Mac: CTRL + Option + key for all browsers
// Note: $con->browser->os and $conf->browser->name may not be defined if we are in CLI mode.
$conf->browser->stringforfirstkey = $langs->trans("KeyboardShortcut");
if ($conf->browser->os == 'macintosh') {
if (!empty($conf->browser->os) && $conf->browser->os == 'macintosh') {
$conf->browser->stringforfirstkey .= ' CTRL + Option +';
} else {
if ($conf->browser->name == 'chrome') {
if (!empty($conf->browser->name) && $conf->browser->name == 'chrome') {
$conf->browser->stringforfirstkey .= ' ALT +';
} elseif ($conf->browser->name == 'firefox') {
} elseif (!empty($conf->browser->name) && $conf->browser->name == 'firefox') {
$conf->browser->stringforfirstkey .= ' ALT + SHIFT +';
} else {
$conf->browser->stringforfirstkey .= ' CTL +';

View file

@ -683,8 +683,8 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
print "\n".'<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="create";
document.formsoc.submit();
document.newmember.action.value="create";
document.newmember.submit();
});
function initfieldrequired() {
jQuery("#tdcompany").removeClass("fieldrequired");
@ -715,7 +715,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
$listetype = $adht->liste_array(1);
print img_picto('', $adht->picto, 'class="pictofixedwidth"');
if (count($listetype)) {
print $form->selectarray("typeid", $listetype, (GETPOSTINT('typeid') ? GETPOSTINT('typeid') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0, '', 0, 0, 0, '', 'minwidth200', 1);
print $form->selectarray("typeid", $listetype, (GETPOSTINT('typeid') ? GETPOSTINT('typeid') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0, '', 0, 0, 0, '', 'minwidth150 maxwidth300 widthcentpercentminusx', 1);
} else {
print '<span class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</span>';
}
@ -834,7 +834,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
// Title
if (getDolGlobalString('MEMBER_NEWFORM_ASK_TITLE')) {
print '<tr><td class="titlefield">'.$langs->trans('UserTitle').'</td><td>';
print '<tr><td>'.$langs->trans('UserTitle').'</td><td>';
print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'</td></tr>'."\n";
}
@ -846,7 +846,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
// EMail
print '<tr><td>'.(getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? '<span class="fieldrequired">' : '').$langs->trans("EMail").(getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? '</span>' : '').'</td>';
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.dol_escape_htmltag(GETPOST('member_email', "aZ09arobase")).'"></td></tr>'."\n";
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth150 maxwidth300 widthcentpercentminusx" maxlength="255" value="'.dol_escape_htmltag(GETPOST('member_email', "aZ09arobase")).'"></td></tr>'."\n";
// Login
if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {
@ -859,7 +859,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
print '<tr><td>'.$langs->trans("Gender").'</td>';
print '<td>';
$arraygender = array('man' => $langs->trans("Genderman"), 'woman' => $langs->trans("Genderwoman"), 'other' => $langs->trans("Genderother"));
print $form->selectarray('gender', $arraygender, GETPOST('gender', 'alphanohtml'), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print $form->selectarray('gender', $arraygender, GETPOST('gender', 'alphanohtml'), 1, 0, 0, '', 0, 0, 0, '', 'minwidth150 maxwidth300 widthcentpercentminusx', 1);
print '</td></tr>';
// Address
@ -878,7 +878,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
print img_picto('', 'country', 'class="pictofixedwidth paddingright"');
$country_id = GETPOSTINT('country_id');
if (!$country_id && getDolGlobalString('MEMBER_NEWFORM_FORCECOUNTRYCODE')) {
$country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, '2', $db, $langs);
$country_id = getCountry(getDolGlobalString('MEMBER_NEWFORM_FORCECOUNTRYCODE'), '2', $db, $langs);
}
if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
$country_code = dol_user_country();
@ -892,7 +892,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
}
}
$country_code = getCountry($country_id, '2', $db, $langs);
print $form->select_country($country_id, 'country_id');
print $form->select_country($country_id, 'country_id', '', 0, 'minwidth150 maxwidth300 widthcentpercentminusx');
print '</td></tr>';
// State
@ -900,22 +900,22 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($country_code) {
print img_picto('', 'state', 'class="pictofixedwidth paddingright"');
print $formcompany->select_state(GETPOSTINT("state_id"), $country_code);
print $formcompany->select_state(GETPOSTINT("state_id"), $country_code, 'state_id', 'minwidth150 maxwidth300 widthcentpercentminusx');
}
print '</td></tr>';
}
// Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td>';
print '<td>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').'<input type="text" name="phone" size="20" value="'.dol_escape_htmltag(GETPOST('phone')).'"></td></tr>';
print '<td>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').'<input type="text" name="phone" class="maxwidth300 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('phone')).'"></td></tr>';
// Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td>';
print '<td>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').'<input type="text" name="phone_perso" size="20" value="'.dol_escape_htmltag(GETPOST('phone_perso')).'"></td></tr>';
print '<td>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').'<input type="text" name="phone_perso" class="maxwidth300 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('phone_perso')).'"></td></tr>';
// Mobile phone
print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
print '<td>'.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').'<input type="text" name="phone_mobile" size="20" value="'.dol_escape_htmltag(GETPOST('phone_mobile')).'"></td></tr>';
print '<td>'.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').'<input type="text" name="phone_mobile" class="maxwidth300 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('phone_mobile')).'"></td></tr>';
// Birthday
print '<tr id="trbirth" class="trbirth"><td>'.$langs->trans("DateOfBirth").'</td><td>';
@ -923,7 +923,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
print '</td></tr>'."\n";
// Photo
print '<tr><td>'.$langs->trans("URLPhoto").'</td><td><input type="text" name="photo" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('photo')).'"></td></tr>'."\n";
print '<tr><td>'.$langs->trans("URLPhoto").'</td><td><input type="text" name="photo" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('photo')).'"></td></tr>'."\n";
// Public
if (getDolGlobalString('MEMBER_PUBLIC_ENABLED')) {
@ -938,8 +938,8 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
// Comments
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note_private', 'restricthtml'), 0, 1).'</textarea></td>';
print '<td class="tdtop"></td>';
print '<td class="tdtop"><textarea placeholder="'.dolPrintHTML($langs->trans("Comments")).'" name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note_private', 'restricthtml'), 0, 1).'</textarea></td>';
print '</tr>'."\n";
// Add specific fields used by Dolibarr foundation for example
@ -995,6 +995,11 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
$adht->fetch($typeid);
$caneditamount = $adht->caneditamount;
$amountbytype = $adht->amountByType(1); // Load the array of amount per type
foreach ($amountbytype as $k => $v) {
$amount = max(0, (float) $v, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT"));
$amountbytype[$k] = $amount;
}
$amountbytype_json = json_encode($amountbytype);
$caneditamountbytype = $adht->caneditamountByType(1); // Load the array of caneditamount per type
$caneditamountbytype_json = json_encode($caneditamountbytype);
@ -1053,9 +1058,10 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
print '<script>
jQuery(function($) {
$("#typeid").on("change", function() {
console.log("Type of membership changed, we force amount update");
let typeId = $(this).val();
let amountVal = amountbytype[typeId] || 0;
let formattedAmount = parseFloat(amountVal).toFixed(2);
let formattedAmount = parseFloat(amountVal);
if (canEditAmount[typeId] === "1") {
// Editable mode
@ -1079,7 +1085,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
// Display Captcha code if is enabled
if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_MEMBER') && is_object($captchaobj)) {
print '<tr><td class="titlefield"><label><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td><br>';
print '<tr><td><label><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td><br>';
if (method_exists($captchaobj, 'getCaptchaCodeForForm')) {
print $captchaobj->getCaptchaCodeForForm(''); // @phan-suppress-current-line PhanUndeclaredMethod
} else {
@ -1156,7 +1162,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
print '<tr class="oddeven">';
// Label
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td>'.dolPrintHTML($objp->label).'</td>';
// Duration
print '<td class="center">';
$unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration);

View file

@ -376,8 +376,8 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P
$currencyCodeType = strtoupper($object->currency);
$paymentmethodstripeid = $object->payment_method;
$customer_id = $object->customer;
$invoice_id = "";
$supplierinvoice_id = "";
$invoice_id = 0;
$supplierinvoice_id = 0;
$salary_id = "";
$paymentTypeCode = ""; // payment type according to Stripe
$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
@ -656,14 +656,16 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P
if (!$error) {
if (getDolGlobalString('STRIPE_IPN_SEND_EMAIL_ON_DIRECT_DEBIT_CONFIRMATION')) {
// If option to send email after confirmation of direct debit is on, we send the email (template must exists
$labeltouse = getDolGlobalString('STRIPE_IPN_SEND_EMAIL_ON_DIRECT_DEBIT_CONFIRMATION'); // Example: 'InvoicePaymentSuccess'
$labeltouse = getDolGlobalString('STRIPE_IPN_SEND_EMAIL_ON_DIRECT_DEBIT_CONFIRMATION');
// Example: $labeltouse = 'InvoicePaymentSuccess'
$invoice = new Facture($db);
$invoice->fetch($invoice_id);
$invoice->fetch_thirdparty();
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
$outputlangs->setDefaultLang(empty($invoice->thirdparty->default_lang) ? $mysoc->default_lang : $invoice->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members", "bills"));
// Get email content from template
@ -672,16 +674,18 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
if (! empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'facture_send', $user, $outputlangs, 0, 1, $labeltouse);
}
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'facture_send', $user, $outputlangs, 0, 1, $labeltouse);
if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$appli = $mysoc->name;
$subject = '['.$appli.'] Invoice direct debit payment recevied';
$msg = 'An invoice direct debit payment for invoice '.$invoice->ref.' has been recevied';
if (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $invoice);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
@ -692,11 +696,13 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P
if (is_array($invoice->linkedObjects['contrat']) && count($invoice->linkedObjects['contrat']) > 0) {
//dol_sort_array($object->linkedObjects['facture'], 'date');
foreach ($invoice->linkedObjects['contrat'] as $idcontract => $contract) {
$substitutionarray['__CONTRACT_REF__']=$contract->ref_customer;
$substitutionarray['__REFCLIENT__']=$contract->ref_customer; // For backward compatibility
$substitutionarray['__REF_CLIENT__']=$contract->ref_customer;
$substitutionarray['__REF_CUSTOMER__']=$contract->ref_customer;
foreach ($invoice->linkedObjects['contrat'] as $contract) {
/** @var Contrat $contract */
'@phan-var-force Contrat $contract';
$substitutionarray['__CONTRACT_REF__'] = $contract->ref_customer;
$substitutionarray['__REFCLIENT__'] = $contract->ref_customer; // For backward compatibility
$substitutionarray['__REF_CLIENT__'] = $contract->ref_customer;
$substitutionarray['__REF_CUSTOMER__'] = $contract->ref_customer;
$foundcontract = $contract;
break;
}
@ -704,40 +710,31 @@ if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_P
dol_syslog('__DIRECTDOWNLOAD_URL_INVOICE__='.$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']);
$urlforsellyoursaasaccount = getRootUrlForAccount($foundcontract);
if ($urlforsellyoursaasaccount) {
$tmpforurl=preg_replace('/.*document.php/', '', $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']);
if ($tmpforurl) {
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']=$urlforsellyoursaasaccount.'/source/document.php'.$tmpforurl;
} else {
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']=$urlforsellyoursaasaccount;
}
}
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
// Attach a file ?
$file='';
$listofpaths=array();
$listofnames=array();
$listofmimes=array();
if (is_object($invoice)) {
$invoicediroutput = $conf->invoice->dir_output;
$fileparams = dol_most_recent_file($invoicediroutput . '/' . $invoice->ref, preg_quote($invoice->ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
$file = ''; // Disable attachment of invoice in emails
if ($file) {
$listofpaths=array($file);
$listofnames=array(basename($file));
$listofmimes=array(dol_mimetype($file));
}
/*
$invoicediroutput = $conf->invoice->dir_output;
$fileparams = dol_most_recent_file($invoicediroutput . '/' . $invoice->ref, preg_quote($invoice->ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
$file = ''; // Disable attachment of invoice in emails
if ($file) {
$listofpaths=array($file);
$listofnames=array(basename($file));
$listofmimes=array(dol_mimetype($file));
}
*/
$from = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
$trackid = 'inv'.$invoice->id;
$moreinheader = 'X-Dolibarr-Info: doTakeStripePaymentForThirdParty'."\r\n";
$moreinheader = 'X-Dolibarr-Info: public stripe ipn.php'."\r\n";
$addr_cc = '';
if (!empty($invoice->thirdparty->array_options['options_emailccinvoice'])) {
dol_syslog("We add the recipient ".$invoice->thirdparty->array_options['options_emailccinvoice']." as CC", LOG_DEBUG);

View file

@ -2480,7 +2480,7 @@ if ($action == 'create' && $permissiontoadd) {
$origin = 'supplier_order';
}
if ($origin && $origin_id > 0) {
if ($origin_id > 0) {
$sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end";
$sql .= ", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot";
$sql .= ", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception";

View file

@ -378,6 +378,8 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
padding-top: 6px !important;
padding-bottom: 6px !important;
vertical-align: middle;
white-space: nowrap;
display: inline-block;
}
.nonature-back {

View file

@ -49,6 +49,8 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
padding-top: 5px !important;
padding-bottom: 6px !important;
vertical-align: middle;
white-space: nowrap;
display: inline-block;
}
.nonature-back {