Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#221 [QuickCreation] add: add const + check statut #256

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions class/actions_easycrm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ public function completeTabsHead(array $parameters): int
return 0; // or return 1 to replace standard code
}

/**
/**
* Overloading the addMoreMassActions function
*
* @param array $parameters Hook metadatas (context, etc...)
Expand Down Expand Up @@ -755,7 +755,7 @@ public function doPreMassActions($parameters)

return 0; // or return 1 to replace standard code
}

/**
* Overloading the doMassActions function
*
Expand Down Expand Up @@ -807,4 +807,40 @@ public function doMassActions($parameters, $object)

return 0; // or return 1 to replace standard code
}

/**
* Overloading the saturneAdminPWAAdditionalConfig function : replacing the parent's function with the one below
*
* @param array $parameters Hook metadatas (context, etc...)
* @return int 0 < on error, 0 on success, 1 to replace standard code
*/
public function saturneAdminPWAAdditionalConfig(array $parameters): int
{
global $langs;

if (strpos($parameters['context'], 'pwaadmin') !== false) {
// PWA configuration
$out = load_fiche_titre($langs->trans('Config'), '', '');

$out .= '<table class="noborder centpercent">';
$out .= '<tr class="liste_titre">';
$out .= '<td>' . $langs->trans('Parameters') . '</td>';
$out .= '<td>' . $langs->trans('Description') . '</td>';
$out .= '<td class="center">' . $langs->trans('Status') . '</td>';
$out .= '</tr>';

// PWA close project when probability zero
$out .= '<tr class="oddeven"><td>';
$out .= $langs->trans('PWACloseProjectOpportunityZero');
$out .= '</td><td>';
$out .= $langs->trans('PWACloseProjectOpportunityZeroDescription');
$out .= '</td><td class="center">';
$out .= ajax_constantonoff('EASYCRM_PWA_CLOSE_PROJECT_WHEN_OPPORTUNITY_ZERO');
$out .= '</td></tr>';

$out .= '</table>';
}

return 0; // or return 1 to replace standard code
}
}
6 changes: 5 additions & 1 deletion core/modules/modEasyCRM.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ public function __construct($db)
'contactcard',
'thirdpartycard',
'thirdpartylist',
'main'
'main',
'pwaadmin'
],
// Set this to 1 if features of module are opened to external users
'moduleforexternal' => 0,
Expand Down Expand Up @@ -218,6 +219,9 @@ public function __construct($db)
$i++ => ['EASYCRM_EVENT_DESCRIPTION_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_EVENT_CATEGORIES_VISIBLE', 'integer', 1, '', 0, 'current'],

// CONST PWA
$i++ => ['EASYCRM_PWA_CLOSE_PROJECT_WHEN_OPPORTUNITY_ZERO', 'integer', 0, '', 0, 'current'],

// CONST ADDRESS
$i++ => ['EASYCRM_DISPLAY_MAIN_ADDRESS', 'integer', 0, '', 0, 'current'],
$i++ => ['EASYCRM_ADDRESS_ADDON', 'chaine', 'mod_address_standard', '', 0, 'current'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
$project->opp_amount = price2num(GETPOST('opp_amount', 'int'));
$project->date_c = dol_now();
$project->date_start = dol_now();
$project->statut = 1;
$project->statut = getDolGlobalInt('EASYCRM_PWA_CLOSE_PROJECT_WHEN_OPPORTUNITY_ZERO') > 0 && $project->opp_percent == 0 ? Project::STATUS_CLOSED : Project::STATUS_VALIDATED;
$project->usage_opportunity = 1;
$project->usage_task = 1;

Expand Down
2 changes: 1 addition & 1 deletion langs/en_US/easycrm.lang
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
ModuleEasyCRMName = EasyCRM
ModuleEasyCRMDesc = Simplification of CRM
EasyCRMDescription = Simplification of CRM
EasyCRMDescriptionLong = Simplification of CRM
EasyCRMDescriptionLong = Simplification of CRM
5 changes: 5 additions & 0 deletions langs/fr_FR/easycrm.lang
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,16 @@ OpportunityStatusDescription = Selection du statut d'opportunité <br> Valeur pa
OpportunityAmountDescription = Selection du montant d'opportunité <br> Valeur par défaut : <b> 3000 € </b>
ProspectCustomerDescription = Selection de la nature des tiers <br> Valeur par défaut : <b> Prospect </b>

# PWA - Progressive Web App
PWACloseProjectOpportunityZero = Clôturer le projet
PWACloseProjectOpportunityZeroDescription = Clôturer le projet quand l'opportunité est à 0

# Product Kit - Produit Kit
ProductKitConf = Compléter la description d'une ligne de devis avec la composition du kit
ProductKitConfDesc = Indépendemment du paramètre du module produit sur la complétion de la description. <br> A l'ajout d'un produit/service, ayant un kit, sur une ligne de devis, la description de la ligne sera remplacée par le libellé et la description des produits composants.



#
# Tools - Outils
#
Expand Down