diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 05494016d59..ce3218dd7af 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Nick Fragoulis * Copyright (C) 2024 Alexandre Spangaro * @@ -152,7 +152,7 @@ class pdf_soleil extends ModelePDFFicheinter $outputlangs->loadLangs(array("main", "interventions", "dict", "companies", "compta")); // Show Draft Watermark - if ($object->statut == $object::STATUS_DRAFT && (getDolGlobalString('FICHINTER_DRAFT_WATERMARK'))) { + if ($object->status == $object::STATUS_DRAFT && (getDolGlobalString('FICHINTER_DRAFT_WATERMARK'))) { $this->watermark = getDolGlobalString('FICHINTER_DRAFT_WATERMARK'); } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 5ed98e5f45e..ea7e461f54b 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -118,7 +118,7 @@ $result = restrictedArea($user, 'ficheinter', $id, 'fichinter'); $permissionnote = $user->hasRight('ficheinter', 'creer'); // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->hasRight('ficheinter', 'creer'); // Used by the include of actions_dellink.inc.php -$permissiontodelete = (($object->statut == Fichinter::STATUS_DRAFT && $user->hasRight('ficheinter', 'creer')) || $user->hasRight('ficheinter', 'supprimer')); +$permissiontodelete = (($object->status == Fichinter::STATUS_DRAFT && $user->hasRight('ficheinter', 'creer')) || $user->hasRight('ficheinter', 'supprimer')); $permissiontoadd = $user->hasRight('ficheinter', 'creer'); $permissiontoeditextra = $permissiontoadd; if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')])) { @@ -1555,7 +1555,7 @@ if ($action == 'create') { print "\n"; // Icon to edit and delete - if ($object->statut == 0 && $user->hasRight('ficheinter', 'creer')) { + if ($object->status == 0 && $user->hasRight('ficheinter', 'creer')) { print ''; print 'rowid.'#'.$objp->rowid.'">'; print img_edit(); @@ -1585,7 +1585,7 @@ if ($action == 'create') { } // Line in update mode - if ($object->statut == 0 && $action == 'editline' && $user->hasRight('ficheinter', 'creer') && GETPOSTINT('line_id') == $objp->rowid) { + if ($object->status == 0 && $action == 'editline' && $user->hasRight('ficheinter', 'creer') && GETPOSTINT('line_id') == $objp->rowid) { print ''; // No. @@ -1648,7 +1648,7 @@ if ($action == 'create') { $db->free($resql); // Add new line - if ($object->statut == 0 && $user->hasRight('ficheinter', 'creer') && $action != 'editline' && (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2')) { + if ($object->status == 0 && $user->hasRight('ficheinter', 'creer') && $action != 'editline' && (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2')) { if (!$num) { print '
'; print ''; @@ -1766,7 +1766,7 @@ if ($action == 'create') { if ($user->socid == 0) { if ($action != 'editdescription' && ($action != 'presend')) { // Validate - if ($object->statut == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '1')) { + if ($object->status == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '1')) { if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'validate'))) { print ''; } else { @@ -1775,7 +1775,7 @@ if ($action == 'create') { } // Modify - if ($object->statut == Fichinter::STATUS_VALIDATED && ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'unvalidate')))) { + if ($object->status == Fichinter::STATUS_VALIDATED && ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'unvalidate')))) { print '
'; if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') { print $langs->trans("Modify"); @@ -1786,7 +1786,7 @@ if ($action == 'create') { } // Reopen - if ($object->statut >= Fichinter::STATUS_CLOSED) { + if ($object->status >= Fichinter::STATUS_CLOSED) { if ($user->hasRight('ficheinter', 'creer')) { print ''; } else { @@ -1796,7 +1796,7 @@ if ($action == 'create') { // Send if (empty($user->socid)) { - if ($object->statut > Fichinter::STATUS_DRAFT) { + if ($object->status > Fichinter::STATUS_DRAFT) { if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('ficheinter', 'ficheinter_advance', 'send')) { print ''; } else { @@ -1806,7 +1806,7 @@ if ($action == 'create') { } // Create intervention model - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 && $object->statut == Fichinter::STATUS_DRAFT && $user->hasRight('ficheinter', 'creer') && (count($object->lines) > 0)) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 && $object->status == Fichinter::STATUS_DRAFT && $user->hasRight('ficheinter', 'creer') && (count($object->lines) > 0)) { print ''; @@ -1814,9 +1814,9 @@ if ($action == 'create') { $arrayofcreatebutton = array(); // Proposal - if (isModEnabled("service") && isModEnabled("propal") && $object->statut > Fichinter::STATUS_DRAFT) { + if (isModEnabled("service") && isModEnabled("propal") && $object->status > Fichinter::STATUS_DRAFT) { $langs->load("propal"); - if ($object->statut < Fichinter::STATUS_BILLED) { + if ($object->status < Fichinter::STATUS_BILLED) { $arrayofcreatebutton[] = array( 'url' => '/comm/propal/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, 'label' => $langs->trans('AddProp'), @@ -1828,9 +1828,9 @@ if ($action == 'create') { } // Invoicing - if (isModEnabled('invoice') && $object->statut > Fichinter::STATUS_DRAFT) { + if (isModEnabled('invoice') && $object->status > Fichinter::STATUS_DRAFT) { $langs->load("bills"); - if ($object->statut < Fichinter::STATUS_BILLED) { + if ($object->status < Fichinter::STATUS_BILLED) { $arrayofcreatebutton[] = array( 'url' => '/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, 'label' => $langs->trans('AddBill'), @@ -1841,7 +1841,7 @@ if ($action == 'create') { } if (getDolGlobalString('FICHINTER_CLASSIFY_BILLED')) { // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1 - if ($object->statut != Fichinter::STATUS_BILLED) { + if ($object->status != Fichinter::STATUS_BILLED) { print ''; } else { print ''; @@ -1854,7 +1854,7 @@ if ($action == 'create') { } // Sign - if ($object->statut > Fichinter::STATUS_DRAFT) { + if ($object->status > Fichinter::STATUS_DRAFT) { if ($object->signed_status != Fichinter::$SIGNED_STATUSES['STATUS_SIGNED_ALL']) { print ''; } else { @@ -1863,7 +1863,7 @@ if ($action == 'create') { } // Done - if (!getDolGlobalString('FICHINTER_CLASSIFY_BILLED') && $object->statut > Fichinter::STATUS_DRAFT && $object->statut < Fichinter::STATUS_CLOSED) { + if (!getDolGlobalString('FICHINTER_CLASSIFY_BILLED') && $object->status > Fichinter::STATUS_DRAFT && $object->status < Fichinter::STATUS_CLOSED) { print ''; } @@ -1904,13 +1904,13 @@ if ($action == 'create') { $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); // Show direct download link - if ($object->statut != Fichinter::STATUS_DRAFT && getDolGlobalString('FICHINTER_ALLOW_EXTERNAL_DOWNLOAD')) { + if ($object->status != Fichinter::STATUS_DRAFT && getDolGlobalString('FICHINTER_ALLOW_EXTERNAL_DOWNLOAD')) { print '
'."\n"; print showDirectDownloadLink($object).'
'; } // Show online signature link - if ($object->statut != Fichinter::STATUS_DRAFT && getDolGlobalString('FICHINTER_ALLOW_ONLINE_SIGN')) { + if ($object->status != Fichinter::STATUS_DRAFT && getDolGlobalString('FICHINTER_ALLOW_ONLINE_SIGN')) { print '
'; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index bd23b85a053..52446b3b9f7 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015-2020 Charlene Benke * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2023-2024 William Mead * Copyright (C) 2024-2025 MDW * @@ -145,9 +145,15 @@ class Fichinter extends CommonObject /** * @var int status + * @deprecated Use $status instead */ public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate + /** + * @var int status + */ + public $status = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate + /** * @var string description */ @@ -340,7 +346,7 @@ class Fichinter extends CommonObject $sql .= ", '".$this->db->escape($this->model_pdf)."'"; $sql .= ", ".($this->fk_project ? ((int) $this->fk_project) : 0); $sql .= ", ".($this->fk_contrat ? ((int) $this->fk_contrat) : 0); - $sql .= ", ".((int) $this->statut); + $sql .= ", ".((int) $this->status); $sql .= ", ".($this->signed_status); $sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null"); $sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null"); @@ -555,7 +561,7 @@ class Fichinter extends CommonObject $error = 0; // Protection - if ($this->statut <= self::STATUS_DRAFT) { + if ($this->status <= self::STATUS_DRAFT) { return 0; } @@ -580,7 +586,8 @@ class Fichinter extends CommonObject } if (!$error) { - $this->statut = self::STATUS_DRAFT; + $this->status = self::STATUS_DRAFT; + $this->statut = self::STATUS_DRAFT; // deprecated $this->db->commit(); return 1; } else { @@ -725,7 +732,7 @@ class Fichinter extends CommonObject $error = 0; - if ($this->statut == self::STATUS_CLOSED) { + if ($this->status == self::STATUS_CLOSED) { return 0; } else { $this->db->begin(); @@ -751,7 +758,8 @@ class Fichinter extends CommonObject } if (!$error) { - $this->statut = self::STATUS_CLOSED; + $this->status = self::STATUS_CLOSED; + $this->statut = self::STATUS_CLOSED; // deprecated $this->db->commit(); return 1; } else { @@ -884,9 +892,7 @@ class Fichinter extends CommonObject $datas = []; $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ShowIntervention").''; - if (isset($this->status)) { - $datas['picto'] .= ' '.$this->getLibStatut(5); - } + $datas['picto'] .= ' '.$this->getLibStatut(5); $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; return $datas; @@ -1340,12 +1346,12 @@ class Fichinter extends CommonObject $this->statut = self::STATUS_DRAFT; // deprecated // Clear fields - $this->user_author_id = $user->id; + $this->user_author_id = $user->id; $this->user_validation_id = 0; - $this->date_creation = ''; - $this->date_validation = ''; + $this->date_creation = ''; + $this->date_validation = ''; - $this->ref_client = ''; + $this->ref_client = ''; if (!$clone_notes) { $this->note_private = '';