From f17474a8de3448e40da8d31c00019bd4bfafb13f Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 11 Jan 2021 16:56:19 +0100 Subject: [PATCH 01/17] 12.0 FIX Translation Permission777 FR --- htdocs/langs/fr_FR/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index c4025fb1577..097f2227790 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -848,6 +848,7 @@ Permission773=Supprimer les notes de frais Permission774=Lire toutes les notes de frais (même pour les utilisateurs en dehors de ma hierarchie) Permission775=Approuver les notes de frais Permission776=Payer les notes de frais +Permission777=Lire les notes de frais de tout le monde Permission779=Exporter les notes de frais Permission1001=Consulter les stocks Permission1002=Créer/modifier entrepôts From 77f213832ec9fbc1ec2925066739355b9e85fe27 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 11 Jan 2021 19:40:44 +0100 Subject: [PATCH 02/17] fix: update group name --- htdocs/user/class/usergroup.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 4d858ffbaf9..2c29db85fc7 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -675,6 +675,10 @@ class UserGroup extends CommonObject { global $user, $conf; + if (empty($this->nom) && !empty($this->name)) { + $this->nom = $this->name; + } + $entity = $conf->entity; if (!empty($conf->multicompany->enabled) && $conf->entity == 1) { From 20fba8f4d24efb84e58cb221143a35056b2a5d8d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Jan 2021 05:46:24 +0100 Subject: [PATCH 03/17] FIX : Accountancy - FEC Export - Add trans & unaccent on journal label --- .../class/accountancyexport.class.php | 40 ++++++++++--------- .../class/accountingjournal.class.php | 2 +- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 1bcc4129821..28c049609f3 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -820,6 +820,8 @@ class AccountancyExport */ public function exportFEC($objectLines) { + global $langs; + $separator = "\t"; $end_line = "\r\n"; @@ -853,55 +855,55 @@ class AccountancyExport $date_validation = dol_print_date($line->date_validated, '%Y%m%d'); // FEC:JournalCode - print $line->code_journal.$separator; + print $line->code_journal . $separator; // FEC:JournalLib - print $line->journal_label.$separator; + print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator; // FEC:EcritureNum - print $line->piece_num.$separator; + print $line->piece_num . $separator; // FEC:EcritureDate - print $date_document.$separator; + print $date_document . $separator; // FEC:CompteNum - print $line->numero_compte.$separator; + print $line->numero_compte . $separator; // FEC:CompteLib - print dol_string_unaccent($line->label_compte).$separator; + print dol_string_unaccent($line->label_compte) . $separator; // FEC:CompAuxNum - print $line->subledger_account.$separator; + print $line->subledger_account . $separator; // FEC:CompAuxLib - print dol_string_unaccent($line->subledger_label).$separator; + print dol_string_unaccent($line->subledger_label) . $separator; // FEC:PieceRef - print $line->doc_ref.$separator; + print $line->doc_ref . $separator; // FEC:PieceDate - print dol_string_unaccent($date_creation).$separator; + print dol_string_unaccent($date_creation) . $separator; // FEC:EcritureLib - print dol_string_unaccent($line->label_operation).$separator; + print dol_string_unaccent($line->label_operation) . $separator; // FEC:Debit - print price2fec($line->debit).$separator; + print price2fec($line->debit) . $separator; // FEC:Credit - print price2fec($line->credit).$separator; + print price2fec($line->credit) . $separator; // FEC:EcritureLet - print $line->lettering_code.$separator; + print $line->lettering_code . $separator; // FEC:DateLet - print $date_lettering.$separator; + print $date_lettering . $separator; // FEC:ValidDate - print $date_validation.$separator; + print $date_validation . $separator; // FEC:Montantdevise - print $line->multicurrency_amount.$separator; + print $line->multicurrency_amount . $separator; // FEC:Idevise print $line->multicurrency_code; @@ -919,6 +921,8 @@ class AccountancyExport */ public function exportFEC2($objectLines) { + global $langs; + $separator = "\t"; $end_line = "\r\n"; @@ -955,7 +959,7 @@ class AccountancyExport print $line->code_journal . $separator; // FEC:JournalLib - print $line->journal_label . $separator; + print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator; // FEC:EcritureNum print $line->piece_num . $separator; diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index a76be081471..6ee8a03d8ff 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -126,7 +126,7 @@ class AccountingJournal extends CommonObject $this->rowid = $obj->rowid; $this->code = $obj->code; - $this->ref = $obj->code; + $this->ref = $obj->code; $this->label = $obj->label; $this->nature = $obj->nature; $this->active = $obj->active; From 5d6ca5c6362e4c95ba1280476a8a790f024a582c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Jan 2021 05:52:47 +0100 Subject: [PATCH 04/17] FIX: Accountancy - Add translation when journal label data is record --- htdocs/accountancy/journal/bankjournal.php | 6 +++--- htdocs/accountancy/journal/expensereportsjournal.php | 6 +++--- htdocs/accountancy/journal/purchasesjournal.php | 8 ++++---- htdocs/accountancy/journal/sellsjournal.php | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index d353041234f..c47255647cb 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -549,7 +549,7 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->debit = ($mt >= 0 ? $mt : 0); $bookkeeping->credit = ($mt < 0 ? -$mt : 0); $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->date_creation = $now; @@ -605,7 +605,7 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->debit = ($mt < 0 ? -$mt : 0); $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->date_creation = $now; @@ -737,7 +737,7 @@ if (!$error && $action == 'writebookkeeping') { $bookkeeping->debit = ($mt < 0 ? -$mt : 0); $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->date_creation = $now; $bookkeeping->label_compte = ''; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 26e2b4cdf77..70ec097cd27 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -223,7 +223,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt <= 0) ? -$mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -271,7 +271,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -329,7 +329,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 94f878527dd..611dde36af5 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -322,7 +322,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt <= 0) ? -$mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -372,7 +372,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -433,7 +433,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -484,7 +484,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 9f44e02aafa..62d2238a116 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -333,7 +333,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt < 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -383,7 +383,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt < 0) ? -$mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; @@ -443,7 +443,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt < 0) ? -$mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; + $bookkeeping->journal_label = $langs->transnoentities($journal_label); $bookkeeping->fk_user_author = $user->id; $bookkeeping->entity = $conf->entity; From 19ac498f4e96861764afd9120b1b923fa8ccdfa2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Jan 2021 06:03:57 +0100 Subject: [PATCH 05/17] FIX: Accountancy - Piece is a required field for FEC compatibility --- htdocs/accountancy/bookkeeping/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index d0f43cfe3dd..d9da5b02aef 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -224,9 +224,10 @@ if ($action == "confirm_update") { $action = 'create'; $error++; } - if (!GETPOST('next_num_mvt', 'alpha')) + if (!GETPOST('doc_ref', 'alpha')) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Piece")), null, 'errors'); + $action = 'create'; $error++; } @@ -371,7 +372,7 @@ if ($action == 'create') print ''; print ''; - print ''.$langs->trans("Piece").''; + print ''.$langs->trans("Piece").''; print ''; print ''; From 75323859e4c0e1ed90eb96bd4407335ccef15b39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Jan 2021 13:58:16 +0100 Subject: [PATCH 06/17] Add some hooks to add new buttons (compensation of removal of tabs). --- htdocs/comm/action/index.php | 9 +++++++++ htdocs/comm/action/list.php | 15 +++++++++++---- htdocs/comm/action/pertype.php | 9 +++++++++ htdocs/comm/action/peruser.php | 9 +++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index dc0ada64eb3..016201be0f3 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -454,6 +454,15 @@ $viewmode .= ''; +// Add more views from hooks +$parameters = array(); $object = null; +$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); +if (empty($reshook)) { + $viewmode .= $hookmanager->resPrint; +} elseif ($reshook > 1) { + $viewmode = $hookmanager->resPrint; +} + $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 2fe47ab39f1..f5a0a6783da 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -472,11 +472,9 @@ if ($resql) // Calendars from hooks $parameters = array(); $object = null; $reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action); - if (empty($reshook)) - { + if (empty($reshook)) { $s .= $hookmanager->resPrint; - } elseif ($reshook > 1) - { + } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } @@ -513,6 +511,15 @@ if ($resql) $viewmode .= ''; + // Add more views from hooks + $parameters = array(); $object = null; + $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); + if (empty($reshook)) { + $viewmode .= $hookmanager->resPrint; + } elseif ($reshook > 1) { + $viewmode = $hookmanager->resPrint; + } + $tmpforcreatebutton = dol_getdate(dol_now(), true); $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 29b86b96868..f956b5ae5f7 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -384,6 +384,15 @@ $viewmode .= ''; +// Add more views from hooks +$parameters = array(); $object = null; +$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); +if (empty($reshook)) { + $viewmode .= $hookmanager->resPrint; +} elseif ($reshook > 1) { + $viewmode = $hookmanager->resPrint; +} + $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 55e6725ba8d..2dc62a52e91 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -389,6 +389,15 @@ $viewmode .= ''; +// Add more views from hooks +$parameters = array(); $object = null; +$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); +if (empty($reshook)) { + $viewmode .= $hookmanager->resPrint; +} elseif ($reshook > 1) { + $viewmode = $hookmanager->resPrint; +} + $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) From 2e9f3b803de83010278872ea4554e67e6ea6f46e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Jan 2021 13:59:20 +0100 Subject: [PATCH 07/17] Add some hooks to add new buttons (compensation of removal of tabs). Signed-off-by: Laurent Destailleur --- htdocs/core/class/hookmanager.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 89b5a79df4b..d610203b3ad 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -156,6 +156,7 @@ class HookManager $method, array( 'addCalendarChoice', + 'addCalendarView', 'addMoreActionsButtons', 'addMoreMassActions', 'addSearchEntry', From 958b255822b6401132d48843bc872088f5db1bc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Jan 2021 21:06:02 +0100 Subject: [PATCH 08/17] Fix #15949 by introducing 'alphawithlgt' as GETPOST possible param. --- htdocs/core/lib/functions.lib.php | 10 +++++++++- htdocs/core/tpl/card_presend.tpl.php | 2 +- test/phpunit/SecurityTest.php | 13 +++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d6b67088e78..c5b58bace4b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -675,7 +675,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = case 'nohtml': $out = dol_string_nohtmltag($out, 0); break; - case 'alpha': // No html and no " and no ../ + case 'alpha': // No html and no ../ and " replaced with '' case 'alphanohtml': // Recommended for most scalar parameters and search parameters if (!is_array($out)) { // '"' is dangerous because param in url can close the href= or src= and add javascript functions. @@ -686,6 +686,14 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = $out = dol_string_nohtmltag($out, 0); } break; + case 'alphawithlgt': // No " and no ../ but we keep < > tags + if (!is_array($out)) { + // '"' is dangerous because param in url can close the href= or src= and add javascript functions. + // '../' is dangerous because it allows dir transversals + $out = str_replace(array('"', '"'), "", trim($out)); + $out = str_replace(array('../'), '', $out); + } + break; case 'restricthtml': // Recommended for most html textarea $out = dol_string_onlythesehtmltags($out, 0, 1, 1); break; diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 92a767a23ea..5d3381b2719 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -196,7 +196,7 @@ if ($action == 'presend') } $formmail->withto = $liste; - $formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto') ? GETPOST('sendto') : '1') : '1'); + $formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto', 'alphawithlgt') ? GETPOST('sendto', 'alphawithlgt') : '1') : '1'); $formmail->withtocc = $liste; $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; $formmail->withtopic = $topicmail; diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index d2405e9609d..a1459c22e27 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -287,6 +287,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase $_POST["param8"]="Hackerobjnotdefined\''; + $_POST["param11"]=' Name '; $result=GETPOST('id', 'int'); // Must return nothing print __METHOD__." result=".$result."\n"; @@ -334,6 +335,10 @@ class SecurityTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals($_GET["param5"], $result); + $result=GETPOST("param6", 'alpha'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('\'\'>', $result); + $result=GETPOST("param6", 'nohtml'); print __METHOD__." result=".$result."\n"; $this->assertEquals('">', $result); @@ -356,6 +361,14 @@ class SecurityTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals($_POST["param9"], $result, 'We should get param9 after processing param10'); + $result=GETPOST("param11", 'alphanohtml'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals("Name", $result, 'Test an email string with alphanohtml'); + + $result=GETPOST("param11", 'alphawithlgt'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(trim($_POST["param11"]), $result, 'Test an email string with alphawithlgt'); + return $result; } From dae1794e3df84858af61c366cf5235f56f94ddc0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 13 Jan 2021 11:08:33 +0100 Subject: [PATCH 09/17] FIX: Accountancy - Export Gestinum_v3 use facnumber for customer invoice --- htdocs/accountancy/class/accountancyexport.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 28c049609f3..c57ee343b00 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1638,15 +1638,15 @@ class AccountancyExport ($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) { if ($line->doc_type == 'customer_invoice') { // Get new customer invoice ref and company name - $sql = 'SELECT f.facnumber, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f'; + $sql = 'SELECT f.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f'; $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid'; $sql .= ' WHERE f.rowid = ' . $line->fk_doc; $resql = $this->db->query($sql); if ($resql) { if ($obj = $this->db->fetch_object($resql)) { // Save invoice infos - $invoices_infos[$line->fk_doc] = array('ref' => $obj->facnumber, 'company_name' => $obj->nom); - $invoice_ref = $obj->facnumber; + $invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom); + $invoice_ref = $obj->ref; $company_name = $obj->nom; } } From 8d65dff93d43e991d1dc1276aef345255d6b10a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jan 2021 11:15:30 +0100 Subject: [PATCH 10/17] Fix missing param --- htdocs/compta/paiement/class/paiement.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 6b7f1612836..89737ca917f 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -578,9 +578,10 @@ class Paiement extends CommonObject * @param string $emetteur_nom Name of transmitter * @param string $emetteur_banque Name of bank * @param int $notrigger No trigger + * @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on. * @return int <0 if KO, bank_line_id if OK */ - public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0) + public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0, $accountancycode = '') { global $conf, $langs, $user; @@ -625,7 +626,8 @@ class Paiement extends CommonObject '', $user, $emetteur_nom, - $emetteur_banque + $emetteur_banque, + $accountancycode ); // Mise a jour fk_bank dans llx_paiement From 2ea5b331b4ccf835666bf0b3686b0c13a5a86413 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jan 2021 12:36:33 +0100 Subject: [PATCH 11/17] README --- htdocs/modulebuilder/template/README.md | 6 +++--- .../template/core/modules/modMyModule.class.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index c3afa63e1b7..45c5e4b51eb 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -2,17 +2,17 @@ ## Features -Description... +Description of the module... -Other modules are available on [Dolistore.com](https://www.dolistore.com). +Other external modules are available on [Dolistore.com](https://www.dolistore.com). ## Translations -Translations can be define manually by editing files into directories *langs*. +Translations can be completed manually by editing files into directories *langs*. '; print ''; print $formaccounting->select_account((GETPOSTISSET("accountingaccount_number") ? GETPOST("accountingaccount_number", "alpha") : $line->numero_compte), 'accountingaccount_number', 1, array(), 1, 1, ''); print ''; print ''; - // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not - // use setup of keypress to select thirdparty and this hang browser on large database. - if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) - { + // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: + // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. + // Also, it is not possible to use a value that is not in the list. + // Also, the label is not automatically filled when a value is selected. + if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1); } else { print ''; print ''; print ''; @@ -672,18 +676,21 @@ if ($action == 'create') if ($action == "" || $action == 'add') { print '
'; + print ''; print ''; print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, ''); print ''; print ''; - // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not - // use setup of keypress to select thirdparty and this hang browser on large database. - if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) - { + // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: + // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. + // Also, it is not possible to use a value that is not in the list. + // Also, the label is not automatically filled when a value is selected. + if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print $formaccounting->select_auxaccount('', 'subledger_account', 1); } else { print ''; print ''; print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8a96877a35b..2b61078fd89 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6421,8 +6421,7 @@ class Form $value = $tmpvalue; $disabled = ''; $style = ''; } - if (!empty($disablebademail)) - { + if (!empty($disablebademail)) { if (($disablebademail == 1 && !preg_match('/<.+@.+>/', $value)) || ($disablebademail == 2 && preg_match('/---/', $value))) { @@ -6431,8 +6430,7 @@ class Form } } - if ($key_in_label) - { + if ($key_in_label) { if (empty($nohtmlescape)) $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ?dol_trunc($value, $maxlen) : $value)); else $selectOptionValue = $key.' - '.($maxlen ?dol_trunc($value, $maxlen) : $value); } else { diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index d6f7b269da1..d8d365cf433 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -347,7 +347,7 @@ class FormAccounting extends Form // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of auxilary thirdparty accounts + * Return list of auxilary accounts. Cumulate list from customers, suppliers and users. * * @param string $selectid Preselected pcg_type * @param string $htmlname Name of field in html form @@ -372,7 +372,7 @@ class FormAccounting extends Form if ($resql) { while ($obj = $this->db->fetch_object($resql)) { if (!empty($obj->code_compta)) { - $aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->nom.')'; + $aux_account[$obj->code_compta] = $obj->code_compta.'
('.$obj->nom.')'; } } } else { @@ -392,7 +392,7 @@ class FormAccounting extends Form if ($resql) { while ($obj = $this->db->fetch_object($resql)) { if ($obj->code_compta_fournisseur != "") { - $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')'; + $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')'; } } } else { @@ -412,7 +412,7 @@ class FormAccounting extends Form if ($resql) { while ($obj = $this->db->fetch_object($resql)) { if (!empty($obj->accountancy_code)) { - $aux_account[$obj->accountancy_code] = $obj->accountancy_code.' ('.dolGetFirstLastname($obj->firstname, $obj->lastname).')'; + $aux_account[$obj->accountancy_code] = $obj->accountancy_code.' ('.dolGetFirstLastname($obj->firstname, $obj->lastname).')'; } } } else { From ea60a824eee8992225373b5d7c2c783e531b079e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Jan 2021 11:07:48 +0100 Subject: [PATCH 15/17] Comment --- htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index 23e7d489e09..cf7897bf7a2 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -51,6 +51,6 @@ CREATE TABLE llx_accounting_bookkeeping journal_label varchar(255), -- FEC:JournalLib date_validated datetime, -- FEC:ValidDate | if empty: movement not validated / if not empty: movement validated (No deleting / No modification) date_export datetime DEFAULT NULL, -- - import_key varchar(14), + import_key varchar(14), -- ID of import when data was inserted by a mass import extraparams varchar(255) -- for other parameters with json format ) ENGINE=innodb; From 1cf86931b3328ec36aab517c41b79a36b383ad09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Jan 2021 12:58:50 +0100 Subject: [PATCH 16/17] Fix graph of opportunity when a status has been removed. --- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/graph_opportunities.inc.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 6d2892cddad..67c78bf2915 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -216,6 +216,7 @@ Value=Value PersonalValue=Personal value NewObject=New %s NewValue=New value +OldValue=Old value %s CurrentValue=Current value Code=Code Type=Type diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 2bb9332c2ae..97977406a48 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -20,9 +20,8 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON p.fk_opp_status = cls.rowid"; // If lead status has been removed, we must show it in stats as unknown $sql .= " WHERE p.entity IN (".getEntity('project').")"; - $sql .= " AND p.fk_opp_status = cls.rowid"; $sql .= " AND p.fk_statut = 1"; // Opend projects only if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")"; if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; @@ -66,7 +65,15 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print '
'; print ''; print ''."\n"; + $listofstatus = array_keys($listofoppstatus); + // Complete with values found into database and not into the dictionary + foreach($valsamount as $key => $val) { + if (!in_array($key, $listofstatus)) { + $listofstatus[] = $key; + } + } + foreach ($listofstatus as $status) { $labelStatus = ''; @@ -74,6 +81,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code'); if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code); if (empty($labelStatus)) $labelStatus = $listofopplabel[$status]; + if (empty($labelStatus)) $labelStatus = $langs->transnoentitiesnoconv('OldValue', $status); // When id is id of an entry no more in dictionary for example. //$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')'; //$labelStatus .= ' - '.price2num($listofoppstatus[$status]).'%'; From 446e3b9a9d0c231f95d81f3799eb1b56782d27b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Jan 2021 13:26:54 +0100 Subject: [PATCH 17/17] css --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index a35ffbad1b5..c5820db60b7 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -768,7 +768,7 @@ if ($action == 'create' || $action == 'adduserldap') print ''; if (is_array($liste) && count($liste)) { - print $form->selectarray('users', $liste, '', 1); + print $form->selectarray('users', $liste, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth500'); print ajax_combobox('users'); } print '
'.$langs->trans("Statistics").' - '.$langs->trans("OpportunitiesStatusForOpenedProjects").'
';