From 02942e844e5e94b4289caf96c29397244e7683a8 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 27 Oct 2022 15:26:40 +0200 Subject: [PATCH 1/8] Fix propal page reload : use thirdparty values --- htdocs/comm/propal/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index c737ea63ebe..64f58e4d705 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1635,13 +1635,13 @@ if ($action == 'create') { // Terms of payment print ''.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'paiment'); - $form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements((GETPOST('cond_reglement_id', 'int') > 0 ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); print ''; // Mode of payment print ''.$langs->trans('PaymentMode').''; print img_picto('', 'bank').' '; - $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); + $form->select_types_paiements((GETPOST('mode_reglement_id', 'int') > 0 ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Bank Account From f45f3740e2aa1517938bb62bb4e472ff45dfaf23 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 28 Oct 2022 08:10:39 +0200 Subject: [PATCH 2/8] FIX Accountancy - Review of Winfic - eWinfic - Winsis compta export format --- .../accountancy/class/accountancyexport.class.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index ec24af642fd..db58cb2ccbc 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -657,9 +657,12 @@ class AccountancyExport /** * Export format : WinFic - eWinfic - WinSis Compta + * Last review for this format : 2022-10-28 Alexandre Spangaro (aspangaro@open-dsi.fr) * + * Help : https://wiki.gestan.fr/lib/exe/fetch.php?media=wiki:v15:compta:accountancy-format_winfic-ewinfic-winsiscompta.pdf * * @param array $TData data + * * @return void */ public function exportWinfic(&$TData) @@ -679,7 +682,7 @@ class AccountancyExport $Tab = array(); //$Tab['type_ligne'] = 'M'; - $Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2); + $Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2), 2); //We use invoice date $data->doc_date not $date_ecriture which is the transfert date //maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ? @@ -688,11 +691,11 @@ class AccountancyExport $Tab['folio'] = ' 1'; - $Tab['num_ecriture'] = str_pad(self::trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT); + $Tab['num_ecriture'] = str_pad(dol_trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT); $Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); - $Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0'); + $Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6), 6, '0'); if ($data->sens == 'D') { $Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); @@ -704,9 +707,9 @@ class AccountancyExport $Tab['montant_crebit'] = str_pad(number_format($data->credit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); } - $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); + $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); - $Tab['lettrage'] = str_repeat(' ', 2); + $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left'), 2); $Tab['code_piece'] = str_repeat(' ', 5); From c4543eff73244ee05c7d5e502c24a6fac956acc6 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Fri, 28 Oct 2022 16:31:01 +0200 Subject: [PATCH 3/8] FIX: Fix the request SQL for transversal user, the join on usergroup table must be with getEntity('usergroup') and not other element --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/user/class/user.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a3a72d4894a..27b00377411 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2072,7 +2072,7 @@ abstract class CommonObject $sql .= " AND te.entity IS NOT NULL"; // Show all users } else { $sql .= " AND ug.fk_user = te.rowid"; - $sql .= " AND ug.entity IN (".getEntity($this->element).")"; + $sql .= " AND ug.entity IN (".getEntity('usergroup').")"; } } else { $sql .= ' AND te.entity IN ('.getEntity($this->element).')'; @@ -2142,7 +2142,7 @@ abstract class CommonObject $sql .= " AND te.entity IS NOT NULL"; // Show all users } else { $sql .= " AND ug.fk_user = te.rowid"; - $sql .= " AND ug.entity IN (".getEntity($this->element).")"; + $sql .= " AND ug.entity IN (".getEntity('usergroup').")"; } } else { $sql .= ' AND te.entity IN ('.getEntity($this->element).')'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 04eebd6b6c9..1543d579839 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3490,7 +3490,7 @@ class User extends CommonObject } else { $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; $sql .= " WHERE ((ug.fk_user = t.rowid"; - $sql .= " AND ug.entity IN (".getEntity('user')."))"; + $sql .= " AND ug.entity IN (".getEntity('usergroup')."))"; $sql .= " OR t.entity = 0)"; // Show always superadmin } } else { From 5888f376774ca613b6692d250da0e4be97081acc Mon Sep 17 00:00:00 2001 From: IC-faycal Date: Mon, 31 Oct 2022 13:53:26 +0100 Subject: [PATCH 4/8] FIX change in the communication status of the prospect --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 28c08631278..4f8618a883e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1452,7 +1452,7 @@ class Societe extends CommonObject $sql .= ",fk_effectif = ".($this->effectif_id > 0 ? ((int) $this->effectif_id) : "null"); if (isset($this->stcomm_id)) { - $sql .= ",fk_stcomm=".($this->stcomm_id > 0 ? ((int) $this->stcomm_id) : "0"); + $sql .= ",fk_stcomm=".($this->stcomm_id >= -1 ? ((int) $this->stcomm_id) : "0"); } if (isset($this->typent_id)) { $sql .= ",fk_typent = ".($this->typent_id > 0 ? ((int) $this->typent_id) : "0"); From 4bd9bdaccd509172cf7b483e6eefde78acf42338 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Nov 2022 07:56:24 +0100 Subject: [PATCH 5/8] FIX Accountancy - Review of Winfic - eWinfic - Winsis compta export format --- .../class/accountancyexport.class.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index db58cb2ccbc..022a8ecd3c0 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -657,7 +657,7 @@ class AccountancyExport /** * Export format : WinFic - eWinfic - WinSis Compta - * Last review for this format : 2022-10-28 Alexandre Spangaro (aspangaro@open-dsi.fr) + * Last review for this format : 2022-11-01 Alexandre Spangaro (aspangaro@open-dsi.fr) * * Help : https://wiki.gestan.fr/lib/exe/fetch.php?media=wiki:v15:compta:accountancy-format_winfic-ewinfic-winsiscompta.pdf * @@ -670,10 +670,14 @@ class AccountancyExport global $conf; $end_line = "\r\n"; + $index = 1; //We should use dol_now function not time however this is wrong date to transfert in accounting //$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy //$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy + + // Warning ! When truncation is necessary, no dot because 3 dots = three characters. The columns are shifted + foreach ($TData as $data) { $code_compta = $data->numero_compte; if (!empty($data->subledger_account)) { @@ -691,11 +695,11 @@ class AccountancyExport $Tab['folio'] = ' 1'; - $Tab['num_ecriture'] = str_pad(dol_trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT); + $Tab['num_ecriture'] = str_pad(dol_trunc($index, 6), 6, ' ', STR_PAD_LEFT); $Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); - $Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6), 6, '0'); + $Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6, 'right', 'UTF-8', 1), 6, '0'); if ($data->sens == 'D') { $Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); @@ -707,11 +711,11 @@ class AccountancyExport $Tab['montant_crebit'] = str_pad(number_format($data->credit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); } - $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); + $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30, 'right', 'UTF-8', 1), 30); $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left'), 2); - $Tab['code_piece'] = str_repeat(' ', 5); + $Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5), 5, ' ', STR_PAD_LEFT); $Tab['code_stat'] = str_repeat(' ', 4); @@ -735,6 +739,8 @@ class AccountancyExport $Tab['end_line'] = $end_line; print implode('|', $Tab); + + $index++; } } From d3d55240f911cbf98878e935dd107b02ea8952da Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Nov 2022 08:00:37 +0100 Subject: [PATCH 6/8] FIX Accountancy - Review of Winfic - eWinfic - Winsis compta export format --- htdocs/accountancy/class/accountancyexport.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 022a8ecd3c0..73035c55d5d 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -686,7 +686,7 @@ class AccountancyExport $Tab = array(); //$Tab['type_ligne'] = 'M'; - $Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2), 2); + $Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2, 'right', 'UTF-8', 1), 2); //We use invoice date $data->doc_date not $date_ecriture which is the transfert date //maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ? @@ -695,7 +695,7 @@ class AccountancyExport $Tab['folio'] = ' 1'; - $Tab['num_ecriture'] = str_pad(dol_trunc($index, 6), 6, ' ', STR_PAD_LEFT); + $Tab['num_ecriture'] = str_pad(dol_trunc($index, 6, 'right', 'UTF-8', 1), 6, ' ', STR_PAD_LEFT); $Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); @@ -713,9 +713,9 @@ class AccountancyExport $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30, 'right', 'UTF-8', 1), 30); - $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left'), 2); + $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left', 'UTF-8', 1), 2); - $Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5), 5, ' ', STR_PAD_LEFT); + $Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5, 'left', 'UTF-8', 1), 5, ' ', STR_PAD_LEFT); $Tab['code_stat'] = str_repeat(' ', 4); From 8e9be8f40fbf541b2abdcc519a975e617d53878e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Nov 2022 23:33:08 +0100 Subject: [PATCH 7/8] Update card.php --- htdocs/comm/propal/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 64f58e4d705..da4c756705f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1635,13 +1635,13 @@ if ($action == 'create') { // Terms of payment print ''.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'paiment'); - $form->select_conditions_paiements((GETPOST('cond_reglement_id', 'int') > 0 ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements(((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') > 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); print ''; // Mode of payment print ''.$langs->trans('PaymentMode').''; print img_picto('', 'bank').' '; - $form->select_types_paiements((GETPOST('mode_reglement_id', 'int') > 0 ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); + $form->select_types_paiements(((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') > 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Bank Account From ff16d74bd2975d207ed45fca66fc1caaff3065ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 00:00:02 +0100 Subject: [PATCH 8/8] FIX install wizard error management --- htdocs/install/step5.php | 82 ++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index b841edb12ac..27bce2d8e57 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -220,9 +220,9 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."
"; $success = 1; } else { - if ($newuser->error == 'ErrorLoginAlreadyExists') { + if ($result == -6) { //login or email already exists dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING); - print '
'.$langs->trans("AdminLoginAlreadyExists", $login)."

"; + print '
'.$newuser->error."

"; $success = 1; } else { dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR); @@ -357,48 +357,50 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { // Create lock file // If first install -if ($action == "set" && $success) { - if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) { - // Install is finished - print $langs->trans("SystemIsInstalled")."
"; +if ($action == "set") { + if ($success) { + if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) { + // Install is finished + print $langs->trans("SystemIsInstalled")."
"; - $createlock = 0; + $createlock = 0; - if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) { - // Install is finished, we create the lock file - $lockfile = DOL_DATA_ROOT.'/install.lock'; - $fp = @fopen($lockfile, "w"); - if ($fp) { - if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) { - $force_install_lockinstall = 444; // For backward compatibility + if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) { + // Install is finished, we create the lock file + $lockfile = DOL_DATA_ROOT.'/install.lock'; + $fp = @fopen($lockfile, "w"); + if ($fp) { + if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) { + $force_install_lockinstall = 444; // For backward compatibility + } + fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); + fclose($fp); + @chmod($lockfile, octdec($force_install_lockinstall)); + $createlock = 1; } - fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); - fclose($fp); - @chmod($lockfile, octdec($force_install_lockinstall)); - $createlock = 1; } + if (empty($createlock)) { + print '
'.$langs->trans("WarningRemoveInstallDir")."
"; + } + + print "
"; + + print $langs->trans("YouNeedToPersonalizeSetup")."


"; + + print ''; + } else { + // If here MAIN_VERSION_LAST_UPGRADE is not empty + print $langs->trans("VersionLastUpgrade").': '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'; + print $langs->trans("VersionProgram").': '.DOL_VERSION.'
'; + print $langs->trans("MigrationNotFinished").'
'; + print "
"; + + print ''; } - if (empty($createlock)) { - print '
'.$langs->trans("WarningRemoveInstallDir")."
"; - } - - print "
"; - - print $langs->trans("YouNeedToPersonalizeSetup")."


"; - - print ''; - } else { - // If here MAIN_VERSION_LAST_UPGRADE is not empty - print $langs->trans("VersionLastUpgrade").': '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'; - print $langs->trans("VersionProgram").': '.DOL_VERSION.'
'; - print $langs->trans("MigrationNotFinished").'
'; - print "
"; - - print ''; } } elseif (empty($action) || preg_match('/upgrade/i', $action)) { // If upgrade @@ -443,7 +445,7 @@ if ($action == "set" && $success) { $morehtml .= ''; } } else { - dol_print_error('', 'step5.php: unknown choice of action'); + dol_print_error('', 'step5.php: unknown choice of action='.$action.' in create lock file seaction'); } // Clear cache files