From 740b2c92285aaf60c69fe3849306a6798fc01b74 Mon Sep 17 00:00:00 2001 From: "DEMAREST Maxime (Indelog)" Date: Tue, 28 Apr 2020 08:59:27 +0200 Subject: [PATCH 01/46] NEW possibilty to group payments by mode and show their subtotal This add two params (PAYMENTS_REPORT_GROUP_BY_MOD and PAYMENTS_FOURN_REPORT_GROUP_BY_MOD) for payments and supplier payments to group them by mode and get subtotals for each mode. Add the corresponding configuration options on admin page fore each payments and supplier payments. --- htdocs/admin/payment.php | 14 +++- htdocs/admin/supplier_payment.php | 56 ++++++++++++++ htdocs/compta/paiement/rapport.php | 5 +- .../modules/rapport/pdf_paiement.class.php | 74 +++++++++++++++++-- htdocs/fourn/facture/rapport.php | 5 +- htdocs/langs/en_US/bills.lang | 1 + htdocs/langs/fr_FR/bills.lang | 1 + 7 files changed, 145 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index e740150e1d5..a5b494b62e2 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -1,5 +1,6 @@ + * Copyright (C) 2020 Maxime DEMAREST * * 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 @@ -70,11 +71,12 @@ if ($action == 'setmod') if ($action == 'setparams') { $freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS', 'none'); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $freetext, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + $res = dolibarr_set_const($db, "PAYMENTS_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity); + if (!$res > 0) $error++; + if ($error) { setEventMessages($langs->trans("Error"), null, 'errors'); @@ -253,6 +255,14 @@ print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $co print ''; print "\n"; +// Allow to group payments by mod in rapports +print ''; +print $langs->trans("GroupPaymentsByModOnReports"); +print ''; +print $form->selectyesno("PAYMENTS_REPORT_GROUP_BY_MOD", $conf->global->PAYMENTS_REPORT_GROUP_BY_MOD, 1); +print ''; +print "\n"; + print ''; print ''; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index d533ba0d8eb..e2fc6dce4a7 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Laurent Destailleur + * Copyright (C) 2020 Maxime DEMAREST * * 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 @@ -144,6 +145,23 @@ elseif ($action == 'specimen') } } + + +elseif ($action == 'setparams') +{ + $res = dolibarr_set_const($db, "PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity); + if (!$res > 0) $error++; + + if ($error) + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } + if (!$error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } +} + /* * View */ @@ -428,8 +446,46 @@ foreach ($dirmodels as $reldir) print ''; +/* + * Other Options + */ + +print "
"; + +print load_fiche_titre($langs->trans("OtherOptions"), '', ''); + +print '
'; +print ''; +print ''; + +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +// Allow to group payments by mod in rapports +print '\n"; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; +print $langs->trans("GroupPaymentsByModOnReports"); +print ''; +print $form->selectyesno("PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", $conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD, 1); +print ''; +print "
'; + dol_fiche_end(); +print '
'; +print '
'; +print ''; +print '
'; +print '
'; + +print ''; + // End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 80013d3d865..76a1ce72d76 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2006 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2020 Maxime DEMAREST * * 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 @@ -26,6 +27,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/rapport/pdf_paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Security check @@ -84,6 +86,7 @@ if ($action == 'builddoc') */ $formother = new FormOther($db); +$formfile = new FormFile($db); llxHeader(); @@ -155,7 +158,7 @@ if ($year) $tfile = $dir.'/'.$year.'/'.$file; $relativepath = $year.'/'.$file; print ''; - print ''.img_pdf().' '.$file.''; + print ''.img_pdf().' '.$file.''.$formfile->showPreview($file, 'facture_paiement', $relativepath, 0).''; print ''.dol_print_size(dol_filesize($tfile)).''; print ''.dol_print_date(dol_filemtime($tfile), "dayhour").''; print ''; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 2377e537606..58b5de4d7d8 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2006 Rodolphe Quiedeville * Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2015-2018 Charlene BENKE + * Copyright (C) 2020 Maxime DEMAREST * * 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 @@ -207,7 +208,11 @@ class pdf_paiement $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if (!empty($socid)) $sql .= " AND s.rowid = ".$socid; - $sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; + // If global param PAYMENTS_REPORT_GROUP_BY_MOD is set, payement are ordered by paiement_code + if (!empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) + $sql .= " ORDER BY paiement_code ASC, p.datep ASC, pf.fk_paiement ASC"; + else + $sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; break; case "fourn": $sql = "SELECT p.datep as dp, f.ref as ref"; @@ -237,7 +242,11 @@ class pdf_paiement $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if (!empty($socid)) $sql .= " AND s.rowid = ".$socid; - $sql .= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC"; + // If global param PAYMENTS_FOURN_REPORT_GROUP_BY_MOD is set, payement fourn are ordered by paiement_code + if (!empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD)) + $sql .= " ORDER BY paiement_code ASC, p.datep ASC, pf.fk_paiementfourn ASC"; + else + $sql .= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC"; break; } @@ -425,7 +434,7 @@ class pdf_paiement public function Body(&$pdf, $page, $lines, $outputlangs) { // phpcs:enable - global $langs; + global $langs, $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); $pdf->SetFont('', '', $default_font_size - 1); @@ -435,6 +444,11 @@ class pdf_paiement $pdf->SetFillColor(220, 220, 220); $yp = 0; $numlines = count($lines); + if (($this->doc_type == 'client' && !empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) || ($this->doc_type == 'fourn' && !empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD))) + { + $mod = $lines[0][2]; + $total_mod = 0; + } for ($j = 0; $j < $numlines; $j++) { $i = $j; @@ -450,8 +464,17 @@ class pdf_paiement { if ($yp > $this->tab_height - 15) { - $pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $langs->transnoentities('SubTotal')." : ".price($total_page), 0, 'R', 0); + $pdf->SetFillColor(255, 255, 255); + $pdf->Rect($this->marge_gauche +1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite -3, $this->line_height, 'F', array(), array()); + $pdf->line($this->marge_gauche, $this->tab_top + 10 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 10 + $yp, array('dash'=>1)); + $pdf->line($this->marge_gauche, $this->tab_top + 15 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 15 + $yp); + $pdf->SetFont('', 'B', $default_font_size - 1); + $pdf->SetXY($this->posxdate -1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->posxpaymentamount - 2 - $this->marge_droite, $this->line_height, $langs->transnoentities('SubTotal')." : ", 0, 'R', 1); + $pdf->SetXY($this->posxpaymentamount -1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount +1, $this->line_height, price($total_page), 0, 'R', 1); + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->SetFillColor(220, 220, 220); $page++; $pdf->AddPage(); $this->_pagehead($pdf, $page, 0, $outputlangs); @@ -474,6 +497,7 @@ class pdf_paiement $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $lines[$j][4], 0, 'R', 1); $yp = $yp + 5; $total_page += $lines[$j][9]; + if (($this->doc_type == 'client' && !empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) || ($this->doc_type == 'fourn' && !empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD))) $total_mod += $lines[$j][9]; } // Invoice number @@ -497,9 +521,45 @@ class pdf_paiement { $oldprowid = $lines[$j][7]; } + + // Add line to add total by payment mode if mode reglement for nex line change + if ((($this->doc_type == 'client' && !empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) || ($this->doc_type == 'fourn' && !empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD))) && ($mod != $lines[$j+1][2])) + { + $pdf->SetFillColor(245, 245, 245); + $pdf->Rect($this->marge_gauche +1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite -3, $this->line_height, 'F', array(), array()); + $pdf->line($this->marge_gauche, $this->tab_top + 10 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 10 + $yp, array('dash'=>1)); + $pdf->line($this->marge_gauche, $this->tab_top + 15 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 15 + $yp); + $pdf->SetXY($this->posxdate -1, $this->tab_top + 10 + $yp); + $pdf->SetFont('', 'I', $default_font_size - 1); + $pdf->MultiCell($this->posxpaymentamount - 2 - $this->marge_droite, $this->line_height, $langs->transnoentities('Total').' '.$mod." : ", 0, 'R', 1); + $pdf->SetXY($this->posxpaymentamount -1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount +1, $this->line_height, price($total_mod), 0, 'R', 1); + $pdf->SetFont('', '', $default_font_size - 1); + $mod = $lines[$j+1][2]; + $total_mod = 0; + $yp = $yp + 5; + if ($yp > $this->tab_height - 5) + { + $page++; + $pdf->AddPage(); + $this->_pagehead($pdf, $page, 0, $outputlangs); + $pdf->SetFont('', '', $default_font_size - 1); + $yp = 0; + } + $pdf->SetFillColor(220, 220, 220); + } + } $total += $total_page; - $pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $langs->transnoentities('Total')." : ".price($total), 0, 'R', 0); + $pdf->SetFillColor(255, 255, 255); + $pdf->Rect($this->marge_gauche +1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite -3, $this->line_height, 'F', array(), array()); + $pdf->line($this->marge_gauche, $this->tab_top + 10 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 10 + $yp, array('dash'=>1)); + $pdf->line($this->marge_gauche, $this->tab_top + 15 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 15 + $yp); + $pdf->SetXY($this->posxdate -1, $this->tab_top + 10 + $yp); + $pdf->SetFont('', 'B'); + $pdf->MultiCell($this->posxpaymentamount - 2 - $this->marge_droite, $this->line_height, $langs->transnoentities('Total')." : ", 0, 'R', 1); + $pdf->SetXY($this->posxpaymentamount -1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount +1, $this->line_height, price($total), 0, 'R', 1); + $pdf->SetFillColor(220, 220, 220); } } diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index f0bf2d85dd1..9f38c4c4f9e 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -1,5 +1,6 @@ + * Copyright (C) 2020 Maxime DEMAREST * * 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 @@ -24,6 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/rapport/pdf_paiement_fourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->loadLangs(array('bills')); @@ -86,6 +88,7 @@ if ($action == 'builddoc') */ $formother = new FormOther($db); +$formfile = new FormFile($db); $titre = ($year ? $langs->trans("PaymentsReportsForYear", $year) : $langs->trans("PaymentsReports")); @@ -157,7 +160,7 @@ if ($year) { $tfile = $dir.'/'.$year.'/'.$file; $relativepath = $year.'/'.$file; - print ''.img_pdf().' '.$file.''; + print ''.img_pdf().' '.$file.''.$formfile->showPreview($file, 'facture_fournisseur', 'payments/'.$relativepath, 0).''; print ''.dol_print_size(dol_filesize($tfile)).''; print ''.dol_print_date(dol_filemtime($tfile), "dayhour").''; } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 55de1591689..9f11d8ecf87 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -385,6 +385,7 @@ GeneratedFromTemplate=Generated from template invoice %s WarningInvoiceDateInFuture=Warning, the invoice date is higher than current date WarningInvoiceDateTooFarInFuture=Warning, the invoice date is too far from current date ViewAvailableGlobalDiscounts=View available discounts +GroupPaymentsByModOnReports=Group payments by mode on reports # PaymentConditions Statut=Status PaymentConditionShortRECEP=Due Upon Receipt diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 6ad3faba02d..92a0da802d1 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -393,6 +393,7 @@ GeneratedFromTemplate=Généré à partir du modèle de facture %s WarningInvoiceDateInFuture=Attention, la date de facturation est antérieur à la date actuelle WarningInvoiceDateTooFarInFuture=Attention, la date de facturation est trop éloignée de la date actuelle ViewAvailableGlobalDiscounts=Voir les remises disponibles +GroupPaymentsByModOnReports=Grouper les paiements par mode sur les rapports # PaymentConditions Statut=État PaymentConditionShortRECEP=A réception From 2cf5f12a62a949f602ac601ac6965977c991af80 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 28 Apr 2020 07:18:45 +0000 Subject: [PATCH 02/46] Fixing style errors. --- htdocs/admin/supplier_payment.php | 12 ++++++------ htdocs/core/modules/rapport/pdf_paiement.class.php | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index e2fc6dce4a7..5d7a0d0b8d5 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -152,14 +152,14 @@ elseif ($action == 'setparams') $res = dolibarr_set_const($db, "PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity); if (!$res > 0) $error++; - if ($error) + if ($error) { - setEventMessages($langs->trans("Error"), null, 'errors'); - } - if (!$error) + setEventMessages($langs->trans("Error"), null, 'errors'); + } + if (!$error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } } /* diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 58b5de4d7d8..024310abb09 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -548,7 +548,6 @@ class pdf_paiement } $pdf->SetFillColor(220, 220, 220); } - } $total += $total_page; $pdf->SetFillColor(255, 255, 255); From b93a3ceb297b7722229ecfbfe6d0eedb16c2f5cc Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Fri, 8 May 2020 17:25:48 +0200 Subject: [PATCH 03/46] TakePOS Auto Order improvements --- htdocs/takepos/css/phone.css | 28 +++++ htdocs/takepos/genimg/qr.php | 7 +- htdocs/takepos/invoice.php | 20 ++-- htdocs/takepos/phone.php | 162 ++++++++++++++++++++++----- htdocs/takepos/public/auto_order.php | 7 +- 5 files changed, 185 insertions(+), 39 deletions(-) diff --git a/htdocs/takepos/css/phone.css b/htdocs/takepos/css/phone.css index 49d833ade17..0f3606071f0 100644 --- a/htdocs/takepos/css/phone.css +++ b/htdocs/takepos/css/phone.css @@ -79,3 +79,31 @@ button.phonebutton { height:90%; font-weight: bold; } + +button.publicphonebutton { + display: inline-block; + position: relative; + padding: 0; + line-height: normal; + cursor: pointer; + vertical-align: middle; + text-align: center; + overflow: visible; /* removes extra width in IE */ + width:33%; + height:90%; + font-weight: bold; +} + +button.publicphonebutton2 { + display: inline-block; + position: relative; + padding: 0; + line-height: normal; + cursor: pointer; + vertical-align: middle; + text-align: center; + overflow: visible; /* removes extra width in IE */ + width:33%; + font-weight: bold; + padding: 8px 16px; +} diff --git a/htdocs/takepos/genimg/qr.php b/htdocs/takepos/genimg/qr.php index c73e874a465..553f5165a0d 100644 --- a/htdocs/takepos/genimg/qr.php +++ b/htdocs/takepos/genimg/qr.php @@ -29,5 +29,8 @@ require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php'; $key = GETPOST('key'); -$module = new modTcpdfbarcode($db); -$result = $module->buildBarCode("http://www.takepos.com", 'QRCODE', 'Y'); +$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); +$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + +$module = new modtcpdfbarcode($db); +$result = $module->buildBarCode($urlwithroot."/takepos/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y'); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index b1641072829..236b302406d 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -32,7 +32,7 @@ if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); } if (!defined('NOREQUIREHTML')) { define('NOREQUIREHTML', '1'); } if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } -require '../main.inc.php'; +if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; @@ -47,16 +47,11 @@ $idproduct = GETPOST('idproduct', 'int'); $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant $placeid = 0; // $placeid is ID of invoice -if ($_SESSION["publicterminal"]) { - $_SESSION["takeposterminal"] = 1; // Use Terminal 1 for public customers -} -elseif (empty($user->rights->takepos->run)) { +if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { accessforbidden(); } - - -if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') || $_SESSION["publicterminal"]) +if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { // DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED if ($_SESSION["takeposterminal"] == "") @@ -629,6 +624,12 @@ $(document).ready(function() { if (selectedline==this.id) return; // If is already selected else selectedline=this.id; selectedtext=$('#'+selectedline).find("td:first").html(); + }); /* Autoselect the line */ @@ -913,7 +914,7 @@ if ($_SESSION["basiclayout"] == 1) $htmlforlines .= '" onclick="AddProduct(\''.$place.'\', '.$row->id.')">'; $htmlforlines .= ''; $htmlforlines .= $row->label; - $htmlforlines .= ''; + $htmlforlines .= '
'.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).'
'; $htmlforlines .= ''."\n"; } $htmlforlines .= ''; @@ -990,6 +991,7 @@ if ($placeid > 0) } $htmlforlines .= '" id="'.$line->id.'">'; $htmlforlines .= ''; + if ($_SESSION["basiclayout"] == 1) $htmlforlines .= $line->qty." x "; //if ($line->product_label) $htmlforlines.= ''.$line->product_label.''; if (isset($line->product_type)) { diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index eac1f40bfd1..6e912d988dc 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -31,7 +31,7 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); -if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../main.inc.php'; +if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE') && isset($_GET['key'])) require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -45,6 +45,7 @@ if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { else $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant $action = GETPOST('action', 'alpha'); $setterminal = GETPOST('setterminal', 'int'); +$idproduct = GETPOST('idproduct', 'int'); if ($setterminal > 0) { @@ -53,14 +54,10 @@ if ($setterminal > 0) $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); -if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { - $_SESSION["takeposterminal"] = 1; // Use Terminal 1 for public customers -} -elseif (empty($user->rights->takepos->run)) { +if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { accessforbidden(); } - /* * View */ @@ -75,7 +72,42 @@ $head = ' top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); ?> - + +fetch($idproduct); + print "".$prod->label."
"; + print ''; + print "
".$prod->description; + print "
".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).""; + print '
'; + print ''; +} +elseif ($action=="editline"){ + $placeid = GETPOST('placeid', 'int'); + $selectedline = GETPOST('selectedline', 'int'); + $invoice = new Facture($db); + $invoice->fetch($placeid); + foreach ($invoice->lines as $line) + { + if ($line->id == $selectedline) + { + $prod = new Product($db); + $prod->fetch($line->fk_product); + print "".$prod->label."
"; + print ''; + print "
".$prod->description; + print "
".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).""; + print '
'; + print ''; + print ''; + print ''; + } + } +} +else { +?> -global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '
'.$langs->trans('TerminalSelect').'
'; -?> + global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '
'.$langs->trans('TerminalSelect').'
'; + ?>
global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"]
- Date: Fri, 8 May 2020 18:04:38 +0200 Subject: [PATCH 05/46] Fix URLs --- htdocs/takepos/phone.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 7e454a734a3..8714173e45f 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -31,7 +31,7 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); -if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE') && isset($_GET['key'])) require '../main.inc.php'; +if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -71,14 +71,13 @@ $head = ' '; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); -?> - -'; + if ($action=="productinfo"){ $prod = new Product($db); $prod->fetch($idproduct); print "".$prod->label."
"; - print ''; + print ''; print "
".$prod->description; print "
".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).""; print '
'; From b89b6d7679546811e13826e74262fa67cd10be75 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Fri, 8 May 2020 18:51:49 +0200 Subject: [PATCH 06/46] Name fix --- htdocs/takepos/genimg/qr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/genimg/qr.php b/htdocs/takepos/genimg/qr.php index 553f5165a0d..99f7fced1d0 100644 --- a/htdocs/takepos/genimg/qr.php +++ b/htdocs/takepos/genimg/qr.php @@ -32,5 +32,5 @@ $key = GETPOST('key'); $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file -$module = new modtcpdfbarcode($db); +$module = new modTcpdfbarcode($db); $result = $module->buildBarCode($urlwithroot."/takepos/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y'); From 04480847df1ca79066567d41c58e613ed03a4189 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 10 May 2020 08:28:03 +0200 Subject: [PATCH 07/46] NEW Accountancy balance - Add a button ShowSubtotalByGroup --- htdocs/accountancy/bookkeeping/balance.php | 61 ++++++++++++++-------- htdocs/langs/en_US/accountancy.lang | 1 + 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index b2a25b00ce2..7b99057f73a 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -55,7 +55,7 @@ $pagenext = $page + 1; //if (! $sortfield) $sortfield="p.date_fin"; //if (! $sortorder) $sortorder="DESC"; - +$show_subgroup = GETPOST('show_subgroup', 'alpha'); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); @@ -130,10 +130,11 @@ if (!empty($search_accountancy_code_end)) { if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers { - $search_accountancy_code_start = ''; - $search_accountancy_code_end = ''; + $show_subgroup = ''; $search_date_start = ''; $search_date_end = ''; + $search_accountancy_code_start = ''; + $search_accountancy_code_end = ''; $filter = array(); } @@ -223,6 +224,12 @@ if ($action != 'export_csv') $moreforfilter .= $form->selectDate($search_date_start ? $search_date_start : -1, 'date_start', 0, 0, 1, '', 1, 0); $moreforfilter .= $langs->trans('DateEnd').': '; $moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1, 'date_end', 0, 0, 1, '', 1, 0); + + $moreforfilter .= ' - '; + $moreforfilter .= $langs->trans('ShowSubtotalByGroup').': '; + $moreforfilter .= ''; + + $moreforfilter .= '
'; if (!empty($moreforfilter)) { @@ -289,26 +296,31 @@ if ($action != 'export_csv') } print ''; - // Permet d'afficher le compte comptable - if (empty($displayed_account) || $root_account_description != $displayed_account) + if(!empty($show_subgroup)) { - // Affiche un Sous-Total par compte comptable - if ($displayed_account != "") { - print ''.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_credit - $sous_total_debit)).''; - print " \n"; + // Permet d'afficher le compte comptable + if (empty($displayed_account) || $root_account_description != $displayed_account) { + // Affiche un Sous-Total par compte comptable + if ($displayed_account != "") { + print '' . $langs->trans("SubTotal") . ':'; + print '' . price($sous_total_debit) . ''; + print '' . price($sous_total_credit) . ''; + print '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; + print "\n"; + print "\n"; + print ''; + } + + // Show first line of a break + print ''; + print '' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . ''; print ''; + + $displayed_account = $root_account_description; + $sous_total_debit = 0; + $sous_total_credit = 0; } - - // Show first line of a break - print ''; - print ''.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').''; - print ''; - - $displayed_account = $root_account_description; - $sous_total_debit = 0; - $sous_total_credit = 0; } - // $object->get_compte_racine($line->numero_compte); print ''.length_accountg($line->numero_compte).''; @@ -326,12 +338,15 @@ if ($action != 'export_csv') $sous_total_credit += $line->credit; } - print ''.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_debit - $sous_total_credit)).''; - print " \n"; - print ''; + if(!empty($show_subgroup)) + { + print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_debit - $sous_total_credit)) . ''; + print "\n"; + print ''; + } print ''.$langs->trans("AccountBalance").':'.price($total_debit).''.price($total_credit).''.price(price2num($total_debit - $total_credit)).''; - print " \n"; + print "\n"; print ''; print ""; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index eb3229efaee..a3d4437b043 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -235,6 +235,7 @@ UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-par PaymentsNotLinkedToProduct=Payment not linked to any product / service ShowOpeningBalance=Show opening balance HideOpeningBalance=Hide opening balance +ShowSubtotalByGroup=Show subtotal by group Pcgtype=Group of account PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report. From 0dccc9cbeb734ebdba69ed29354ec42fc7d3677f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 May 2020 07:27:20 +0200 Subject: [PATCH 08/46] Debug colspan --- htdocs/accountancy/bookkeeping/balance.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 7b99057f73a..85562ebc268 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -302,12 +302,11 @@ if ($action != 'export_csv') if (empty($displayed_account) || $root_account_description != $displayed_account) { // Affiche un Sous-Total par compte comptable if ($displayed_account != "") { - print '' . $langs->trans("SubTotal") . ':'; + print '' . $langs->trans("SubTotal") . ':'; print '' . price($sous_total_debit) . ''; print '' . price($sous_total_credit) . ''; print '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; print "\n"; - print "\n"; print ''; } From d9e26b8569404f2a47329c9a8ff26d5c0cd4af27 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 12 May 2020 08:38:03 +0200 Subject: [PATCH 09/46] fix template email on prpal list --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index eaeea9e3d43..522e8f5eaa3 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -468,7 +468,7 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit); $topicmail = "SendPropalRef"; - $modelmail = "proposal_send"; + $modelmail = "propal_send"; $objecttmp = new Propal($db); $trackid = 'pro'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; From 66beb7c14f9b88bb2aa1388f3f3a1356f80e460a Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 12 May 2020 10:17:47 +0200 Subject: [PATCH 10/46] FIX: Do not show stats panel if the user does not have permissions --- htdocs/comm/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index fcd3823b0c2..82e331eb623 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2015-2019 Frédéric France * Copyright (C) 2015 Marcos García @@ -581,7 +581,7 @@ if ($object->id > 0) $boxstat .= ''; $boxstat .= ' + $html .= ' - - - - '; + '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

'.$product->description_short->language[$this->lang - 1].''; + // do not load if display none + //$html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; } return $html; } From 0850570e951e98b1b50de544844f9a19e669a97a Mon Sep 17 00:00:00 2001 From: "DEMAREST Maxime (Indelog)" Date: Tue, 12 May 2020 13:15:49 +0200 Subject: [PATCH 15/46] Fix and imporve some points for compta/accounting-flles.php * Fix zip generation for accouning-files if line has no document. The zip file generated if $filesarray contain a line with empty 'files' was unsustainable because it try to add empty files. * Add clickable link to jump on card for other line than Invoice and Supplier Invoice * Add various payment * Use label as ref for paiements of salaries line to display more explicit line --- htdocs/compta/accounting-files.php | 64 +++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 471637461f6..9c26cc0999c 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -37,8 +37,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php' require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; -$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta", "trips")); +$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta", "trips", "banks")); $date_start = GETPOST('date_start', 'alpha'); $date_startDay = GETPOST('date_startday', 'int'); @@ -176,7 +178,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Paiements of salaries if (GETPOST('selectpaymentsofsalaries')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql .= " WHERE datep between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -191,6 +193,14 @@ if (($action == 'searchfiles' || $action == 'dl')) { $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; } + // Various payments + if (GETPOST('selectvariouspayment')) { + if (!empty($sql)) $sql .= " UNION ALL"; + $sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.datec as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; + $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as t"; + $sql .= " WHERE datec between ".$wheretail; + $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; + } if ($sql) { $sql .= $db->order($sortfield, $sortorder); @@ -254,6 +264,12 @@ if (($action == 'searchfiles' || $action == 'dl')) { $upload_dir = $conf->tax->dir_output.'/'.$subdir; $link = "document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F'; break; + case "VariousPayment": + $subdir = ''; + $subdir .= ($subdir ? '/' : '').dol_sanitizeFileName($objd->id); + $upload_dir = $conf->bank->dir_output.'/'.$subdir; + $link = "document.php?modulepart=banque&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; default: $subdir = ''; $upload_dir = ''; @@ -394,11 +410,13 @@ if ($result && $action == "dl" && !$error) { foreach ($filesarray as $key => $file) { - foreach ($file['files'] as $filecursor) { - if (file_exists($filecursor["fullname"])) { - $zip->addFile($filecursor["fullname"], $filecursor["relpathnamelang"]); - } - } + if (!empty($file['files'])) { + foreach ($file['files'] as $filecursor) { + if (file_exists($filecursor["fullname"])) { + $zip->addFile($filecursor["fullname"], $filecursor["relpathnamelang"]); + } + } + } $log .= '"'.$langs->trans($file['item']).'"'; if (!empty($conf->multicompany->enabled) && is_object($mc)) @@ -448,6 +466,11 @@ $form = new Form($db); $userstatic = new User($db); $invoice = new Facture($db); $supplier_invoice = new FactureFournisseur($db); +$expensereport = new ExpenseReport($db); +$don = new Don($db); +$salary_payment = new PaymentSalary($db); +$charge_sociales = new ChargeSociales($db); +$various_payment = new PaymentVarious($db); $title = $langs->trans("ComptaFiles").' - '.$langs->trans("List"); $help_url = ''; @@ -492,7 +515,8 @@ $listofchoices = array( 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips'), 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation'), 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'), - 'selectsocialcontributions'=>array('label'=>'SocialContributions') + 'selectsocialcontributions'=>array('label'=>'SocialContributions'), + 'selectvariouspayment'=>array('label'=>'VariousPayment') ); foreach ($listofchoices as $choice => $val) { $checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : ''); @@ -592,14 +616,34 @@ if (!empty($date_start) && !empty($date_stop)) // Ref print ''; // File link From 48183b396ad674fb22e1c9415978d8414b0fd9e8 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 13 May 2020 08:54:42 +0200 Subject: [PATCH 17/46] Fix top menu search method must be GET --- htdocs/main.inc.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8e05aa34ab8..2beb4f74787 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2002,7 +2002,7 @@ function top_menu_search() $defaultAction = ''; $buttonList = '\n"; From 872518a91fa2f30318f298c5bb630af616ee32e4 Mon Sep 17 00:00:00 2001 From: "DEMAREST Maxime (Indelog)" Date: Wed, 13 May 2020 16:54:53 +0200 Subject: [PATCH 21/46] Add total by credit/debit for accounting-file.php --- htdocs/compta/accounting-files.php | 104 ++++++++++++++++------------- 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 98d8c9b9983..64332671b5d 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -42,6 +42,10 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +// Constant to define payment sens +const PAY_DEBIT = 0; +const PAY_CREDIT = 1; + $langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta", "trips", "banks")); $date_start = GETPOST('date_start', 'alpha'); @@ -144,7 +148,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Customer invoices if (GETPOST('selectinvoices')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_CREDIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql .= " WHERE datef between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -153,7 +157,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Vendor invoices if (GETPOST('selectsupplierinvoices')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_DEBIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql .= " WHERE datef between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -162,7 +166,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Expense reports if (GETPOST('selectexpensereports')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql .= " WHERE date_fin between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -171,7 +175,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Donations if (GETPOST('selectdonations')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_CREDIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country"; $sql .= " WHERE datedon between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -180,7 +184,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Paiements of salaries if (GETPOST('selectpaymentsofsalaries')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql .= " WHERE datep between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -189,7 +193,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Social contributions if (GETPOST('selectsocialcontributions')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.date_creation as date, t.date_ech as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.date_creation as date, t.date_ech as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t"; $sql .= " WHERE date_creation between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -198,7 +202,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Various payments if (GETPOST('selectvariouspayment')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.datep as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.datep as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, sens"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as t"; $sql .= " WHERE datep between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -311,6 +315,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { $nofile['thirdparty_code'] = $objd->thirdparty_code; $nofile['country_code'] = $objd->country_code; $nofile['vatnum'] = $objd->vatnum; + $nofile['sens'] = $objd->sens; $filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile; } @@ -329,11 +334,11 @@ if (($action == 'searchfiles' || $action == 'dl')) { $file['ref'] = ($objd->ref ? $objd->ref : $objd->id); $file['fk'] = $objd->fk_soc; $file['item'] = $objd->item; - $file['thirdparty_name'] = $objd->thirdparty_name; $file['thirdparty_code'] = $objd->thirdparty_code; $file['country_code'] = $objd->country_code; $file['vatnum'] = $objd->vatnum; + $file['sens'] = $objd->sens; // Save record into array (only the first time it is found) if (empty($filesarray[$file['item'].'_'.$file['id']])) { @@ -417,7 +422,8 @@ if ($result && $action == "dl" && !$error) $log .= ','.$langs->transnoentitiesnoconv("ThirdParty"); $log .= ','.$langs->transnoentitiesnoconv("Code"); $log .= ','.$langs->transnoentitiesnoconv("Country"); - $log .= ','.$langs->transnoentitiesnoconv("VATIntra")."\n"; + $log .= ','.$langs->transnoentitiesnoconv("VATIntra"); + $log .= ','.$langs->transnoentitiesnoconv("Sens")."\n"; $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip'; dol_delete_file($zipname); @@ -454,6 +460,7 @@ if ($result && $action == "dl" && !$error) $log .= ',"'.$file['thirdparty_code'].'"'; $log .= ',"'.$file['country_code'].'"'; $log .= ',"'.$file['vatnum'].'"'; + $log .= ',"'.$file['sens'].'"'; $log .= "\n"; } $zip->addFromString('transactions.csv', $log); @@ -605,11 +612,12 @@ if (!empty($date_start) && !empty($date_stop)) { // Sort array by date ASC to calculate balance - $totalET = 0; - $totalIT = 0; - $totalVAT = 0; - $totalDebit = 0; - $totalCredit = 0; + $totalET_debit = 0; + $totalIT_debit = 0; + $totalVAT_debit = 0; + $totalET_credit = 0; + $totalIT_credit = 0; + $totalVAT_credit = 0; // Display array foreach ($TData as $data) @@ -682,11 +690,11 @@ if (!empty($date_start) && !empty($date_stop)) print ''; // Total ET - print '\n"; + print '\n"; // Total IT - print '\n"; + print '\n"; // Total VAT - print '\n"; + print '\n"; print '\n"; @@ -696,42 +704,42 @@ if (!empty($date_start) && !empty($date_stop)) print '\n"; - // Debit - //print '\n"; - // Credit - //print '\n"; - - $totalET += $data['amount_ht']; - $totalIT += $data['amount_ttc']; - $totalVAT += $data['amount_vat']; - - $totalDebit += ($data['amount_ttc'] > 0) ? abs($data['amount_ttc']) : 0; - $totalCredit += ($data['amount_ttc'] > 0) ? 0 : abs($data['amount_ttc']); - - // Balance - //print '\n"; + if ($data['sens']) { + $totalET_credit += $data['amount_ht']; + $totalIT_credit += $data['amount_ttc']; + $totalVAT_credit += $data['amount_vat']; + } else { + $totalET_debit -= $data['amount_ht']; + $totalIT_debit -= $data['amount_ttc']; + $totalVAT_debit -= $data['amount_vat']; + } print "\n"; } + // Total credits print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - /*print ''; - print ''; - print ''; - */ + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + // Total debits + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + // Balance + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; } } From ee6e717f4632716ce1e4d6a12301882b17850524 Mon Sep 17 00:00:00 2001 From: "DEMAREST Maxime (Indelog)" Date: Wed, 13 May 2020 17:47:30 +0200 Subject: [PATCH 22/46] Add payment loan in accounting-files.php --- htdocs/compta/accounting-files.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 64332671b5d..a97a0a815b7 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -41,12 +41,13 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php'; // Constant to define payment sens const PAY_DEBIT = 0; const PAY_CREDIT = 1; -$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta", "trips", "banks")); +$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta", "trips", "banks", "loan")); $date_start = GETPOST('date_start', 'alpha'); $date_startDay = GETPOST('date_startday', 'int'); @@ -207,6 +208,14 @@ if (($action == 'searchfiles' || $action == 'dl')) { $sql .= " WHERE datep between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; } + // Loan payments + if (GETPOST('selectloanspayment')) { + if (!empty($sql)) $sql .= " UNION ALL"; + $sql .= " SELECT t.rowid as id, l.entity, l.label as ref, 1 as paid, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ht, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ttc, 0 as total_tva, 0 as fk_soc, t.datep as date, t.datep as date_due, 'LoanPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; + $sql .= " FROM ".MAIN_DB_PREFIX."payment_loan as t LEFT JOIN ".MAIN_DB_PREFIX."loan as l ON l.rowid = t.fk_loan"; + $sql .= " WHERE datep between ".$wheretail; + $sql .= " AND l.entity IN (".($entity == 1 ? '0,1' : $entity).')'; + } if ($sql) { $sql .= $db->order($sortfield, $sortorder); @@ -283,6 +292,13 @@ if (($action == 'searchfiles' || $action == 'dl')) { $link = "document.php?modulepart=banque&file=".str_replace('/', '%2F', $subdir).'%2F'; $modulepart = "banque"; break; + case "LoanPayment": + // Loan payment has no linked file + $subdir = ''; + $upload_dir = $conf->loan->dir_output.'/'.$subdir; + $link = ""; + $modulepart = ""; + break; default: $subdir = ''; $upload_dir = ''; @@ -497,6 +513,7 @@ $don = new Don($db); $salary_payment = new PaymentSalary($db); $charge_sociales = new ChargeSociales($db); $various_payment = new PaymentVarious($db); +$payment_loan = new PaymentLoan($db); $title = $langs->trans("ComptaFiles").' - '.$langs->trans("List"); $help_url = ''; @@ -542,7 +559,8 @@ $listofchoices = array( 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation'), 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'), 'selectsocialcontributions'=>array('label'=>'SocialContributions'), - 'selectvariouspayment'=>array('label'=>'VariousPayment') + 'selectvariouspayment'=>array('label'=>'VariousPayment'), + 'selectloanspayment'=>array('label'=>'PaymentLoan'), ); foreach ($listofchoices as $choice => $val) { $checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : ''); @@ -671,6 +689,10 @@ if (!empty($date_start) && !empty($date_stop)) $various_payment->id = $data['id']; $various_payment->ref = $data['ref']; print $various_payment->getNomUrl(1, '', 0, 0, '', 0, 0, 0); + } elseif ($data['item'] == 'LoanPayment') { + $payment_loan->id = $data['id']; + $payment_loan->ref = $data['ref']; + print $payment_loan->getNomUrl(1, '', 0, 0, '', 0, 0, 0); } else { print $data['ref']; } From ac0b735131af206c67d34420ed38a3fff43a8482 Mon Sep 17 00:00:00 2001 From: "DEMAREST Maxime (Indelog)" Date: Wed, 13 May 2020 18:01:00 +0200 Subject: [PATCH 23/46] Fix use date_ech for social contributions in accounting-file.php --- htdocs/compta/accounting-files.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index a97a0a815b7..f9bc453d999 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -194,9 +194,9 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Social contributions if (GETPOST('selectsocialcontributions')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.date_creation as date, t.date_ech as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; + $sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t"; - $sql .= " WHERE date_creation between ".$wheretail; + $sql .= " WHERE t.date_ech between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; } From 9f6a5d4cc95097e92eeb94d6524add35ae3a5c3d Mon Sep 17 00:00:00 2001 From: ATM john Date: Thu, 14 May 2020 10:50:20 +0200 Subject: [PATCH 24/46] Fix multicompany supplier product price filter --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 93061d200d8..078cfb2b5f2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2759,7 +2759,7 @@ class Form } if (!empty($conf->barcode->enabled)) $sql .= ", pfp.barcode"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; if ($socid) $sql .= " AND pfp.fk_soc = ".$socid; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; // Units From 1bd00b0e8c635db1a8348c97d3933699b92d88db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 12:28:17 +0200 Subject: [PATCH 25/46] Fix to solve feedbacks of https://www.dolibarr.fr/forum/t/email-collector-avec-office-365-bug-et-contournement/32726 --- .../class/emailcollector.class.php | 20 +++++++++++++++---- .../install/mysql/migration/11.0.0-12.0.0.sql | 2 ++ .../llx_emailcollector_emailcollector.sql | 3 ++- htdocs/langs/en_US/admin.lang | 1 + 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 11cf2477720..969b83cac5a 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -100,8 +100,9 @@ class EmailCollector extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector'), 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1), - 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>100, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'), - 'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'), + 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'), + 'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)'), + 'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'), 'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'), 'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'), //'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105), @@ -173,6 +174,7 @@ class EmailCollector extends CommonObject public $host; + public $hostcharset; public $login; public $password; public $source_directory; @@ -985,9 +987,10 @@ class EmailCollector extends CommonObject $nbemailprocessed = 0; $nbemailok = 0; $nbactiondone = 0; + $charset = ($this->hostcharset ? $this->hostcharset : "UTF-8"); // Scan IMAP inbox - $arrayofemail = imap_search($connection, $search, null, "UTF-8"); + $arrayofemail = imap_search($connection, $search, null, $charset); if ($arrayofemail === false) { // Nothing found or search string not understood @@ -1086,6 +1089,7 @@ class EmailCollector extends CommonObject } $header = imap_fetchheader($connection, $imapemail, 0); + $header = preg_replace('/\r\n\s+/m', ' ', $header); // When a header line is on several lines, merge lines $matches = array(); preg_match_all('/([^: ]+): (.+?(?:\r\n\s(?:.+?))*)\r\n/m', $header, $matches); $headers = array_combine($matches[1], $matches[2]); @@ -1132,7 +1136,10 @@ class EmailCollector extends CommonObject // Can use also imap_mime_header_decode($str) // Can use also mb_decode_mimeheader($str) // Can use also iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8') - if (function_exists('imap_mime_header_decode')) { + if (function_exists('iconv_mime_decode')) { + $overview[0]->subject = iconv_mime_decode($overview[0]->subject, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'); + } + elseif (function_exists('imap_mime_header_decode')) { $elements = imap_mime_header_decode($overview[0]->subject); $newstring = ''; if (!empty($elements)) { @@ -1146,6 +1153,8 @@ class EmailCollector extends CommonObject elseif (function_exists('mb_decode_mimeheader')) { $overview[0]->subject = mb_decode_mimeheader($overview[0]->subject); } + // Removed emojis + $overview[0]->subject = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $overview[0]->subject); // Parse IMAP email structure global $htmlmsg, $plainmsg, $charset, $attachments; @@ -1153,6 +1162,9 @@ class EmailCollector extends CommonObject //$htmlmsg,$plainmsg,$charset,$attachments $messagetext = $plainmsg ? $plainmsg : dol_string_nohtmltag($htmlmsg, 0); + // Removed emojis + $messagetext = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $messagetext); + /*var_dump($plainmsg); var_dump($htmlmsg); var_dump($messagetext);*/ diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 8a68e763160..7daf41a05d3 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -285,3 +285,5 @@ ALTER TABLE llx_prelevement_facture ADD COLUMN fk_facture_fourn INTEGER NULL; ALTER TABLE llx_menu MODIFY COLUMN module varchar(255); UPDATE llx_actioncomm SET fk_action = 50 where fk_action = 40 AND code = 'TICKET_MSG'; + +ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN hostcharset varchar(16) DEFAULT 'UTF-8'; diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql index 10f3e4f8b9b..87581f418e8 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql @@ -21,7 +21,8 @@ CREATE TABLE llx_emailcollector_emailcollector( ref varchar(128) NOT NULL, label varchar(255), description text, - host varchar(255), + host varchar(255), + hostcharset varchar(16) DEFAULT 'UTF-8', login varchar(128), password varchar(128), source_directory varchar(255) NOT NULL, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1bd7f3d0297..5ce79a12231 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -40,6 +40,7 @@ WebUserGroup=Web server user/group NoSessionFound=Your PHP configuration seems to not allow listing of active sessions. The directory used to save sessions (%s) may be protected (for example by OS permissions or by PHP directive open_basedir). DBStoringCharset=Database charset to store data DBSortingCharset=Database charset to sort data +HostCharset=Host charset ClientCharset=Client charset ClientSortingCharset=Client collation WarningModuleNotActive=Module %s must be enabled From bcaa83eeeca16486d5d3d511ea7290b25146aba5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 14:10:04 +0200 Subject: [PATCH 26/46] FIX dol_concatdesc to escape < Better help --- htdocs/admin/emailcollector_card.php | 4 ++-- htdocs/core/class/translate.class.php | 2 +- htdocs/core/lib/functions.lib.php | 9 +++++---- htdocs/emailcollector/class/emailcollector.class.php | 9 +++++++-- htdocs/langs/en_US/admin.lang | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 74592ff777a..80161eaadc6 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -592,7 +592,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; $htmltext = $langs->transnoentitiesnoconv("OperationParamDesc"); //var_dump($htmltext); - print $form->textwithpicto('', $htmltext); + print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt'); print ''; print ''; print ''; @@ -643,7 +643,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Delete print ''; print ''; diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 4f3930a4588..3fc3151030a 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -308,7 +308,7 @@ class Translate continue; } else { - // Convert some strings: Parse and render carriage returns. Also, change '\\s' int '\s' because transifex sync pull the string '\s' into string '\\s' + // Convert some strings: Parse and render carriage returns. Also, change '\\s' into '\s' because transifex sync pull the string '\s' into string '\\s' $this->tab_translate[$key] = str_replace(array('\\n', '\\\\s'), array("\n", '\s'), $value); if ($usecachekey) { $tabtranslatedomain[$key] = $value; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 20094da216c..31716dc3f3c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5794,7 +5794,8 @@ function dolGetFirstLineOfText($text, $nboflines = 1, $charset = 'UTF-8') /** - * Replace CRLF in string with a HTML BR tag + * Replace CRLF in string with a HTML BR tag. + * WARNING: The content after operation contains some HTML tags (the
) so be sure to also have encode the special chars of stringtoencode into HTML before. * * @param string $stringtoencode String to encode * @param int $nl2brmode 0=Adding br before \n, 1=Replacing \n by br @@ -6048,7 +6049,7 @@ function dol_textishtml($msg, $option = 0) * * @param string $text1 Text 1 * @param string $text2 Text 2 - * @param bool $forxml false=Use
instead of \n if html content detected, true=Use
instead of \n if html content detected + * @param bool $forxml true=Use
instead of
if we have to add a br tag * @param bool $invert invert order of description lines (we often use config MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION in this parameter) * @return string Text 1 + new line + Text2 * @see dol_textishtml() @@ -6063,9 +6064,9 @@ function dol_concatdesc($text1, $text2, $forxml = false, $invert = false) } $ret = ''; - $ret .= (!dol_textishtml($text1) && dol_textishtml($text2)) ?dol_nl2br($text1, 0, $forxml) : $text1; + $ret .= (!dol_textishtml($text1) && dol_textishtml($text2)) ? dol_nl2br(dol_escape_htmltag($text1, 0, 1, '', 1), 0, $forxml) : $text1; $ret .= (!empty($text1) && !empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2)) ? ($forxml ? "
\n" : "
\n") : "\n") : ""; - $ret .= (dol_textishtml($text1) && !dol_textishtml($text2)) ?dol_nl2br($text2, 0, $forxml) : $text2; + $ret .= (dol_textishtml($text1) && !dol_textishtml($text2)) ? dol_nl2br(dol_escape_htmltag($text2, 0, 1, '', 1), 0, $forxml) : $text2; return $ret; } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 969b83cac5a..2bc6d6db962 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -937,8 +937,8 @@ class EmailCollector extends CommonObject } imap_errors(); // Clear stack of errors. - // $conf->global->MAIL_PREFIX_FOR_EMAIL_ID must be defined $host = dol_getprefix('email'); + //$host = '123456'; // Define the IMAP search string // See https://tools.ietf.org/html/rfc3501#section-6.4.4 for IMAPv4 (PHP not yet compatible) @@ -1081,6 +1081,7 @@ class EmailCollector extends CommonObject dol_syslog("Start of loop on email", LOG_INFO, 1); + $i = 0; foreach ($arrayofemail as $imapemail) { if ($nbemailprocessed > 1000) @@ -1088,6 +1089,8 @@ class EmailCollector extends CommonObject break; // Do not process more than 1000 email per launch (this is a different protection than maxnbcollectedpercollect } + $i++; + $header = imap_fetchheader($connection, $imapemail, 0); $header = preg_replace('/\r\n\s+/m', ' ', $header); // When a header line is on several lines, merge lines $matches = array(); @@ -1095,6 +1098,8 @@ class EmailCollector extends CommonObject $headers = array_combine($matches[1], $matches[2]); //var_dump($headers); + dol_syslog("** Process email ".$i." References: ".$headers['References']); + // If there is a filter on trackid if ($searchfilterdoltrackid > 0) { @@ -1130,7 +1135,7 @@ class EmailCollector extends CommonObject // GET Email meta datas $overview = imap_fetch_overview($connection, $imapemail, 0); - dol_syslog("** Process email - msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject); + dol_syslog("msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject); // Decode $overview[0]->subject according to RFC2047 // Can use also imap_mime_header_decode($str) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5ce79a12231..6c139a0f10c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1939,7 +1939,7 @@ WithoutDolTrackingID=Dolibarr Reference not found in Message ID FormatZip=Zip MainMenuCode=Menu entry code (mainmenu) ECMAutoTree=Show automatic ECM tree -OperationParamDesc=Define values to use for action, or how to extract values. For example:
objproperty1=SET:abc
objproperty1=SET:a value with replacement of __objproperty1__
objproperty3=SETIFEMPTY:abc
objproperty4=EXTRACT:HEADER:X-Myheaderkey.*[^\s]+(.*)
options_myextrafield=EXTRACT:SUBJECT:([^\s]*)
object.objproperty5=EXTRACT:BODY:My company name is\s([^\s]*)

Use a ; char as separator to extract or set several properties. +OperationParamDesc=Define the values to use for the object of the action, or how to extract values. For example:
objproperty1=SET:the value to set
objproperty2=SET:a value with replacement of __objproperty1__
objproperty3=SETIFEMPTY:value used if objproperty3 is not already defined
objproperty4=EXTRACT:HEADER:X-Myheaderkey:\s*([^\s]*)
options_myextrafield1=EXTRACT:SUBJECT:([^\n]*)
object.objproperty5=EXTRACT:BODY:My company name is\s([^\s]*)

Use a ; char as separator to extract or set several properties. OpeningHours=Opening hours OpeningHoursDesc=Enter here the regular opening hours of your company. ResourceSetup=Configuration of Resource module From 4a65b629ee3c93266226208d24806aee8243e168 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 14:29:14 +0200 Subject: [PATCH 27/46] Position of fields --- htdocs/index.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 36aae1f25b8..7f6e462839b 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -142,11 +142,11 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) 'orders', 'invoices', 'donations', - 'contracts', - 'interventions', 'supplier_proposals', 'supplier_orders', 'supplier_invoices', + 'contracts', + 'interventions', 'ticket' ); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2f5e10c1459..afb154408c5 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3643,7 +3643,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); } span.boxstatstext { - opacity: 0.7; + opacity: 0.5; line-height: 18px; color: var(--colortext); } From 72c6aa81bb146813ab52f6a95f321ba9918c687c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 May 2020 12:30:59 +0200 Subject: [PATCH 28/46] Trans --- htdocs/langs/en_US/modulebuilder.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index b815cf997cc..135ac1ae9ec 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -83,7 +83,7 @@ ListOfDictionariesEntries=List of dictionaries entries ListOfPermissionsDefined=List of defined permissions SeeExamples=See examples here EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION) -VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create), 5=Visible on list end view form only (not create, not update). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example:
preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
($user->rights->holiday->define_holiday ? 1 : 0) +VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create), 5=Visible on list end view form only (not create, not update).

Using a negative value means field is not shown by default on list but can be selected for viewing).

It can be an expression, for example:
preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
($user->rights->holiday->define_holiday ? 1 : 0) DisplayOnPdfDesc=Display this field on compatible PDF documents, you can manage position with "Position" field.
Currently, known compatibles PDF models are : eratosthene (order), espadon (ship), sponge (invoices), cyan (propal/quotation), cornas (supplier order)

For document :
0 = not displayed
1 = display
2 = display only if not empty

For document lines :
0 = not displayed
1 = displayed in a column
3 = display in line description column after the description
4 = display in description column after the description only if not empty DisplayOnPdf=Display on PDF IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0) From 4a04cecbaae3c6deea391462718f08323965805d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 May 2020 12:49:53 +0200 Subject: [PATCH 29/46] CSS --- htdocs/theme/eldy/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ef39d38a568..60c7ee43bb0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1611,7 +1611,7 @@ div.nopadding { } td.nobordernopadding.widthpictotitle.col-picto { - color: var(--colortexttitlenotab); + color: #bbb; opacity: 0.85; } .table-list-of-attached-files .col-picto, .table-list-of-links .col-picto { From 0b3e917155c8e4f9f4a6fe676268fd357f6e8df0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 May 2020 13:29:50 +0200 Subject: [PATCH 30/46] CSS --- htdocs/core/tpl/extrafields_view.tpl.php | 21 ++++++++++++++++++--- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index e6cbad245d9..198a3910747 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -52,8 +52,12 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] { $lastseparatorkeyfound = ''; $extrafields_collapse_num = ''; + $extrafields_collapse_num_old = ''; + $i = 0; foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { + $i++; + // Discard if extrafield is a hidden field on form $enabled = 1; @@ -65,6 +69,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] { $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); } + $perms = 1; if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) { @@ -87,6 +92,8 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] $value = $object->array_options["options_".$key]; //var_dump($key.' - '.$value); } + + // Print line tr of extra field if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') { $extrafields_collapse_num = ''; @@ -109,13 +116,20 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] } else { - print '
'; + print ''; + $extrafields_collapse_num_old = $extrafields_collapse_num; print '
'; - if (!empty($conf->propal->enabled)) + if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { // Box proposals $tmp = $object->getOutstandingProposals(); @@ -599,7 +599,7 @@ if ($object->id > 0) if ($link) $boxstat .= ''; } - if (!empty($conf->commande->enabled)) + if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { // Box commandes $tmp = $object->getOutstandingOrders(); @@ -617,7 +617,7 @@ if ($object->id > 0) if ($link) $boxstat .= ''; } - if (!empty($conf->facture->enabled)) + if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { // Box factures $tmp = $object->getOutstandingBills(); From e1db0ef855173bffda16735f7c4a836c8de68a50 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 12 May 2020 10:57:51 +0200 Subject: [PATCH 11/46] Update index.php --- htdocs/comm/mailing/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 61187f2e647..6b765d9451f 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -157,6 +157,7 @@ print '
'; $limit = 10; $sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; +$sql .= " WHERE m.entity = ".$conf->entity; $sql .= " ORDER BY m.date_creat DESC"; $sql .= " LIMIT ".$limit; $result = $db->query($sql); From 8bd1179b8207671f4d33d8f6d156c453b7bf8239 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Tue, 12 May 2020 17:03:24 +0200 Subject: [PATCH 12/46] Update qr.php --- htdocs/takepos/genimg/qr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/genimg/qr.php b/htdocs/takepos/genimg/qr.php index 99f7fced1d0..3f27464f5ca 100644 --- a/htdocs/takepos/genimg/qr.php +++ b/htdocs/takepos/genimg/qr.php @@ -33,4 +33,4 @@ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', t $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $module = new modTcpdfbarcode($db); -$result = $module->buildBarCode($urlwithroot."/takepos/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y'); +$result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y'); From fc2f2c6da71b6c4f7f0b16216f0fba320b52ba1d Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 12 May 2020 17:41:21 +0200 Subject: [PATCH 13/46] FIX : wrong url param --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9fa696c69b3..cb3aa9cd099 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4837,7 +4837,7 @@ elseif ($id > 0 || ! empty($ref)) { if (! $objectidnext) { - print ''; + print ''; } } From 366ae2f116cfaaed73e07a4b06d0a596ded92582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 12 May 2020 18:44:26 +0200 Subject: [PATCH 14/46] Update dolistore.class.php --- .../admin/dolistore/class/dolistore.class.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 230c588f7e4..a229f3c985d 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -248,11 +248,8 @@ class Dolistore // phpcs:enable global $langs, $conf; $html = ""; - $parity = "pair"; $last_month = time() - (30 * 24 * 60 * 60); foreach ($this->products as $product) { - $parity = ($parity == "impair") ? 'pair' : 'impair'; - // check new product ? $newapp = ''; if ($last_month < strtotime($product->date_add)) { @@ -267,7 +264,7 @@ class Dolistore // add image or default ? if ($product->id_default_image != '') { $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image; - $images = ''; + $images = ''; $images .= ''; } else { $images = ''; @@ -306,16 +303,16 @@ class Dolistore //.'
'.$langs->trans("SeeInMarkerPlace").' //output template - $html .= '
'.$newapp.$images.'

'.$product->name->language[$this->lang - 1] .'
'.$version.'

- '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

'.$product->description_short->language[$this->lang - 1].'
'.$price.' - '.$download_link.'
'.$price.''.$download_link.'
'; - if ($data['item'] == 'Invoice') { - $invoice->id = $data['id']; + if ($data['item'] == 'Invoice') { + $invoice->id = $data['id']; $invoice->ref = $data['ref']; print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); } elseif ($data['item'] == 'SupplierInvoice') { $supplier_invoice->id = $data['id']; $supplier_invoice->ref = $data['ref']; print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); + } elseif ($data['item'] == 'ExpenseReport') { + $expensereport->id = $data['id']; + $expensereport->ref = $data['ref']; + print $expensereport->getNomUrl(1, '', 0, 0, '', 0, 0, 0); + } elseif ($data['item'] == 'SalaryPayment') { + $salary_payment->id = $data['id']; + $salary_payment->ref = $data['ref']; + print $salary_payment->getNomUrl(1, '', 0, 0, '', 0, 0, 0); + } elseif ($data['item'] == 'Donation') { + $don->id = $data['id']; + $don->ref = $data['ref']; + print $don->getNomUrl(1, '', 0, 0, '', 0, 0, 0); + } elseif ($data['item'] == 'SocialContributions') { + $charge_sociales->id = $data['id']; + $charge_sociales->ref = $data['ref']; + print $charge_sociales->getNomUrl(1, '', 0, 0, '', 0, 0, 0); + } elseif ($data['item'] == 'VariousPayment') { + $various_payment->id = $data['id']; + $various_payment->ref = $data['ref']; + print $various_payment->getNomUrl(1, '', 0, 0, '', 0, 0, 0); } else { print $data['ref']; } From b7ae5ffa1d085661bed4906ad4540562e6134219 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 13 May 2020 06:12:45 +0000 Subject: [PATCH 16/46] Fixing style errors. --- htdocs/compta/accounting-files.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 9c26cc0999c..66d36df25b2 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -616,37 +616,37 @@ if (!empty($date_start) && !empty($date_stop)) // Ref print ''; - if ($data['item'] == 'Invoice') { - $invoice->id = $data['id']; + if ($data['item'] == 'Invoice') { + $invoice->id = $data['id']; $invoice->ref = $data['ref']; print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } elseif ($data['item'] == 'SupplierInvoice') { + } elseif ($data['item'] == 'SupplierInvoice') { $supplier_invoice->id = $data['id']; $supplier_invoice->ref = $data['ref']; print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } elseif ($data['item'] == 'ExpenseReport') { + } elseif ($data['item'] == 'ExpenseReport') { $expensereport->id = $data['id']; $expensereport->ref = $data['ref']; print $expensereport->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } elseif ($data['item'] == 'SalaryPayment') { + } elseif ($data['item'] == 'SalaryPayment') { $salary_payment->id = $data['id']; $salary_payment->ref = $data['ref']; print $salary_payment->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } elseif ($data['item'] == 'Donation') { + } elseif ($data['item'] == 'Donation') { $don->id = $data['id']; $don->ref = $data['ref']; print $don->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } elseif ($data['item'] == 'SocialContributions') { + } elseif ($data['item'] == 'SocialContributions') { $charge_sociales->id = $data['id']; $charge_sociales->ref = $data['ref']; print $charge_sociales->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } elseif ($data['item'] == 'VariousPayment') { + } elseif ($data['item'] == 'VariousPayment') { $various_payment->id = $data['id']; $various_payment->ref = $data['ref']; print $various_payment->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } else { + } else { print $data['ref']; - } + } print ''; if (!empty($data['files'])) { - foreach ($data['files'] as $filecursor) { - print ''.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'
'; + foreach ($data['files'] as $id=>$filecursor) { + print ''.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).' '.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'
'; } } print "
'.$data['paid'].''.price($data['amount_ht'])."'.price($data['sens']?$data['amount_ht']:-$data['amount_ht'])."'.price($data['amount_ttc'])."'.price($data['sens']?$data['amount_ttc']:-$data['amount_ttc'])."'.price($data['amount_vat'])."'.price($data['sens']?$data['amount_vat']:-$data['amount_vat'])."'.$data['thirdparty_name']."'.$data['vatnum']."'.(($data['amount_ttc'] > 0) ? price(abs($data['amount_ttc'])) : '')."'.(($data['amount_ttc'] > 0) ? '' : price(abs($data['amount_ttc'])))."'.price($data['balance'])."
'.price(price2num($totalET, 'MT')).''.price(price2num($totalIT, 'MT')).''.price(price2num($totalVAT, 'MT')).''.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).''.$langs->trans('Total').' '.$langs->trans('Income').''.price(price2num($totalET_credit, 'MT')).''.price(price2num($totalIT_credit, 'MT')).''.price(price2num($totalVAT_credit, 'MT')).'
'.$langs->trans('Total').' '.$langs->trans('Outcome').''.price(price2num($totalET_debit, 'MT')).''.price(price2num($totalIT_debit, 'MT')).''.price(price2num($totalVAT_debit, 'MT')).'
'.$langs->trans('Total').''.price(price2num($totalET_credit+$totalET_debit, 'MT')).''.price(price2num($totalIT_credit+$totalIT_debit, 'MT')).''.price(price2num($totalVAT_credit+$totalVAT_debit, 'MT')).'
'; - print ''.img_edit().''; + print ''.img_edit().''; print ' '.img_delete().''; print '
'; print ''; print ''; - print ''; print ''; print ''; @@ -643,7 +643,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Delete print ''; print ''; diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 4f3930a4588..3fc3151030a 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -308,7 +308,7 @@ class Translate continue; } else { - // Convert some strings: Parse and render carriage returns. Also, change '\\s' int '\s' because transifex sync pull the string '\s' into string '\\s' + // Convert some strings: Parse and render carriage returns. Also, change '\\s' into '\s' because transifex sync pull the string '\s' into string '\\s' $this->tab_translate[$key] = str_replace(array('\\n', '\\\\s'), array("\n", '\s'), $value); if ($usecachekey) { $tabtranslatedomain[$key] = $value; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 20094da216c..31716dc3f3c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5794,7 +5794,8 @@ function dolGetFirstLineOfText($text, $nboflines = 1, $charset = 'UTF-8') /** - * Replace CRLF in string with a HTML BR tag + * Replace CRLF in string with a HTML BR tag. + * WARNING: The content after operation contains some HTML tags (the
) so be sure to also have encode the special chars of stringtoencode into HTML before. * * @param string $stringtoencode String to encode * @param int $nl2brmode 0=Adding br before \n, 1=Replacing \n by br @@ -6048,7 +6049,7 @@ function dol_textishtml($msg, $option = 0) * * @param string $text1 Text 1 * @param string $text2 Text 2 - * @param bool $forxml false=Use
instead of \n if html content detected, true=Use
instead of \n if html content detected + * @param bool $forxml true=Use
instead of
if we have to add a br tag * @param bool $invert invert order of description lines (we often use config MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION in this parameter) * @return string Text 1 + new line + Text2 * @see dol_textishtml() @@ -6063,9 +6064,9 @@ function dol_concatdesc($text1, $text2, $forxml = false, $invert = false) } $ret = ''; - $ret .= (!dol_textishtml($text1) && dol_textishtml($text2)) ?dol_nl2br($text1, 0, $forxml) : $text1; + $ret .= (!dol_textishtml($text1) && dol_textishtml($text2)) ? dol_nl2br(dol_escape_htmltag($text1, 0, 1, '', 1), 0, $forxml) : $text1; $ret .= (!empty($text1) && !empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2)) ? ($forxml ? "
\n" : "
\n") : "\n") : ""; - $ret .= (dol_textishtml($text1) && !dol_textishtml($text2)) ?dol_nl2br($text2, 0, $forxml) : $text2; + $ret .= (dol_textishtml($text1) && !dol_textishtml($text2)) ? dol_nl2br(dol_escape_htmltag($text2, 0, 1, '', 1), 0, $forxml) : $text2; return $ret; } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 969b83cac5a..2bc6d6db962 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -937,8 +937,8 @@ class EmailCollector extends CommonObject } imap_errors(); // Clear stack of errors. - // $conf->global->MAIL_PREFIX_FOR_EMAIL_ID must be defined $host = dol_getprefix('email'); + //$host = '123456'; // Define the IMAP search string // See https://tools.ietf.org/html/rfc3501#section-6.4.4 for IMAPv4 (PHP not yet compatible) @@ -1081,6 +1081,7 @@ class EmailCollector extends CommonObject dol_syslog("Start of loop on email", LOG_INFO, 1); + $i = 0; foreach ($arrayofemail as $imapemail) { if ($nbemailprocessed > 1000) @@ -1088,6 +1089,8 @@ class EmailCollector extends CommonObject break; // Do not process more than 1000 email per launch (this is a different protection than maxnbcollectedpercollect } + $i++; + $header = imap_fetchheader($connection, $imapemail, 0); $header = preg_replace('/\r\n\s+/m', ' ', $header); // When a header line is on several lines, merge lines $matches = array(); @@ -1095,6 +1098,8 @@ class EmailCollector extends CommonObject $headers = array_combine($matches[1], $matches[2]); //var_dump($headers); + dol_syslog("** Process email ".$i." References: ".$headers['References']); + // If there is a filter on trackid if ($searchfilterdoltrackid > 0) { @@ -1130,7 +1135,7 @@ class EmailCollector extends CommonObject // GET Email meta datas $overview = imap_fetch_overview($connection, $imapemail, 0); - dol_syslog("** Process email - msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject); + dol_syslog("msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject); // Decode $overview[0]->subject according to RFC2047 // Can use also imap_mime_header_decode($str) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5ce79a12231..6c139a0f10c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1939,7 +1939,7 @@ WithoutDolTrackingID=Dolibarr Reference not found in Message ID FormatZip=Zip MainMenuCode=Menu entry code (mainmenu) ECMAutoTree=Show automatic ECM tree -OperationParamDesc=Define values to use for action, or how to extract values. For example:
objproperty1=SET:abc
objproperty1=SET:a value with replacement of __objproperty1__
objproperty3=SETIFEMPTY:abc
objproperty4=EXTRACT:HEADER:X-Myheaderkey.*[^\s]+(.*)
options_myextrafield=EXTRACT:SUBJECT:([^\s]*)
object.objproperty5=EXTRACT:BODY:My company name is\s([^\s]*)

Use a ; char as separator to extract or set several properties. +OperationParamDesc=Define the values to use for the object of the action, or how to extract values. For example:
objproperty1=SET:the value to set
objproperty2=SET:a value with replacement of __objproperty1__
objproperty3=SETIFEMPTY:value used if objproperty3 is not already defined
objproperty4=EXTRACT:HEADER:X-Myheaderkey:\s*([^\s]*)
options_myextrafield1=EXTRACT:SUBJECT:([^\n]*)
object.objproperty5=EXTRACT:BODY:My company name is\s([^\s]*)

Use a ; char as separator to extract or set several properties. OpeningHours=Opening hours OpeningHoursDesc=Enter here the regular opening hours of your company. ResourceSetup=Configuration of Resource module From 9a8e9bdc99ccec244b6b8ae43c5869f0192789a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 14:29:14 +0200 Subject: [PATCH 33/46] Position of fields --- htdocs/index.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 36aae1f25b8..7f6e462839b 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -142,11 +142,11 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) 'orders', 'invoices', 'donations', - 'contracts', - 'interventions', 'supplier_proposals', 'supplier_orders', 'supplier_invoices', + 'contracts', + 'interventions', 'ticket' ); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2f5e10c1459..afb154408c5 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3643,7 +3643,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); } span.boxstatstext { - opacity: 0.7; + opacity: 0.5; line-height: 18px; color: var(--colortext); } From 68512e0281da45963a89c6ce890c080062fc61e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 14:56:15 +0200 Subject: [PATCH 34/46] Look and feel v12 --- .../core/boxes/box_accountancy_last_manual_entries.php | 5 ++++- htdocs/core/boxes/box_boms.php | 5 ++++- htdocs/core/boxes/box_clients.php | 5 ++++- htdocs/core/boxes/box_commandes.php | 5 ++++- htdocs/core/boxes/box_factures_imp.php | 5 ++++- htdocs/core/boxes/box_ficheinter.php | 9 ++++++--- htdocs/core/boxes/box_fournisseurs.php | 2 +- htdocs/core/boxes/box_goodcustomers.php | 5 ++++- htdocs/core/boxes/box_mos.php | 5 ++++- htdocs/core/boxes/box_prospect.php | 4 ++-- htdocs/core/boxes/box_services_contracts.php | 5 ++++- htdocs/core/boxes/box_shipments.php | 5 ++++- htdocs/core/tools.php | 2 +- htdocs/install/default.css | 2 +- htdocs/install/step5.php | 10 +++++----- 15 files changed, 52 insertions(+), 22 deletions(-) diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php index f1ee00c6c59..6198c90e663 100644 --- a/htdocs/core/boxes/box_accountancy_last_manual_entries.php +++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php @@ -140,7 +140,10 @@ class box_accountancy_last_manual_entries extends ModeleBoxes $line++; } - if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedManualEntries")); + if ($num == 0) $this->info_box_contents[$line][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoRecordedManualEntries") + ); $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_boms.php b/htdocs/core/boxes/box_boms.php index 57c5ce2e2e2..c75c4c24e8f 100644 --- a/htdocs/core/boxes/box_boms.php +++ b/htdocs/core/boxes/box_boms.php @@ -153,7 +153,10 @@ class box_boms extends ModeleBoxes $line++; } - if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedOrders")); + if ($num == 0) $this->info_box_contents[$line][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoRecordedOrders") + ); $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index d82a4aee71e..70718db55b5 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -148,7 +148,10 @@ class box_clients extends ModeleBoxes $line++; } - if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedCustomers")); + if ($num == 0) $this->info_box_contents[$line][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoRecordedCustomers") + ); $this->db->free($result); } diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 37a25c8084d..7ec5071b6e3 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -174,7 +174,10 @@ class box_commandes extends ModeleBoxes $line++; } - if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedOrders")); + if ($num == 0) $this->info_box_contents[$line][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoRecordedOrders") + ); $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 0a44105a853..a374094ea89 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -180,7 +180,10 @@ class box_factures_imp extends ModeleBoxes $line++; } - if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoUnpaidCustomerBills")); + if ($num == 0) $this->info_box_contents[$line][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoUnpaidCustomerBills") + ); $this->db->free($result); } diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index e289c83d541..4125ce92eaa 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -145,13 +145,16 @@ class box_ficheinter extends ModeleBoxes $i++; } - if ($num == 0) $this->info_box_contents[$i][] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedInterventions")); + if ($num == 0) $this->info_box_contents[$i][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoRecordedInterventions") + ); $this->db->free($resql); } else { - $this->info_box_contents[0][] = array( + $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, 'text' => ($this->db->error().' sql='.$sql), @@ -160,7 +163,7 @@ class box_ficheinter extends ModeleBoxes } else { - $this->info_box_contents[0][] = array( + $this->info_box_contents[0][0] = array( 'td' => 'class="nohover opacitymedium left"', 'text' => $langs->trans("ReadPermissionNotAllowed") ); diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 2f55a379362..44dd891bfb8 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -136,7 +136,7 @@ class box_fournisseurs extends ModeleBoxes } if ($num == 0) $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', + 'td' => 'class="center opacitymedium"', 'text'=>$langs->trans("NoRecordedSuppliers"), ); diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index 79eb6f9ab8e..46dfdff6d23 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -142,7 +142,10 @@ class box_goodcustomers extends ModeleBoxes $line++; } - if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedCustomers")); + if ($num == 0) $this->info_box_contents[$line][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoRecordedCustomers") + ); $this->db->free($result); } diff --git a/htdocs/core/boxes/box_mos.php b/htdocs/core/boxes/box_mos.php index 9b863aa2d5a..ec21d5d00cf 100644 --- a/htdocs/core/boxes/box_mos.php +++ b/htdocs/core/boxes/box_mos.php @@ -149,7 +149,10 @@ class box_mos extends ModeleBoxes $line++; } - if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedOrders")); + if ($num == 0) $this->info_box_contents[$line][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoRecordedOrders") + ); $this->db->free($result); } else { diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 54ed1c76051..1024ef1d4ec 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -149,8 +149,8 @@ class box_prospect extends ModeleBoxes if ($num == 0) { $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', - 'text'=>$langs->trans("NoRecordedProspects"), + 'td' => 'class="center opacitymedium"', + 'text'=> $langs->trans("NoRecordedProspects"), ); } diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index f8e6dd22452..7167097672b 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -223,7 +223,10 @@ class box_services_contracts extends ModeleBoxes $i++; } - if ($num == 0) $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoContractedProducts")); + if ($num == 0) $this->info_box_contents[$i][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoContractedProducts") + ); $this->db->free($result); } diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index 26f45bc08db..278ad974cf5 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -158,7 +158,10 @@ class box_shipments extends ModeleBoxes $line++; } - if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedShipments")); + if ($num == 0) $this->info_box_contents[$line][0] = array( + 'td' => 'class="center opacitymedium"', + 'text'=>$langs->trans("NoRecordedShipments") + ); $this->db->free($result); } else { diff --git a/htdocs/core/tools.php b/htdocs/core/tools.php index 348417dd345..accb8eeed00 100644 --- a/htdocs/core/tools.php +++ b/htdocs/core/tools.php @@ -46,7 +46,7 @@ $text = $langs->trans("Tools"); print load_fiche_titre($text, '', 'wrench'); // Show description of content -print '
'.$langs->trans("ToolsDesc").'


'; +print '
'.$langs->trans("ToolsDesc").'


'; // Show logo diff --git a/htdocs/install/default.css b/htdocs/install/default.css index f0e51caecab..f363789c129 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -53,7 +53,7 @@ div.titre { } span.titre { - font-weight: bold; + /* font-weight: bold; */ background: #FFFFFF; color: rgb(0,113,121); border: 1px solid #bbb; diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index 1609035e415..b74594ce8da 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -384,10 +384,10 @@ if ($action == "set" && $success) print "
"; - print $langs->trans("YouNeedToPersonalizeSetup")."

"; + print $langs->trans("YouNeedToPersonalizeSetup")."


"; print ''; } else @@ -399,7 +399,7 @@ if ($action == "set" && $success) print "
"; print ''; } } @@ -435,7 +435,7 @@ elseif (empty($action) || preg_match('/upgrade/i', $action)) print "

"; print '
'; } else @@ -447,7 +447,7 @@ elseif (empty($action) || preg_match('/upgrade/i', $action)) print "
"; print ''; } } From 6ec5dd02b61a21154b55812660f09b57b87994dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 15:27:10 +0200 Subject: [PATCH 35/46] Fix Fatal error with bad triggers --- htdocs/core/class/interfaces.class.php | 89 +++++++++++-------- htdocs/core/modules/DolibarrModules.class.php | 10 ++- .../interface_80_modStripe_Stripe.class.php | 2 +- htdocs/theme/eldy/info-box.inc.php | 4 +- 4 files changed, 59 insertions(+), 46 deletions(-) diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index f1daafeb9e7..9302ed09afb 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -328,48 +328,59 @@ class Interfaces continue; } - $objMod = new $modName($db); + try { + $objMod = new $modName($db); - // Define disabledbyname and disabledbymodule - $disabledbyname = 0; - $disabledbymodule = 1; - $module = ''; + if (is_subclass_of($objMod, 'DolibarrTriggers')) + { + // Define disabledbyname and disabledbymodule + $disabledbyname = 0; + $disabledbymodule = 1; + $module = ''; - // Check if trigger file is disabled by name - if (preg_match('/NORUN$/i', $files[$key])) $disabledbyname = 1; - // Check if trigger file is for a particular module - if (preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/i', $files[$key], $reg)) - { - $module = preg_replace('/^mod/i', '', $reg[2]); - $constparam = 'MAIN_MODULE_'.strtoupper($module); - if (strtolower($module) == 'all') $disabledbymodule = 0; - elseif (empty($conf->global->$constparam)) $disabledbymodule = 2; - $triggers[$j]['module'] = strtolower($module); + // Check if trigger file is disabled by name + if (preg_match('/NORUN$/i', $files[$key])) $disabledbyname = 1; + // Check if trigger file is for a particular module + if (preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/i', $files[$key], $reg)) + { + $module = preg_replace('/^mod/i', '', $reg[2]); + $constparam = 'MAIN_MODULE_'.strtoupper($module); + if (strtolower($module) == 'all') $disabledbymodule = 0; + elseif (empty($conf->global->$constparam)) $disabledbymodule = 2; + $triggers[$j]['module'] = strtolower($module); + } + + // We set info of modules + $triggers[$j]['picto'] = $objMod->picto ?img_object('', $objMod->picto, 'class="valignmiddle pictomodule "') : img_object('', 'generic', 'class="valignmiddle pictomodule "'); + $triggers[$j]['file'] = $files[$key]; + $triggers[$j]['fullpath'] = $fullpath[$key]; + $triggers[$j]['relpath'] = $relpath[$key]; + $triggers[$j]['iscoreorexternal'] = $iscoreorexternal[$key]; + $triggers[$j]['version'] = $objMod->getVersion(); + $triggers[$j]['status'] = img_picto($langs->trans("Active"), 'tick'); + if ($disabledbyname > 0 || $disabledbymodule > 1) $triggers[$j]['status'] = ''; + + $text = ''.$langs->trans("Description").':
'; + $text .= $objMod->getDesc().'
'; + $text .= '
'.$langs->trans("Status").':
'; + if ($disabledbyname == 1) + { + $text .= $langs->trans("TriggerDisabledByName").'
'; + if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'
'; + } + else + { + if ($disabledbymodule == 0) $text .= $langs->trans("TriggerAlwaysActive").'
'; + if ($disabledbymodule == 1) $text .= $langs->trans("TriggerActiveAsModuleActive", $module).'
'; + if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'
'; + } + } + else { + print 'Error: Trigger '.$modName.' does not extends DolibarrTriggers
'; + } } - - // We set info of modules - $triggers[$j]['picto'] = $objMod->picto ?img_object('', $objMod->picto, 'class="valignmiddle pictomodule "') : img_object('', 'generic', 'class="valignmiddle pictomodule "'); - $triggers[$j]['file'] = $files[$key]; - $triggers[$j]['fullpath'] = $fullpath[$key]; - $triggers[$j]['relpath'] = $relpath[$key]; - $triggers[$j]['iscoreorexternal'] = $iscoreorexternal[$key]; - $triggers[$j]['version'] = $objMod->getVersion(); - $triggers[$j]['status'] = img_picto($langs->trans("Active"), 'tick'); - if ($disabledbyname > 0 || $disabledbymodule > 1) $triggers[$j]['status'] = ''; - - $text = ''.$langs->trans("Description").':
'; - $text .= $objMod->getDesc().'
'; - $text .= '
'.$langs->trans("Status").':
'; - if ($disabledbyname == 1) - { - $text .= $langs->trans("TriggerDisabledByName").'
'; - if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'
'; - } - else - { - if ($disabledbymodule == 0) $text .= $langs->trans("TriggerAlwaysActive").'
'; - if ($disabledbymodule == 1) $text .= $langs->trans("TriggerActiveAsModuleActive", $module).'
'; - if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'
'; + catch(Exception $e) { + print $e->getMessage(); } $triggers[$j]['info'] = $text; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 9543cf74442..f9d27fedfa4 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2295,9 +2295,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it { print img_object($alttext, 'generic', 'class="inline-block valignmiddle"'); } - print 'getVersion(1).'">'; - print $this->getVersion(1); - print ''; + if ($this->isCoreOrExternalModule() == 'external') { + print 'getVersion(1).'">'; + print $this->getVersion(1); + print ''; + } /*print ''; print '
'; @@ -2313,7 +2315,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it print '
- '.$this->getName().' + '.$this->getName().' '.nl2br($this->getDesc()).''; /*print 'getVersion(1).'">'; diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index 27138e6099f..e6c2df36ee1 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; /** * Class of triggers for stripe module */ -class InterfaceStripe +class InterfaceStripe extends DolibarrTriggers { /** * @var DoliDB Database handler. diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 3138cd8bfd9..3d9c392f32b 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -8,7 +8,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> */ .info-box-module-external span.info-box-icon-version { - background: #999; + background: #bbb; } .info-box { @@ -74,7 +74,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> height: 80px; width: 80px; font-size: 25px; - line-height: 80px; + line-height: 100px; } .info-box-module .info-box-icon { height: 106px; From 7c01b54d73237b39e8ee45ca0e5784ba8c666adc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 15:42:37 +0200 Subject: [PATCH 36/46] Fix version on module list --- htdocs/admin/modules.php | 4 +++- htdocs/core/modules/DolibarrModules.class.php | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 6a0ff450346..c0f1991835b 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -680,7 +680,9 @@ if ($mode == 'common' || $mode == 'commonkanban') if (preg_match('/development/i', $version)) $versiontrans .= img_warning($langs->trans("Development"), 'style="float: left"'); if (preg_match('/experimental/i', $version)) $versiontrans .= img_warning($langs->trans("Experimental"), 'style="float: left"'); if (preg_match('/deprecated/i', $version)) $versiontrans .= img_warning($langs->trans("Deprecated"), 'style="float: left"'); - $versiontrans .= $objMod->getVersion(1); + if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { + $versiontrans .= $objMod->getVersion(1); + } // Define imginfo $imginfo = "info"; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index f9d27fedfa4..384c4fc3a7e 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2295,8 +2295,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it { print img_object($alttext, 'generic', 'class="inline-block valignmiddle"'); } - if ($this->isCoreOrExternalModule() == 'external') { - print 'getVersion(1).'">'; + + $version = $this->getVersion(0); + $versiontrans = ''; + if (preg_match('/development/i', $version)) $versiontrans .= 'warning'; + if (preg_match('/experimental/i', $version)) $versiontrans .= 'warning'; + if (preg_match('/deprecated/i', $version)) $versiontrans .= 'warning'; + if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { + print 'getVersion(1).'">'; print $this->getVersion(1); print ''; } From 3d26351c6b4de6444a4f7230cbfa0d93d165e7e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 16:03:31 +0200 Subject: [PATCH 37/46] Fix function if hours. --- htdocs/core/lib/date.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index ae138bcceec..a751f584564 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -912,7 +912,7 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0, $nbOpenDay=$lastday; - if ($inhour == 1) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort"); + if ($inhour == 1) $nbOpenDay = ($nbOpenDay * 24); return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); } else From b26c1757e6ab26142aa57ab27e53cb847db47b93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 16:07:23 +0200 Subject: [PATCH 38/46] Prepare v13 --- .../install/mysql/migration/12.0.0-13.0.0.sql | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 htdocs/install/mysql/migration/12.0.0-13.0.0.sql diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql new file mode 100644 index 00000000000..210fe31d1ef --- /dev/null +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -0,0 +1,36 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 13.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. + + +-- Missing in v12 + + +-- For v13 + + From 9becb24073c6fc90230289ee0b33170ff517d6a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 16:40:40 +0200 Subject: [PATCH 39/46] Prepare v13 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 0780154118e..b70419de5f4 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (!defined('DOL_VERSION')) define('DOL_VERSION', '13.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (!defined('EURO')) define('EURO', chr(128)); From 215cf9e6f804cba007c44cc7c08a68e3b2b38a9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 16:45:32 +0200 Subject: [PATCH 40/46] Prepare v13 --- htdocs/install/check.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 95e3082cb56..408f4b2a1a8 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -479,7 +479,8 @@ else array('from'=>'8.0.0', 'to'=>'9.0.0'), array('from'=>'9.0.0', 'to'=>'10.0.0'), array('from'=>'10.0.0', 'to'=>'11.0.0'), - array('from'=>'11.0.0', 'to'=>'12.0.0') + array('from'=>'11.0.0', 'to'=>'12.0.0'), + array('from'=>'12.0.0', 'to'=>'13.0.0') ); $count = 0; From 499c2ea30a63c4b5b575576ce02f37f7e554e9b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 16:52:21 +0200 Subject: [PATCH 41/46] FIX #13855 --- htdocs/core/lib/ajax.lib.php | 2 +- htdocs/main.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 64f442633de..1d3e80b90be 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/lib/ajax.lib.php - * \brief Page called by Ajax request for produts + * \brief Page called to enhance interface with Javascript and Ajax features. */ diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d4d1f84a344..49c48e34ec1 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -317,7 +317,7 @@ if (!defined('NOLOGIN') && !defined('NOIPCHECK') && !empty($dolibarr_main_restri // Loading of additional presentation includes if (!defined('NOREQUIREHTML')) require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) -if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory +require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory // If install or upgrade process not done or not completely finished, we call the install page. if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) From 949e0f2326a6f3268b511110903aec472315b5b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 17:27:12 +0200 Subject: [PATCH 42/46] Fix filter on language --- htdocs/website/class/websitepage.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 84eaf0efb27..c63823f51a1 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -332,7 +332,11 @@ class WebsitePage extends CommonObject if ($key == 't.rowid' || $key == 't.fk_website') { $sqlwhere[] = $key.'='.$value; } elseif ($key == 'lang' || $key == 't.lang') { - $sqlwhere[] = $key." = '".$this->db->escape(substr($value, 0, 2))."'"; + $listoflang = array(); + foreach(explode(',', $value) as $tmpvalue) { + $listoflang[] = "'".$this->db->escape(substr(str_replace("'", '', $tmpvalue), 0, 2))."'"; + } + $sqlwhere[] = $key." IN (".join(',', $listoflang).")"; } else { $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } From 1bf677f53735d66bbb4e0a7e9c9a8896ec99e95d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 18:14:55 +0200 Subject: [PATCH 43/46] Can set status of a websitepage --- htdocs/core/ajax/objectonoff.php | 11 ++++++++--- htdocs/core/class/commonobject.class.php | 5 ++++- htdocs/core/lib/security.lib.php | 1 + htdocs/website/index.php | 14 +++++++++++++- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index dd39bce6d4e..6466df89a07 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -43,9 +43,9 @@ if (!empty($user->socid)) { $socid = $user->socid; } -if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { +/*if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { accessforbidden('Calling this file is allowed only when MAIN_DIRECT_STATUS_UPDATE is set'); -} +}*/ /* @@ -75,5 +75,10 @@ if (($action == 'set') && !empty($id)) { $triggerkey = 'COMPANY_UPDATE'; } - $object->setValueFrom($field, $value, $element, $id, $user, $triggerkey); + $tablename = $element; + if ($tablename == 'websitepage') $tablename = 'website_page'; + + $format = 'int'; + + $object->setValueFrom($field, $value, $tablename, $id, $format, '', $user, $triggerkey); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f3f1b9eaee3..6148b55a5cf 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8070,7 +8070,10 @@ abstract class CommonObject { if (empty($id) && empty($ref) && empty($morewhere)) return -1; - $sql = 'SELECT '.$this->getFieldList(); + $fieldlist = $this->getFieldList(); + if (empty($fieldlist)) return 0; + + $sql = 'SELECT '.$fieldlist; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element; if (!empty($id)) $sql .= ' WHERE rowid = '.$id; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 6749f32ffbe..03f1525eb91 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -192,6 +192,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if ($features == 'mo') $features = 'mrp'; if ($features == 'member') $features = 'adherent'; if ($features == 'subscription') { $features = 'adherent'; $feature2 = 'cotisation'; }; + if ($features == 'websitepage') $features = 'website'; // Get more permissions checks from hooks $parameters = array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 690dc0efe3b..ac26f2ee7bb 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3170,6 +3170,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') $pageauthorid = $objectpage->fk_user_creat; $pageusermodifid = $objectpage->fk_user_modif; $pageauthoralias = $objectpage->author_alias; + $pagestatus = $objectpage->status; } else { @@ -3178,6 +3179,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') $pageauthorid = $user->id; $pageusermodifid = 0; $pageauthoralias = ''; + $pagestatus = 1; } if (GETPOST('WEBSITE_TITLE', 'alpha')) $pagetitle = GETPOST('WEBSITE_TITLE', 'alpha'); if (GETPOST('WEBSITE_PAGENAME', 'alpha')) $pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha'); @@ -3186,7 +3188,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') if (GETPOST('WEBSITE_IMAGE', 'alpha')) $pageimage = GETPOST('WEBSITE_IMAGE', 'alpha'); if (GETPOST('WEBSITE_KEYWORDS', 'alpha')) $pagekeywords = GETPOST('WEBSITE_KEYWORDS', 'alpha'); if (GETPOST('WEBSITE_LANG', 'aZ09')) $pagelang = GETPOST('WEBSITE_LANG', 'aZ09'); - if (GETPOST('htmlheader', 'none')) $pagehtmlheader = GETPOST('htmlheader', 'none'); + if (GETPOST('htmlheader', 'none')) $pagehtmlheader = GETPOST('htmlheader', 'none'); // Title print '
'; + if ($action != 'createcontainer') + { + print ''; + } + print '
attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; print '">'; if (!empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); @@ -161,6 +175,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); $value = isset($_POST["options_".$key]) ? dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]) : $datenotinstring; } + //TODO Improve element and rights detection if ($action == 'edit_extras' && $permok && GETPOST('attribute', 'none') == $key) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 60c7ee43bb0..2f5e10c1459 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1751,7 +1751,7 @@ img.photorefnoborder { border-bottom: px solid rgb(); /* border-bottom: 2px solid var(--colorbackhmenu1); */ } -.trextrafieldseparator td { +.trextrafieldseparator td, .trextrafields_collapse_last td { /* border-bottom: 2px solid var(--colorbackhmenu1) !important; */ border-bottom: 2px solid rgb() !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index c7ce5709efd..da2df5eb788 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1799,7 +1799,7 @@ img.photorefnoborder { border-bottom: px solid rgb(); } -.trextrafieldseparator td { +.trextrafieldseparator td, .trextrafields_collapse_last td { border-bottom: 1px solid rgb() !important; } .tdhrthin { From a796122f7b0e1050df2fe5ac635107e4aa3750be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 12:28:17 +0200 Subject: [PATCH 31/46] Fix to solve feedbacks of https://www.dolibarr.fr/forum/t/email-collector-avec-office-365-bug-et-contournement/32726 --- .../class/emailcollector.class.php | 20 +++++++++++++++---- .../install/mysql/migration/11.0.0-12.0.0.sql | 2 ++ .../llx_emailcollector_emailcollector.sql | 3 ++- htdocs/langs/en_US/admin.lang | 1 + 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 11cf2477720..969b83cac5a 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -100,8 +100,9 @@ class EmailCollector extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector'), 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1), - 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>100, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'), - 'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'), + 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'), + 'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)'), + 'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'), 'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'), 'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'), //'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105), @@ -173,6 +174,7 @@ class EmailCollector extends CommonObject public $host; + public $hostcharset; public $login; public $password; public $source_directory; @@ -985,9 +987,10 @@ class EmailCollector extends CommonObject $nbemailprocessed = 0; $nbemailok = 0; $nbactiondone = 0; + $charset = ($this->hostcharset ? $this->hostcharset : "UTF-8"); // Scan IMAP inbox - $arrayofemail = imap_search($connection, $search, null, "UTF-8"); + $arrayofemail = imap_search($connection, $search, null, $charset); if ($arrayofemail === false) { // Nothing found or search string not understood @@ -1086,6 +1089,7 @@ class EmailCollector extends CommonObject } $header = imap_fetchheader($connection, $imapemail, 0); + $header = preg_replace('/\r\n\s+/m', ' ', $header); // When a header line is on several lines, merge lines $matches = array(); preg_match_all('/([^: ]+): (.+?(?:\r\n\s(?:.+?))*)\r\n/m', $header, $matches); $headers = array_combine($matches[1], $matches[2]); @@ -1132,7 +1136,10 @@ class EmailCollector extends CommonObject // Can use also imap_mime_header_decode($str) // Can use also mb_decode_mimeheader($str) // Can use also iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8') - if (function_exists('imap_mime_header_decode')) { + if (function_exists('iconv_mime_decode')) { + $overview[0]->subject = iconv_mime_decode($overview[0]->subject, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'); + } + elseif (function_exists('imap_mime_header_decode')) { $elements = imap_mime_header_decode($overview[0]->subject); $newstring = ''; if (!empty($elements)) { @@ -1146,6 +1153,8 @@ class EmailCollector extends CommonObject elseif (function_exists('mb_decode_mimeheader')) { $overview[0]->subject = mb_decode_mimeheader($overview[0]->subject); } + // Removed emojis + $overview[0]->subject = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $overview[0]->subject); // Parse IMAP email structure global $htmlmsg, $plainmsg, $charset, $attachments; @@ -1153,6 +1162,9 @@ class EmailCollector extends CommonObject //$htmlmsg,$plainmsg,$charset,$attachments $messagetext = $plainmsg ? $plainmsg : dol_string_nohtmltag($htmlmsg, 0); + // Removed emojis + $messagetext = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $messagetext); + /*var_dump($plainmsg); var_dump($htmlmsg); var_dump($messagetext);*/ diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 8a68e763160..7daf41a05d3 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -285,3 +285,5 @@ ALTER TABLE llx_prelevement_facture ADD COLUMN fk_facture_fourn INTEGER NULL; ALTER TABLE llx_menu MODIFY COLUMN module varchar(255); UPDATE llx_actioncomm SET fk_action = 50 where fk_action = 40 AND code = 'TICKET_MSG'; + +ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN hostcharset varchar(16) DEFAULT 'UTF-8'; diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql index 10f3e4f8b9b..87581f418e8 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql @@ -21,7 +21,8 @@ CREATE TABLE llx_emailcollector_emailcollector( ref varchar(128) NOT NULL, label varchar(255), description text, - host varchar(255), + host varchar(255), + hostcharset varchar(16) DEFAULT 'UTF-8', login varchar(128), password varchar(128), source_directory varchar(255) NOT NULL, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1bd7f3d0297..5ce79a12231 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -40,6 +40,7 @@ WebUserGroup=Web server user/group NoSessionFound=Your PHP configuration seems to not allow listing of active sessions. The directory used to save sessions (%s) may be protected (for example by OS permissions or by PHP directive open_basedir). DBStoringCharset=Database charset to store data DBSortingCharset=Database charset to sort data +HostCharset=Host charset ClientCharset=Client charset ClientSortingCharset=Client collation WarningModuleNotActive=Module %s must be enabled From ae0e6e4dc8e449be6c0354d1849bc71f80c35355 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 14:10:04 +0200 Subject: [PATCH 32/46] FIX dol_concatdesc to escape < Better help --- htdocs/admin/emailcollector_card.php | 4 ++-- htdocs/core/class/translate.class.php | 2 +- htdocs/core/lib/functions.lib.php | 9 +++++---- htdocs/emailcollector/class/emailcollector.class.php | 9 +++++++-- htdocs/langs/en_US/admin.lang | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 74592ff777a..80161eaadc6 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -592,7 +592,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; $htmltext = $langs->transnoentitiesnoconv("OperationParamDesc"); //var_dump($htmltext); - print $form->textwithpicto('', $htmltext); + print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt'); print ''; - print ''.img_edit().''; + print ''.img_edit().''; print ' '.img_delete().''; print '
'; @@ -3381,6 +3383,16 @@ if ($action == 'editmeta' || $action == 'createcontainer') print $doleditor->Create(1, '', true, 'HTML Header', 'html'); print '
'; + print $langs->trans('Status'); + print ''; + print ajax_object_onoff($objectpage, 'status', 'status', 'Enabled', 'Disabled'); + //print dol_print_date($pagedatecreation, 'dayhour'); + print '
'; if ($action == 'createcontainer') { From 7daef0d146d1e5145ab44f6a46c52b15a5b525a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 18:17:08 +0200 Subject: [PATCH 44/46] Fix bad parameters of function --- htdocs/core/ajax/objectonoff.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index dd39bce6d4e..f7bf1d6299c 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -75,5 +75,10 @@ if (($action == 'set') && !empty($id)) { $triggerkey = 'COMPANY_UPDATE'; } - $object->setValueFrom($field, $value, $element, $id, $user, $triggerkey); + $tablename = $element; + if ($tablename == 'websitepage') $tablename = 'website_page'; + + $format = 'int'; + + $object->setValueFrom($field, $value, $tablename, $id, $format, '', $user, $triggerkey); } From d8ee049b4c57491112ecfbbb42e9d3949e0d4468 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 18:41:31 +0200 Subject: [PATCH 45/46] Can select not defined language --- htdocs/website/class/websitepage.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index c63823f51a1..edf1eed51a7 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -333,10 +333,17 @@ class WebsitePage extends CommonObject $sqlwhere[] = $key.'='.$value; } elseif ($key == 'lang' || $key == 't.lang') { $listoflang = array(); + $foundnull = 0; foreach(explode(',', $value) as $tmpvalue) { + if ($tmpvalue == 'null') { + $foundnull++; + continue; + } $listoflang[] = "'".$this->db->escape(substr(str_replace("'", '', $tmpvalue), 0, 2))."'"; } - $sqlwhere[] = $key." IN (".join(',', $listoflang).")"; + $stringtouse = $key." IN (".join(',', $listoflang).")"; + if ($foundnull) $stringtouse = '('.$stringtouse.' OR '.$key.' IS NULL)'; + $sqlwhere[] = $stringtouse; } else { $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } From 40fa0933ebfe2e128e8282999e126c136f0c2511 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2020 18:44:21 +0200 Subject: [PATCH 46/46] Fix on sarch pages --- htdocs/website/class/websitepage.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index edf1eed51a7..3e518d4d633 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -329,8 +329,10 @@ class WebsitePage extends CommonObject $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { - if ($key == 't.rowid' || $key == 't.fk_website') { + if ($key == 't.rowid' || $key == 't.fk_website' || $key == 'status') { $sqlwhere[] = $key.'='.$value; + } elseif ($key == 'type_container') { + $sqlwhere[] = $key."='".$value."'"; } elseif ($key == 'lang' || $key == 't.lang') { $listoflang = array(); $foundnull = 0;