From dbb50d7b169422cebe5838f2d9df8ad430751310 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 11:56:43 +0200 Subject: [PATCH 01/11] Fix PHP 7.2 --- htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 83306b95adb..0ee7c37e622 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -294,7 +294,7 @@ class pdf_soleil extends ModelePDFFicheinter $pageposafter=$pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - $pdf->writeHTMLCell(0, 0, $curX, $curY, $txt.'
'.$desc, LR, 1, 0); + $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); $pageposafter=$pdf->getPage(); $posyafter=$pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; From f0983353f23fd147ebc31f118cc191d9ed84664e Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Thu, 14 Sep 2017 12:01:35 +0200 Subject: [PATCH 02/11] Fix #7387 : filter clsed company when create new documents --- htdocs/commande/card.php | 2 +- htdocs/fourn/card.php | 29 +++++++++++++++++++++++++---- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/supplier_proposal/card.php | 2 +- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index c4bb0ace2f2..1826426bc21 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1513,7 +1513,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } else { print ''; - print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty'); + print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index b1a17f0a1e8..c8e31e78b4f 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -629,19 +629,40 @@ if ($object->id > 0) if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->creer) { $langs->load("supplier_proposal"); - print ''.$langs->trans("AddSupplierProposal").''; + if ($object->status == 1) + { + print ''.$langs->trans("AddSupplierProposal").''; + } + else + { + print ''.$langs->trans("AddSupplierProposal").''; + } } - if ($user->rights->fournisseur->commande->creer) + if ($user->rights->fournisseur->commande->creer) { $langs->load("orders"); - print ''.$langs->trans("AddOrder").''; + if ($object->status == 1) + { + print ''.$langs->trans("AddOrder").''; + } + else + { + print ''.$langs->trans("AddOrder").''; + } } if ($user->rights->fournisseur->facture->creer) { $langs->load("bills"); - print ''.$langs->trans("AddBill").''; + if ($object->status == 1) + { + print ''.$langs->trans("AddBill").''; + } + else + { + print ''.$langs->trans("AddBill").''; + } } if ($user->rights->fournisseur->facture->creer) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 74d96158f65..239e3e7a579 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1427,7 +1427,7 @@ if ($action=='create') } else { - print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1', 'SelectThirdParty'); + print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1 AND status=1', 'SelectThirdParty'); } print ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 8402b298f93..a17049d1128 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1480,7 +1480,7 @@ if ($action == 'create') } else { - print $form->select_company($societe->id, 'socid', 's.fournisseur = 1', 'SelectThirdParty'); + print $form->select_company($societe->id, 'socid', 's.fournisseur = 1 AND status=1', 'SelectThirdParty'); } print ''; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 26729ecf866..b5cbf772136 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1079,7 +1079,7 @@ if ($action == 'create') print ''; } else { print ''; - print $form->select_company('', 'socid', 's.fournisseur = 1', 'SelectThirdParty'); + print $form->select_company('', 'socid', 's.fournisseur = 1 AND status=1', 'SelectThirdParty'); print ''; } print '' . "\n"; From f16d88fd53f8e3250ecea3236287cc3106234b1a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 13:17:31 +0200 Subject: [PATCH 03/11] FIX #7391 --- htdocs/core/lib/functions.lib.php | 54 ++++++++++++++++++------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 57e4f612840..2c89bb6598b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5809,29 +5809,39 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0) $i3 = 0; foreach($tmpcrits as $tmpcrit) { - $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '') . $field . " LIKE '"; + $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); + + if (preg_match('/\.(id|rowid)$/', $field)) // Special cas for rowid that is sometimes a ref so used as a search field + { + $newres .= $field . " = " . (is_numeric(trim($tmpcrit))?trim($tmpcrit):'0'); + } + else + { + $newres .= $field . " LIKE '"; + + $tmpcrit=trim($tmpcrit); + $tmpcrit2=$tmpcrit; + $tmpbefore='%'; $tmpafter='%'; + if (preg_match('/^[\^\$]/', $tmpcrit)) + { + $tmpbefore=''; + $tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2); + } + if (preg_match('/[\^\$]$/', $tmpcrit)) + { + $tmpafter=''; + $tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2); + } + $newres .= $tmpbefore; + $newres .= $db->escape($tmpcrit2); + $newres .= $tmpafter; + $newres .= "'"; + if (empty($tmpcrit2)) + { + $newres .= ' OR ' . $field . " IS NULL"; + } + } - $tmpcrit=trim($tmpcrit); - $tmpcrit2=$tmpcrit; - $tmpbefore='%'; $tmpafter='%'; - if (preg_match('/^[\^\$]/', $tmpcrit)) - { - $tmpbefore=''; - $tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2); - } - if (preg_match('/[\^\$]$/', $tmpcrit)) - { - $tmpafter=''; - $tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2); - } - $newres .= $tmpbefore; - $newres .= $db->escape($tmpcrit2); - $newres .= $tmpafter; - $newres .= "'"; - if (empty($tmpcrit2)) - { - $newres .= ' OR ' . $field . " IS NULL"; - } $i3++; } $i2++; // a criteria was added to string From 2798726dbae8677b0ddf0bf35fb418c6f1c4c091 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 13:23:28 +0200 Subject: [PATCH 04/11] Update card.php --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 1826426bc21..4d8bc4335e5 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1513,7 +1513,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } else { print ''; - print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty'); + print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3)', 'SelectThirdParty'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { From 2de76d733b2b969128dc9e60f782313decdbb866 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 13:24:01 +0200 Subject: [PATCH 05/11] Update card.php --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 239e3e7a579..74d96158f65 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1427,7 +1427,7 @@ if ($action=='create') } else { - print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1 AND status=1', 'SelectThirdParty'); + print $form->select_company((empty($socid)?'':$socid), 'socid', 's.fournisseur = 1', 'SelectThirdParty'); } print ''; From d9947f237455b632ef9f2ab0a07ff904276142da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 13:24:24 +0200 Subject: [PATCH 06/11] Update card.php --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a17049d1128..8402b298f93 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1480,7 +1480,7 @@ if ($action == 'create') } else { - print $form->select_company($societe->id, 'socid', 's.fournisseur = 1 AND status=1', 'SelectThirdParty'); + print $form->select_company($societe->id, 'socid', 's.fournisseur = 1', 'SelectThirdParty'); } print ''; From 22b2446c05a9b03a8f48dfc07325e25c06ec358a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 13:25:01 +0200 Subject: [PATCH 07/11] Update card.php --- htdocs/supplier_proposal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index b5cbf772136..26729ecf866 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1079,7 +1079,7 @@ if ($action == 'create') print ''; } else { print ''; - print $form->select_company('', 'socid', 's.fournisseur = 1 AND status=1', 'SelectThirdParty'); + print $form->select_company('', 'socid', 's.fournisseur = 1', 'SelectThirdParty'); print ''; } print '' . "\n"; From 4bc8773417ed65ca93d2ea4001e3128fe78392a4 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Thu, 14 Sep 2017 13:52:39 +0200 Subject: [PATCH 08/11] decode db password if need --- htdocs/install/check.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index adbe7759f4e..5157d4a9e0a 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -306,7 +306,20 @@ else } else { - require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; + require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; + + // If password is encoded, we decode it + if (preg_match('/crypted:/i',$dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass)) + { + require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; + if (preg_match('/crypted:/i',$dolibarr_main_db_pass)) + { + $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); + $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); + $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted + } + else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); + } // $conf is already instancied inside inc.php $conf->db->type = $dolibarr_main_db_type; @@ -315,12 +328,12 @@ else $conf->db->name = $dolibarr_main_db_name; $conf->db->user = $dolibarr_main_db_user; $conf->db->pass = $dolibarr_main_db_pass; - $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); + $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); if ($db->connected && $db->database_selected) { $ok=true; } - } + } } } From 42399952ea17b958401365a8295f73aac556e905 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 14:48:44 +0200 Subject: [PATCH 09/11] Update check.php --- htdocs/install/check.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 5157d4a9e0a..c96e83ea1d4 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -314,9 +314,8 @@ else require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; if (preg_match('/crypted:/i',$dolibarr_main_db_pass)) { - $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); - $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); - $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted + $dolibarr_main_db_encrypted_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); // We need to set this as it is used to know the password was initially crypted + $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); } else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); } From 84359a0078bcd92515d74e42238319dab331dc6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 16:42:04 +0200 Subject: [PATCH 10/11] Fix maxlength of fields --- htdocs/public/members/new.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 03f24c3ec80..160d66491a1 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -500,13 +500,13 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) print ''; } // EMail -print ''.$langs->trans("Email").' *'."\n"; +print ''.$langs->trans("Email").' *'."\n"; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' *'."\n"; - print ''.$langs->trans("Password").' *'."\n"; - print ''.$langs->trans("PasswordAgain").' *'."\n"; + print ''.$langs->trans("Login").' *'."\n"; + print ''.$langs->trans("Password").' *'."\n"; + print ''.$langs->trans("PasswordAgain").' *'."\n"; } // Birthday print ''.$langs->trans("DateToBirth").''; From 5d920be880d1505416d6bfc2eaf24b7bb2b3c0b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Sep 2017 16:51:41 +0200 Subject: [PATCH 11/11] FIX Upgrade missing on field --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 76c8f6df672..cd535c5c119 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -60,6 +60,8 @@ ALTER TABLE llx_user DROP COLUMN phenix_login; ALTER TABLE llx_user DROP COLUMN phenix_pass; ALTER TABLE llx_user ADD COLUMN dateemployment datetime; +ALTER TABLE llx_user MODIFY login varchar(50) NOT NULL; + ALTER TABLE llx_societe ADD COLUMN fk_account integer; ALTER TABLE llx_commandedet ADD COLUMN fk_commandefourndet integer DEFAULT NULL after import_key; -- link to detail line of commande fourn (resplenish)