Skip to content

Commit

Permalink
Merge pull request #1815 from Evarisk/develop
Browse files Browse the repository at this point in the history
1.12.0
  • Loading branch information
nicolas-eoxia authored Jun 3, 2024
2 parents 12bea38 + 49f0c86 commit 14de047
Show file tree
Hide file tree
Showing 20 changed files with 133 additions and 138 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
## Informations

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

### Version

- Version : 1.11.0
- Version : 1.12.0
- PHP : 7.4.33
- Compatibilité : Dolibarr 17.0.0 - 18.0.5
- Saturne Framework : 1.3.0
- Compatibilité : Dolibarr 17.0.0 - 19.0.2
- Saturne Framework : 1.5.0

## Liens

Expand Down
4 changes: 2 additions & 2 deletions class/answer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ class Answer extends SaturneObject
/**
* @var int User ID.
*/
public int $fk_user_creat;
public $fk_user_creat;

/**
* @var int|null User ID.
*/
public ?int $fk_user_modif;
public $fk_user_modif;

/**
* Constructor.
Expand Down
8 changes: 4 additions & 4 deletions class/control.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ class Control extends SaturneObject
/**
* @var int User ID.
*/
public int $fk_user_creat;
public $fk_user_creat;

/**
* @var int|null User ID.
*/
public ?int $fk_user_modif;
public $fk_user_modif;

/**
* @var int Sheet ID.
Expand Down Expand Up @@ -1236,12 +1236,12 @@ class ControlLine extends SaturneObject
/**
* @var int User ID
*/
public int $fk_user_creat;
public $fk_user_creat;

/**
* @var int|null User ID
*/
public ?int $fk_user_modif;
public $fk_user_modif;

/**
* @var int Control ID
Expand Down
4 changes: 2 additions & 2 deletions class/question.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ class Question extends SaturneObject
/**
* @var int User ID.
*/
public int $fk_user_creat;
public $fk_user_creat;

/**
* @var int|null User ID.
*/
public ?int $fk_user_modif;
public $fk_user_modif;

/**
* Constructor.
Expand Down
129 changes: 67 additions & 62 deletions class/sheet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ class Sheet extends SaturneObject
/**
* @var int User ID.
*/
public int $fk_user_creat;
public $fk_user_creat;

/**
* @var int|null User ID.
*/
public ?int $fk_user_modif;
public $fk_user_modif;

/**
* Constructor.
Expand Down Expand Up @@ -276,74 +276,79 @@ public function LibStatut(int $status, int $mode = 0): string
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}

/**
* Clone an object into another one
*
* @param User $user User that creates
* @param int $fromid Id of object to clone
* @param $options
* @return mixed New object created, <0 if KO
* @throws Exception
*/
public function createFromClone(User $user, $fromid)
{
global $conf, $langs;
$error = 0;
/**
* Clone an object into another one
*
* @param User $user User that creates
* @param int $fromID ID of object to clone
* @return mixed New object created, <0 if KO
* @throws Exception
*/
public function createFromClone(User $user, int $fromID): int
{
dol_syslog(__METHOD__, LOG_DEBUG);

$question = new Question($this->db);
$error = 0;

dol_syslog(__METHOD__, LOG_DEBUG);
$object = new self($this->db);
$this->db->begin();

$object = new self($this->db);
$this->db->begin();
// Load source object
$object->fetchCommon($fromID);

// Load source object
$result = $object->fetchCommon($fromid);
if ($result > 0 && ! empty($object->table_element_line)) {
$object->fetchLines();
}
// Reset some properties
unset($object->fk_user_creat);
unset($object->import_key);

// Create clone
$object->fetchObjectLinked($object->id, 'digiquali_' . $object->element);
$object->context['createfromclone'] = 'createfromclone';
$object->ref = $object->getNextNumRef();
$object->status = 1;
$objectid = $object->create($user);

//add categories
$cat = new Categorie($this->db);
$categories = $cat->containing($fromid, 'sheet');

if (is_array($categories) && !empty($categories)) {
foreach($categories as $cat) {
$categoryIds[] = $cat->id;
}
if ($objectid > 0) {
$object->fetch($objectid);
$object->setCategories($categoryIds);
}
}
// Clear fields
if (property_exists($object, 'ref')) {
$object->ref = '';
}
if (property_exists($object, 'date_creation')) {
$object->date_creation = dol_now();
}
if (property_exists($object, 'status')) {
$object->status = self::STATUS_VALIDATED;
}

//add objects linked
if (is_array($object->linkedObjectsIds['digiquali_question']) && !empty($object->linkedObjectsIds['digiquali_question'])) {
foreach ($object->linkedObjectsIds['digiquali_question'] as $questionId) {
$question->fetch($questionId);
$question->add_object_linked('digiquali_' . $object->element, $objectid);
}
$object->updateQuestionsPosition($object->linkedObjectsIds['digiquali_question']);
}
$object->context = 'createfromclone';

unset($object->context['createfromclone']);
$object->fetchObjectLinked($object->id, 'digiquali_' . $object->element);

// End
if ( ! $error) {
$this->db->commit();
return $objectid;
} else {
$this->db->rollback();
return -1;
}
}
$sheetID = $object->create($user);
if ($sheetID > 0) {
// Categories
$categoryIds = [];
$category = new Categorie($this->db);
$categories = $category->containing($fromID, 'sheet');
if (is_array($categories) && !empty($categories)) {
foreach($categories as $category) {
$categoryIds[] = $category->id;
}
$object->setCategories($categoryIds);
}

// Add objects linked
if (is_array($object->linkedObjects['digiquali_question']) && !empty($object->linkedObjects['digiquali_question'])) {
foreach ($object->linkedObjects['digiquali_question'] as $question) {
$question->add_object_linked('digiquali_' . $object->element, $sheetID);
}
}
} else {
$error++;
$this->error = $object->error;
$this->errors = $object->errors;
}

// End
if (!$error) {
$this->db->commit();
return $sheetID;
} else {
$this->db->rollback();
return -1;
}
}

// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
Expand Down
8 changes: 4 additions & 4 deletions class/survey.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ class Survey extends SaturneObject
/**
* @var int User ID
*/
public int $fk_user_creat;
public $fk_user_creat;

/**
* @var int|null User ID
*/
public ?int $fk_user_modif;
public $fk_user_modif;

/**
* @var int Sheet ID
Expand Down Expand Up @@ -750,12 +750,12 @@ class SurveyLine extends SaturneObject
/**
* @var int User ID
*/
public int $fk_user_creat;
public $fk_user_creat;

/**
* @var int|null User ID
*/
public ?int $fk_user_modif;
public $fk_user_modif;

/**
* @var int Survey ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@
*/
class doc_controldocument_odt extends SaturneDocumentModel
{
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.5 = array(5, 5)
*/
public $phpmin = [7, 4];

/**
* @var string Dolibarr version of the loaded document.
*/
public string $version = 'dolibarr';

/**
* @var string Module.
*/
Expand Down Expand Up @@ -121,7 +110,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$foundTagForLines = 1;
try {
$listLines = $odfHandler->setSegment('questions');
} catch (OdfException $e) {
} catch (OdfException|OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template.
$foundTagForLines = 0;
$listLines = '';
Expand Down Expand Up @@ -217,7 +206,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$foundTagForLines = 1;
try {
$listLines = $odfHandler->setSegment('equipment');
} catch (OdfException $e) {
} catch (OdfException|OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template.
$foundTagForLines = 0;
$listLines = '';
Expand Down Expand Up @@ -270,7 +259,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$foundTagForLines = 1;
try {
$listLines = $odfHandler->setSegment('photos');
} catch (OdfException $e) {
} catch (OdfException|OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template.
$foundTagForLines = 0;
$listLines = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@
*/
class doc_surveydocument_odt extends SaturneDocumentModel
{
/**
* @var array Minimum version of PHP required by module
* e.g.: PHP ≥ 5.5 = array(5, 5)
*/
public $phpmin = [7, 4];

/**
* @var string Dolibarr version of the loaded document
*/
public string $version = 'dolibarr';

/**
* @var string Module
*/
Expand Down Expand Up @@ -106,7 +95,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$foundTagForLines = 1;
try {
$listLines = $odfHandler->setSegment('questions');
} catch (OdfException $e) {
} catch (OdfException|OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template
$foundTagForLines = 0;
$listLines = '';
Expand Down Expand Up @@ -185,7 +174,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$foundTagForLines = 1;
try {
$listLines = $odfHandler->setSegment('photos');
} catch (OdfException $e) {
} catch (OdfException|OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template
$foundTagForLines = 0;
$listLines = '';
Expand Down
2 changes: 1 addition & 1 deletion 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.11.0';
$this->version = '1.12.0';
// Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';

Expand Down
3 changes: 2 additions & 1 deletion core/tpl/digiquali_answers.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@
<?php if ($question->authorize_answer_photo > 0) : ?>
<div class="table-cell table-full linked-medias answer_photo_<?php echo $question->id ?>">
<?php if ($object->status == 0 ) : ?>
<input hidden multiple class="fast-upload" id="fast-upload-answer-photo<?php echo $question->id ?>" type="file" name="userfile[]" capture="environment" accept="image/*">
<input hidden multiple class="fast-upload<?php echo getDolGlobalInt('SATURNE_USE_FAST_UPLOAD_IMPROVEMENT') ? '-improvement' : ''; ?>" id="fast-upload-answer-photo<?php echo $question->id ?>" type="file" name="userfile[]" capture="environment" accept="image/*">
<input type="hidden" class="question-answer-photo" id="answer_photo_<?php echo $question->id ?>" name="answer_photo_<?php echo $question->id ?>" value=""/>
<input type="hidden" class="fast-upload-options" data-from-subtype="answer_photo_<?php echo $question->id ?>" data-from-subdir="answer_photo/<?php echo $question->ref ?>"/>
<label for="fast-upload-answer-photo<?php echo $question->id ?>">
<div class="wpeo-button button-square-50">
<i class="fas fa-camera"></i><i class="fas fa-plus-circle button-add"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct($db)
$this->name = preg_replace('/^Interface/i', '', get_class($this));
$this->family = 'demo';
$this->description = 'DigiQuali triggers.';
$this->version = '1.11.0';
$this->version = '1.12.0';
$this->picto = 'digiquali@digiquali';
}

Expand Down
4 changes: 2 additions & 2 deletions lib/digiquali_sheet.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ function get_sheet_linkable_objects(): array
}
$hookmanager->initHooks(['get_sheet_linkable_objects']);

$reshook = $hookmanager->executeHooks('extendSheetLinkableObjectsList', $linkableObjectTypes);
$resHook = $hookmanager->executeHooks('extendSheetLinkableObjectsList', $linkableObjectTypes);

if ($reshook && (is_array($hookmanager->resArray) && !empty($hookmanager->resArray))) {
if (empty($resHook) && is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) {
$linkableObjectTypes = $hookmanager->resArray;
}

Expand Down
3 changes: 0 additions & 3 deletions public/control/public_control.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
* \brief Public page to view control.
*/

if (!defined('NOREQUIREUSER')) {
define('NOREQUIREUSER', '1');
}
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1');
}
Expand Down
Loading

0 comments on commit 14de047

Please sign in to comment.