From 5ed01f67336769d867de5a900200e6cbcdb5ebb6 Mon Sep 17 00:00:00 2001 From: Givriz Date: Sat, 3 Apr 2021 17:09:14 +0200 Subject: [PATCH 01/20] Fix errors phpv8 --- htdocs/admin/company.php | 2 +- htdocs/admin/delais.php | 2 +- htdocs/admin/mails.php | 36 ++++++++++--------- .../core/boxes/box_dolibarr_state_board.php | 2 +- htdocs/core/lib/admin.lib.php | 4 +-- htdocs/core/modules/modDataPolicy.class.php | 2 +- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index d8af6ac1b4f..15f4a27c8c7 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -666,7 +666,7 @@ print ''.$langs->trans("FiscalYearInformation").'\n"; print ''; -print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').''; +print (isset($conf->global->SOCIETE_FISCAL_MONTH_START) ? $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100') : '').''; print ""; print '
'; diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 4fe21a8460b..71783b2a319 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -289,7 +289,7 @@ if ($action == 'edit') { print '
'; -if ($conf->global->MAIN_DISABLE_METEO != 1) { +if (isset($conf->global->MAIN_DISABLE_METEO) && $conf->global->MAIN_DISABLE_METEO != 1) { // Show logo for weather print ''.$langs->trans("DescWeather").' '; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 72d16569b25..ac23480bd4d 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -48,7 +48,7 @@ $substitutionarrayfortest = array( '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, '__ID__' => 'RecipientIdRecord', //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails - '__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty)) ? '' : '', + '__CHECK_READ__' => (isset($object->thirdparty) && is_object($object) && is_object($object->thirdparty)) ? '' : '', '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails '__LOGIN__' => 'RecipientLogin', '__LASTNAME__' => 'RecipientLastname', @@ -554,7 +554,7 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; // Disable - print ''.$langs->trans("MAIN_DISABLE_ALL_MAILS").''.yn($conf->global->MAIN_DISABLE_ALL_MAILS); + print ''.$langs->trans("MAIN_DISABLE_ALL_MAILS").''.(isset($conf->global->MAIN_DISABLE_ALL_MAILS) ? yn($conf->global->MAIN_DISABLE_ALL_MAILS) : ''); if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { print img_warning($langs->trans("Disabled")); } @@ -737,26 +737,28 @@ if ($action == 'edit') { print ''.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; print ''; - if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') { - print $langs->trans('RobotEmail'); - } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') { - print $langs->trans('UserEmail'); - } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') { - print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); - } else { - $id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE); - if ($id > 0) { - include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php'; - $emailsenderprofile = new EmailSenderProfile($db); - $emailsenderprofile->fetch($id); - print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>'); + if (isset($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)) { + if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') { + print $langs->trans('RobotEmail'); + } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') { + print $langs->trans('UserEmail'); + } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') { + print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); + } else { + $id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE); + if ($id > 0) { + include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php'; + $emailsenderprofile = new EmailSenderProfile($db); + $emailsenderprofile->fetch($id); + print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>'); + } } } print ''; // Errors To print ''.$langs->trans("MAIN_MAIL_ERRORS_TO").''; - print ''.$conf->global->MAIN_MAIL_ERRORS_TO; + print ''.(isset($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : ''); if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) { print img_warning($langs->trans("ErrorBadEMail")); } @@ -776,7 +778,7 @@ if ($action == 'edit') { print ''; //Add user to select destinaries list - print ''.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").''.yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT).''; + print ''.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").''.(isset($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT) ? yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT) : '').''; print ''; print ''; diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 7d4a290f0bc..0d2356c00ac 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -66,7 +66,7 @@ class box_dolibarr_state_board extends ModeleBoxes $this->enabled = 0; // disabled by this option } - $this->hidden = !($user->rights->societe->lire && empty($user->socid)); + $this->hidden = !(isset($user->rights->societe->lire) && empty($user->socid)); } /** diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 3088db079e3..6769fa9ccad 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1885,14 +1885,14 @@ function email_admin_prepare_head() $head[$h][2] = 'common'; $h++; - if ($conf->mailing->enabled) { + if (isset($conf->mailing->enabled)) { $head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php"; $head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv("EMailing")); $head[$h][2] = 'common_emailing'; $h++; } - if ($conf->ticket->enabled) { + if (isset($conf->ticket->enabled)) { $head[$h][0] = DOL_URL_ROOT."/admin/mails_ticket.php"; $head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv("Ticket")); $head[$h][2] = 'common_ticket'; diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php index 0e2027494e7..05eaf9920bd 100644 --- a/htdocs/core/modules/modDataPolicy.class.php +++ b/htdocs/core/modules/modDataPolicy.class.php @@ -132,7 +132,7 @@ class modDataPolicy extends DolibarrModules { array('DATAPOLICY_ADHERENT', 'chaine', '', $langs->trans('NUMBER_MONTH_BEFORE_DELETION'), 0), ); - $country = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); + if (isset($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $country = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); // Some keys to add into the overwriting translation tables /* $this->overwrite_translation = array( From 1bac38eef29f1688572df63648fe99ab6c9d1b7d Mon Sep 17 00:00:00 2001 From: Damien BENOIT <48482664+Givriz@users.noreply.github.com> Date: Sun, 4 Apr 2021 18:24:58 +0200 Subject: [PATCH 02/20] Update company.php --- htdocs/admin/company.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 15f4a27c8c7..138cfdad4e0 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -666,7 +666,7 @@ print ''.$langs->trans("FiscalYearInformation").'\n"; print ''; -print (isset($conf->global->SOCIETE_FISCAL_MONTH_START) ? $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START, 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100') : '').''; +print $formother->select_month(isset($conf->global->SOCIETE_FISCAL_MONTH_START) ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').''; print ""; print '
'; From ac2cca51c0b41098d8b1d7493a287a8a09038f3d Mon Sep 17 00:00:00 2001 From: Damien BENOIT <48482664+Givriz@users.noreply.github.com> Date: Wed, 7 Apr 2021 19:37:17 +0200 Subject: [PATCH 03/20] Update delais.php --- htdocs/admin/delais.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 71783b2a319..b0c1cc5398b 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -289,7 +289,7 @@ if ($action == 'edit') { print '
'; -if (isset($conf->global->MAIN_DISABLE_METEO) && $conf->global->MAIN_DISABLE_METEO != 1) { +if (!isset($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO != 1) { // Show logo for weather print ''.$langs->trans("DescWeather").' '; From 7a54e5d346de63526518c3f0c331d4e5304f2980 Mon Sep 17 00:00:00 2001 From: Givriz Date: Mon, 12 Apr 2021 16:03:56 +0200 Subject: [PATCH 04/20] Using empty instead of isset I used empty instead of isset, and I fixed some problems of my previous pull request --- htdocs/admin/company.php | 2 +- htdocs/admin/delais.php | 4 +-- htdocs/admin/mails.php | 36 +++++++++---------- .../core/boxes/box_dolibarr_state_board.php | 2 +- htdocs/core/lib/admin.lib.php | 4 +-- htdocs/core/modules/modDataPolicy.class.php | 3 +- 6 files changed, 25 insertions(+), 26 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 138cfdad4e0..0c6da346285 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -666,7 +666,7 @@ print ''.$langs->trans("FiscalYearInformation").'\n"; print ''; -print $formother->select_month(isset($conf->global->SOCIETE_FISCAL_MONTH_START) ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').''; +print $formother->select_month(!empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').''; print ""; print '
'; diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index b0c1cc5398b..00f05152a86 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -289,7 +289,7 @@ if ($action == 'edit') { print '
'; -if (!isset($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO != 1) { +if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO != 1) { // Show logo for weather print ''.$langs->trans("DescWeather").' '; @@ -302,7 +302,7 @@ if (!isset($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_MET $str_mode_enabled = $str_mode_percentage; } print ''.$str_mode_enabled.''; - print ''; + print ''; print '

'; } else { diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index ac23480bd4d..78b4012a6a2 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -48,7 +48,7 @@ $substitutionarrayfortest = array( '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, '__ID__' => 'RecipientIdRecord', //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails - '__CHECK_READ__' => (isset($object->thirdparty) && is_object($object) && is_object($object->thirdparty)) ? '' : '', + '__CHECK_READ__' => (is_object($object) && !empty($object->thirdparty) && is_object($object->thirdparty)) ? '' : '', '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails '__LOGIN__' => 'RecipientLogin', '__LASTNAME__' => 'RecipientLastname', @@ -554,7 +554,7 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; // Disable - print ''.$langs->trans("MAIN_DISABLE_ALL_MAILS").''.(isset($conf->global->MAIN_DISABLE_ALL_MAILS) ? yn($conf->global->MAIN_DISABLE_ALL_MAILS) : ''); + print ''.$langs->trans("MAIN_DISABLE_ALL_MAILS").''.yn(!empty($conf->global->MAIN_DISABLE_ALL_MAILS)); if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { print img_warning($langs->trans("Disabled")); } @@ -737,28 +737,26 @@ if ($action == 'edit') { print ''.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; print ''; - if (isset($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)) { - if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') { - print $langs->trans('RobotEmail'); - } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') { - print $langs->trans('UserEmail'); - } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') { - print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); - } else { - $id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE); - if ($id > 0) { - include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php'; - $emailsenderprofile = new EmailSenderProfile($db); - $emailsenderprofile->fetch($id); - print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>'); - } + if (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) === 'robot') { + print $langs->trans('RobotEmail'); + } elseif (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) === 'user') { + print $langs->trans('UserEmail'); + } elseif (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) === 'company') { + print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); + } else { + $id = preg_replace('/senderprofile_/', '', !empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : ''); + if ($id > 0) { + include_once DOL_DOCUMENT_ROOT.'/core/class/emailsenderprofile.class.php'; + $emailsenderprofile = new EmailSenderProfile($db); + $emailsenderprofile->fetch($id); + print $emailsenderprofile->label.' '.dol_escape_htmltag('<'.$emailsenderprofile->email.'>'); } } print ''; // Errors To print ''.$langs->trans("MAIN_MAIL_ERRORS_TO").''; - print ''.(isset($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : ''); + print ''.(!empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : ''); if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) { print img_warning($langs->trans("ErrorBadEMail")); } @@ -778,7 +776,7 @@ if ($action == 'edit') { print ''; //Add user to select destinaries list - print ''.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").''.(isset($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT) ? yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT) : '').''; + print ''.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").''.yn(!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)).''; print ''; print ''; diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 0d2356c00ac..3ff31a0df96 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -66,7 +66,7 @@ class box_dolibarr_state_board extends ModeleBoxes $this->enabled = 0; // disabled by this option } - $this->hidden = !(isset($user->rights->societe->lire) && empty($user->socid)); + $this->hidden = !(!empty($user->rights->societe->lire) && empty($user->socid)); } /** diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 6769fa9ccad..93d09fa2255 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1885,14 +1885,14 @@ function email_admin_prepare_head() $head[$h][2] = 'common'; $h++; - if (isset($conf->mailing->enabled)) { + if (!empty($conf->mailing->enabled)) { $head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php"; $head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv("EMailing")); $head[$h][2] = 'common_emailing'; $h++; } - if (isset($conf->ticket->enabled)) { + if (!empty($conf->ticket->enabled)) { $head[$h][0] = DOL_URL_ROOT."/admin/mails_ticket.php"; $head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv("Ticket")); $head[$h][2] = 'common_ticket'; diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php index 05eaf9920bd..34388540831 100644 --- a/htdocs/core/modules/modDataPolicy.class.php +++ b/htdocs/core/modules/modDataPolicy.class.php @@ -132,7 +132,8 @@ class modDataPolicy extends DolibarrModules { array('DATAPOLICY_ADHERENT', 'chaine', '', $langs->trans('NUMBER_MONTH_BEFORE_DELETION'), 0), ); - if (isset($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $country = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); + $country = array(); + if (!empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $country = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); // Some keys to add into the overwriting translation tables /* $this->overwrite_translation = array( From 9abc7a5b0dfc5431c14450cb788c2c057a35849f Mon Sep 17 00:00:00 2001 From: Damien BENOIT <48482664+Givriz@users.noreply.github.com> Date: Mon, 12 Apr 2021 16:16:48 +0200 Subject: [PATCH 05/20] Update modDataPolicy.class.php --- htdocs/core/modules/modDataPolicy.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php index 34388540831..adccd49ba37 100644 --- a/htdocs/core/modules/modDataPolicy.class.php +++ b/htdocs/core/modules/modDataPolicy.class.php @@ -132,8 +132,7 @@ class modDataPolicy extends DolibarrModules { array('DATAPOLICY_ADHERENT', 'chaine', '', $langs->trans('NUMBER_MONTH_BEFORE_DELETION'), 0), ); - $country = array(); - if (!empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $country = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); + if (!empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $country = explode(":", !empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY) ? $conf->global->MAIN_INFO_SOCIETE_COUNTRY : ''); // Some keys to add into the overwriting translation tables /* $this->overwrite_translation = array( From 22d48c9cb60869aeba878f8c97b3ebd157b33235 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 00:03:33 +0200 Subject: [PATCH 06/20] Update list.php --- htdocs/comm/propal/list.php | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index d45b17447d5..36b7de65842 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -217,7 +217,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $permissiontoread = $user->rights->propal->lire; $permissiontoadd = $user->rights->propal->write; $permissiontodelete = $user->rights->propal->supprimer; -$permissiontoclose = $user->rights->propal->cloturer; +$permissiontovalidate = $user->rights->propale->propal_advance->validate; +$permissiontoclose = $user->rights->propale->propal_advance->close; @@ -298,7 +299,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } -if ($action == 'validate' && $permissiontoadd) { +if ($action == 'validate' && $permissiontovalidate) { if (GETPOST('confirm') == 'yes') { $tmpproposal = new Propal($db); $db->begin(); @@ -316,9 +317,10 @@ if ($action == 'validate' && $permissiontoadd) { setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors'); $error++; } + }else{ + dol_print_error($db); + $error++; } - dol_print_error($db); - $error++; } if ($error) { $db->rollback(); @@ -815,18 +817,20 @@ if ($resql) { // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>$langs->trans("ReGeneratePDF"), - 'builddoc'=>$langs->trans("PDFMerge"), - 'presend'=>$langs->trans("SendByMail"), - 'prevalidate'=>$langs->trans("Validate"), + 'generate_doc'=>img_picto('', 'pdf').' '.$langs->trans("ReGeneratePDF"), + 'builddoc'=>img_picto('', 'pdf').' '.$langs->trans("PDFMerge"), + 'presend'=>img_picto('', 'email').' '.$langs->trans("SendByMail"), ); - if ($user->rights->propal->cloturer) { - $arrayofmassactions['presign']=$langs->trans("Sign"); - $arrayofmassactions['nopresign']=$langs->trans("NoSign"); - $arrayofmassactions['setbilled'] = $langs->trans("ClassifyBilled"); + if ($permissiontovalidate) { + $arrayofmassactions['prevalidate']=img_picto('', 'check').' '.$langs->trans("Validate"); } - if ($user->rights->propal->supprimer) { - $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); + if ($permissiontoclose) { + $arrayofmassactions['presign']=img_picto('', 'propal').' '.$langs->trans("Sign"); + $arrayofmassactions['nopresign']=img_picto('', 'propal').' '.$langs->trans("NoSign"); + $arrayofmassactions['setbilled'] =img_picto('', 'bill').' '.$langs->trans("ClassifyBilled"); + } + if ($permissiontodelete) { + $arrayofmassactions['predelete'] = ''.img_picto('', 'fa-trash').$langs->trans("Delete"); } if (in_array($massaction, array('presend', 'predelete', 'closed'))) { From 29dd2e4b67edba0c6109997de62f91dbc90064db Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 00:07:29 +0200 Subject: [PATCH 07/20] Update list.php --- htdocs/comm/propal/list.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 36b7de65842..78cb69c9871 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -217,8 +217,14 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $permissiontoread = $user->rights->propal->lire; $permissiontoadd = $user->rights->propal->write; $permissiontodelete = $user->rights->propal->supprimer; -$permissiontovalidate = $user->rights->propale->propal_advance->validate; -$permissiontoclose = $user->rights->propale->propal_advance->close; +if (!empty(MAIN_USE_ADVANCED_PERMS)){ + $permissiontovalidate = $user->rights->propale->propal_advance->validate; + $permissiontoclose = $user->rights->propale->propal_advance->close; +}else{ + $permissiontovalidate = $user->rights->propal->write; + $permissiontoclose = $user->rights->propal->write; +} + From 78b08586e3209a67f29cd8aa3df683f2e59be846 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 13 Apr 2021 22:11:04 +0000 Subject: [PATCH 08/20] Fixing style errors. --- htdocs/comm/propal/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 78cb69c9871..50572c637f7 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -217,10 +217,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $permissiontoread = $user->rights->propal->lire; $permissiontoadd = $user->rights->propal->write; $permissiontodelete = $user->rights->propal->supprimer; -if (!empty(MAIN_USE_ADVANCED_PERMS)){ +if (!empty(MAIN_USE_ADVANCED_PERMS)) { $permissiontovalidate = $user->rights->propale->propal_advance->validate; $permissiontoclose = $user->rights->propale->propal_advance->close; -}else{ +} else { $permissiontovalidate = $user->rights->propal->write; $permissiontoclose = $user->rights->propal->write; } @@ -323,7 +323,7 @@ if ($action == 'validate' && $permissiontovalidate) { setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors'); $error++; } - }else{ + } else { dol_print_error($db); $error++; } From 9e40b8bf4c4a147b049c5840ddd77dc0cdea022d Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 00:27:46 +0200 Subject: [PATCH 09/20] Update list.php --- 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 78cb69c9871..6c603da2602 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -836,7 +836,7 @@ if ($resql) { $arrayofmassactions['setbilled'] =img_picto('', 'bill').' '.$langs->trans("ClassifyBilled"); } if ($permissiontodelete) { - $arrayofmassactions['predelete'] = ''.img_picto('', 'fa-trash').$langs->trans("Delete"); + $arrayofmassactions['predelete'] = img_picto('', 'delete').' '.img_picto('', 'fa-trash').$langs->trans("Delete"); } if (in_array($massaction, array('presend', 'predelete', 'closed'))) { From 992cf0a091ff567ed68c9d9ba61ff0cdc9bd5fd0 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 00:29:06 +0200 Subject: [PATCH 10/20] Update list.php --- 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 9ee4fb8a926..1efc0f998e5 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -836,7 +836,7 @@ if ($resql) { $arrayofmassactions['setbilled'] =img_picto('', 'bill').' '.$langs->trans("ClassifyBilled"); } if ($permissiontodelete) { - $arrayofmassactions['predelete'] = img_picto('', 'delete').' '.img_picto('', 'fa-trash').$langs->trans("Delete"); + $arrayofmassactions['predelete'] = img_picto('', 'delete').' '$langs->trans("Delete"); } if (in_array($massaction, array('presend', 'predelete', 'closed'))) { From c7d0ff94f95bda8a2522f1add6d8258a06b1e422 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 01:03:32 +0200 Subject: [PATCH 11/20] Update list.php --- htdocs/comm/propal/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 1efc0f998e5..ff01a55b4ab 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -14,6 +14,7 @@ * Copyright (C) 2017-2018 Charlene Benke * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Alexandre Spangaro + * Copyright (C) 2021 Anthony Berton * * 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 From e1557b15ee45e6f3ccb87791d419256a3abdec57 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 01:12:20 +0200 Subject: [PATCH 12/20] Update list.php --- 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 ff01a55b4ab..6720af5a83b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -14,7 +14,7 @@ * Copyright (C) 2017-2018 Charlene Benke * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Alexandre Spangaro - * Copyright (C) 2021 Anthony Berton + * Copyright (C) 2021 Anthony Berton * * 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 From 5a68718eb2329b3b9418571bf8b5f63a4fb0bf47 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 02:32:39 +0200 Subject: [PATCH 13/20] Update list.php --- htdocs/comm/propal/list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 6720af5a83b..469489fa88e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -218,9 +218,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $permissiontoread = $user->rights->propal->lire; $permissiontoadd = $user->rights->propal->write; $permissiontodelete = $user->rights->propal->supprimer; -if (!empty(MAIN_USE_ADVANCED_PERMS)) { +if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $permissiontovalidate = $user->rights->propale->propal_advance->validate; $permissiontoclose = $user->rights->propale->propal_advance->close; + $permissiontosendbymail = $user->rights->propale->propal_advance->send; } else { $permissiontovalidate = $user->rights->propal->write; $permissiontoclose = $user->rights->propal->write; @@ -837,7 +838,7 @@ if ($resql) { $arrayofmassactions['setbilled'] =img_picto('', 'bill').' '.$langs->trans("ClassifyBilled"); } if ($permissiontodelete) { - $arrayofmassactions['predelete'] = img_picto('', 'delete').' '$langs->trans("Delete"); + $arrayofmassactions['predelete'] = img_picto('', 'delete').' '.$langs->trans("Delete"); } if (in_array($massaction, array('presend', 'predelete', 'closed'))) { From 3b2a27de1640b864339496b17eef27b0a012609e Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 02:35:39 +0200 Subject: [PATCH 14/20] Update list.php --- htdocs/comm/propal/list.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 469489fa88e..03b5730a390 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -827,8 +827,11 @@ if ($resql) { $arrayofmassactions = array( 'generate_doc'=>img_picto('', 'pdf').' '.$langs->trans("ReGeneratePDF"), 'builddoc'=>img_picto('', 'pdf').' '.$langs->trans("PDFMerge"), - 'presend'=>img_picto('', 'email').' '.$langs->trans("SendByMail"), + ); + if ($permissiontosendbymail) { + $arrayofmassactions['presend']=img_picto('', 'email').' '.$langs->trans("SendByMail"); + } if ($permissiontovalidate) { $arrayofmassactions['prevalidate']=img_picto('', 'check').' '.$langs->trans("Validate"); } From 26767c15504fb39eb73b16b308ed98655f0db83f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 14 Apr 2021 00:36:07 +0000 Subject: [PATCH 15/20] Fixing style errors. --- 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 03b5730a390..3c150e2aec8 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -827,7 +827,7 @@ if ($resql) { $arrayofmassactions = array( 'generate_doc'=>img_picto('', 'pdf').' '.$langs->trans("ReGeneratePDF"), 'builddoc'=>img_picto('', 'pdf').' '.$langs->trans("PDFMerge"), - + ); if ($permissiontosendbymail) { $arrayofmassactions['presend']=img_picto('', 'email').' '.$langs->trans("SendByMail"); From 7040330914be2ce84b4009c2d03b00d0fd7ef687 Mon Sep 17 00:00:00 2001 From: altairis-noe Date: Wed, 14 Apr 2021 10:13:31 +0200 Subject: [PATCH 16/20] project select in edit or create warehouse --- htdocs/product/stock/card.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 7f2f8f58bb5..39c4c525696 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Simon Tosser * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2016 Francis Appels + * Copyright (C) 2021 NoĆ© Cendrier * * 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 @@ -35,6 +36,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +if (!empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} + // Load translation files required by the page $langs->loadLangs(array('products', 'stocks', 'companies', 'categories')); @@ -238,6 +244,9 @@ $form = new Form($db); $formproduct = new FormProduct($db); $formcompany = new FormCompany($db); $formfile = new FormFile($db); +if (!empty($conf->projet->enabled)) { + $formproject = new FormProjets($db); +} $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("", $langs->trans("WarehouseCard"), $help_url); @@ -267,6 +276,15 @@ if ($action == 'create') { print img_picto('', 'stock').$formproduct->selectWarehouses((GETPOSTISSET('fk_parent') ? GETPOST('fk_parent', 'int') : 'ifone'), 'fk_parent', '', 1); print ''; + // Project + if (!empty($conf->projet->enabled)) { + $langs->load('projects'); + print ''.$langs->trans('Project').''; + print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); + print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; + print ''; + } + // Description print ''.$langs->trans("Description").''; // Editeur wysiwyg @@ -382,6 +400,11 @@ if ($action == 'create') { $morehtmlref = '
'; $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu; $morehtmlref .= '
'; + if ($object->project) { + $morehtmlref .= '
'; + $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu; + $morehtmlref .= '
'; + } $shownav = 1; if ($user->socid && !in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { @@ -707,6 +730,15 @@ if ($action == 'create') { print $formproduct->selectWarehouses($object->fk_parent, 'fk_parent', '', 1); print ''; + // Project + if (!empty($conf->projet->enabled)) { + $langs->load('projects'); + print ''.$langs->trans('Project').''; + print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); + print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; + print ''; + } + // Description print ''.$langs->trans("Description").''; // Editeur wysiwyg From 4c8d37ce286c056aa012b8c57fa009eafd04677c Mon Sep 17 00:00:00 2001 From: altairis-noe Date: Wed, 14 Apr 2021 13:45:25 +0200 Subject: [PATCH 17/20] warehouse can now be linked to a project with fk_project --- htdocs/product/stock/card.php | 45 ++++++++++++++++--- htdocs/product/stock/class/entrepot.class.php | 14 ++++-- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 39c4c525696..60690cedeeb 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -105,6 +105,7 @@ if (empty($reshook)) { if ($action == 'add' && $user->rights->stock->creer) { $object->ref = (string) GETPOST("ref", "alpha"); $object->fk_parent = (int) GETPOST("fk_parent", "int"); + $object->fk_project = GETPOST('projectid', 'int'); $object->label = (string) GETPOST("libelle", "alpha"); $object->description = (string) GETPOST("desc", "alpha"); $object->statut = GETPOST("statut"); @@ -168,6 +169,7 @@ if (empty($reshook)) { if ($object->fetch($id)) { $object->label = GETPOST("libelle"); $object->fk_parent = GETPOST("fk_parent"); + $object->fk_project = GETPOST('projectid'); $object->description = GETPOST("desc"); $object->statut = GETPOST("statut"); $object->lieu = GETPOST("lieu"); @@ -221,6 +223,9 @@ if (empty($reshook)) { if ($error) { $action = 'edit_extras'; } + } elseif ($action == 'classin' && $usercancreate) { + // Link to a project + $object->setProject(GETPOST('projectid', 'int')); } if ($cancel == $langs->trans("Cancel")) { @@ -399,12 +404,39 @@ if ($action == 'create') { $morehtmlref = '
'; $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu; - $morehtmlref .= '
'; - if ($object->project) { - $morehtmlref .= '
'; - $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu; - $morehtmlref .= '
'; + + // Project + if (!empty($conf->projet->enabled)) { + $langs->load("projects"); + $morehtmlref .= '
'.img_picto('', 'project').' '.$langs->trans('Project').' '; + if ($usercancreate) { + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + } + if ($action == 'classify') { + $projectid = $object->fk_project; + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } } + $morehtmlref .= ''; $shownav = 1; if ($user->socid && !in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { @@ -511,7 +543,7 @@ if ($action == 'create') { $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { - if (empty($action)) { + if (empty($action) || $action == 'classin') { if ($user->rights->stock->creer) { print ''.$langs->trans("Modify").''; } else { @@ -732,6 +764,7 @@ if ($action == 'create') { // Project if (!empty($conf->projet->enabled)) { + $projectid = $object->fk_project; $langs->load('projects'); print ''.$langs->trans('Project').''; print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 214a12ead14..2f3131feba9 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -108,6 +108,11 @@ class Entrepot extends CommonObject */ public $fk_parent; + /** + * @var int ID of project + */ + public $fk_project; + /** * @var array List of short language codes for status */ @@ -124,6 +129,7 @@ class Entrepot extends CommonObject 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35, 'searchall'=>1), 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>1, 'searchall'=>1), 'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:statut=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41), + 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25), 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45, 'searchall'=>1), 'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'searchall'=>1), 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55, 'searchall'=>1), @@ -198,8 +204,8 @@ class Entrepot extends CommonObject $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (ref, entity, datec, fk_user_author, fk_parent)"; - $sql .= " VALUES ('".$this->db->escape($this->label)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (ref, entity, datec, fk_user_author, fk_parent, fk_project)"; + $sql .= " VALUES ('".$this->db->escape($this->label)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").", ".($this->fk_project > 0 ? $this->fk_project : "NULL").")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); $result = $this->db->query($sql); @@ -290,6 +296,7 @@ class Entrepot extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot "; $sql .= " SET ref = '".$this->db->escape($this->label)."'"; $sql .= ", fk_parent = ".(($this->fk_parent > 0) ? $this->fk_parent : "NULL"); + $sql .= ", fk_project = ".(($this->fk_project > 0) ? $this->fk_project : "NULL"); $sql .= ", description = '".$this->db->escape($this->description)."'"; $sql .= ", statut = ".$this->statut; $sql .= ", lieu = '".$this->db->escape($this->lieu)."'"; @@ -432,7 +439,7 @@ class Entrepot extends CommonObject return -1; } - $sql = "SELECT rowid, entity, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id, phone, fax,"; + $sql = "SELECT rowid, entity, fk_parent, fk_project, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id, phone, fax,"; $sql .= " model_pdf, import_key"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; if ($id) { @@ -452,6 +459,7 @@ class Entrepot extends CommonObject $this->id = $obj->rowid; $this->entity = $obj->entity; $this->fk_parent = $obj->fk_parent; + $this->fk_project = $obj->fk_project; $this->ref = $obj->label; $this->label = $obj->label; $this->libelle = $obj->label; // deprecated From 32d401bed4d194b47ce49f04d0f68579fd76f64a Mon Sep 17 00:00:00 2001 From: Givriz Date: Wed, 14 Apr 2021 15:26:18 +0200 Subject: [PATCH 18/20] Update mails.php --- htdocs/admin/mails.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 78b4012a6a2..0252f149d10 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -737,11 +737,11 @@ if ($action == 'edit') { print ''.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; print ''; - if (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) === 'robot') { + if (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) && $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') { print $langs->trans('RobotEmail'); - } elseif (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) === 'user') { + } elseif (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) && $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') { print $langs->trans('UserEmail'); - } elseif (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) === 'company') { + } elseif (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) && $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') { print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); } else { $id = preg_replace('/senderprofile_/', '', !empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : ''); From 658e1de45d672e508474991a04c4ec05975b520f Mon Sep 17 00:00:00 2001 From: altairis-noe Date: Wed, 14 Apr 2021 16:08:28 +0200 Subject: [PATCH 19/20] stickler adjust --- htdocs/product/stock/card.php | 4 ++-- htdocs/product/stock/class/entrepot.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 60690cedeeb..f7e833ea234 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -289,7 +289,7 @@ if ($action == 'create') { print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; print ''; } - + // Description print ''.$langs->trans("Description").''; // Editeur wysiwyg @@ -771,7 +771,7 @@ if ($action == 'create') { print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; print ''; } - + // Description print ''.$langs->trans("Description").''; // Editeur wysiwyg diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 2f3131feba9..8bd250bc76e 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -108,7 +108,7 @@ class Entrepot extends CommonObject */ public $fk_parent; - /** + /** * @var int ID of project */ public $fk_project; From 598156de0459b02266dd2f3de8897793cb544c79 Mon Sep 17 00:00:00 2001 From: Givriz Date: Wed, 14 Apr 2021 17:58:46 +0200 Subject: [PATCH 20/20] Update modDataPolicy.class.php There was useless condition --- htdocs/core/modules/modDataPolicy.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php index adccd49ba37..047ff2b5a8d 100644 --- a/htdocs/core/modules/modDataPolicy.class.php +++ b/htdocs/core/modules/modDataPolicy.class.php @@ -132,7 +132,7 @@ class modDataPolicy extends DolibarrModules { array('DATAPOLICY_ADHERENT', 'chaine', '', $langs->trans('NUMBER_MONTH_BEFORE_DELETION'), 0), ); - if (!empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $country = explode(":", !empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY) ? $conf->global->MAIN_INFO_SOCIETE_COUNTRY : ''); + $country = explode(":", empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY) ? '' : $conf->global->MAIN_INFO_SOCIETE_COUNTRY); // Some keys to add into the overwriting translation tables /* $this->overwrite_translation = array(