Skip to content

Commit

Permalink
#4 [QuickCreation] add: contact quick add/rework other
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Mar 8, 2023
1 parent 26d2f4b commit 077d821
Show file tree
Hide file tree
Showing 3 changed files with 285 additions and 178 deletions.
41 changes: 37 additions & 4 deletions core/modules/modEasyCRM.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ public function __construct($db)
global $langs, $conf;
$this->db = $db;

require_once __DIR__ . '/../../../saturne/lib/saturne_functions.lib.php';

saturne_load_langs(['easycrm@easycrm']);
if (isModEnabled('saturne')) {
require_once __DIR__ . '/../../../saturne/lib/saturne_functions.lib.php';
saturne_load_langs(['easycrm@easycrm']);
} else {
$this->error++;
$this->errors[] = $langs->trans('activateModuleDependNotSatisfied', 'EasyCRM', 'Saturne');
}

// ID for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used module id).
Expand Down Expand Up @@ -155,6 +159,30 @@ public function __construct($db)
// );
$i = 0;
$this->const = [
// CONST CONFIGURATION
// CONST THIRDPARTY
$i++ => ['EASYCRM_THIRDPARTY_CLIENT_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_THIRDPARTY_CLIENT_VALUE', 'integer', 2, '', 0, 'current'],
$i++ => ['EASYCRM_THIRDPARTY_NAME_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_THIRDPARTY_EMAIL_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_THIRDPARTY_CATEGORIES_VISIBLE', 'integer', 1, '', 0, 'current'],

// CONST CONTACT
$i++ => ['EASYCRM_CONTACT_LASTNAME_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_CONTACT_FIRSTNAME_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_CONTACT_JOB_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_CONTACT_PHONEPRO_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_CONTACT_EMAIL_VISIBLE', 'integer', 1, '', 0, 'current'],

// CONST PROJECT
$i++ => ['EASYCRM_PROJECT_LABEL_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_PROJECT_OPPORTUNITY_STATUS_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_PROJECT_OPPORTUNITY_STATUS_VALUE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_PROJECT_OPPORTUNITY_AMOUNT_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_PROJECT_OPPORTUNITY_AMOUNT_VALUE', 'integer', 3000, '', 0, 'current'],
$i++ => ['EASYCRM_PROJECT_DATE_START_VISIBLE', 'integer', 1, '', 0, 'current'],
$i++ => ['EASYCRM_PROJECT_CATEGORIES_VISIBLE', 'integer', 1, '', 0, 'current'],

// CONST MODULE
$i++ => ['EASYCRM_VERSION','chaine', $this->version, '', 0, 'current'],
$i => ['EASYCRM_DB_VERSION', 'chaine', $this->version, '', 0, 'current'],
Expand Down Expand Up @@ -232,7 +260,7 @@ public function __construct($db)
$this->menu[$r++] = [
'fk_menu' => 'fk_mainmenu=easycrm', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type' => 'left', // This is a Top menu entry
'titre' => $langs->transnoentities('QuickProjectCreation'),
'titre' => $langs->transnoentities('QuickCreation'),
'prefix' => '<i class="fas fa-plus-circle pictofixedwidth"></i>',
'mainmenu' => 'easycrm',
'leftmenu' => 'quickcreation',
Expand Down Expand Up @@ -315,6 +343,11 @@ public function init($options = ''): int
dolibarr_set_const($this->db, 'EASYCRM_VERSION', $this->version, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($this->db, 'EASYCRM_DB_VERSION', $this->version, 'chaine', 0, '', $conf->entity);

if ($this->error > 0) {
setEventMessages('', $this->errors, 'errors');
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

// Permissions
$this->remove($options);

Expand Down
30 changes: 29 additions & 1 deletion langs/fr_FR/easycrm.lang
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,32 @@
ModuleEasyCRMName = EasyCRM
ModuleEasyCRMDesc = Simplification de la CRM
EasyCRMDescription = Simplification de la CRM
EasyCRMDescriptionLong = Simplification de la CRM
EasyCRMDescriptionLong = Simplification de la CRM

#
# Quick Creation - Ajout rapide
#
QuickCreation = Ajout rapide
QuickCreations = ajouts rapide
QuickThirdPartyCreation = Ajout rapide de tiers
QuickThirdPartyCreations = ajouts rapide de tiers
QuickProjectCreation = Ajout rapide de projet
QuickProjectCreations = ajouts rapide de projet
QuickContactCreation = Ajout rapide de contact/adresse
QuickContactCreations = ajouts rapide de contact/adresse

#
# Config page - Page d'administration
#

# Data - Donnée
OpportunityStatusDescription = Selection du statut d'opportunité <br> Valeur par défaut : <b> Prospection </b>
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>

#
# Other - Autre
#

# Data - Donnée
LastProjects = Les %s derniers projets
Loading

0 comments on commit 077d821

Please sign in to comment.