Skip to content

Commit

Permalink
Merge pull request #215 from Eoxia/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
nicolas-eoxia authored Jan 19, 2024
2 parents 0c7dac6 + 4cbf240 commit 5e30c3a
Show file tree
Hide file tree
Showing 49 changed files with 1,679 additions and 192 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
/.gitattributes
node_modules
package-lock.json
.DS_Store
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
## Informations

- Numéro du module : 436351
- Dernière mise à jour : 13/09/2023
- Dernière mise à jour : 19/12/2023
- Éditeur : [Eoxia](https://eoxia.com)
- Thème : Eldy Menu
- Licence : GPLv3
- Disponible sur : Windows - MacOS - Linux
-
### Version

- Version : 1.2.0
- Compatibilité : Dolibarr 16.0.0 - 18.0.1
- Saturne Framework : 1.1.2
- Version : 1.3.0
- PHP : 7.4.33
- Compatibilité : Dolibarr 16.0.0 - 18.0.3
- Saturne Framework : 1.2.1

## Liens

Expand Down
24 changes: 23 additions & 1 deletion admin/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@
print ajax_constantonoff('EASYCRM_THIRDPARTY_WEB_VISIBLE');
print '</td></td><td></td></tr>';

// Commercial
print '<tr class="oddeven"><td>';
print $langs->trans('AllocateCommercial');
print '</td><td>';
print $langs->trans('ObjectVisibleDescription', $langs->trans('AllocateCommercial'));
print '</td>';

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

// Private note
print '<tr class="oddeven"><td>';
print $langs->trans('NotePrivate');
Expand All @@ -220,7 +231,7 @@
print '<tr class="oddeven"><td>';
print $langs->trans('CustomersProspectsCategoriesShort');
print '</td><td>';
print $langs->trans('ObjectVisibleDescription', $langs->trans('CustomersProspectsCategoriesShort'));
print $langs->trans('ObjectVisibleDescription', $langs->transnoentities('CustomersProspectsCategoriesShort'));
print '</td>';

print '<td class="center">';
Expand Down Expand Up @@ -346,6 +357,17 @@
print ajax_constantonoff('EASYCRM_PROJECT_DATE_START_VISIBLE');
print '</td></td><td></td></tr>';

// Description
print '<tr class="oddeven"><td>';
print $langs->trans('Description');
print '</td><td>';
print $langs->trans('ObjectVisibleDescription', $langs->trans('Description'));
print '</td>';

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

// Extrafields
print '<tr class="oddeven"><td>';
print $langs->trans('Extrafields');
Expand Down
51 changes: 36 additions & 15 deletions class/actions_easycrm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function addMoreBoxStatsCustomer(array $parameters, CommonObject $object,
global $conf, $langs, $user;

// Do something only for the current context
if ($parameters['currentcontext'] == 'thirdpartycomm') {
if (strpos($parameters['context'], 'thirdpartycomm') !== false) {
if (isModEnabled('project') && $user->hasRight('projet', 'lire') && isModEnabled('saturne')) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once __DIR__ . '/../../saturne/lib/object.lib.php';
Expand Down Expand Up @@ -129,7 +129,7 @@ public function addMoreRecentObjects(array $parameters, CommonObject $object, st
global $conf, $db, $langs, $user;

// Do something only for the current context
if ($parameters['currentcontext'] == 'thirdpartycomm') {
if (strpos($parameters['context'], 'thirdpartycomm') !== false) {
if (isModEnabled('project') && $user->hasRight('projet', 'lire') && isModEnabled('saturne')) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once __DIR__ . '/../../saturne/lib/object.lib.php';
Expand Down Expand Up @@ -217,9 +217,9 @@ public function addMoreActionsButtons(array $parameters, CommonObject $object, s
global $langs, $user;

// Do something only for the current context
if (in_array($parameters['currentcontext'], ['thirdpartycomm', 'projectcard'])) {
if (preg_match('/thirdpartycomm|projectcard/', $parameters['context'])) {
if (empty(GETPOST('action')) || GETPOST('action') == 'update') {
if ($parameters['currentcontext'] == 'thirdpartycomm') {
if (strpos($parameters['context'], 'thirdpartycomm') !== false) {
$socid = $object->id;
$moreparam = '';
} else {
Expand All @@ -245,7 +245,7 @@ public function addMoreActionsButtons(array $parameters, CommonObject $object, s
*/
public function doActions(array $parameters, $object, string $action): int
{
if (in_array($parameters['currentcontext'], ['invoicecard', 'invoicereccard', 'thirdpartycomm', 'thirdpartycard'])) {
if (preg_match('/invoicecard|invoicereccard|thirdpartycomm|thirdpartycard/', $parameters['context'])) {
if ($action == 'set_notation_object_contact') {
require_once __DIR__ . '/../lib/easycrm_function.lib.php';

Expand All @@ -271,7 +271,7 @@ public function printCommonFooter(array $parameters): int
global $conf, $db, $langs , $object;

// Do something only for the current context
if (in_array($parameters['currentcontext'], ['thirdpartycomm', 'projectcard'])) {
if (preg_match('/thirdpartycomm|projectcard/', $parameters['context'])) {
if (isModEnabled('agenda')) {
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';

Expand All @@ -281,7 +281,7 @@ public function printCommonFooter(array $parameters): int
$actiomcomm = new ActionComm($db);

$filter = ' AND a.id IN (SELECT c.fk_actioncomm FROM ' . MAIN_DB_PREFIX . 'categorie_actioncomm as c WHERE c.fk_categorie = ' . $conf->global->EASYCRM_ACTIONCOMM_COMMERCIAL_RELAUNCH_TAG . ')';
$actiomcomms = $actiomcomm->getActions(GETPOST('socid'), ($parameters['currentcontext'] != 'thirdpartycomm' ? GETPOST('id') : ''), ($parameters['currentcontext'] != 'thirdpartycomm' ? 'project' : ''), $filter, 'a.datec');
$actiomcomms = $actiomcomm->getActions(GETPOST('socid'), ((strpos($parameters['context'], 'thirdpartycomm') !== false) ? '' : GETPOST('id')), ((strpos($parameters['context'], 'thirdpartycomm') !== false) ? '' : 'project'), $filter, 'a.datec');
if (is_array($actiomcomms) && !empty($actiomcomms)) {
$nbActiomcomms = count($actiomcomms);
$lastActiomcomm = array_shift($actiomcomms);
Expand All @@ -306,7 +306,7 @@ public function printCommonFooter(array $parameters): int
}

// Do something only for the current context
if ($parameters['currentcontext'] == 'projectcard') {
if (strpos($parameters['context'], 'projectcard') !== false) {
if (empty(GETPOST('action')) || GETPOST('action') == 'update') {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
Expand All @@ -329,7 +329,7 @@ public function printCommonFooter(array $parameters): int
}
}

if (in_array($parameters['currentcontext'], ['invoicelist', 'invoicereclist', 'thirdpartylist'])) {
if (preg_match('/invoicelist|invoicereclist|thirdpartylist/', $parameters['context'])) {
$cssPath = dol_buildpath('/saturne/css/saturne.min.css', 1);
print '<link href="' . $cssPath . '" rel="stylesheet">';

Expand All @@ -346,7 +346,7 @@ public function printCommonFooter(array $parameters): int
<?php
}

if (in_array($parameters['currentcontext'], ['invoicecard', 'invoicereccard', 'thirdpartycomm', 'thirdpartycard'])) {
if (preg_match('/invoicecard|invoicereccard|thirdpartycomm|thirdpartycard/', $parameters['context'])) {
$cssPath = dol_buildpath('/saturne/css/saturne.min.css', 1);
print '<link href="' . $cssPath . '" rel="stylesheet">';

Expand All @@ -368,7 +368,7 @@ public function printCommonFooter(array $parameters): int
<?php
}

if ($parameters['currentcontext'] == 'contactcard') {
if (strpos($parameters['context'], 'contactcard') !== false) {
if (in_array(GETPOST('action'), ['create', 'edit'])) {
$out = img_picto('', 'fontawesome_fa-id-card-alt_fas', 'class="pictofixedwidth"'); ?>
<script>
Expand All @@ -381,6 +381,27 @@ public function printCommonFooter(array $parameters): int
return 0; // or return 1 to replace standard code
}

/**
* Overloading the addHtmlHeader function : replacing the parent's function with the one below
*
* @param array $parameters Hook metadata (context, etc...)
* @return int 0 < on error, 0 on success, 1 to replace standard code
*/
public function addHtmlHeader(array $parameters): int
{
if (strpos($_SERVER['PHP_SELF'], 'easycrm') !== false) {
?>
<script>
$('link[rel="manifest"]').remove();
</script>
<?php

$this->resprints = '<link rel="manifest" href="' . DOL_URL_ROOT . '/custom/easycrm/manifest.json.php' . '" />';
}

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

/**
* Overloading the printFieldListValue function : replacing the parent's function with the one below
*
Expand All @@ -393,7 +414,7 @@ public function printFieldListValue(array $parameters): int
global $conf, $db, $langs, $object, $user;

// Do something only for the current context
if ($parameters['currentcontext'] == 'projectlist') {
if (strpos($parameters['context'], 'projectlist') !== false) {
if (isModEnabled('agenda') && isModEnabled('project') && $user->hasRight('projet', 'lire') && isModEnabled('saturne')) {
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
Expand Down Expand Up @@ -436,7 +457,7 @@ public function printFieldListValue(array $parameters): int
}
}

if (in_array($parameters['currentcontext'], ['invoicelist', 'invoicereclist', 'thirdpartylist'])) {
if (preg_match('/invoicelist|invoicereclist|thirdpartylist/', $parameters['context'])) {
if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
$extrafieldName = 'options_notation_' . $object->element . '_contact';
if ($object->element == 'facturerec') {
Expand Down Expand Up @@ -472,7 +493,7 @@ public function printFieldListValue(array $parameters): int
*/
public function formConfirm(array $parameters, CommonObject $object): int
{
if ($parameters['currentcontext'] == 'propalcard') {
if (strpos($parameters['context'], 'propalcard') !== false) {
if (empty($object->thirdparty->id)) {
$object->fetch_thirdparty();
}
Expand All @@ -491,7 +512,7 @@ public function completeTabsHead(array $parameters): int
{
global $langs;

if (in_array($parameters['currentcontext'], ['invoicereccard', 'invoicereccontact'])) {
if (preg_match('/invoicereccard|invoicereccontact/', $parameters['context'])) {
$nbContact = 0;
// Enable caching of thirdrparty count Contacts
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
Expand Down
Loading

0 comments on commit 5e30c3a

Please sign in to comment.