From b3757a6f697264521f86aa4fd58ae00622950929 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 18 Mar 2021 11:07:48 +0100 Subject: [PATCH 01/18] FIX: fix checkbox displayed according to module project setup parameters - work in progress --- htdocs/projet/card.php | 104 ++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index db710e2715d..50cf57f1863 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -841,17 +841,17 @@ elseif ($object->id > 0) print ''; // Usage - print ''; - print $langs->trans("Usage"); - print ''; - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print ''; - print '
'; + print ''; + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) { + print 'usage_task ? ' checked="checked"' : '')) . '"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + print 'usage_bill_time ? ' checked="checked"' : '')) . '"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Thirdparty if ($conf->societe->enabled) @@ -1022,32 +1021,31 @@ elseif ($object->id > 0) print ''; // Usage - print ''; - print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Visibility print ''; // Usage (opp, task, bill time, ...) - print ''; - print ''; + print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print ' '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print ' '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - /* - print ' '; - $htmltext = $langs->trans("OrganizeEvent"); - print $form->textwithpicto($langs->trans("OrganizeEvent"), $htmltext);*/ - print ''; - print ''; // Thirdparty if ($conf->societe->enabled) @@ -841,17 +844,19 @@ elseif ($object->id > 0) print ''; // Usage - print ''; - print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Thirdparty if ($conf->societe->enabled) @@ -923,18 +929,18 @@ elseif ($object->id > 0) print ''; print ''; - // Opportunity probability - print ''; - print ''; - print ''; + // Opportunity probability + print ''; + print ''; + print ''; - // Opportunity amount - print ''; - print ''; - print ''; - } + // Opportunity amount + print ''; + print ''; + print ''; + } // Date start print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + print 'usage_opportunity ? ' checked="checked"' : '')) . '"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) { + print 'usage_task ? ' checked="checked"' : '')) . '"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + print 'usage_bill_time ? ' checked="checked"' : '')) . '"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; From d8528161016e6df5d88ade1031bf61cb09ae0865 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 18 Mar 2021 11:07:48 +0100 Subject: [PATCH 02/18] FIX: fix checkbox displayed according to module project setup parameters --- htdocs/projet/card.php | 231 ++++++++++++++++--------------- htdocs/projet/contact.php | 198 +++++++++++++------------- htdocs/projet/element.php | 51 +++---- htdocs/projet/tasks.php | 51 +++---- htdocs/projet/tasks/comment.php | 51 +++---- htdocs/projet/tasks/contact.php | 51 +++---- htdocs/projet/tasks/document.php | 51 +++---- htdocs/projet/tasks/note.php | 51 +++---- htdocs/projet/tasks/task.php | 51 +++---- htdocs/projet/tasks/time.php | 51 +++---- 10 files changed, 436 insertions(+), 401 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index db710e2715d..9adfd8130c6 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -550,50 +550,53 @@ if ($action == 'create' && $user->rights->projet->creer) print '
'.$langs->trans("Label").'
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print ' '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print ''; - print '
'; + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print ' '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print ''; + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print ' '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ' '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + /* + print ' '; + $htmltext = $langs->trans("OrganizeEvent"); + print $form->textwithpicto($langs->trans("OrganizeEvent"), $htmltext);*/ + print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print ''; - print '
'; + print ''; + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')) . '"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')) . '"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("OpportunityProbability").' %'; - print ''; - print '
'.$langs->trans("OpportunityProbability").' %'; + print ''; + print '
'.$langs->trans("OpportunityAmount").'
'.$langs->trans("OpportunityAmount").'
'.$langs->trans("DateStart").''; @@ -1022,32 +1028,35 @@ elseif ($object->id > 0) print ''; // Usage - print ''; - print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Visibility print ''; - // Opportunity Weighted Amount - print ''; + // Opportunity Weighted Amount + print ''; } // Date start - end diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 93ced9392c4..2faa9868e07 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -63,11 +63,11 @@ if ($action == 'addcontact' && $user->rights->projet->creer) $result = 0; $result = $object->fetch($id); - if ($result > 0 && $id > 0) - { - $contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); - $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); - } + if ($result > 0 && $id > 0) + { + $contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); + $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); + } if ($result >= 0) { @@ -93,7 +93,7 @@ if ($action == 'swapstatut' && $user->rights->projet->creer) { if ($object->fetch($id)) { - $result = $object->swapContactStatus(GETPOST('ligne', 'int')); + $result = $object->swapContactStatus(GETPOST('ligne', 'int')); } else { @@ -153,100 +153,102 @@ if ($id > 0 || !empty($ref)) dol_fiche_head($head, 'contact', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project')); - // Project card + // Project card - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = '
'; - // Title - $morehtmlref .= $object->title; - // Thirdparty - if ($object->thirdparty->id > 0) - { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); - } - $morehtmlref .= '
'; + $morehtmlref = '
'; + // Title + $morehtmlref .= $object->title; + // Thirdparty + if ($object->thirdparty->id > 0) + { + $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref .= '
'; - // Define a complementary filter for search of next/prev ref. - if (!$user->rights->projet->all->lire) - { - $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; - } + // Define a complementary filter for search of next/prev ref. + if (!$user->rights->projet->all->lire) + { + $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); + $object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + } - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; - print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')) . '"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')) . '"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')) . '"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; @@ -1071,16 +1080,16 @@ elseif ($object->id > 0) // Opportunity Amount print '
'.$langs->trans("OpportunityAmount").''; /*if ($object->opp_status) - { - print price($obj->opp_amount, 1, $langs, 1, 0, -1, $conf->currency); - }*/ + { + print price($obj->opp_amount, 1, $langs, 1, 0, -1, $conf->currency); + }*/ if (strcmp($object->opp_amount, '')) print price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency); print '
'.$langs->trans('OpportunityWeightedAmount').''; - if (strcmp($object->opp_amount, '') && strcmp($object->opp_percent, '')) print price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency); - print '
'.$langs->trans('OpportunityWeightedAmount').''; + if (strcmp($object->opp_amount, '') && strcmp($object->opp_percent, '')) print price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency); + print '
'; - - // Usage - print ''; - print ''; + print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; - } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print '
'; + // Usage + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) + { + print ''; + print ''; + } // Visibility print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $object->opp_status) - { - // Opportunity status - print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $object->opp_status) + { + // Opportunity status + print ''; - // Opportunity percent - print ''; + // Opportunity percent + print ''; - // Opportunity Amount - print ''; - } + // Opportunity Amount + print ''; + } - // Date start - end - print ''; + print ''; - // Budget + // Budget print ''; @@ -257,36 +259,36 @@ if ($id > 0 || !empty($ref)) print "
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; if ($object->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("OpportunityStatus").''; - $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); - if ($code) print $langs->trans("OppStatus".$code); - print '
'.$langs->trans("OpportunityStatus").''; + $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); + if ($code) print $langs->trans("OppStatus".$code); + print '
'.$langs->trans("OpportunityProbability").''; - if (strcmp($object->opp_percent, '')) print price($object->opp_percent, '', $langs, 1, 0).' %'; - print '
'.$langs->trans("OpportunityProbability").''; + if (strcmp($object->opp_percent, '')) print price($object->opp_percent, '', $langs, 1, 0).' %'; + print '
'.$langs->trans("OpportunityAmount").''; - if (strcmp($object->opp_amount, '')) print price($object->opp_amount, '', $langs, 0, 0, 0, $conf->currency); - print '
'.$langs->trans("OpportunityAmount").''; + if (strcmp($object->opp_amount, '')) print price($object->opp_amount, '', $langs, 0, 0, 0, $conf->currency); + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Date start - end + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; $start = dol_print_date($object->date_start, 'day'); print ($start ? $start : '?'); $end = dol_print_date($object->date_end, 'day'); print ' - '; print ($end ? $end : '?'); if ($object->hasDelay()) print img_warning("Late"); - print '
'.$langs->trans("Budget").''; if (strcmp($object->budget_amount, '')) print price($object->budget_amount, '', $langs, 0, 0, 0, $conf->currency); print '
"; - print ''; - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; + print '
'; - print ''; + print '
'; - // Description - print ''; + // Description + print ''; - // Categories - if ($conf->categorie->enabled) { - print '"; - } + // Categories + if ($conf->categorie->enabled) { + print '"; + } - print '
'.$langs->trans("Description").''; - print nl2br($object->description); - print '
'.$langs->trans("Description").''; + print nl2br($object->description); + print '
'.$langs->trans("Categories").''; - print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); - print "
'.$langs->trans("Categories").''; + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); + print "
'; + print '
'; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; - print '
'; + print '
'; - dol_fiche_end(); + dol_fiche_end(); - print '
'; + print '
'; // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl')); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 3d6f954f439..abee780cb41 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -163,32 +163,35 @@ print '
'; print ''; // Usage -print ''; -print ''; + print ''; } -if (empty($conf->global->PROJECT_HIDE_TASKS)) -{ - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; -} -if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) -{ - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; -} -print ''; // Visibility print '
'; -print $langs->trans("Usage"); -print ''; -if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) +if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ebc6a7dc556..3f4b1e9a429 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -409,32 +409,35 @@ if ($id > 0 || !empty($ref)) print ''; // Usage - print ''; - print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Visibility print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 82b4d8fdc10..0141b85a8cd 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -151,32 +151,35 @@ if ($id > 0 || !empty($ref)) print ''; // Usage - print ''; - print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Visibility print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 415859127db..5c9df2ea2ef 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -223,32 +223,35 @@ if ($id > 0 || !empty($ref)) print ''; // Usage - print ''; - print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Visibility print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index bd4335f747f..a8f0c2c9d57 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -167,32 +167,35 @@ if ($object->id > 0) print ''; // Usage - print ''; - print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Visibility print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 4967257570e..77ee70a6829 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -146,32 +146,35 @@ if ($object->id > 0) print ''; // Usage - print ''; - print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Visibility print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 1ba2373f35d..d912286b3c8 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -261,32 +261,35 @@ if ($id > 0 || !empty($ref)) print ''; // Usage - print ''; - print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Visibility print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index b95f285c628..3b2e36d34c6 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -656,32 +656,35 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; // Usage - print ''; - print ''; + print ''; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print ''; // Visibility print ''; print ''; print ''; - print ''; + print ''; print ''; print "\n"; } @@ -440,7 +440,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; From 99d4618ab542ad2edd1a12c271f7db012904056c Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 21 Mar 2021 13:49:17 +0100 Subject: [PATCH 07/18] Fix 16897 V13 Wrong picto for Expired membership Force picto for Expired membership when no subscription is needed to Waiting (as other) --- htdocs/adherents/index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index e5d8fe6628e..c54d648cd97 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -431,17 +431,17 @@ foreach ($AdherentType as $key => $adhtype) { print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print "\n"; } print ''; print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; print ''; print "
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; + print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; From 2de2f1ce4dbe6394ff4f6fdf175f31e9a7030852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Mar 2021 09:02:29 +0100 Subject: [PATCH 03/18] fix nested comments for doxygen --- htdocs/compta/facture/class/api_invoices.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 85da9cd5c37..befc4e20e13 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1,6 +1,6 @@ -/* Copyright (C) 2020 Thibault FOUCART + * Copyright (C) 2020 Thibault FOUCART * * 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 36baf9b76b52051218f3d357f173797d72bff941 Mon Sep 17 00:00:00 2001 From: Chl Date: Fri, 19 Mar 2021 02:42:47 +0100 Subject: [PATCH 04/18] FIX #16143 Old PG requires "()" on DROP FUNCTION On PostgreSQL 9.6 and previous, the upgrade script fails with a syntax error if the dropped function's name is not followed by parentheses. Patch tested on 9.6 and 13.2. --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index cc0386621a8..bfa8bf01b39 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -575,7 +575,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',205); -- Removed no more used function --- VPGSQL8.2 DROP FUNCTION IF EXISTS update_modified_column_date_m CASCADE; +-- VPGSQL8.2 DROP FUNCTION IF EXISTS update_modified_column_date_m() CASCADE; insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4); From 2d7f858c1ac2ff170b581a4b8f1057af9dbf7232 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 20 Mar 2021 14:04:20 +0100 Subject: [PATCH 05/18] #Fix #16767 unremovable attached file in mailmodel #Fix #16767 unremovable attached file in mailmodel --- htdocs/core/class/html.formmail.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 14e0d9c02d1..c4723eacc57 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -382,8 +382,7 @@ class FormMail extends Form $listofmimes = array(); $keytoavoidconflict = empty($this->trackid) ? '' : '-'.$this->trackid; // this->trackid must be defined - if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) - { + if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) { foreach ($this->param['fileinit'] as $file) From 860a2f2ffa85620673d916ce0e7e63a2d99971ac Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 21 Mar 2021 11:36:23 +0100 Subject: [PATCH 06/18] Fix #16893 picto UpToDate change to Unpaid sometimes #Fix #16893 picto UpToDate change to Unpaid sometimes As $now is set on the start of the script. But, the timestamp may change before LibStatut is called at the end. To avoid this we add 10 second to $now before comparing to dol_now() in LibStatut --- htdocs/adherents/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index b2ef8e8854b..e5d8fe6628e 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -432,7 +432,7 @@ foreach ($AdherentType as $key => $adhtype) { print ''.$adhtype->getNomUrl(1, dol_size(32)).''.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).''.(isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).''.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).''.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, $now+10, 3).''.(isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '').' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'
'.$langs->trans("Total").''.$SommeA.' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).''.$SommeB.' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).''.$SommeC.' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).''.$SommeC.' '.$staticmember->LibStatut(1, $adhtype->subscription, $now+10, 3).''.$SommeD.' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'
'.$adhtype->getNomUrl(1, dol_size(32)).''.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).''.(isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).''.(isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : '').' '.$staticmember->LibStatut(1, 1, 0, 3).''.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, $now+10, 3).''.(isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '').' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'
'.$langs->trans("Total").''.$SommeA.' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).''.$SommeB.' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).''.$SommeC.' '.$staticmember->LibStatut(1, $adhtype->subscription, $now+10, 3).''.$SommeD.' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).''.$SommeA.' '.$staticmember->LibStatut(-1, 1, 0, 3).''.$SommeB.' '.$staticmember->LibStatut(1, 1, 0, 3).''.$SommeC.' '.$staticmember->LibStatut(1, 1, $now+10, 3).''.$SommeD.' '.$staticmember->LibStatut(0, 1, 0, 3).'
\n"; From f1fb7e732eecd9b8c59fe099b0c49d9fca4161b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Mar 2021 00:07:35 +0100 Subject: [PATCH 08/18] Fix trans --- htdocs/langs/en_US/banks.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index b6782b57ef6..91d64b1fc27 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -174,7 +174,7 @@ YourSEPAMandate=Your SEPA mandate FindYourSEPAMandate=This is your SEPA mandate to authorize our company to make direct debit order to your bank. Return it signed (scan of the signed document) or send it by mail to AutoReportLastAccountStatement=Automatically fill the field 'number of bank statement' with last statement number when making reconciliation CashControl=POS cash desk control -NewCashFence=New cash desk closing +NewCashFence=New cash desk opening or closing BankColorizeMovement=Colorize movements BankColorizeMovementDesc=If this function is enable, you can choose specific background color for debit or credit movements BankColorizeMovementName1=Background color for debit movement From 6ba878725e4a25d27e4a94da3d5e7865627d601b Mon Sep 17 00:00:00 2001 From: daraelmin Date: Mon, 22 Mar 2021 07:28:16 +0100 Subject: [PATCH 09/18] Fix #16794 V13 order by status instead of statut --- htdocs/core/class/html.formother.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index c71029769f2..b6ae7cdbfc2 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -474,7 +474,7 @@ class FormOther //Add hook to filter on user (for exemple on usergroup define in custom modules) if (!empty($reshook)) $sql_usr .= $hookmanager->resArray[1]; } - $sql_usr .= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION. + $sql_usr .= " ORDER BY status DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION. //print $sql_usr;exit; $resql_usr = $this->db->query($sql_usr); From b1215875824c2fd4f38a34926ef5f07ecc93e27e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 22 Mar 2021 15:39:54 +0100 Subject: [PATCH 10/18] change to GETPOST --- htdocs/projet/tasks/time.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index ffb214e3830..3cd49eb7d9e 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -175,10 +175,10 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) $action = 'createtime'; $error++; } else { - $object->timespent_note = $_POST["timespent_note"]; + $object->timespent_note = GETPOST('timespent_note','alpha'); if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value - $object->timespent_duration = $_POST["timespent_durationhour"] * 60 * 60; // We store duration in seconds - $object->timespent_duration += ($_POST["timespent_durationmin"] ? $_POST["timespent_durationmin"] : 0) * 60; // We store duration in seconds + $object->timespent_duration = (int) GETPOST("timespent_durationhour",'int') * 60 * 60; // We store duration in seconds + $object->timespent_duration += (GETPOST('timespent_durationmin','int') ? (int) GETPOST('timespent_durationmin','int') : 0) * 60; // We store duration in seconds if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered { $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); @@ -224,10 +224,10 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $result = $object->delTimeSpent($user); $object->fetch($id, $ref); - $object->timespent_note = $_POST["timespent_note_line"]; - $object->timespent_old_duration = $_POST["old_duration"]; - $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds - $object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds + $object->timespent_note = GETPOST('timespent_note_line','alpha'); + $object->timespent_old_duration = GETPOST("old_duration"); + $object->timespent_duration = (int) GETPOST("new_durationhour", 'int') * 60 * 60; // We store duration in seconds + $object->timespent_duration += (GETPOST("new_durationmin", 'int') ? (int) GETPOST('new_durationmin', 'int') : 0) * 60; // We store duration in seconds if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered { $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); @@ -248,11 +248,11 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $object->fetch($id, $ref); // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) - $object->timespent_id = $_POST["lineid"]; - $object->timespent_note = $_POST["timespent_note_line"]; - $object->timespent_old_duration = $_POST["old_duration"]; - $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds - $object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds + $object->timespent_id = GETPOST("lineid" , 'int'); + $object->timespent_note = GETPOST('timespent_note_line','alpha'); + $object->timespent_old_duration = GETPOST("old_duration"); + $object->timespent_duration = (int) GETPOST("new_durationhour", 'int') * 60 * 60; // We store duration in seconds + $object->timespent_duration += (GETPOST("new_durationmin", 'int') ? (int) GETPOST('new_durationmin', 'int') : 0) * 60; // We store duration in seconds if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered { $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); @@ -260,7 +260,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us } else { $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); } - $object->timespent_fk_user = $_POST["userid_line"]; + $object->timespent_fk_user = GETPOST("userid_line" , 'int'); $result = $object->updateTimeSpent($user); if ($result >= 0) From ba66eaeb188f45f553f595d743a861d3115a0ca5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 22 Mar 2021 14:42:31 +0000 Subject: [PATCH 11/18] Fixing style errors. --- htdocs/projet/tasks/time.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3cd49eb7d9e..eeca9e34cd1 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -175,10 +175,10 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) $action = 'createtime'; $error++; } else { - $object->timespent_note = GETPOST('timespent_note','alpha'); + $object->timespent_note = GETPOST('timespent_note', 'alpha'); if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value - $object->timespent_duration = (int) GETPOST("timespent_durationhour",'int') * 60 * 60; // We store duration in seconds - $object->timespent_duration += (GETPOST('timespent_durationmin','int') ? (int) GETPOST('timespent_durationmin','int') : 0) * 60; // We store duration in seconds + $object->timespent_duration = (int) GETPOST("timespent_durationhour", 'int') * 60 * 60; // We store duration in seconds + $object->timespent_duration += (GETPOST('timespent_durationmin', 'int') ? (int) GETPOST('timespent_durationmin', 'int') : 0) * 60; // We store duration in seconds if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered { $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); @@ -224,7 +224,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $result = $object->delTimeSpent($user); $object->fetch($id, $ref); - $object->timespent_note = GETPOST('timespent_note_line','alpha'); + $object->timespent_note = GETPOST('timespent_note_line', 'alpha'); $object->timespent_old_duration = GETPOST("old_duration"); $object->timespent_duration = (int) GETPOST("new_durationhour", 'int') * 60 * 60; // We store duration in seconds $object->timespent_duration += (GETPOST("new_durationmin", 'int') ? (int) GETPOST('new_durationmin', 'int') : 0) * 60; // We store duration in seconds @@ -248,8 +248,8 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $object->fetch($id, $ref); // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) - $object->timespent_id = GETPOST("lineid" , 'int'); - $object->timespent_note = GETPOST('timespent_note_line','alpha'); + $object->timespent_id = GETPOST("lineid", 'int'); + $object->timespent_note = GETPOST('timespent_note_line', 'alpha'); $object->timespent_old_duration = GETPOST("old_duration"); $object->timespent_duration = (int) GETPOST("new_durationhour", 'int') * 60 * 60; // We store duration in seconds $object->timespent_duration += (GETPOST("new_durationmin", 'int') ? (int) GETPOST('new_durationmin', 'int') : 0) * 60; // We store duration in seconds @@ -260,7 +260,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us } else { $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); } - $object->timespent_fk_user = GETPOST("userid_line" , 'int'); + $object->timespent_fk_user = GETPOST("userid_line", 'int'); $result = $object->updateTimeSpent($user); if ($result >= 0) From 05419441aaa232a6224b4f0ca3e7b06bccbc312b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 23 Mar 2021 19:58:15 +0100 Subject: [PATCH 12/18] FIX missing return edit if update error --- htdocs/adherents/card.php | 106 ++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 50 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index a3fe601ae6e..7199423669a 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -303,7 +303,9 @@ if (empty($reshook)) { // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); - if ($ret < 0) $error++; + if ($ret < 0) { + $error++; + } // Check if we need to also synchronize user information $nosyncuser = 0; @@ -317,62 +319,66 @@ if (empty($reshook)) { if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass = 1; // Disable synchronizing } - $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass); + if (!$error) { + $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass); - if ($result >= 0 && !count($object->errors)) { - $categories = GETPOST('memcats', 'array'); - $object->setCategories($categories); + if ($result >= 0 && !count($object->errors)) { + $categories = GETPOST('memcats', 'array'); + $object->setCategories($categories); - // Logo/Photo save - $dir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos'; - $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); - if ($file_OK) { - if (GETPOST('deletephoto')) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileimg = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/'.$object->photo; - $dirthumbs = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/thumbs'; - dol_delete_file($fileimg); - dol_delete_dir_recursive($dirthumbs); - } + // Logo/Photo save + $dir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos'; + $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); + if ($file_OK) { + if (GETPOST('deletephoto')) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $fileimg = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/'.$object->photo; + $dirthumbs = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/thumbs'; + dol_delete_file($fileimg); + dol_delete_dir_recursive($dirthumbs); + } - if (image_format_supported($_FILES['photo']['name']) > 0) { - dol_mkdir($dir); + if (image_format_supported($_FILES['photo']['name']) > 0) { + dol_mkdir($dir); - if (@is_dir($dir)) { - $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); - if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) { - setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); - } else { - // Create thumbs - $object->addThumbs($newfile); - } - } - } else { - setEventMessages("ErrorBadImageFormat", null, 'errors'); - } - } else { - switch ($_FILES['photo']['error']) { - case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini - case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form - $errors[] = "ErrorFileSizeTooLarge"; - break; - case 3: //uploaded file was only partially uploaded - $errors[] = "ErrorFilePartiallyUploaded"; - break; - } - } + if (@is_dir($dir)) { + $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) { + setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + } else { + // Create thumbs + $object->addThumbs($newfile); + } + } + } else { + setEventMessages("ErrorBadImageFormat", null, 'errors'); + } + } else { + switch ($_FILES['photo']['error']) { + case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini + case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form + $errors[] = "ErrorFileSizeTooLarge"; + break; + case 3: //uploaded file was only partially uploaded + $errors[] = "ErrorFilePartiallyUploaded"; + break; + } + } - $rowid = $object->id; - $id = $object->id; - $action = ''; + $rowid = $object->id; + $id = $object->id; + $action = ''; - if (!empty($backtopage)) { - header("Location: ".$backtopage); - exit; - } + if (!empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + } else { + setEventMessages($object->error, $object->errors, 'errors'); + $action = ''; + } } else { - setEventMessages($object->error, $object->errors, 'errors'); - $action = ''; + $action = 'edit'; } } else { $action = 'edit'; From 21a9779fe20c79f6d8ea46a676c43fc40be6cd01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Mar 2021 21:49:45 +0100 Subject: [PATCH 13/18] FIX inconsistency in margin recording with option "Force to sale price" --- htdocs/compta/facture/class/facture.class.php | 12 ++++++------ htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.formmargin.class.php | 6 ++++-- htdocs/langs/en_US/margins.lang | 2 +- htdocs/margin/agentMargins.php | 6 +++++- htdocs/margin/customerMargins.php | 7 +++++-- htdocs/margin/productMargins.php | 5 ++++- htdocs/margin/tabs/productMargins.php | 6 +++++- htdocs/margin/tabs/thirdpartyMargins.php | 6 +++++- 9 files changed, 36 insertions(+), 16 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e302c83e2d8..4ae9fe197fe 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5171,11 +5171,11 @@ class FactureLigne extends CommonInvoiceLine // Check parameters if ($this->product_type < 0) return -1; - // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0 && $pa_ht_isemptystring) - { - if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) - { + // if buy price not provided, define buyprice as configured in margin admin + if ($this->pa_ht == 0 && $pa_ht_isemptystring) { + // We call defineBuyPrice only if data was not provided (if input was '0', we will not go here and value will remaine '0') + $result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product); + if ($result < 0) { return $result; } else { $this->pa_ht = $result; @@ -5214,7 +5214,7 @@ class FactureLigne extends CommonInvoiceLine $sql .= ", total_localtax2=".price2num($this->total_localtax2); } $sql .= ", fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null"); - $sql .= ", buy_price_ht='".price2num($this->pa_ht)."'"; + $sql .= ", buy_price_ht=".(($this->pa_ht || $this->pa_ht === 0 || $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option) $sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null"); if (!empty($this->rang)) $sql .= ", rang=".$this->rang; $sql .= ", situation_percent=".$this->situation_percent; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index af2c902aacb..8a3f50c02a4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7122,7 +7122,7 @@ abstract class CommonObject $buyPrice = 0; - if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) // In most cases, test here is false + if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull > 0)) // In most cases, test here is false { $buyPrice = $unitPrice * (1 - $discountPercent / 100); } else { diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 233f98df662..608698cf1b1 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -91,8 +91,10 @@ class FormMargin if ($product->fetch_product_fournisseur_price($line->fk_fournprice)) $line->pa_ht = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100); } - // si prix d'achat non renseigné et devrait l'être, alors prix achat = prix vente - if ((!isset($line->pa_ht) || $line->pa_ht == 0) && $line->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) { + + // If buy price is not defined (null), we will use the sell price. If defined to 0 (it means it was forced to 0 during insert, for example for a free to get product), we must still use 0. + //if ((!isset($line->pa_ht) || $line->pa_ht == 0) && $line->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull > 0)) { + if ((!isset($line->pa_ht)) && $line->subprice > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull > 0)) { $line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100)); } diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang index 76ea8ad5c4d..c3bff2305de 100644 --- a/htdocs/langs/en_US/margins.lang +++ b/htdocs/langs/en_US/margins.lang @@ -22,7 +22,7 @@ ProductService=Product or Service AllProducts=All products and services ChooseProduct/Service=Choose product or service ForceBuyingPriceIfNull=Force buying/cost price to selling price if not defined -ForceBuyingPriceIfNullDetails=If buying/cost price not defined, and this option "ON", margin will be zero on line (buying/cost price = selling price), otherwise ("OFF"), marge will be equal to suggested default. +ForceBuyingPriceIfNullDetails=If buying/cost price not provided when we add a new line, and this option is "ON", the margin will be 0 on the new line (buying/cost price = selling price). If this option is "OFF", margin will be equal to the value suggested by default (and 100% if no default value can be found). MARGIN_METHODE_FOR_DISCOUNT=Margin method for global discounts UseDiscountAsProduct=As a product UseDiscountAsService=As a service diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index e7229abd2d3..d2a19e87149 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -170,7 +170,11 @@ if (!empty($startdate)) if (!empty($enddate)) $sql .= " AND f.datef <= '".$db->idate($enddate)."'"; $sql .= " AND d.buy_price_ht IS NOT NULL"; -if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; +// We should not use this here. Option ForceBuyingPriceIfNull should have effect only when inserting data. Once data is recorded, it must be used as it is for report. +// We keep it with value ForceBuyingPriceIfNull = 2 for retroactive effect but results are unpredicable. +if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 2) { + $sql .= " AND d.buy_price_ht <> 0"; +} //if ($agentid > 0) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname"; //else $sql.= " GROUP BY u.rowid, u.login, u.lastname, u.firstname"; $sql .= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname"; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 468d633875d..feb5cd34c8e 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -234,8 +234,11 @@ $sql .= " AND f.datef >= '".$db->idate($startdate)."'"; if (!empty($enddate)) $sql .= " AND f.datef <= '".$db->idate($enddate)."'"; $sql .= " AND d.buy_price_ht IS NOT NULL"; -if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) -$sql .= " AND d.buy_price_ht <> 0"; +// We should not use this here. Option ForceBuyingPriceIfNull should have effect only when inserting data. Once data is recorded, it must be used as it is for report. +// We keep it with value ForceBuyingPriceIfNull = 2 for retroactive effect but results are unpredicable. +if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 2) { + $sql .= " AND d.buy_price_ht <> 0"; +} if ($client) $sql .= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.ref, f.total, f.datef, f.paye, f.fk_statut"; else $sql .= " GROUP BY s.rowid, s.nom, s.code_client, s.client"; $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index ebe8c9c1cac..b7695c9b2ea 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -197,8 +197,11 @@ if (!empty($startdate)) if (!empty($enddate)) $sql .= " AND f.datef <= '".$db->idate($enddate)."'"; $sql .= " AND d.buy_price_ht IS NOT NULL"; -if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) +// We should not use this here. Option ForceBuyingPriceIfNull should have effect only when inserting data. Once data is recorded, it must be used as it is for report. +// We keep it with value ForceBuyingPriceIfNull = 2 for retroactive effect but results are unpredicable. +if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 2) { $sql .= " AND d.buy_price_ht <> 0"; +} if ($id > 0) $sql .= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity, d.fk_product, f.rowid, f.ref, f.total, f.datef, f.paye, f.fk_statut"; else $sql .= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity"; $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 5fcec11c93b..eb82f121295 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -150,7 +150,11 @@ if ($id > 0 || !empty($ref)) if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if (!empty($socid)) $sql .= " AND f.fk_soc = $socid"; $sql .= " AND d.buy_price_ht IS NOT NULL"; - if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; + // We should not use this here. Option ForceBuyingPriceIfNull should have effect only when inserting data. Once data is recorded, it must be used as it is for report. + // We keep it with value ForceBuyingPriceIfNull = 2 for retroactive effect but results are unpredicable. + if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 2) { + $sql .= " AND d.buy_price_ht <> 0"; + } $sql .= " GROUP BY s.nom, s.rowid, s.code_client, f.rowid, f.ref, f.total, f.datef, f.paye, f.fk_statut, f.type"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index bfa5ac15811..0b79ec62b90 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -163,7 +163,11 @@ if ($socid > 0) $sql .= " AND d.fk_facture = f.rowid"; $sql .= " AND f.fk_soc = $socid"; $sql .= " AND d.buy_price_ht IS NOT NULL"; - if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; + // We should not use this here. Option ForceBuyingPriceIfNull should have effect only when inserting data. Once data is recorded, it must be used as it is for report. + // We keep it with value ForceBuyingPriceIfNull = 2 for retroactive effect but results are unpredicable. + if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 2) { + $sql .= " AND d.buy_price_ht <> 0"; + } $sql .= " GROUP BY s.nom, s.rowid, s.code_client, f.rowid, f.ref, f.total, f.datef, f.paye, f.fk_statut, f.type"; $sql .= $db->order($sortfield, $sortorder); // TODO: calculate total to display then restore pagination From 965ee162700660892394f20986094a67b328e3e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Mar 2021 21:53:56 +0100 Subject: [PATCH 14/18] Fix typo --- htdocs/langs/en_US/margins.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang index c3bff2305de..ad5406409b4 100644 --- a/htdocs/langs/en_US/margins.lang +++ b/htdocs/langs/en_US/margins.lang @@ -22,7 +22,7 @@ ProductService=Product or Service AllProducts=All products and services ChooseProduct/Service=Choose product or service ForceBuyingPriceIfNull=Force buying/cost price to selling price if not defined -ForceBuyingPriceIfNullDetails=If buying/cost price not provided when we add a new line, and this option is "ON", the margin will be 0 on the new line (buying/cost price = selling price). If this option is "OFF", margin will be equal to the value suggested by default (and 100% if no default value can be found). +ForceBuyingPriceIfNullDetails=If buying/cost price not provided when we add a new line, and this option is "ON", the margin will be 0 on the new line (buying/cost price = selling price). If this option is "OFF" (recommended), margin will be equal to the value suggested by default (and may be 100% if no default value can be found). MARGIN_METHODE_FOR_DISCOUNT=Margin method for global discounts UseDiscountAsProduct=As a product UseDiscountAsService=As a service From 443fd544be8fc5dad558d22936eb12f1c31be42f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Mar 2021 01:07:29 +0100 Subject: [PATCH 15/18] Update time.php --- htdocs/projet/tasks/time.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index eeca9e34cd1..534a7ec09f5 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -177,8 +177,8 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) } else { $object->timespent_note = GETPOST('timespent_note', 'alpha'); if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value - $object->timespent_duration = (int) GETPOST("timespent_durationhour", 'int') * 60 * 60; // We store duration in seconds - $object->timespent_duration += (GETPOST('timespent_durationmin', 'int') ? (int) GETPOST('timespent_durationmin', 'int') : 0) * 60; // We store duration in seconds + $object->timespent_duration = GETPOSTINT("timespent_durationhour") * 60 * 60; // We store duration in seconds + $object->timespent_duration += (GETPOSTINT('timespent_durationmin') ? GETPOSTINT('timespent_durationmin') : 0) * 60; // We store duration in seconds if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered { $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); @@ -226,8 +226,8 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $object->fetch($id, $ref); $object->timespent_note = GETPOST('timespent_note_line', 'alpha'); $object->timespent_old_duration = GETPOST("old_duration"); - $object->timespent_duration = (int) GETPOST("new_durationhour", 'int') * 60 * 60; // We store duration in seconds - $object->timespent_duration += (GETPOST("new_durationmin", 'int') ? (int) GETPOST('new_durationmin', 'int') : 0) * 60; // We store duration in seconds + $object->timespent_duration = GETPOSTINT("new_durationhour") * 60 * 60; // We store duration in seconds + $object->timespent_duration += (GETPOSTINT("new_durationmin") ? GETPOSTINT('new_durationmin') : 0) * 60; // We store duration in seconds if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered { $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); @@ -251,8 +251,8 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $object->timespent_id = GETPOST("lineid", 'int'); $object->timespent_note = GETPOST('timespent_note_line', 'alpha'); $object->timespent_old_duration = GETPOST("old_duration"); - $object->timespent_duration = (int) GETPOST("new_durationhour", 'int') * 60 * 60; // We store duration in seconds - $object->timespent_duration += (GETPOST("new_durationmin", 'int') ? (int) GETPOST('new_durationmin', 'int') : 0) * 60; // We store duration in seconds + $object->timespent_duration = GETPOSTINT("new_durationhour") * 60 * 60; // We store duration in seconds + $object->timespent_duration += (GETPOSTINT("new_durationmin") ? GETPOSTINT('new_durationmin') : 0) * 60; // We store duration in seconds if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered { $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); From ccd6d28f6fee8b6e1a427219e274cf601ec55ac8 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Thu, 25 Mar 2021 14:39:42 +0100 Subject: [PATCH 16/18] FIX #16843 https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4 fa-mail-forward => fa-share --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b63f9d72f26..2a57a983496 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3337,7 +3337,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', - 'uparrow'=>'mail-forward', 'vcard'=>'address-card', + 'uparrow'=>'share', 'vcard'=>'address-card', 'jabber'=>'comment-o', 'website'=>'globe-americas' ); From 512a570b631c988b868d0d192910acd679a3d56b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Mar 2021 01:37:19 +0100 Subject: [PATCH 17/18] FIX error for duplicate thirdparty found correctly returned by ws --- htdocs/webservices/server_supplier_invoice.php | 1 - htdocs/webservices/server_thirdparty.php | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 507095ac78b..8ba70409806 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -329,7 +329,6 @@ function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '') * @param array $authentication Array of authentication information * @param int $idthirdparty Id thirdparty * @return array Array result - * */ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) { diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index d7ded82cc3f..c81b6bc6f63 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -298,14 +298,16 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') // Init and check authentication $objectresp = array(); - $errorcode = ''; $errorlabel = ''; + $errorcode = ''; + $errorlabel = ''; $error = 0; $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); // Check parameters if (!$error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext))) { $error++; - $errorcode = 'BAD_PARAMETERS'; $errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both."; + $errorcode = 'BAD_PARAMETERS'; + $errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both."; } if (!$error) @@ -316,8 +318,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') { $thirdparty = new Societe($db); $result = $thirdparty->fetch($id, $ref, $ref_ext); - if ($result > 0) - { + if ($result > 0) { $thirdparty_result_fields = array( 'id' => $thirdparty->id, 'ref' => $thirdparty->name, @@ -380,8 +381,10 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') $objectresp = array( 'result'=>array('result_code'=>'OK', 'result_label'=>''), 'thirdparty'=>$thirdparty_result_fields); - } - else { + } elseif ($result == -2) { + $error++; + $errorcode = 'DUPLICATE_FOUND'; $errorlabel = 'Object found several times for id='.$id.' or ref='.$ref.' or ref_ext='.$ref_ext; + } else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } From 1382323f77bc8642d6665ee61b33c4036bf87942 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 27 Mar 2021 06:56:34 +0100 Subject: [PATCH 18/18] FIX Start hour on ACCOUNTING_DATE_START_BINDING --- htdocs/accountancy/admin/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 64ebf2d1ab0..2febe354f2e 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -84,7 +84,7 @@ if ($action == 'update') { $constvalue = GETPOST($constname, 'alpha'); if ($constname == 'ACCOUNTING_DATE_START_BINDING') { - $constvalue = dol_mktime(12, 0, 0, GETPOST($constname.'month', 'int'), GETPOST($constname.'day', 'int'), GETPOST($constname.'year', 'int')); + $constvalue = dol_mktime(0, 0, 0, GETPOST($constname.'month', 'int'), GETPOST($constname.'day', 'int'), GETPOST($constname.'year', 'int')); } if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {