Skip to content

Commit

Permalink
Merge pull request #3946 from Evarisk/develop
Browse files Browse the repository at this point in the history
10.2.0
  • Loading branch information
nicolas-eoxia authored May 31, 2024
2 parents 1676974 + 2961f4a commit a497010
Show file tree
Hide file tree
Showing 37 changed files with 625 additions and 484 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
## Informations

- Numéro du module : 436302
- Dernière mise à jour : 17/05/2024
- Dernière mise à jour : 31/05/2024
- Éditeur : [Evarisk](https://evarisk.com)
- Thème : Eldy Menu
- Licence : GPLv3
- Disponible sur : Windows - MacOS - Linux

### Version

- Version : 10.1.0
- Version : 10.2.0
- PHP : 7.4.33
- Compatibilité : Dolibarr 16.0.0 - 19.0.2
- Saturne Framework : 1.4.0
- Saturne Framework : 1.4.0 - 1.5.0

## Liens

Expand Down
2 changes: 1 addition & 1 deletion admin/config/firepermit.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
$masterWorkerId = GETPOST('maitre_oeuvre');

if ( ! $error) {
$constforval = 'DIGIRISKDOLIBARR_' . strtoupper($type) . "_MAITRE_OEUVRE";
$constforval = 'DIGIRISKDOLIBARR_' . strtoupper($object->element) . "_MAITRE_OEUVRE";
dolibarr_set_const($db, $constforval, $masterWorkerId, 'integer', 0, '', $conf->entity);
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
Expand Down
2 changes: 1 addition & 1 deletion admin/config/preventionplan.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
$masterWorkerId = GETPOST('maitre_oeuvre');

if ( ! $error) {
$constForVal = 'DIGIRISKDOLIBARR_' . strtoupper($type) . "_MAITRE_OEUVRE";
$constForVal = 'DIGIRISKDOLIBARR_' . strtoupper($object->element) . "_MAITRE_OEUVRE";
dolibarr_set_const($db, $constForVal, $masterWorkerId, 'integer', 0, '', $conf->entity);
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
Expand Down
10 changes: 5 additions & 5 deletions admin/config/riskassessmentdocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
die('Include of digiriskdolibarr main fails');
}

global $conf, $db, $langs, $user;
global $conf, $db, $langs, $mc, $user;

// Libraries
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
Expand Down Expand Up @@ -174,8 +174,8 @@

require __DIR__ . '/../../../saturne/core/tpl/admin/object/object_numbering_module_view.tpl.php';

$areRisksShared = !empty($conf->mc->entities['risk']) ? strpos($conf->mc->entities['risk'], $conf->entity) : 0;
$areRisksSharable = isModEnabled('multicompany') && !empty($conf->mc->sharings['risk']) && $areRisksShared > 0;
$areRisksShared = !empty($mc->entities['risk']) ? strpos($mc->entities['risk'], $conf->entity) : 0;
$areRisksSharable = isModEnabled('multicompany') && !empty($mc->sharings['risk']) && $areRisksShared > 0;

$constArray[$moduleNameLowerCase] = [
'RiskDescription' => [
Expand Down Expand Up @@ -438,8 +438,8 @@

require __DIR__ . '/../../../saturne/core/tpl/admin/object/object_numbering_module_view.tpl.php';

$areRiskSignsShared = !empty($conf->mc->entities['risksign']) ? strpos($conf->mc->entities['risksign'], $conf->entity) : 0;
$areRisksSignsSharable = isModEnabled('multicompany') && !empty($conf->mc->sharings['risksign']) && $areRiskSignsShared > 0;
$areRiskSignsShared = !empty($mc->entities['risksign']) ? strpos($mc->entities['risksign'], $conf->entity) : 0;
$areRisksSignsSharable = isModEnabled('multicompany') && !empty($mc->sharings['risksign']) && $areRiskSignsShared > 0;

$constArray[$moduleNameLowerCase] = [
'ShowInheritedRiskSigns' => [
Expand Down
56 changes: 33 additions & 23 deletions admin/ticket/ticket.php

Large diffs are not rendered by default.

54 changes: 24 additions & 30 deletions class/actions_digiriskdolibarr.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ public function addHtmlHeader(array $parameters): int
$this->resprints = $out;
}

if (strpos($_SERVER['PHP_SELF'], 'digiriskdolibarr') !== false) {
?>
<script>
$('link[rel="manifest"]').remove();
</script>
<?php

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

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

Expand Down Expand Up @@ -251,7 +261,7 @@ public function printCommonFooter($parameters)
$object->fetch(GETPOST('id'),'',GETPOST('track_id'));
require_once __DIR__ . '/digiriskelement.class.php';
$digiriskelement = new DigiriskElement($db);
$selectDigiriskElement = $digiriskelement->selectDigiriskElementList($object->array_options['options_digiriskdolibarr_ticket_service'], 'options_digiriskdolibarr_ticket_service', [], 1, 0, array(), 0, 0, 'minwidth100', 0, false, 1);
$selectDigiriskElement = $digiriskelement->selectDigiriskElementList($object->array_options['options_digiriskdolibarr_ticket_service'], 'options_digiriskdolibarr_ticket_service', [], 1, 0, array(), 0, 0, 'minwidth100 maxwidth300', 0, false, 1);
?>
<script>
jQuery('#options_digiriskdolibarr_ticket_service').remove()
Expand Down Expand Up @@ -596,7 +606,19 @@ public function doActions($parameters, $object, $action)
}

require __DIR__ . '/../../saturne/core/tpl/documents/documents_action.tpl.php';
} elseif (in_array($parameters['currentcontext'] , array('ticketlist', 'thirdpartyticket', 'projectticket'))) {
} else if (strpos($parameters['context'], 'projectcard') !== false) {
if ($action == 'builddoc' && GETPOST('model') == 'orque_projectdocument') {
require_once __DIR__ . '/digiriskdolibarrdocuments/projectdocument.class.php';

$document = new ProjectDocument($this->db);

$moduleNameLowerCase = 'digiriskdolibarr';
$permissiontoadd = $user->rights->projet->creer;
$moreParams['modulePart'] = 'project';

require __DIR__ . '/../../saturne/core/tpl/documents/documents_action.tpl.php';
}
} elseif (in_array($parameters['currentcontext'] , array('ticketlist', 'thirdpartyticket', 'projectticket'))) {
if ($action == 'list') {
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
$searchCategoryTicketList = GETPOST('search_category_ticket_list', 'array');
Expand Down Expand Up @@ -849,34 +871,6 @@ public function printFieldListSearchParam($parameters, $object)
}
}

/**
* Overloading the commonGenerateDocument function : replacing the parent's function with the one below
*
* @param Hook $parameters Metadatas (context, etc...)
* @param object $object Current object
* @param string $action
* @return int 0 < on error, 0 on success, 1 to replace standard code
*/
public function commonGenerateDocument($parameters, $object, $action) {
global $db, $user;

if ($parameters['currentcontext'] == 'projectcard') {
if ($parameters['modele'] == 'orque_projectdocument') {
require_once __DIR__ . '/../class/digiriskdolibarrdocuments/projectdocument.class.php';

$projectdocument = new ProjectDocument($db);

$moreparams['object'] = $object;
$moreparams['user'] = $user;
$moreparams['objectType'] = 'project';
if ($object->element == 'project') {
$projectdocument->generateDocument($parameters['modele'], $parameters['outputlangs'], $parameters['hidedetails'], $parameters['hidedesc'], $parameters['hideref'], $moreparams, true);
}
}
}
return 0; // return 0 or return 1 to replace standard code
}

/**
* Overloading the saturneBannerTab function : replacing the parent's function with the one below
*
Expand Down
4 changes: 2 additions & 2 deletions class/digiriskdocuments.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function info($id)
*/
public function fillRiskData(Odf $odfHandler, $object, Translate $outputLangs, $tmparray, $file, $risks, $allEntities = false)
{
global $action, $conf, $hookmanager, $langs;
global $action, $conf, $hookmanager, $langs, $mc;

$usertmp = new User($this->db);
$project = new Project($this->db);
Expand Down Expand Up @@ -249,7 +249,7 @@ public function fillRiskData(Odf $odfHandler, $object, Translate $outputLangs, $
if (!empty($conf->global->DIGIRISKDOLIBARR_SHOW_SHARED_RISKS)) {
$project->fetch($related_task->fk_projet);
if ($project->entity != $conf->entity) {
$result = !empty($conf->mc->sharings['project']) ? in_array($project->entity, $conf->mc->sharings['project']) : 0;
$result = !empty($mc->sharings['project']) ? in_array($project->entity, $mc->sharings['project']) : 0;
} else {
$result = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion class/digiriskelement.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public function setCategories($categories)
* @return string HTML string with
* @throws Exception
*/
public function selectDigiriskElementList($selected = '', $htmlname = 'fk_element', $filter = [], $showempty = '1', $forcecombo = 0, $events = array(), $outputmode = 0, $limit = 0, $morecss = 'minwidth100', $current_element = 0, $multiple = false, $noroot = 0, $contextpage = '', $multientitymanaged = true, $hideref = false)
public function selectDigiriskElementList($selected = '', $htmlname = 'fk_element', $filter = [], $showempty = '1', $forcecombo = 0, $events = array(), $outputmode = 0, $limit = 0, $morecss = 'minwidth100 maxwidth300', $current_element = 0, $multiple = false, $noroot = 0, $contextpage = '', $multientitymanaged = true, $hideref = false)
{
global $conf, $form, $langs;

Expand Down
Loading

0 comments on commit a497010

Please sign in to comment.