From 4ec4801c77d79be71b7e9a486272c2b2496a14f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Oct 2020 15:54:08 +0200 Subject: [PATCH 1/6] FIX Only template of enabled modules visible --- htdocs/admin/mails_templates.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 9ff86260c4b..b9281765771 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -429,7 +429,7 @@ if ($action == 'delete') } -$sql = "SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active"; +$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active"; $sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates"; $sql .= " WHERE entity IN (".getEntity('email_template').")"; if (!$user->admin) @@ -779,6 +779,13 @@ if ($resql) print "\n"; } else { + if ($obj->module) { + $tempmodulekey = $obj->module; + if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) { + $i++; + continue; + } + } $keyforobj = 'type_template'; if (!in_array($obj->$keyforobj, array_keys($elementList))) { From 2a31d4393813bca71ead9fe47d74deb40af1f0cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Oct 2020 18:41:26 +0200 Subject: [PATCH 2/6] FIX Show errors in session on login page --- htdocs/core/lib/security2.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 6f206832e2d..60b01b567f4 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -290,6 +290,8 @@ if (!function_exists('dol_loginfunction')) // Include login page template include $template_dir.'login.tpl.php'; + // Global html output events ($mesgs, $errors, $warnings) + dol_htmloutput_events(0); $_SESSION["dol_loginmesg"] = ''; } From a729bff0621ec64d2b330c1ede40bfc1ee851c6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Oct 2020 11:54:18 +0200 Subject: [PATCH 3/6] Fix trans --- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/mails.lang | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7a4aee9856a..e47390b9ce0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -480,7 +480,7 @@ ModuleCompanyCodeSupplierDigitaria=%s followed by the truncated supplier name by Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).
Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required. UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than... WarningPHPMail=WARNING: The setup to send emails from the application is using the default generic setup. It is often better to setup outgoing emails to use the email server of your Email Service Provider instead of the default setup for several reasons: -WarningPHPMailA=- Using the server of the Email Service Provider increase the trustability of your email, so it increase the deliverablity without being flagging as SPAM +WarningPHPMailA=- Using the server of the Email Service Provider increases the trustability of your email, so it increases the deliverablity without being flagged as SPAM WarningPHPMailB=- Some Email Service Providers (like Yahoo) do not allow you to send an email from another server than their own server. Your current setup uses the server of the application to send email and not the server of your email provider, so some recipients (the one compatible with the restrictive DMARC protocol), will ask your email provider if they can accept your email and some email providers (like Yahoo) may respond "no" because the server is not theirs, so few of your sent Emails may not be accepted for delivery (be careful also of your email provider's sending quota). WarningPHPMailC=- Using the SMTP server of your own Email Service Provider to send emails is also interesting so all emails sent from application will also be saved into your "Sent" directory of your mailbox. WarningPHPMailD=If the method 'PHP Mail' is really the method you would like to use, you can remove this warning by adding the constant MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP to 1 in Home - Setup - Other. diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 7e34db3d8b8..a7223605ff0 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -163,9 +163,9 @@ AdvTgtCreateFilter=Create filter AdvTgtOrCreateNewFilter=Name of new filter NoContactWithCategoryFound=No contact/address with a category found NoContactLinkedToThirdpartieWithCategoryFound=No contact/address with a category found -OutGoingEmailSetup=Outgoing email setup -InGoingEmailSetup=Incoming email setup -OutGoingEmailSetupForEmailing=Outgoing email setup (for module %s) +OutGoingEmailSetup=Outgoing emails +InGoingEmailSetup=Incoming emails +OutGoingEmailSetupForEmailing=Outgoing emails (for module %s) DefaultOutgoingEmailSetup=Same configuration than the global Outgoing email setup Information=Information ContactsWithThirdpartyFilter=Contacts with third-party filter From 9b423106dc3ea875b67c07cbd8ff9f2423340556 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 21 Oct 2020 16:10:48 +0200 Subject: [PATCH 4/6] NEW add margin info in invoice list --- htdocs/compta/facture/list.php | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 9a871514215..4f795274ad2 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -39,6 +39,9 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +if (!empty($conf->margin->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; +} require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -203,6 +206,10 @@ $arrayfields = array( 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>200), 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>210), 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>220), // Not enabled by default because slow + 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled)?0:1)), + 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled)?0:1)), + 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($conf->global->DISPLAY_MARGIN_RATES)?0:1)), + 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($conf->global->DISPLAY_MARK_RATES)?0:1)), 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), 'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))), @@ -405,6 +412,10 @@ if ($massaction == 'makepayment'){ $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); +$formmargin = null; +if (!empty($conf->margin->enabled)) { + $formmargin = new FormMargin($db); +} $bankaccountstatic = new Account($db); $facturestatic = new Facture($db); $formcompany = new FormCompany($db); @@ -1019,6 +1030,26 @@ if ($resql) print ''; print ''; } + if (!empty($arrayfields['total_pa']['checked'])) + { + print ''; + print ''; + } + if (!empty($arrayfields['total_margin']['checked'])) + { + print ''; + print ''; + } + if (!empty($arrayfields['total_margin_rate']['checked'])) + { + print ''; + print ''; + } + if (!empty($arrayfields['total_mark_rate']['checked'])) + { + print ''; + print ''; + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -1102,6 +1133,10 @@ if ($resql) if (!empty($arrayfields['f.multicurrency_total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); if (!empty($arrayfields['multicurrency_dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['multicurrency_dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); if (!empty($arrayfields['multicurrency_rtp']['checked'])) print_liste_field_titre($arrayfields['multicurrency_rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['total_pa']['checked'])) print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['total_margin']['checked'])) print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['total_margin_rate']['checked'])) print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['total_mark_rate']['checked'])) print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -1205,6 +1240,12 @@ if ($resql) $facturestatic->alreadypaid = $paiement; + $marginInfo = array(); + if (!empty($conf->margin->enabled)) { + $facturestatic->fetch_lines(); + $marginInfo = $formmargin->getMarginInfosArray($facturestatic); + } + print '' . price($marginInfo['pa_total']) . ''; + if (!$i) $totalarray['nbfield']++; + } + // Total margin + if (!empty($arrayfields['total_margin']['checked'])) + { + print '' . price($marginInfo['total_margin']) . ''; + if (!$i) $totalarray['nbfield']++; + } + // Total margin rate + if (!empty($arrayfields['total_margin_rate']['checked'])) + { + print '' . (($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%') . ''; + if (!$i) $totalarray['nbfield']++; + } + // total mark rate + if (!empty($arrayfields['total_mark_rate']['checked'])) + { + print '' . (($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%') . ''; + if (!$i) $totalarray['nbfield']++; + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook From 672797aa65ef613c879453085d7faa1c550e90f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Oct 2020 17:09:40 +0200 Subject: [PATCH 5/6] add missing parameter --- htdocs/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/document.php b/htdocs/document.php index bc0cc1eb933..a608dfe820e 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -173,7 +173,7 @@ $refname = basename(dirname($original_file)."/"); if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart'); // Check security and set return info with full path of file -$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname); +$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name From 409f8f9866beb3941969d013a990bb61a074e778 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Oct 2020 19:50:40 +0200 Subject: [PATCH 6/6] Update doc --- htdocs/compta/bank/bankentries_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 0558f097121..a63692deb3f 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -774,7 +774,7 @@ if ($resql) { if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { - if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments + if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // Default is to record miscellaneous direct entries using miscellaneous payments { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier); } else // If direct entries is not done using miscellaneous payments