From 9bd5477fc132446c5d85695833da5186a41dd306 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jun 2024 12:57:53 +0200 Subject: [PATCH 01/14] Debug v20 --- htdocs/core/tpl/objectline_edit.tpl.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 032fdc77b8b..fa58c7124e8 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -387,6 +387,7 @@ $coldisplay++; if ($prefillDates) { echo ' '.$langs->trans('FillWithLastServiceDates').''; } + print '\n"; } - if (!empty($conf->use_javascript_ajax) || $onlyselect) { - //var_dump($selected); - if ($selected == 'done') { - $selected = '100'; - } - print ''; - if ($selected == 0 || $selected == 100) { - $canedit = 0; - } - - print ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve', '-1', $morecss); - - if (empty($onlyselect)) { - print ' = 0) ? '' : ' disabled').'>'; - print '%'; - } - } else { - print ' %'; - } } From a8a48c3315bfd7d7bc7bb8f918ce5144defc69f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jun 2024 16:20:01 +0200 Subject: [PATCH 05/14] Debug v20 - fix css --- htdocs/comm/action/index.php | 16 ++++++++-------- htdocs/comm/action/list.php | 32 +++++++++++++++++++------------- htdocs/comm/action/pertype.php | 20 ++++++++++++-------- htdocs/comm/action/peruser.php | 31 ++++++++++++++++++------------- 4 files changed, 57 insertions(+), 42 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 8ae53fcc203..af345ae89f5 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -495,35 +495,35 @@ print ''; $viewmode = ''; $viewmode .= ''; // To add a space before the navigation tools -$newcardbutton = ''; $newparam = ''; +$newcardbutton = ''; if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { $tmpforcreatebutton = dol_getdate(dol_now(), true); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index e0ffc594557..420ff107c5f 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -676,41 +676,42 @@ if (empty($reshook)) { } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } + $viewyear = is_object($object) ? dol_print_date($object->datep, '%Y') : ''; $viewmonth = is_object($object) ? dol_print_date($object->datep, '%m') : ''; $viewday = is_object($object) ? dol_print_date($object->datep, '%d') : ''; -$viewmode = ''; -$viewmode .= ''; + +$viewmode = ''; + +$viewmode .= ''; + + $tmpforcreatebutton = dol_getdate(dol_now(), true); $newparam = '&month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 990c9af705f..849f71c18fa 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -430,38 +430,37 @@ if ($conf->use_javascript_ajax) { $massactionbutton = ''; -$viewmode = ''; +$viewmode = ''; + +$viewmode .= ''; + + $newparam = ''; $newcardbutton = ''; if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 86ccb548efa..30f0d61d41a 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -431,40 +431,41 @@ if ($conf->use_javascript_ajax) { } } +$mode = 'show_peruser'; $massactionbutton = ''; -$viewmode = ''; -$viewmode .= ''; + +$viewmode = ''; + +$viewmode .= ''; + $newparam = ''; $newcardbutton = ''; From 6b9141a6c04dddb39b416ef70a660cb14392fb72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jun 2024 16:31:44 +0200 Subject: [PATCH 06/14] css --- htdocs/admin/ihm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index d8f102ba2bc..fc160d8abf6 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -706,10 +706,10 @@ if ($mode == 'login') { print '' . img_delete($langs->trans("Delete")) . ''; if (file_exists($conf->mycompany->dir_output . '/logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND'))) { print '   '; - print ''; + print ''; } } else { - print ''; + print ''; } print ''; print ''; From 702cca150240819e4b674f60427364419b794c94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 24 Jun 2024 22:15:56 +0200 Subject: [PATCH 07/14] fix $action is unknown (#30148) https://github.com/Dolibarr/dolibarr/commit/dafbefdc74bc31afe38529653a737a3a6cab74a0 --- htdocs/core/class/commonobject.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 82f57001e44..e99a7bbac32 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7203,7 +7203,8 @@ abstract class CommonObject } if (!$error) { - $parameters = array('key'=>$key); + $parameters = array('key' => $key); + global $action; $reshook = $hookmanager->executeHooks('updateExtraFieldBeforeCommit', $parameters, $this, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); From c08710126288a9f03ecd4518771fbf2ca04b14d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 24 Jun 2024 22:16:47 +0200 Subject: [PATCH 08/14] fix phan (#30147) * fix phan * fix phan * fix phan * fix phan * fix phan * fix phan * fix phan --- htdocs/bom/class/bom.class.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 2f8d6344f26..a61844d0899 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1524,8 +1524,8 @@ class BOM extends CommonObject /** * Get Net needs by product * - * @param array $TNetNeeds Array of ChildBom and infos linked to - * @param float $qty qty needed (used as a factor to produce 1 unit) + * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param float $qty qty needed (used as a factor to produce 1 unit) * @return void */ public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) @@ -1538,7 +1538,7 @@ class BOM extends CommonObject } } else { if (empty($TNetNeeds[$line->fk_product]['qty'])) { - $TNetNeeds[$line->fk_product]['qty'] = 0; + $TNetNeeds[$line->fk_product]['qty'] = 0.0; } // When using nested level (or not), the qty for needs must always use the same unit to be able to be cumulated. // So if unit in bom is not the same than default, we must recalculate qty after units comparisons. @@ -1552,7 +1552,7 @@ class BOM extends CommonObject /** * Get/add Net needs Tree by product or bom * - * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param array $TNetNeeds Array of ChildBom and infos linked to * @param float $qty qty needed (used as a factor to produce 1 unit) * @param int $level level of recursivity * @return void @@ -1575,7 +1575,16 @@ class BOM extends CommonObject } else { // When using nested level (or not), the qty for needs must always use the same unit to be able to be cumulated. // So if unit in bom is not the same than default, we must recalculate qty after units comparisons. + if (!isset($TNetNeeds[$this->id]['product'])) { + $TNetNeeds[$this->id]['product'] = array(); + } + if (!isset($TNetNeeds[$this->id]['product'][$line->fk_product])) { + $TNetNeeds[$this->id]['product'][$line->fk_product] = array(); + } $TNetNeeds[$this->id]['product'][$line->fk_product]['fk_unit'] = $line->fk_unit; + if (empty($TNetNeeds[$this->id]['product'][$line->fk_product]['qty'])) { + $TNetNeeds[$this->id]['product'][$line->fk_product]['qty'] = 0.0; + } $TNetNeeds[$this->id]['product'][$line->fk_product]['qty'] += $line->qty * $qty; $TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level; } From 05f6862b83edfaf993fb477a922cf9b39deb9f66 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 24 Jun 2024 22:39:02 +0200 Subject: [PATCH 09/14] Fix MO error handling (#30140) * Fix return error iso dol_print_error incase of createProduction error * Block delete button iso return contraint error. * Fix phan on getNetNeedsTree * fix phan * try to fix phan * try fix phan * Array seems too dynamic for phan. * try fix phan * try fix phan * Can't fix phan @eldy --------- Co-authored-by: Laurent Destailleur --- htdocs/langs/en_US/errors.lang | 1 + htdocs/mrp/class/mo.class.php | 7 +++---- htdocs/product/class/product.class.php | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 2f4842e0ae7..047914c7d11 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -338,6 +338,7 @@ ErrorIncoherentDates=Date start must be less than date end ErrorEndHourIsNull=End date cannot be zero ErrorStartHourIsNull=Start date cannot be zero ErrorTooManyLinesToProcessPleaseUseAMoreSelectiveFilter=Too many lines to process. Please use a more selective filter. +ErrorEmptyValueForQty=Quantity cannot be zero. # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 6cef9a66358..565339953d2 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -334,11 +334,11 @@ class Mo extends CommonObject if (!$error) { $this->db->commit(); + return $idcreated; } else { $this->db->rollback(); + return -1; } - - return $idcreated; } /** @@ -744,7 +744,6 @@ class Mo extends CommonObject $error++; $this->error = $moline->error; $this->errors = $moline->errors; - dol_print_error($this->db, $moline->error, $moline->errors); } if ($this->fk_bom > 0) { // If a BOM is defined, we know what to consume. @@ -2164,7 +2163,7 @@ class MoLine extends CommonObjectLine public function create(User $user, $notrigger = 0) { if (empty($this->qty)) { - $this->error = 'BadValueForQty'; + $this->error = 'ErrorEmptyValueForQty'; return -1; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e16ce3f550a..a492d384432 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -86,7 +86,8 @@ class Product extends CommonObject 'facturedet' => array('name' => 'Invoice', 'parent' => 'facture', 'parentkey' => 'fk_facture'), 'contratdet' => array('name' => 'Contract', 'parent' => 'contrat', 'parentkey' => 'fk_contrat'), 'facture_fourn_det' => array('name' => 'SupplierInvoice', 'parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'), - 'commande_fournisseurdet' => array('name' => 'SupplierOrder', 'parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande') + 'commande_fournisseurdet' => array('name' => 'SupplierOrder', 'parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande'), + 'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo') ); /** From 53ffdec9bda5ead7e3e64f5d0da30643b56093ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jun 2024 01:50:31 +0200 Subject: [PATCH 10/14] Fix field type url --- htdocs/webhook/class/target.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index bf85177ad4f..cb860fab1a6 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -97,7 +97,7 @@ class Target extends CommonObject 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 4, 'noteditable' => 1, 'index' => 1, 'searchall' => 1, 'validate' => 1, 'comment' => "Reference of object"), 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'csslist'=>'tdoverflowmax150', 'showoncombobox' => 2, 'validate' => 1,), 'trigger_codes' => array('type' => 'text', 'label' => 'TriggerCodes', 'enabled' => 1, 'position' => 50, 'notnull' => 1, 'visible' => 1, 'help' => "TriggerCodeInfo", 'tdcss'=>'titlefieldmiddle', 'csslist'=>'tdoverflowmax200', 'css' => 'minwidth400', 'arrayofkeyval' => array('defined_in_constructor' => 'defined_from_c_action_trigger'), 'multiinput' => 1,), - 'url' => array('type' => 'varchar(255)', 'label' => 'Url', 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'visible' => 1,), + 'url' => array('type' => 'url', 'label' => 'Url', 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'visible' => 1,), 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => 1,), 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), From 60701b72e2c5e878367956447be798c913acefd2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jun 2024 01:52:19 +0200 Subject: [PATCH 11/14] Fix position of fields --- htdocs/webhook/target_card.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 8d3f4c47d4a..3fa52337e8e 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -490,16 +490,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); - // Disable - if ($object->status == $object::STATUS_VALIDATED) { - print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); - } - - // Enable - if ($object->status == $object::STATUS_DRAFT) { - print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); - } - // Clone print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken(), '', $permissiontoadd); @@ -522,6 +512,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } */ + // Enable + if ($object->status == $object::STATUS_DRAFT) { + print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); + } + + // Disable + if ($object->status == $object::STATUS_VALIDATED) { + print dolGetButtonAction('', $langs->trans('Disable'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); + } + // Delete (need delete permission, or if draft, just need create/modify permission) print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete); } From 4d8d14a0dcb9693454d6bf5f08e532b3634297b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jun 2024 01:54:23 +0200 Subject: [PATCH 12/14] Look and feel v20 --- htdocs/admin/webhook.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index 749e95ae006..632a0963a64 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -158,8 +158,10 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); $head = webhookAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "webhook"); +print '
'; + // Setup page goes here -echo ''.$langs->trans("WebhookSetupPage", $langs->transnoentitiesnoconv("Targets")).'

'; +print ''.$langs->trans("WebhookSetupPage", $langs->transnoentitiesnoconv("Targets")).'...

'; if ($action == 'edit') { From 7f52f47dfd9ac55aab7dd2d2958bf7b617ab74d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jun 2024 10:30:34 +0200 Subject: [PATCH 13/14] Fix link for warning --- htdocs/accountancy/index.php | 5 +++-- htdocs/core/lib/functions.lib.php | 6 +++++- htdocs/langs/en_US/admin.lang | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 4158dd7dcf1..1f10c8fedc5 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -123,8 +123,9 @@ if (isModEnabled('accounting')) { print load_fiche_titre($langs->trans("AccountancyArea"), empty($resultboxes['selectboxlist']) ? '' : $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { - print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")); - print info_admin($langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode")); + $messagewarning = $langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"); + $messagewarning .= ' '.$langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org'); + print info_admin($messagewarning); print "
"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c6789e07a0a..5ed7df94c92 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1970,7 +1970,9 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapeta // For case of tag with attribute $reg = array(); if (preg_match('/<'.preg_quote($tagtoreplace, '/').'\s+([^>]+)>/', $tmp, $reg)) { - $tmpattributes = str_ireplace(array('[', ']'), '_', $reg[1]); // We must not have [ ] inside the attribute string + $tmpattributes = str_ireplace(array('[', ']'), '_', $reg[1]); // We must never have [ ] inside the attribute string + $tmpattributes = str_ireplace('href="http:', '__HREFHTTPA', $tmpattributes); + $tmpattributes = str_ireplace('href="https:', '__HREFHTTPSA', $tmpattributes); $tmpattributes = str_ireplace('src="http:', '__SRCHTTPIMG', $tmpattributes); $tmpattributes = str_ireplace('src="https:', '__SRCHTTPSIMG', $tmpattributes); $tmpattributes = str_ireplace('"', '__DOUBLEQUOTE', $tmpattributes); @@ -1997,6 +1999,8 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapeta $result = preg_replace('/__BEGINENDTAGTOREPLACE'.$tagtoreplace.'\[(.*)\]__/', '<'.$tagtoreplace.' \1 />', $result); } + $result = str_ireplace('__HREFHTTPA', 'href="http:', $result); + $result = str_ireplace('__HREFHTTPSA', 'href="https:', $result); $result = str_ireplace('__SRCHTTPIMG', 'src="http:', $result); $result = str_ireplace('__SRCHTTPSIMG', 'src="https:', $result); $result = str_ireplace('__DOUBLEQUOTE', '"', $result); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8c57c11b9a2..98c658e6a78 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2104,7 +2104,7 @@ BaseCurrency=Reference currency of the company (go into setup of company to chan WarningNoteModuleInvoiceForFrenchLaw=This module %s is compliant with French laws (Loi Finance 2016). WarningNoteModulePOSForFrenchLaw=This module %s is compliant with French laws (Loi Finance 2016) because module Non Reversible Logs is automatically activated. WarningInstallationMayBecomeNotCompliantWithLaw=You are trying to install module %s that is an external module. Activating an external module means you trust the publisher of that module and that you are sure that this module does not adversely impact the behavior of your application, and is compliant with laws of your country (%s). If the module introduces an illegal feature, you become responsible for the use of illegal software. -WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode=If you're using the experimental mode for status invoices, you'll need to update your data to switch to the official mode. Contact a preferred partner who will help you with this task. List of preferred partners available by following this link +WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode=If you're using the experimental mode for status invoices, you'll need to update your data to switch to the official mode. Contact a preferred partner who will help you with this task. List of preferred partners available by following this link MAIN_PDF_MARGIN_LEFT=Left margin on PDF MAIN_PDF_MARGIN_RIGHT=Right margin on PDF From af75f6994be982e62c674dfefe8d01e6ffd485db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jun 2024 11:09:13 +0200 Subject: [PATCH 14/14] Fix link of bank account for donation --- htdocs/don/card.php | 47 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index ab74a498a04..49097ebbdc8 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -33,8 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/dons/modules_don.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; @@ -412,6 +413,8 @@ if (empty($reshook)) { * View */ +$bankaccountstatic = new Account($db); + $title = $langs->trans("Donation"); $help_url = 'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones|DE:Modul_Spenden'; @@ -842,8 +845,10 @@ if (!empty($id) && $action != 'edit') { * Payments */ $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,"; - $sql .= "c.code as type_code,c.libelle as paiement_type"; + $sql .= " c.code as type_code, c.libelle as paiement_type,"; + $sql .= " b.fk_account"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_donation as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid"; $sql .= ", ".MAIN_DB_PREFIX."c_paiement as c "; $sql .= ", ".MAIN_DB_PREFIX."don as d"; $sql .= " WHERE d.rowid = ".((int) $id); @@ -857,13 +862,16 @@ if (!empty($id) && $action != 'edit') { if ($resql) { $num = $db->num_rows($resql); $i = 0; - $total = 0; + $totalpaid = 0; print ''; print ''; print ''; print ''; print ''; + if (isModEnabled("bank")) { + print ''; + } print ''; print ''; @@ -875,6 +883,28 @@ if (!empty($id) && $action != 'edit') { print '\n"; $labeltype = ($langs->trans("PaymentType".$objp->type_code) != "PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type; print "\n"; + if (isModEnabled("bank")) { + $bankaccountstatic->fetch($objp->fk_account); + /*$bankaccountstatic->id = $objp->fk_bank; + $bankaccountstatic->ref = $objp->baref; + $bankaccountstatic->label = $objp->baref; + $bankaccountstatic->number = $objp->banumber; + $bankaccountstatic->currency_code = $objp->bacurrency_code; + + if (isModEnabled('accounting')) { + $bankaccountstatic->account_number = $objp->account_number; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($objp->fk_accountancy_journal); + $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } + */ + print ''; + } print '\n"; print ""; $totalpaid += $objp->amount; @@ -882,12 +912,17 @@ if (!empty($id) && $action != 'edit') { } if ($object->paid == 0) { - print "\n"; - print "\n"; + $colspan = 3; + if (isModEnabled("bank")) { + $colspan++; + } + print '\n"; + print '\n"; $remaintopay = $object->amount - $totalpaid; + $resteapayeraffiche = $remaintopay; - print ""; + print '"; print '\n"; } print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("BankAccount").''.$langs->trans("Amount").'
'.dol_print_date($db->jdate($objp->dp), 'day')."".$labeltype.' '.$objp->num_payment."'; + if ($bankaccountstatic->id) { + print $bankaccountstatic->getNomUrl(1, 'transactions'); + } + print ''.price($objp->amount)."
".$langs->trans("AlreadyPaid")." :".price($totalpaid)."
".$langs->trans("AmountExpected")." :".price($object->amount)."
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid)."
'.$langs->trans("AmountExpected").' :'.price($object->amount)."
".$langs->trans("RemainderToPay")." :
'.$langs->trans("RemainderToPay")." :'.price($remaintopay)."
";