Skip to content

Commit

Permalink
Merge pull request #1558 from Evarisk/develop
Browse files Browse the repository at this point in the history
1.9.0
  • Loading branch information
nicolas-eoxia authored Sep 13, 2023
2 parents de9b296 + 608c17b commit dc8db56
Show file tree
Hide file tree
Showing 26 changed files with 820 additions and 565 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
## Informations

- Numéro du module : 436301
- Dernière mise à jour : 23/08/2023
- Dernière mise à jour : 13/09/2023
- Éditeur : [Evarisk](https://evarisk.com)
- Thème : Eldy Menu
- Licence : GPLv3
- Disponible sur : Windows - MacOS - Linux

### Version

- Version : 1.8.1
- Compatibilité : Dolibarr 16.0.0 - 17.0.3
- Version : 1.9.0
- Compatibilité : Dolibarr 16.0.0 - 18.0.1
- Saturne Framework : 1.1.2

## Liens
Expand Down Expand Up @@ -66,3 +66,4 @@ Génération du rapport de contrôle
git clone https://github.com/Evarisk/digiquali.git
git clone https://github.com/Evarisk/saturne.git
```
- Activer le module dans la liste des Modules/Applications installés
16 changes: 14 additions & 2 deletions admin/control.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,18 @@
print '</td>';
print '</tr>';

// Auto-save action on question answer
print '<tr><td>';
print $langs->trans('AutoSaveActionQuestionAnswer');
print '</td><td>';
print $langs->trans('AutoSaveActionQuestionAnswerDescription');
print '</td>';

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

print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">';
print '<input type="hidden" name="token" value="' . newToken() . '">';
print '<input type="hidden" name="action" value="update_public_survey_title">';
Expand All @@ -417,7 +429,7 @@
print '</td>';

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

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

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

Expand Down
4 changes: 2 additions & 2 deletions admin/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
require_once __DIR__ . '/../lib/digiquali.lib.php';

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

// Load translation files required by the page
saturne_load_langs(['admin']);
Expand Down Expand Up @@ -126,7 +126,7 @@
print '<tr class="oddeven"><td>';
print $langs->trans('AdvancedTriggers');
print '</td><td>';
print $langs->trans('AdvancedTriggersDescription');
print $langs->trans('AdvancedTriggersDescription', $moduleName);
print '</td>';

print '<td class="center">';
Expand Down
41 changes: 38 additions & 3 deletions class/actions_digiquali.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function doActions(array $parameters, $object, string $action): int
*/
public function printCommonFooter($parameters)
{
global $conf, $form, $langs, $user;
global $conf, $form, $langs, $object, $user;

$error = 0; // Error counter

Expand Down Expand Up @@ -284,6 +284,41 @@ public function printCommonFooter($parameters)
<?php
}

require_once __DIR__ . '/../lib/digiquali_sheet.lib.php';

$linkableElements = get_sheet_linkable_objects();

if (!empty($linkableElements)) {
foreach($linkableElements as $linkableElement) {
if ($linkableElement['link_name'] == $object->element) {
if ($parameters['currentcontext'] == $linkableElement['hook_name_card']) {
$picto = img_picto('', 'fontawesome_fa-clipboard-check_fas_#d35968', 'class="pictofixedwidth"');
$extrafieldsNames = ['qc_frequency', 'control_history_link'];
foreach ($extrafieldsNames as $extrafieldsName) {
$jQueryElement = 'td.' . $object->element . '_extras_' . $extrafieldsName; ?>
<script>
var objectElement = <?php echo "'" . $jQueryElement . "'"; ?>;
jQuery(objectElement).prepend(<?php echo json_encode($picto); ?>);
</script>
<?php
}
} elseif (in_array($parameters['currentcontext'], [$linkableElement['hook_name_list'], 'projecttaskscard']) || preg_match('/' . $linkableElement['hook_name_list'] . '/', $parameters['context'])) {
$picto = img_picto('', 'fontawesome_fa-clipboard-check_fas_#d35968', 'class="pictofixedwidth"');
$extrafieldsNames = ['qc_frequency', 'control_history_link'];
foreach ($extrafieldsNames as $extrafieldsName) { ?>
<script>
var objectElement = <?php echo "'" . $extrafieldsName . "'"; ?>;
var outJS = <?php echo json_encode($picto); ?>;
var cell = $('.liste > tbody > tr.liste_titre').find('th[data-titlekey="' + objectElement + '"]');
cell.prepend(outJS);
</script>
<?php
}
}
}
}
}

if (!$error) {
$this->results = array('myreturn' => 999);
return 0; // or return 1 to replace standard code
Expand Down Expand Up @@ -355,7 +390,7 @@ public function saturneBannerTab(array $parameters, CommonObject $object): int
// Do something only for the current context.
if (preg_match('/controlcard/', $parameters['context'])) {
if ($conf->browser->layout == 'phone') {
$morehtmlref = '<i class="toggleControlInfo far fa-caret-square-down"></i>' . ' ' . $langs->trans('DisplayMoreInfo');
$morehtmlref = '<br><div>' . img_picto('', 'fontawesome_fa-caret-square-down_far_#966EA2F2_fa-2em', 'class="toggleControlInfo pictofixedwidth valignmiddle" style="width: 35px;"') . $langs->trans('DisplayMoreInfo') . '</div>';
} else {
$morehtmlref = '';
}
Expand All @@ -377,7 +412,7 @@ public function printMainArea(array $parameters): int
global $conf, $mysoc;

// Do something only for the current context.
if (in_array($parameters['currentcontext'], ['publiccontrol', 'publicsurvey'])) {
if (in_array($parameters['currentcontext'], ['publiccontrol', 'publicsurvey', 'publiccontrolhistory'])) {
if (!empty($conf->global->SATURNE_SHOW_COMPANY_LOGO)) {
// Define logo and logoSmall.
$logoSmall = $mysoc->logo_small;
Expand Down
10 changes: 8 additions & 2 deletions class/control.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ class Control extends SaturneObject
'date_creation' => ['type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 2, 'positioncard' => 10],
'tms' => ['type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 0],
'import_key' => ['type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 0, 'index' => 0],
'control_date' => ['type' => 'date', 'label' => 'ControlDate', 'enabled' => 1, 'position' => 63, 'notnull' => 0, 'visible' => 5],
'next_control_date' => ['type' => 'date', 'label' => 'NextControlDate', 'enabled' => 1, 'position' => 65, 'notnull' => 0, 'visible' => 5],
'control_date' => ['type' => 'date', 'label' => 'ControlDate', 'enabled' => 1, 'position' => 63, 'notnull' => 0, 'visible' => 2],
'next_control_date' => ['type' => 'date', 'label' => 'NextControlDate', 'enabled' => 1, 'position' => 65, 'notnull' => 0, 'visible' => 2],
'status' => ['type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 5, 'index' => 1, 'default' => 0, 'arrayofkeyval' => [0 => 'Draft', 1 => 'Validated', 2 => 'Locked']],
'note_public' => ['type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => 0],
'note_private' => ['type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 0],
Expand Down Expand Up @@ -551,6 +551,9 @@ public function createFromClone(User $user, int $fromID, array $options): int
if (empty($options['photos'])) {
$object->photo = '';
}
if (property_exists($object, 'control_date')) {
$object->control_date = '';
}
if (property_exists($object, 'next_control_date')) {
$object->next_control_date = '';
}
Expand Down Expand Up @@ -1055,6 +1058,9 @@ public function getTriggerDescription(SaturneObject $object): string
{
global $db, $langs;

// Load DigiQuali libraries
require_once __DIR__ . '/../class/sheet.class.php';

$sheet = new Sheet($db);
$sheet->fetch($object->fk_sheet);

Expand Down
18 changes: 15 additions & 3 deletions core/modules/modDigiQuali.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct($db)
$this->editor_url = 'https://evarisk.com/';

// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = '1.8.1';
$this->version = '1.9.0';
// Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';

Expand Down Expand Up @@ -125,7 +125,7 @@ public function __construct($db)
'publiccontrol',
'publicsurvey',
'digiqualiadmindocuments',
'productlotcard'
'projecttaskscard'
],
// Set this to 1 if features of module are opened to external users
'moduleforexternal' => 0,
Expand All @@ -148,7 +148,7 @@ public function __construct($db)
// A condition to hide module
$this->hidden = false;
// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
$this->depends = ['modFckeditor', 'modProduct', 'modProductBatch', 'modAgenda', 'modECM', 'modProjet', 'modCategorie', 'modSaturne', 'modTicket'];
$this->depends = ['modFckeditor', 'modProduct', 'modProductBatch', 'modAgenda', 'modECM', 'modProjet', 'modCategorie', 'modSaturne', 'modTicket', 'modCron'];
$this->requiredby = []; // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
$this->conflictwith = []; // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)

Expand Down Expand Up @@ -231,6 +231,9 @@ public function __construct($db)

// CONST CONTROL LINE
$i++ => ['DIGIQUALI_CONTROLDET_ADDON', 'chaine', 'mod_controldet_standard', '', 0, 'current'],
$i++ => ['DIGIQUALI_CONTROLDET_AUTO_SAVE_ACTION', 'integer', 1, '', 0, 'current'],

// CONST CONTROL EQUIPMENT
$i++ => ['DIGIQUALI_CONTROL_EQUIPMENT_ADDON', 'chaine', 'mod_control_equipment_standard', '', 0, 'current'],

// CONST MODULE
Expand Down Expand Up @@ -287,6 +290,9 @@ public function __construct($db)
$objectType = $linkableElement['tab_type'];
}
$this->tabs[] = ['data' => $objectType . ':+control:' . $pictoDigiQuali . $langs->trans('Controls') . ':digiquali@digiquali:$user->rights->digiquali->control->read:/custom/digiquali/view/control/control_list.php?fromid=__ID__&fromtype=' . $linkableElement['link_name']];

$this->module_parts['hooks'][] = $linkableElement['hook_name_list'];
$this->module_parts['hooks'][] = $linkableElement['hook_name_card'];
}
}

Expand Down Expand Up @@ -721,6 +727,12 @@ public function init($options = ''): int
dolibarr_set_const($this->db, 'DIGIQUALI_QUESTION_BACKWARD_COMPATIBILITY', 1, 'integer', 0, '', $conf->entity);
}

require_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php';

$cronJob = new Cronjob($this->db);
$cronJob->fetch(0, 'ActionComm', 'sendEmailsReminder');
$cronJob->reprogram_jobs($user->login, dol_now());

return $result;
}

Expand Down
Loading

0 comments on commit dc8db56

Please sign in to comment.