Skip to content

Commit

Permalink
#13 [QuickCreation] add: unique creation object
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Mar 15, 2023
1 parent f06e306 commit d337cf0
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 167 deletions.
12 changes: 6 additions & 6 deletions admin/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('Name') . '</td>';
print '<td>' . $langs->trans('Description') . '</td>';
print '<td class="center">' . $langs->trans('Status') . '</td>';
print '<td class="center">' . $langs->trans('Visible') . '</td>';
print '<td>' . $langs->trans('Value') . '</td>';
print '</tr>';

Expand All @@ -126,7 +126,7 @@
print '</td>';

print '<td class="center">';
print ajax_constantonoff('EASYCRM_THIRDPARTY_CLIENT_VISIBLE');
//print ajax_constantonoff('EASYCRM_THIRDPARTY_CLIENT_VISIBLE');
print '</td>';

if ($conf->global->EASYCRM_THIRDPARTY_CLIENT_VISIBLE > 0 && isModEnabled('societe')) {
Expand All @@ -144,7 +144,7 @@
print '</td>';

print '<td class="center">';
print ajax_constantonoff('EASYCRM_THIRDPARTY_NAME_VISIBLE');
//print ajax_constantonoff('EASYCRM_THIRDPARTY_NAME_VISIBLE');
print '</td></td><td></tr>';

// Email
Expand Down Expand Up @@ -180,7 +180,7 @@
print '</td>';

print '<td class="center">';
print ajax_constantonoff('EASYCRM_CONTACT_LASTNAME_VISIBLE');
//print ajax_constantonoff('EASYCRM_CONTACT_LASTNAME_VISIBLE');
print '</td></td><td></tr>';

// Firstname
Expand Down Expand Up @@ -228,7 +228,7 @@
print '</td></td><td></tr>';

// PROJECT
print '<tr class="oddeven"><td colspan="4" class="center"><div class="titre inline-block">' . $langs->trans('Configs', $langs->trans('QuickProjectCreations')) . '</div></td><tr>';
print '<tr class="oddeven"><td colspan="4" class="center"><div class="titre inline-block">' . $langs->trans('Configs', $langs->transnoentities('QuickProjectCreations')) . '</div></td><tr>';

// ProjectLabel
print '<tr class="oddeven"><td>';
Expand All @@ -238,7 +238,7 @@
print '</td>';

print '<td class="center">';
print ajax_constantonoff('EASYCRM_PROJECT_LABEL_VISIBLE');
//print ajax_constantonoff('EASYCRM_PROJECT_LABEL_VISIBLE');
print '</td></td><td></tr>';

// OpportunityStatus
Expand Down
15 changes: 8 additions & 7 deletions core/modules/modEasyCRM.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct($db)
global $langs, $conf;
$this->db = $db;

if (isModEnabled('saturne')) {
if (file_exists(__DIR__ . '/../../../saturne/lib/saturne_functions.lib.php')) {
require_once __DIR__ . '/../../../saturne/lib/saturne_functions.lib.php';
saturne_load_langs(['easycrm@easycrm']);
} else {
Expand Down Expand Up @@ -185,7 +185,8 @@ public function __construct($db)

// CONST MODULE
$i++ => ['EASYCRM_VERSION','chaine', $this->version, '', 0, 'current'],
$i => ['EASYCRM_DB_VERSION', 'chaine', $this->version, '', 0, 'current'],
$i++ => ['EASYCRM_DB_VERSION', 'chaine', $this->version, '', 0, 'current'],
$i => ['EASYCRM_SHOW_PATCH_NOTE', 'integer', 1, '', 0, 'current'],
];

// Some keys to add into the overwriting translation tables
Expand Down Expand Up @@ -338,16 +339,16 @@ public function init($options = ''): int
{
global $conf;

$sql = [];

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')
}

$sql = [];

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);

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

Expand Down
32 changes: 1 addition & 31 deletions easycrmindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,4 @@
die('Include of easycrm main fails');
}

// Global variables definitions
global $conf, $db, $langs, $moduleName, $moduleNameLowerCase, $user;

// Libraries
require_once __DIR__ . '/core/modules/mod' . $moduleName . '.class.php';

// Load translation files required by the page
saturne_load_langs();

// Initialize technical objects
$classname = 'mod' . $moduleName;
$modModule = new $classname($db);

// Security check
$permissiontoread = $user->rights->$moduleNameLowerCase->read;
saturne_check_access($permissiontoread);

/*
* View
*/

$title = $langs->trans('ModuleArea', $moduleName);
$helpUrl = 'FR:Module_' . $moduleName;

saturne_header(0, '', $title . ' ' . $modModule->version, $helpUrl);

print load_fiche_titre($title . ' ' . $modModule->version, '', $moduleNameLowerCase . '_color.png@' . $moduleNameLowerCase);

// End of page
llxFooter();
$db->close();
require_once __DIR__ . '/../saturne/core/tpl/index/index_view.tpl.php';
5 changes: 3 additions & 2 deletions langs/fr_FR/easycrm.lang
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ 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
QuickProjectCreation = Ajout rapide d'opportunité ou de projet
QuickProjectCreations = ajouts rapide d'opportunité ou de projet
QuickContactCreation = Ajout rapide de contact/adresse
QuickContactCreations = ajouts rapide de contact/adresse
CommercialFollowUp = Suivi commercial

#
# Config page - Page d'administration
Expand Down
Loading

0 comments on commit d337cf0

Please sign in to comment.