From 57b532cdd0f5328f461818522c2190917843be44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Mar 2017 12:51:43 +0100 Subject: [PATCH] Fix status of opportunity is required if an amount is defined --- htdocs/install/mysql/migration/repair.sql | 1 + htdocs/projet/card.php | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 06372f42aba..03c1ab07dfd 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -232,6 +232,7 @@ UPDATE llx_actioncomm set fk_user_action = fk_user_author where fk_user_author > UPDATE llx_projet_task_time set task_datehour = task_date where task_datehour IS NULL and task_date IS NOT NULL; UPDATE llx_projet set fk_opp_status = NULL where fk_opp_status = -1; +UPDATE llx_projet set fk_opp_status = (SELECT rowid FROM llx_c_lead_status WHERE code='PROSP') where fk_opp_status IS NULL and opp_amount > 0; UPDATE llx_c_lead_status set code = 'WON' where code = 'WIN'; -- Requests to clean old tables or external modules tables diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6221e4c2b87..a9306bb9218 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -129,6 +129,12 @@ if (empty($reshook)) $error++; } + if (GETPOST('opp_amount') != '' && ! (GETPOST('opp_status') > 0)) + { + $error++; + setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors'); + } + if (! $error) { $error=0; @@ -558,26 +564,26 @@ if ($action == 'create' && $user->rights->projet->creer) // Opportunity probability print ''.$langs->trans("OpportunityProbability").''; - print ' %'; + print ' %'; print ''; print ''; print ''; // Opportunity amount print ''.$langs->trans("OpportunityAmount").''; - print ''; + print ''; print ''; } // Budget print ''.$langs->trans("Budget").''; - print ''; + print ''; print ''; // Description print ''.$langs->trans("Description").''; print ''; - print ''; + print ''; print ''; if ($conf->categorie->enabled) {