From d92096f74a67dd96557a15a33140246ac936863c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Aug 2018 02:04:38 +0200 Subject: [PATCH 01/12] Fix menu payment not required if only module bank on --- htdocs/core/menus/standard/eldy.lib.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 2ad176fff91..695e7c4ca7f 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -150,11 +150,10 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode if (! empty($conf->salaries->enabled)) $menuqualified++; if (! empty($conf->supplier_invoice->enabled)) $menuqualified++; if (! empty($conf->loan->enabled)) $menuqualified++; - if (! empty($conf->banque->enabled)) $menuqualified++; $tmpentry=array( 'enabled'=>$menuqualified, - 'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read) || ! empty($user->rights->banque->lire)), - 'module'=>'facture|supplier_invoice|don|tax|salaries|loan|banque'); + 'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)), + 'module'=>'facture|supplier_invoice|don|tax|salaries|loan'); $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); if ($showmode) { From c6adeabb557b7192548cb1186ab3b8896e628d6a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 13 Aug 2018 12:22:51 +0200 Subject: [PATCH 02/12] Fix dolibarr_set_const --- htdocs/public/stripe/ipn.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 7d2c8d47ff6..13ba40c6981 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -1,5 +1,5 @@ * * 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 +26,7 @@ if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.p if (! $res) die("Include of main fails"); if (empty($conf->stripe->enabled)) accessforbidden('',0,0,1); +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php'; require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; @@ -143,7 +144,7 @@ if ($event->type == 'payout.created') { elseif ($event->type == 'payout.paid') { global $conf; $error=0; - $result=dolibarr_set_const($db, $service."_NEXTPAYOUT",null,'chaine',0,'',$conf->entity); + $result=dolibarr_set_const($db, $servicestatus."_NEXTPAYOUT",null,'chaine',0,'',1); if ($result) { $langs->load("errors"); From b977c3a9f50e73de5f629b015a50e590d87aef0d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Aug 2018 14:04:10 +0200 Subject: [PATCH 03/12] Fix translation --- htdocs/compta/facture/card.php | 6 ++---- htdocs/fourn/facture/card.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 45e94d1e5d3..f33c41b4c86 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4028,8 +4028,6 @@ else if ($id > 0 || ! empty($ref)) print ''; - // List of previous situation invoices - $sign = 1; if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1; $nbrows = 8; @@ -4370,7 +4368,7 @@ else if ($id > 0 || ! empty($ref)) } else // Credit note { - $cssforamountpaymentcomplete=''; + $cssforamountpaymentcomplete='amountpaymentneutral'; // Total already paid back print ''; @@ -4385,7 +4383,7 @@ else if ($id > 0 || ! empty($ref)) if ($resteapayeraffiche <= 0) print $langs->trans('RemainderToPayBack'); else - print $langs->trans('ExcessPaydBack'); + print $langs->trans('ExcessPaid'); print ' :'; print '' . price($sign * $resteapayeraffiche) . ''; print ' '; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index d409ba35b86..7032f80574c 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2898,7 +2898,7 @@ else if ($resteapayeraffiche <= 0) print $langs->trans('RemainderToPayBack'); else - print $langs->trans('ExcessPaydBack'); + print $langs->trans('ExcessPaid'); print ' :'; print '' . price($sign * $resteapayeraffiche) . ''; print ' '; From d0666a9583619dff9b579917b702c339659ec40b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 13 Aug 2018 14:34:54 +0200 Subject: [PATCH 04/12] Fix incorrect entity --- htdocs/public/stripe/ipn.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 13ba40c6981..ad6aee43bd4 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -124,7 +124,7 @@ $stripe=new Stripe($db); if ($event->type == 'payout.created') { $error=0; - $result=dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s',$event->data->object->arrival_date), 'chaine', 0, '', $conf->entity); + $result=dolibarr_set_const($db, $servicestatus."_NEXTPAYOUT", date('Y-m-d H:i:s',$event->data->object->arrival_date), 'chaine', 0, '', $conf->entity); if ($result > 0) { @@ -144,7 +144,7 @@ if ($event->type == 'payout.created') { elseif ($event->type == 'payout.paid') { global $conf; $error=0; - $result=dolibarr_set_const($db, $servicestatus."_NEXTPAYOUT",null,'chaine',0,'',1); + $result=dolibarr_set_const($db, $servicestatus."_NEXTPAYOUT",null,'chaine',0,'',$conf->entity); if ($result) { $langs->load("errors"); From df57bd176bf2b7325efd7e12a76ab9d2aa5d4520 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Aug 2018 14:53:04 +0200 Subject: [PATCH 05/12] Fix translation --- htdocs/langs/en_US/agenda.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index f1e17a43cfe..9c1a0a35837 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -35,7 +35,7 @@ AgendaAutoActionDesc= Define here events for which you want Dolibarr to create a AgendaSetupOtherDesc= This page provides options to allow export of your Dolibarr events into an external calendar (thunderbird, google calendar, ...) AgendaExtSitesDesc=This page allows to declare external sources of calendars to see their events into Dolibarr agenda. ActionsEvents=Events for which Dolibarr will create an action in agenda automatically -EventRemindersByEmailNotEnabled=Event reminders by email was not enabled into Agenda module setup. +EventRemindersByEmailNotEnabled=Event reminders by email was not enabled into %s module setup. ##### Agenda event labels ##### NewCompanyToDolibarr=Third party %s created ContractValidatedInDolibarr=Contract %s validated From f96dd391fa2891612d77cb294d81cf1ac48db791 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Aug 2018 16:11:23 +0200 Subject: [PATCH 06/12] Fix error in foreign key pointing to old table --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 530070c8252..a3bed1fd332 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -32,6 +32,10 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +-- Forgot in < 4.0 + +ALTER TABLE llx_c_ziptown DROP FOREIGN KEY fk_c_ziptown_fk_pays; +ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country(rowid); -- Forgot in 7.0 @@ -48,6 +52,8 @@ ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (filepath, filename, ent UPDATE llx_const set name = __ENCRYPT('INVOICE_FREE_TEXT')__ where name = __ENCRYPT('FACTURE_FREE_TEXT')__; +fk_c_ziptown_fk_pays + -- drop very old table (bad name) DROP TABLE llx_c_accountancy_category; From 33f0172603e62f237b7159c30d334838df1ef9f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Aug 2018 16:44:49 +0200 Subject: [PATCH 07/12] Fix select zip/town --- htdocs/core/ajax/ziptown.php | 1 + htdocs/core/class/html.formcompany.class.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php index 9fa475039d9..2100d3d3600 100644 --- a/htdocs/core/ajax/ziptown.php +++ b/htdocs/core/ajax/ziptown.php @@ -120,6 +120,7 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) $row_array['selectcountry_id'] = $row['fk_country']; $row_array['state_id'] = $row['fk_county']; + // TODO Use a cache here to avoid to make select_state in each pass (this make a SQL and lot of logs) $row_array['states'] = $formcompany->select_state('',$row['fk_country'],''); array_push($return_arr,$row_array); diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 86105133c4c..f04cfad54bc 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -203,7 +203,7 @@ class FormCompany * * @param string $selected Code state preselected (mus be state id) * @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show - * @param string $htmlname Id of department + * @param string $htmlname Id of department. If '', we want only the string with