From a6d8feefdc47670392b88adaa1ad640b7b819ca4 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 21 Jan 2025 13:00:18 +0100 Subject: [PATCH 01/15] Fix warning --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 08dd5e94151..a2795eda594 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3162,7 +3162,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file = $conf->fckeditor->dir_output.'/'.$original_file; } elseif ($modulepart == 'user' && !empty($conf->user->dir_output)) { // Wrapping for users - $canreaduser = (!empty($fuser->admin) || $fuser->rights->user->user->{$lire}); + $canreaduser = (!empty($fuser->admin) || $fuser->hasRight('user', 'user', 'lire')); if ($fuser->id == (int) $refname) { $canreaduser = 1; } // A user can always read its own card From d0399fdb325f87f23aa07c050b785ddb7b239330 Mon Sep 17 00:00:00 2001 From: Dolibot Date: Tue, 21 Jan 2025 12:07:00 +0000 Subject: [PATCH 02/15] PHPStan > Update baseline --- dev/build/phpstan/phpstan-baseline.neon | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 3d3697f4d16..02bff396fb4 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -16164,12 +16164,6 @@ parameters: count: 2 path: ../../../htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php - - - message: '#^Variable \$old_MAIN_MAIL_AUTOCOPY_TO might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php - - message: '#^Call to function method_exists\(\) with Contact and ''getContactRoles'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -31902,12 +31896,6 @@ parameters: count: 1 path: ../../../htdocs/variants/class/ProductCombination.class.php - - - message: '#^Negated boolean expression is always false\.$#' - identifier: booleanNot.alwaysFalse - count: 1 - path: ../../../htdocs/variants/class/ProductCombination.class.php - - message: '#^Property ProductCombination\:\:\$variation_price_percentage type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue From 7a8d4e2507ac3108cded12df449f0e2f23883a62 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 21 Jan 2025 14:08:52 +0100 Subject: [PATCH 03/15] Debug v21 --- htdocs/comm/action/class/actioncomm.class.php | 4 +- .../comm/action/class/cactioncomm.class.php | 2 + htdocs/core/lib/company.lib.php | 64 +++++++++++++------ 3 files changed, 49 insertions(+), 21 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index a96ec4e0e82..6eb05106686 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1883,7 +1883,7 @@ class ActionComm extends CommonObject $color = 'style="color: #'.$this->type_color.' !important;"'; } if ($this->type_picto) { - $imgpicto = img_picto($titlealt, $this->type_picto, '', 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); + $imgpicto = img_picto($titlealt.'rr', $this->type_picto, '', 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); } else { if ($this->type_code == 'AC_RDV') { $imgpicto = img_picto($titlealt, 'meeting', $color, 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); @@ -1891,7 +1891,7 @@ class ActionComm extends CommonObject $imgpicto = img_picto($titlealt, 'object_phoning', $color, 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); } elseif ($this->type_code == 'AC_FAX') { $imgpicto = img_picto($titlealt, 'object_phoning_fax', $color, 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); - } elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN' || (!empty($this->code) && preg_match('/_SENTBYMAIL/', $this->code))) { + } elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN' || $this->type_code == 'AC_EMAILING' || (!empty($this->code) && preg_match('/_SENTBYMAIL/', $this->code))) { $imgpicto = img_picto($titlealt, 'object_email', $color, 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); } elseif ($this->type_code == 'AC_INT') { $imgpicto = img_picto($titlealt, 'object_intervention', $color, 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 9c28468c1c7..db3fcfe1bbc 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -163,11 +163,13 @@ class CActionComm global $langs, $conf, $user; $langs->load("commercial"); + /* $actionstatic = new ActionComm($this->db); $rep_id = array(); $rep_code = array(); $rep_all = array(); + */ $sql = "SELECT id, code, libelle as label, module, type, color, picto"; $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index dcaa104ee2c..6f6d25eecb8 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1809,6 +1809,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $sql .= " a.percent as percent, 'action' as type,"; $sql .= " a.fk_element, a.elementtype,"; $sql .= " a.fk_contact,"; + $sql .= " a.code,"; $sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,"; $sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) { @@ -2006,6 +2007,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr $sql .= $hookmanager->resPrint; } + // Now add events of emailing module if (is_array($actioncode)) { foreach ($actioncode as $code) { $sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj); @@ -2087,6 +2089,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr 'firstname' => empty($obj->firstname) ? '' : $obj->firstname, 'fk_element' => (int) $obj->fk_element, 'elementtype' => $obj->elementtype, + + 'code' => $obj->code, + // Type of event 'acode' => $obj->acode, 'alabel' => $obj->alabel, @@ -2102,6 +2107,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr 'dateend' => $db->jdate($obj->dp2), 'note' => $obj->label, 'percent' => (int) $obj->percent, + + 'code' => $obj->code, + + // Type of event 'acode' => $obj->acode, 'userid' => (int) $obj->user_id, @@ -2238,11 +2247,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; $caction = new CActionComm($db); - $arraylist = $caction->liste_array(1, 'code', '', (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? 1 : 0), '', 1); + $arraylist = $caction->liste_array(1, 'code', '', (getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? 0 : 1), '', 1); foreach ($histo as $key => $value) { $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo + if (empty($actionstatic->code)) { + $actionstatic->code = $histo[$key]['acode']; + } $actionstatic->type_picto = $histo[$key]['apicto'] ?? ''; $actionstatic->type_code = $histo[$key]['acode']; @@ -2314,25 +2326,38 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr } $out .= ''; + // type_code // column "acode" in the sql = code in type of actioncomm, example: AC_OTH_AUTO, AC_EMAILING + // code // columne code in the sql (not yet added), can be AC_CONTACT_SENTBYMAIL, ... + // Type - $labeltype = $actionstatic->type_code; - if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && empty($arraylist[$labeltype])) { - $labeltype = 'AC_OTH'; + $labelOfTypeToShow = $actionstatic->type_code; + //$typelabel = $actionstatic->type_label; + $code = $actionstatic->code; + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && empty($arraylist[$labelOfTypeToShow])) { + $labelOfTypeToShow = 'AC_OTH'; } if (!empty($actionstatic->code) && preg_match('/^TICKET_MSG/', $actionstatic->code)) { - $labeltype = $langs->trans("Message"); + $labelOfTypeToShow = $langs->trans("Message"); } else { - if (!empty($arraylist[$labeltype])) { - $labeltype = $arraylist[$labeltype]; + if (!empty($arraylist[$labelOfTypeToShow])) { + $labelOfTypeToShow = $arraylist[$labelOfTypeToShow]; + } elseif ($actionstatic->type_code == 'AC_EMAILING') { + $labelOfTypeToShow = $langs->trans("Emailing"); } - if ($actionstatic->type_code == 'AC_OTH_AUTO' && ($actionstatic->type_code != $actionstatic->code) && $labeltype && !empty($arraylist[$actionstatic->code])) { - $labeltype .= ' - '.$arraylist[$actionstatic->code]; // Use code in priority on type_code + if ($actionstatic->type_code == 'AC_OTH_AUTO' && ($actionstatic->type_code != $actionstatic->code) && $labelOfTypeToShow && !empty($arraylist[$actionstatic->code])) { + $labelOfTypeToShow .= ' - '.$arraylist[$actionstatic->code]; // Show also detailed code } } - $out .= ''; + + $labelOfTypeToShowLong = $labelOfTypeToShow; + if ($actionstatic->type_code == 'AC_OTH_AUTO') { + $labelOfTypeToShowLong .= ' (auto)'; + } + + $out .= ''; $out .= $actionstatic->getTypePicto(); //if (empty($conf->dol_optimize_smallscreen)) { - $out .= $labeltype; + $out .= $labelOfTypeToShow; //} $out .= ''; @@ -2341,18 +2366,19 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') { $transcode = $langs->trans("Action".$histo[$key]['acode']); //$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']); - $libelle = $histo[$key]['note']; + $label = $histo[$key]['note']; $actionstatic->id = $histo[$key]['id']; - $out .= ' title="'.dol_escape_htmltag($libelle).'">'; - $out .= dol_trunc($libelle, 120); + $out .= ' title="'.dol_escape_htmltag($label).'">'; + $out .= dol_trunc($label, 120); } if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') { $transcode = $langs->trans("Action".$histo[$key]['acode']); - $libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing'); + $label = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing'); + $label .= ' - '.$histo[$key]['note']; $out .= ''; - $out .= img_object($langs->trans("ShowEMailing"), "email").' '; - $out .= dol_trunc($libelle, 120); + $out .= ' title="'.dol_escape_htmltag($label).'">'; + //$out .= img_object($langs->trans("EMailing").'
'.$histo[$key]['note'], "email").' '; + $out .= dol_trunc($label, 120); $out .= '
'; } $out .= ''; @@ -2606,7 +2632,7 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) if (isModEnabled('mailing') && !empty($objcon->email) && (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) { $sql2 = "SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type"; $sql2 .= ", null as fk_element, '' as elementtype, null as contact_id"; - $sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto"; + $sql2 .= ", 'AC_EMAILING' as code, 'AC_EMAILING' as acode, '' as alabel, '' as apicto"; $sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action if (is_object($filterobj) && get_class($filterobj) == 'Societe') { $sql2 .= ", '' as lastname, '' as firstname"; From cb18ba20d4351ac277a74e1e8c18ea4f6cebe706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lina=20JOUM?= Date: Tue, 21 Jan 2025 15:33:09 +0100 Subject: [PATCH 04/15] ADD: packaging column for product --- htdocs/install/mysql/migration/21.0.0-22.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_product.sql | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql index a629c3c313e..0a4b4487eaa 100644 --- a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql +++ b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql @@ -48,3 +48,5 @@ ALTER TABLE llx_holiday_config ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTE ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (entity, name); ALTER TABLE llx_societe_account ADD COLUMN ip varchar(250); + +ALTER TABLE llx_product ADD COLUMN packaging integer DEFAULT NULL; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index f75a4f4ef3f..74e13e24694 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -110,5 +110,6 @@ create table llx_product price_autogen tinyint DEFAULT 0, fk_project integer DEFAULT NULL, -- Used when product was generated by a project or is specific to a project mandatory_period tinyint DEFAULT 0, -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action) - last_main_doc varchar(255) + last_main_doc varchar(255), + packaging integer DEFAULT NULL )ENGINE=innodb; From 8f7881a8714d992e5cc404655ecf4ad609edb82d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Jan 2025 17:51:01 +0100 Subject: [PATCH 05/15] Debug v21 --- htdocs/langs/en_US/stripe.lang | 1 + htdocs/public/stripe/ipn.php | 79 +++++++++++++++++++--------------- htdocs/stripe/admin/stripe.php | 24 ++++++++--- 3 files changed, 64 insertions(+), 40 deletions(-) diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index 2e244858d28..3d1e3925309 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -12,6 +12,7 @@ YourEMail=Email to receive payment confirmation STRIPE_PAYONLINE_SENDEMAIL=Email notification after a payment attempt (success or fail) Creditor=Creditor PaymentCode=Payment code +StripeAutoRecordPayout=Enable the auto recording of payout (when Stripe do a payout and call the webhook payout.create/payout.paid) StripeDoPayment=Pay with Stripe YouWillBeRedirectedOnStripe=You will be redirected on secured Stripe page to input you credit card information Continue=Next diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 0a2c982258d..e04053634d7 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -178,14 +178,14 @@ top_httphead(); dol_syslog("***** Stripe IPN was called with event->type=".$event->type." service=".$service); -if ($event->type == 'payout.created') { - // When a payout is create by Stripe to transfer money to your account +if ($event->type == 'payout.created' && getDolGlobalString('STRIPE_AUTO_RECORD_PAYOUT')) { + // When a payout is created by Stripe to transfer money to your account $error = 0; $result = dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s', $event->data->object->arrival_date), 'chaine', 0, '', $conf->entity); if ($result > 0) { - $subject = $societeName.' - [NOTIFICATION] Stripe payout scheduled'; + $subject = '['.$societeName.'] Notification - Stripe payout scheduled'; if (!empty($user->email)) { $sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">"; } else { @@ -221,7 +221,7 @@ if ($event->type == 'payout.created') { http_response_code(500); return -1; } -} elseif ($event->type == 'payout.paid') { +} elseif ($event->type == 'payout.paid' && getDolGlobalString('STRIPE_AUTO_RECORD_PAYOUT')) { // When a payout to transfer money to your account is completely done $error = 0; $result = dolibarr_set_const($db, $service."_NEXTPAYOUT", 0, 'chaine', 0, '', $conf->entity); @@ -249,6 +249,8 @@ if ($event->type == 'payout.created') { $typefrom = 'PRE'; $typeto = 'VIR'; + $db->begin(); + if (!$error) { $bank_line_id_from = $accountfrom->addline($dateo, $typefrom, $label, -1 * (float) price2num($amount), '', '', $user); } @@ -274,38 +276,47 @@ if ($event->type == 'payout.created') { if (!($result > 0)) { $error++; } + + if (!$error) { + $db->commit(); + } else { + $db->rollback(); + } + + // Send email + if (!$error) { + $subject = '['.$societeName.'] - NotificationOTIFICATION] Stripe payout done'; + if (!empty($user->email)) { + $sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">"; + } else { + $sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; + } + $replyto = $sendto; + $sendtocc = ''; + if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) { + $sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>'; + } + + $message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." has been done to your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour'); + + $mailfile = new CMailFile( + $subject, + $sendto, + $replyto, + $message, + array(), + array(), + array(), + $sendtocc, + '', + 0, + -1 + ); + + $ret = $mailfile->sendfile(); + } } - $subject = $societeName.' - [NOTIFICATION] Stripe payout done'; - if (!empty($user->email)) { - $sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">"; - } else { - $sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; - } - $replyto = $sendto; - $sendtocc = ''; - if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) { - $sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>'; - } - - $message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." has been done to your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour'); - - $mailfile = new CMailFile( - $subject, - $sendto, - $replyto, - $message, - array(), - array(), - array(), - $sendtocc, - '', - 0, - -1 - ); - - $ret = $mailfile->sendfile(); - return 1; } else { $error++; diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index a017742d722..eb08aac811d 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -379,18 +379,30 @@ print ''.$langs->trans("Example").': '.$mysoc->name.''; print ''; -print ''; -print $langs->trans("StripeUserAccountForActions").''; -print img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers(getDolGlobalString('STRIPE_USER_ACCOUNT_FOR_ACTIONS'), 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0); -print ''; - print ''; print $langs->trans("BankAccount").''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes(getDolGlobalString('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'), 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); print ''; -if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // What is this for ? + +// Param to record automatically payouts (received from IPN payout.payed and payout.created) +print ''; +print $langs->trans("StripeAutoRecordPayout").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_AUTO_RECORD_PAYOUT', array(), null, 0, 0, 1); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_AUTO_RECORD_PAYOUT", $arrval, getDolGlobalInt('STRIPE_AUTO_RECORD_PAYOUT')); +} +print ''; + +if (getDolGlobalInt('STRIPE_AUTO_RECORD_PAYOUT')) { + print ''; + print $langs->trans("StripeUserAccountForActions").''; + print img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers(getDolGlobalString('STRIPE_USER_ACCOUNT_FOR_ACTIONS'), 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0); + print ''; + print ''; print $langs->trans("BankAccountForBankTransfer").''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); From 0c9fd6714b8d71eefa42c546cbcc4a373467daea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Jan 2025 08:50:53 +0100 Subject: [PATCH 06/15] remove debug --- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6eb05106686..bb38c246127 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2024 MDW * Copyright (C) 2024 William Mead * @@ -1883,7 +1883,7 @@ class ActionComm extends CommonObject $color = 'style="color: #'.$this->type_color.' !important;"'; } if ($this->type_picto) { - $imgpicto = img_picto($titlealt.'rr', $this->type_picto, '', 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); + $imgpicto = img_picto($titlealt, $this->type_picto, '', 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); } else { if ($this->type_code == 'AC_RDV') { $imgpicto = img_picto($titlealt, 'meeting', $color, 0, 0, 0, '', ($morecss ? ' '.$morecss : '')); From 928a59a1b362660d9f3deeb47e1f3855bc385cbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Jan 2025 08:53:33 +0100 Subject: [PATCH 07/15] check translations --- dev/tools/codespell/codespell-dict.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tools/codespell/codespell-dict.txt b/dev/tools/codespell/codespell-dict.txt index f26d7250488..05904974269 100644 --- a/dev/tools/codespell/codespell-dict.txt +++ b/dev/tools/codespell/codespell-dict.txt @@ -36,6 +36,7 @@ nowraponalls->nowraponall oddevene->oddeven oddseven->oddeven opacitymediuem->opacitymedium +opend->opened pictofiwedwidth->pictofixedwidth pictofixedwith->pictofixedwidth shippin->shipping From ab33cdff50f0424bd46d577311207393e4907290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Jan 2025 09:00:07 +0100 Subject: [PATCH 08/15] fix doc --- htdocs/stripe/admin/stripe.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index eb08aac811d..77999453856 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -3,8 +3,8 @@ * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2017 Saasprov * Copyright (C) 2018-2022 Thibault FOUCART - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -386,7 +386,9 @@ $form->select_comptes(getDolGlobalString('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'), 'S print ''; -// Param to record automatically payouts (received from IPN payout.payed and payout.created) +// Param to record automatically payouts (received from IPN payout.paid and payout.created) +// https://docs.stripe.com/api/events/types#event_types-payout.created +// https://docs.stripe.com/api/events/types#event_types-payout.paid print ''; print $langs->trans("StripeAutoRecordPayout").''; if ($conf->use_javascript_ajax) { From 618f733d25c7eaca59b2694744fa4edc93fd09b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Jan 2025 09:03:45 +0100 Subject: [PATCH 09/15] fix doc --- htdocs/compta/facture/list.php | 10 +++++----- htdocs/compta/paiement_charge.php | 4 ++-- htdocs/compta/paiement_vat.php | 4 ++-- htdocs/loan/payment/payment.php | 4 ++-- htdocs/projet/tasks.php | 4 ++-- htdocs/salaries/paiement_salary.php | 4 ++-- htdocs/societe/list.php | 8 ++++---- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 238121bb533..1c3856d360e 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -18,7 +18,7 @@ * Copyright (C) 2023 Nick Fragoulis * Copyright (C) 2023 Joachim Kueter * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Solution Libre SAS * Copyright (C) 2024 William Mead * @@ -1271,7 +1271,7 @@ if (in_array($massaction, array('presend', 'predelete', 'makepayment'))) { } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); -// Show the new button only when this page is not opend from the Extended POS +// Show the new button only when this page is not opened from the Extended POS $newcardbutton = ''; if ($contextpage != 'poslist') { $url = DOL_URL_ROOT.'/compta/facture/card.php?action=create'; @@ -1389,7 +1389,7 @@ if (!empty($moreforfilter)) { $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields -// Show the massaction checkboxes only when this page is not opend from the Extended POS +// Show the massaction checkboxes only when this page is not opened from the Extended POS if ($massactionbutton && $contextpage != 'poslist') { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } @@ -2791,7 +2791,7 @@ if ($num > 0) { } } - // Action column (Show the massaction button only when this page is not opend from the Extended POS) + // Action column (Show the massaction button only when this page is not opened from the Extended POS) if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; @@ -2844,7 +2844,7 @@ print ''."\n"; print ''."\n"; -// Show the file area only when this page is not opend from the Extended POS +// Show the file area only when this page is not opened from the Extended POS if ($contextpage != 'poslist') { $hidegeneratedfilelistifempty = 1; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index aa477454751..03474f1c454 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016-2024 Frédéric France + * Copyright (C) 2016-2025 Frédéric France * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 MDW * @@ -229,7 +229,7 @@ if ($action == 'create') { print ''.$langs->trans('AccountToDebit').''; print ''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(GETPOSTISSET("accountid") ? GETPOSTINT("accountid") : $charge->accountid, "accountid", 0, '', 2, '', 0, 'maxwidth500 widthcentpercentminusx', 1); // Show opend bank account list + print $form->select_comptes(GETPOSTISSET("accountid") ? GETPOSTINT("accountid") : $charge->accountid, "accountid", 0, '', 2, '', 0, 'maxwidth500 widthcentpercentminusx', 1); // Show opened bank account list print ''; // Number diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php index 3012d287a28..dd4744dca2c 100644 --- a/htdocs/compta/paiement_vat.php +++ b/htdocs/compta/paiement_vat.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016-2024 Frédéric France + * Copyright (C) 2016-2025 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 MDW * @@ -229,7 +229,7 @@ if ($action == 'create') { print ''.$langs->trans('AccountToDebit').''; print ''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes(GETPOSTINT("accountid") ? GETPOSTINT("accountid") : $tva->accountid, "accountid", 0, '', 1, '', 0, 'maxwidth500 widthcentpercentminusx'); // Show opend bank account list + $form->select_comptes(GETPOSTINT("accountid") ? GETPOSTINT("accountid") : $tva->accountid, "accountid", 0, '', 1, '', 0, 'maxwidth500 widthcentpercentminusx'); // Show opened bank account list print ''; // Number diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 435e95efa60..6b84b73aeab 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2024 Frédéric France + * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2020 Maxime DEMAREST * * This program is free software; you can redistribute it and/or modify @@ -317,7 +317,7 @@ if ($action == 'create') { print ''.$langs->trans('AccountToDebit').''; print ''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes(GETPOSTISSET("accountid") ? GETPOSTINT("accountid") : $loan->accountid, "accountid", 0, 'courant = '.Account::TYPE_CURRENT, 1); // Show opend bank account list + $form->select_comptes(GETPOSTISSET("accountid") ? GETPOSTINT("accountid") : $loan->accountid, "accountid", 0, 'courant = '.Account::TYPE_CURRENT, 1); // Show opened bank account list print ''; // Number diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 2dde9cf51ed..213fc0922ce 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * 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 @@ -955,7 +955,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- print ''; } - // Show the massaction checkboxes only when this page is not opend from the Extended POS + // Show the massaction checkboxes only when this page is not opened from the Extended POS if ($massactionbutton && $contextpage != 'poslist') { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php index f084e5e1a07..fe14dc68319 100644 --- a/htdocs/salaries/paiement_salary.php +++ b/htdocs/salaries/paiement_salary.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016-2024 Frédéric France + * Copyright (C) 2016-2025 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 MDW * @@ -237,7 +237,7 @@ if ($action == 'create') { print ''.$langs->trans('AccountToDebit').''; print ''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes(GETPOSTISSET("accountid") ? GETPOSTINT("accountid") : $salary->accountid, "accountid", 0, '', 1); // Show opend bank account list + $form->select_comptes(GETPOSTISSET("accountid") ? GETPOSTINT("accountid") : $salary->accountid, "accountid", 0, '', 1); // Show opened bank account list print ''; // Number diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index cce3e430b6c..bd82817b05e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -11,7 +11,7 @@ * Copyright (C) 2017 Juanjo Menent * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2020 Open-Dsi - * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2021-2025 Frédéric France * Copyright (C) 2022 Anthony Berton * Copyright (C) 2023 William Mead * Copyright (C) 2024 MDW @@ -1189,7 +1189,7 @@ if ($contextpage == 'poslist' && $type == 't' && (getDolGlobalString('PRODUIT_MU print get_htmloutput_mesg(img_warning('default').' '.$langs->trans("BecarefullChangeThirdpartyBeforeAddProductToInvoice"), [], 'warning', 1); } -// Show the new button only when this page is not opend from the Extended POS (pop-up window) +// Show the new button only when this page is not opened from the Extended POS (pop-up window) // but allow it too, when a user has the rights to create a new customer if ($contextpage != 'poslist') { $url = DOL_URL_ROOT.'/societe/card.php?action=create'.$typefilter; @@ -1890,7 +1890,7 @@ while ($i < $imaxinloop) { } print '>'; - // Action column (Show the massaction button only when this page is not opend from the Extended POS) + // Action column (Show the massaction button only when this page is not opened from the Extended POS) if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined @@ -2303,7 +2303,7 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } - // Action column (Show the massaction button only when this page is not opend from the Extended POS) + // Action column (Show the massaction button only when this page is not opened from the Extended POS) if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined From 0ca29219504c5192fd6eb530551bdb8629a85461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Jan 2025 09:14:43 +0100 Subject: [PATCH 10/15] fix doc --- htdocs/core/boxes/box_funnel_of_prospection.php | 4 ++-- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/graph_opportunities.inc.php | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/boxes/box_funnel_of_prospection.php b/htdocs/core/boxes/box_funnel_of_prospection.php index d6cff6b37c4..6f58aa82ace 100644 --- a/htdocs/core/boxes/box_funnel_of_prospection.php +++ b/htdocs/core/boxes/box_funnel_of_prospection.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Marcos García - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-2025 Frédéric France * Copyright (C) 2016 Juan José Menent * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2024 MDW @@ -143,7 +143,7 @@ class box_funnel_of_prospection extends ModeleBoxes $sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls"; $sql .= " WHERE p.entity IN (".getEntity('project').")"; $sql .= " AND p.fk_opp_status = cls.rowid"; - $sql .= " AND p.fk_statut = 1"; // Opend projects only + $sql .= " AND p.fk_statut = 1"; // Opened projects only $sql .= " AND cls.code NOT IN ('LOST', 'WON')"; $sql .= " GROUP BY p.fk_opp_status, cls.code"; $resql = $this->db->query($sql); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a76687104cb..d1cb8efc86c 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1253,6 +1253,7 @@ CommercialAffected=Sales representative assigned CommercialsDisaffected=Sales representatives unlinked CommercialDisaffected=Sales representative unlinked Message=Message +Emailing=Emailing Progression=Progress YourMessage=Your message YourMessageHasBeenReceived=Your message has been received. We will answer or contact you as soon as possible. diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 9d976d9aba7..78d3ead854d 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2013-2020 Laurent Destailleur + * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 Frédéric France * * 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 @@ -34,7 +34,7 @@ if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON p.fk_opp_status = cls.rowid"; // If lead status has been removed, we must show it in stats as unknown $sql .= " WHERE p.entity IN (".getEntity('project').")"; - $sql .= " AND p.fk_statut = 1"; // Opend projects only + $sql .= " AND p.fk_statut = 1"; // Opened projects only if ($mine || !$user->hasRight('projet', 'all', 'lire')) { $sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; } From 6c0a94bfed62666e2d072ad72b585d27f3515d99 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Jan 2025 09:27:14 +0100 Subject: [PATCH 11/15] QUAL invoice payment, the requested invoice sort first --- htdocs/compta/paiement.php | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 07f5dd234e9..902af2d6e2a 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -570,28 +570,33 @@ if ($result >= 0) { * List of unpaid invoices */ - $sql = 'SELECT f.rowid as facid, f.ref, f.total_ht, f.total_tva, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc, f.type,'; - $sql .= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture as f'; - $sql .= ' WHERE f.entity IN ('.getEntity('facture').')'; - $sql .= ' AND (f.fk_soc = '.((int) $facture->socid); + $sql = "SELECT f.rowid as facid, f.ref, f.total_ht, f.total_tva, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc, f.type,"; + $sql .= " f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; + $sql .= " WHERE f.entity IN (".getEntity('facture').")"; + $sql .= " AND (f.fk_soc = ".((int) $facture->socid); // Can pay invoices of all child of parent company if (getDolGlobalString('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') && !empty($facture->thirdparty->parent)) { - $sql .= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.((int) $facture->thirdparty->parent).')'; + $sql .= " OR f.fk_soc IN (SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE parent = ".((int) $facture->thirdparty->parent).")"; } // Can pay invoices of all child of myself if (getDolGlobalString('FACTURE_PAYMENTS_ON_SUBSIDIARY_COMPANIES')) { - $sql .= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.((int) $facture->thirdparty->id).')'; + $sql .= " OR f.fk_soc IN (SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE parent = ".((int) $facture->thirdparty->id).")"; } - $sql .= ') AND f.paye = 0'; - $sql .= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled + $sql .= ") AND f.paye = 0"; + $sql .= " AND f.fk_statut = 1"; // Statut=0 => not validated, Statut=2 => canceled if ($facture->type != Facture::TYPE_CREDIT_NOTE) { - $sql .= ' AND type IN (0,1,3,5)'; // Standard invoice, replacement, deposit, situation + $sql .= " AND type IN (0,1,3,5)"; // Standard invoice, replacement, deposit, situation } else { - $sql .= ' AND type = 2'; // If paying back a credit note, we show all credit notes + $sql .= " AND type = 2"; // If paying back a credit note, we show all credit notes + } + if (!getDolGlobalInt('FACTURE_PAYMENTS_INVOICE_REQUESTED_SORT_FIRST')) { + // Sort invoices by date and serial number: the older one comes first + $sql .= " ORDER BY f.datef ASC, f.ref ASC"; + } else { + // The requested invoice sort first + $sql .= " ORDER BY f.rowid = ".((int) $facid)." DESC, f.datef ASC, f.ref ASC"; } - // Sort invoices by date and serial number: the older one comes first - $sql .= ' ORDER BY f.datef ASC, f.ref ASC'; $resql = $db->query($sql); if ($resql) { From 01a34b62d113afbb36f11fbef2fc710c4ed78b21 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Jan 2025 21:43:53 +0100 Subject: [PATCH 12/15] FIX avoid php warnings --- htdocs/loan/payment/payment.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 435e95efa60..a1921bdff08 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -62,7 +62,12 @@ if (!$user->hasRight('loan', 'write')) { $loan = new Loan($db); $loan->fetch($chid); +$line_id = 0; $echance = 0; +$amount_capital = 0; +$amount_insurance = 0; +$amount_interest = 0; + $ls = new LoanSchedule($db); // grab all loanschedule $res = $ls->fetchAll($chid); From 8be6642289a56af78f71a81cffeb579a47281b15 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Jan 2025 21:57:49 +0100 Subject: [PATCH 13/15] TODO big problem here !!!!!!! --- htdocs/loan/payment/payment.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index a1921bdff08..2a08bdd0633 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -62,7 +62,7 @@ if (!$user->hasRight('loan', 'write')) { $loan = new Loan($db); $loan->fetch($chid); -$line_id = 0; +//$line_id = 0; // TODO $line_id is never defined !! $echance = 0; $amount_capital = 0; $amount_insurance = 0; @@ -75,8 +75,8 @@ if ($res > 0) { foreach ($ls->lines as $l) { $echance++; // Count term pos // last unpaid term - if (empty($l->fk_bank)) { - $line_id = $l->id; + if (empty($l->fk_bank)) { // TODO fk_bank is never empty ! + $line_id = $l->id; // TODO $line_id is never defined (fk_bank is never empty) break; } elseif ($line_id == $l->id) { // If line_id provided, only count temp pos @@ -86,7 +86,7 @@ if ($res > 0) { } // Set current line with last unpaid line (only if schedule is used) -if (!empty($line_id)) { +if (!empty($line_id)) { // TODO $line_id is never defined and already empty ! $line = new LoanSchedule($db); $res = $line->fetch($line_id); if ($res > 0) { From 1589d5f9fc437bf3f6171858fddf87ed4db666b2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Jan 2025 22:26:05 +0100 Subject: [PATCH 14/15] FIX add TODO --- htdocs/loan/card.php | 1 + htdocs/loan/payment/payment.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 4e072122887..db15cac8665 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -778,6 +778,7 @@ if ($id > 0) { } // Emit payment + // TODO check if loan schedule is created ($echeances->lines > 0) if (($object->paid == 0 || $object->paid == 2) && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->hasRight('loan', 'write')) { print ''; } diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 2a08bdd0633..a1921bdff08 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -62,7 +62,7 @@ if (!$user->hasRight('loan', 'write')) { $loan = new Loan($db); $loan->fetch($chid); -//$line_id = 0; // TODO $line_id is never defined !! +$line_id = 0; $echance = 0; $amount_capital = 0; $amount_insurance = 0; @@ -75,8 +75,8 @@ if ($res > 0) { foreach ($ls->lines as $l) { $echance++; // Count term pos // last unpaid term - if (empty($l->fk_bank)) { // TODO fk_bank is never empty ! - $line_id = $l->id; // TODO $line_id is never defined (fk_bank is never empty) + if (empty($l->fk_bank)) { + $line_id = $l->id; break; } elseif ($line_id == $l->id) { // If line_id provided, only count temp pos @@ -86,7 +86,7 @@ if ($res > 0) { } // Set current line with last unpaid line (only if schedule is used) -if (!empty($line_id)) { // TODO $line_id is never defined and already empty ! +if (!empty($line_id)) { $line = new LoanSchedule($db); $res = $line->fetch($line_id); if ($res > 0) { From 86096280eaf2b006cb003b5b77c6e561424940b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Jan 2025 00:35:28 +0100 Subject: [PATCH 15/15] Fix doc --- htdocs/stripe/admin/stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index eb08aac811d..b993a699cb8 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -386,7 +386,7 @@ $form->select_comptes(getDolGlobalString('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'), 'S print ''; -// Param to record automatically payouts (received from IPN payout.payed and payout.created) +// Param to record automatically payouts (received from IPN payout.paid and payout.created) print ''; print $langs->trans("StripeAutoRecordPayout").''; if ($conf->use_javascript_ajax) {