dolibarr/htdocs/fichinter/class/fichinter.class.php

1670 lines
50 KiB
PHP
Raw Permalink Normal View History

<?php
2003-09-19 13:27:17 +02:00
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2014-09-18 08:58:47 +02:00
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
2018-10-27 14:43:12 +02:00
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
2020-09-03 12:43:38 +02:00
* Copyright (C) 2011-2020 Juanjo Menent <jmenent@2byte.es>
2015-04-18 20:50:03 +02:00
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
2020-09-30 15:17:44 +02:00
* Copyright (C) 2015-2020 Charlene Benke <charlie@patas-monkey.com>
2019-03-21 15:08:09 +01:00
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023-2024 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
2013-08-22 16:49:23 +02:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2013-08-22 16:49:23 +02:00
*/
2003-09-19 13:27:17 +02:00
/**
* \file htdocs/fichinter/class/fichinter.class.php
2023-03-12 13:55:33 +01:00
* \ingroup fichinter
* \brief File for class to manage interventions
2013-08-22 16:49:23 +02:00
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinterligne.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonsignedobject.class.php';
2005-01-09 19:30:34 +01:00
2008-06-21 01:01:02 +02:00
/**
2014-09-18 08:58:47 +02:00
* Class to manage interventions
* @property int $signed_status
* @static array<int> $SIGNED_STATUSES
2008-06-21 01:01:02 +02:00
*/
class Fichinter extends CommonObject
2003-09-19 13:27:17 +02:00
{
use CommonSignedObject;
public $fields = array(
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10),
'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 15),
'fk_projet' => array('type' => 'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label' => 'Fk projet', 'enabled' => 'isModEnabled("project")', 'visible' => -1, 'position' => 20),
'fk_contrat' => array('type' => 'integer', 'label' => 'Fk contrat', 'enabled' => '$conf->contrat->enabled', 'visible' => -1, 'position' => 25),
'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 30),
'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'visible' => 0, 'position' => 35),
'ref_client' => array('type' => 'varchar(255)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 36),
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 40, 'index' => 1),
'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 45),
'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 50),
'date_valid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 55),
'datei' => array('type' => 'date', 'label' => 'Datei', 'enabled' => 1, 'visible' => -1, 'position' => 60),
'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fk user author', 'enabled' => 1, 'visible' => -1, 'position' => 65),
'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 70),
'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 75),
'dateo' => array('type' => 'date', 'label' => 'Dateo', 'enabled' => 1, 'visible' => -1, 'position' => 85),
'datee' => array('type' => 'date', 'label' => 'Datee', 'enabled' => 1, 'visible' => -1, 'position' => 90),
'datet' => array('type' => 'date', 'label' => 'Datet', 'enabled' => 1, 'visible' => -1, 'position' => 95),
'duree' => array('type' => 'integer', 'label' => 'Duree', 'enabled' => 1, 'visible' => -1, 'position' => 100),
NEW intervention signed status update (#30629) * Added confirm_sign, confirm_unsign, sign & unsign actions. Added sign-unsign button. * Updated create & fetch methods with signed_status * Added EN localization * Added intervention signed notification * Added intervention signed auto event. Updated EN localization. Fixed trigger. * Cleaned code * Added signed label to status badge * Cleaned code * Added signed statues dictionary. Added method to get signed status label badge. * Added signed status to intervention list * Added sign localizations * Added sign confirm select. Refactored signed statuses dictionary. * Added method to get localized signed statuses arrray. Refactored code. Added EN localization. * Fixed signed status update * Cleaned code * Updated EN localization * Cleaned code * Changed sign workflow to exclude only drafts * Added signed status change with online sign * Improved signed status workflow * Removed db structure changes * Updated action trigger to FICHINTER_MODIFY * Updated EN localizations * Refactored to use FICHINTER_MODIFY trigger with localized context message. Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Updated EN localizations. * Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Cleaned Ecode. * Fixed undeclared constant * Added contributor details * Updated notification logic to use object context to pass signature status * Refactored to make use of object context for event notification. Cleaned code. * Fixed deprecated method * Cleaned code
2024-08-27 07:01:03 +02:00
'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 101, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 3 => 'SignedReceiverOnline', 9 => 'SignedAll')),
'description' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 105, 'showoncombobox' => 2),
'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110),
'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 115),
'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 120),
'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'Last main doc', 'enabled' => 1, 'visible' => -1, 'position' => 125),
'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 130),
'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 135),
'fk_statut' => array('type' => 'integer', 'label' => 'Fk statut', 'enabled' => 1, 'visible' => -1, 'position' => 500),
2020-03-04 10:05:20 +01:00
);
2022-09-02 08:53:13 +02:00
2018-08-23 18:35:45 +02:00
/**
* @var string ID to identify managed object
*/
public $element = 'fichinter';
2018-09-02 23:25:10 +02:00
2018-08-22 18:48:53 +02:00
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element = 'fichinter';
2018-09-02 23:25:10 +02:00
2018-09-02 11:08:41 +02:00
/**
* @var string Name of subtable line
2018-09-02 11:08:41 +02:00
*/
public $table_element_line = 'fichinterdet';
2018-09-02 11:08:41 +02:00
2018-09-05 12:21:13 +02:00
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'intervention';
2017-07-25 21:22:22 +02:00
/**
* {@inheritdoc}
*/
protected $table_ref_field = 'ref';
2020-11-19 20:50:58 +01:00
/**
* @var int Thirdparty Id
*/
public $socid;
/**
* @var User User that created intervention
*/
2018-09-01 15:27:55 +02:00
public $author;
2019-03-21 20:15:19 +01:00
2019-03-21 15:08:09 +01:00
/**
* @var null|int|'' Date creation record (datec)
*/
public $datec;
2019-03-21 20:15:19 +01:00
/**
* @var null|int|'' Date record (datev)
*/
2018-09-01 15:27:55 +02:00
public $datev;
/**
* @var null|int|'' Date record (dateo)
*/
2018-09-01 15:27:55 +02:00
public $dateo;
/**
* @var null|int|'' Date record (datee)
*/
2018-09-01 15:27:55 +02:00
public $datee;
/**
* @var null|int|'' Date t record (datet)
*/
2018-09-01 15:27:55 +02:00
public $datet;
2019-03-21 20:15:19 +01:00
2019-03-21 15:08:09 +01:00
/**
* Date modification record (tms)
*
* @var int
*/
public $datem;
2019-03-21 20:15:19 +01:00
2020-11-19 20:50:58 +01:00
/**
* @var int duration
*/
2018-09-01 15:27:55 +02:00
public $duration;
2020-11-19 20:50:58 +01:00
/**
* @var int status
*/
public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate
2018-08-31 19:26:08 +02:00
/**
* @var string description
*/
public $description;
2018-10-10 12:16:20 +02:00
/**
2020-11-19 20:50:58 +01:00
* @var int Contract ID
*/
2018-09-01 15:27:55 +02:00
public $fk_contrat = 0;
2018-10-10 12:16:20 +02:00
/**
2020-11-19 20:50:58 +01:00
* @var int Project ID
*/
2018-09-01 15:27:55 +02:00
public $fk_project = 0;
2018-10-10 12:16:20 +02:00
2022-05-17 12:53:50 +02:00
/**
* Customer Ref
* @var string
*/
public $ref_client;
2020-11-19 20:50:58 +01:00
/**
* @var array<string,string> (Encoded as JSON in database)
2020-11-19 20:50:58 +01:00
*/
public $extraparams = array();
2008-06-21 01:01:02 +02:00
2020-11-19 20:50:58 +01:00
/**
2023-02-08 22:23:40 +01:00
* @var FichinterLigne[] lines
2020-11-19 20:50:58 +01:00
*/
2018-09-01 15:27:55 +02:00
public $lines = array();
2008-06-21 01:01:02 +02:00
2017-07-25 21:22:22 +02:00
/**
* Draft status
*/
const STATUS_DRAFT = 0;
2018-09-02 11:08:41 +02:00
2017-07-25 21:22:22 +02:00
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
2018-09-02 11:08:41 +02:00
2017-07-25 21:22:22 +02:00
/**
* Billed
*/
const STATUS_BILLED = 2;
2018-09-02 11:08:41 +02:00
2017-07-25 21:22:22 +02:00
/**
* Closed
*/
const STATUS_CLOSED = 3;
/**
2025-01-05 13:53:16 +01:00
* Date of delivery of receipt
* @var null|int|'' Date the intervention receipt has been delivered
* @deprecated Use $delivery_date_receipt
*/
2023-11-18 17:55:47 +01:00
public $date_delivery;
2025-01-05 13:53:16 +01:00
/**
* Date of delivery of receipt
* @var null|int|'' Date the intervention receipt has been delivered
*/
public $delivery_date_receipt;
/**
* Author Id
* @var int
*/
2023-11-18 17:55:47 +01:00
public $user_author_id;
2020-11-28 14:47:39 +01:00
2008-06-21 01:01:02 +02:00
/**
2011-09-11 20:35:38 +02:00
* Constructor
*
2012-02-24 17:25:53 +01:00
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
2008-06-21 01:01:02 +02:00
2016-04-23 13:16:19 +02:00
/**
* Load indicators into this->nb for board
*
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2016-04-23 13:16:19 +02:00
*/
2024-01-18 18:55:53 +01:00
public function loadStateBoard()
2016-04-23 13:16:19 +02:00
{
global $user;
$this->nb = array();
2016-04-23 13:16:19 +02:00
$clause = "WHERE";
$sql = "SELECT count(fi.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as fi";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON fi.fk_soc = s.rowid";
2024-01-09 13:08:22 +01:00
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
2016-04-23 13:16:19 +02:00
$clause = "AND";
}
$sql .= " ".$clause." fi.entity IN (".getEntity('intervention').")";
2016-04-23 13:16:19 +02:00
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
2020-04-12 16:36:25 +02:00
$this->nb["interventions"] = $obj->nb;
2016-04-23 13:16:19 +02:00
}
$this->db->free($resql);
return 1;
2020-05-21 15:05:19 +02:00
} else {
2016-04-23 13:16:19 +02:00
dol_print_error($this->db);
$this->error = $this->db->error();
2016-04-23 13:16:19 +02:00
return -1;
}
}
2008-06-21 01:01:02 +02:00
2011-07-08 11:18:54 +02:00
/**
* Create an intervention into data base
*
* @param User $user Object user that make creation
* @param int $notrigger Disable all triggers
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2008-06-21 01:01:02 +02:00
*/
public function create($user, $notrigger = 0)
{
global $conf, $langs;
$error = 0;
dol_syslog(get_class($this)."::create ref=".$this->ref);
2010-05-04 20:12:43 +02:00
// Check parameters
2021-02-25 23:00:32 +01:00
if (!empty($this->ref)) { // We check that ref is not already used
$result = self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
2021-02-25 23:00:32 +01:00
if ($result > 0) {
$this->error = 'ErrorRefAlreadyExists';
dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING);
$this->db->rollback();
return -1;
}
2013-05-19 18:28:27 +02:00
}
2021-02-25 23:00:32 +01:00
if (!is_numeric($this->duration)) {
$this->duration = 0;
}
2022-05-17 12:53:50 +02:00
if (isset($this->ref_client)) {
$this->ref_client = trim($this->ref_client);
}
2021-02-25 23:00:32 +01:00
if ($this->socid <= 0) {
$this->error = 'ErrorFicheinterCompanyDoesNotExist';
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -1;
}
$this->entity = setEntity($this);
$soc = new Societe($this->db);
$result = $soc->fetch($this->socid);
2008-06-21 01:01:02 +02:00
$now = dol_now();
2010-05-04 20:12:43 +02:00
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."fichinter (";
$sql .= "fk_soc";
$sql .= ", datec";
$sql .= ", ref";
2022-05-17 12:53:50 +02:00
$sql .= ", ref_client";
$sql .= ", entity";
$sql .= ", fk_user_author";
$sql .= ", fk_user_modif";
$sql .= ", description";
$sql .= ", model_pdf";
$sql .= ", fk_projet";
$sql .= ", fk_contrat";
$sql .= ", fk_statut";
NEW intervention signed status update (#30629) * Added confirm_sign, confirm_unsign, sign & unsign actions. Added sign-unsign button. * Updated create & fetch methods with signed_status * Added EN localization * Added intervention signed notification * Added intervention signed auto event. Updated EN localization. Fixed trigger. * Cleaned code * Added signed label to status badge * Cleaned code * Added signed statues dictionary. Added method to get signed status label badge. * Added signed status to intervention list * Added sign localizations * Added sign confirm select. Refactored signed statuses dictionary. * Added method to get localized signed statuses arrray. Refactored code. Added EN localization. * Fixed signed status update * Cleaned code * Updated EN localization * Cleaned code * Changed sign workflow to exclude only drafts * Added signed status change with online sign * Improved signed status workflow * Removed db structure changes * Updated action trigger to FICHINTER_MODIFY * Updated EN localizations * Refactored to use FICHINTER_MODIFY trigger with localized context message. Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Updated EN localizations. * Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Cleaned Ecode. * Fixed undeclared constant * Added contributor details * Updated notification logic to use object context to pass signature status * Refactored to make use of object context for event notification. Cleaned code. * Fixed deprecated method * Cleaned code
2024-08-27 07:01:03 +02:00
$sql .= ", signed_status";
$sql .= ", note_private";
$sql .= ", note_public";
$sql .= ") ";
$sql .= " VALUES (";
$sql .= $this->socid;
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", '".$this->db->escape($this->ref)."'";
2022-05-18 22:24:30 +02:00
$sql .= ", ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null");
$sql .= ", ".((int) $this->entity);
2021-09-03 21:25:17 +02:00
$sql .= ", ".((int) $user->id);
$sql .= ", ".((int) $user->id);
$sql .= ", ".($this->description ? "'".$this->db->escape($this->description)."'" : "null");
2020-09-10 01:49:09 +02:00
$sql .= ", '".$this->db->escape($this->model_pdf)."'";
2021-09-03 21:25:17 +02:00
$sql .= ", ".($this->fk_project ? ((int) $this->fk_project) : 0);
$sql .= ", ".($this->fk_contrat ? ((int) $this->fk_contrat) : 0);
$sql .= ", ".((int) $this->statut);
NEW intervention signed status update (#30629) * Added confirm_sign, confirm_unsign, sign & unsign actions. Added sign-unsign button. * Updated create & fetch methods with signed_status * Added EN localization * Added intervention signed notification * Added intervention signed auto event. Updated EN localization. Fixed trigger. * Cleaned code * Added signed label to status badge * Cleaned code * Added signed statues dictionary. Added method to get signed status label badge. * Added signed status to intervention list * Added sign localizations * Added sign confirm select. Refactored signed statuses dictionary. * Added method to get localized signed statuses arrray. Refactored code. Added EN localization. * Fixed signed status update * Cleaned code * Updated EN localization * Cleaned code * Changed sign workflow to exclude only drafts * Added signed status change with online sign * Improved signed status workflow * Removed db structure changes * Updated action trigger to FICHINTER_MODIFY * Updated EN localizations * Refactored to use FICHINTER_MODIFY trigger with localized context message. Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Updated EN localizations. * Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Cleaned Ecode. * Fixed undeclared constant * Added contributor details * Updated notification logic to use object context to pass signature status * Refactored to make use of object context for event notification. Cleaned code. * Fixed deprecated method * Cleaned code
2024-08-27 07:01:03 +02:00
$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");
$sql .= ")";
2014-06-12 11:31:53 +02:00
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$result = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if ($result) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
2013-05-19 11:18:45 +02:00
2021-02-25 23:00:32 +01:00
if ($this->id) {
$this->ref = '(PROV'.$this->id.')';
2021-03-14 12:20:23 +01:00
$sql = 'UPDATE '.MAIN_DB_PREFIX."fichinter SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".((int) $this->id);
2014-06-12 11:31:53 +02:00
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if (!$resql) {
$error++;
}
}
2014-08-28 14:48:16 +02:00
2021-02-25 23:00:32 +01:00
if (!$error) {
$result = $this->insertExtraFields();
2021-02-25 23:00:32 +01:00
if ($result < 0) {
$error++;
}
}
2014-08-28 14:48:16 +02:00
// Add linked object
2021-02-25 23:00:32 +01:00
if (!$error && $this->origin && $this->origin_id) {
$ret = $this->add_object_linked();
2021-02-25 23:00:32 +01:00
if (!$ret) {
dol_print_error($this->db);
}
}
2012-12-05 18:48:02 +01:00
2021-02-25 23:00:32 +01:00
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('FICHINTER_CREATE', $user);
2021-02-25 23:00:32 +01:00
if ($result < 0) {
$error++;
}
// End call triggers
}
2012-07-29 12:54:19 +02:00
2020-11-19 20:50:58 +01:00
if (!$error) {
$this->db->commit();
return $this->id;
2020-05-21 15:05:19 +02:00
} else {
$this->db->rollback();
Qual: Apply automatic phan fixes (deprecations, unneeded imports) (#28154) * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports). * Qual: Apply automatic phan fixes (deprecations, unneeded imports) # Qual: Apply automatic phan fixes (deprecations, unneeded imports) This applies automatic fixes by phan for deprecated functions, unneeded imports).
2024-02-13 21:46:12 +01:00
$this->error = implode(',', $this->errors);
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
return -1;
}
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->error();
$this->db->rollback();
return -1;
}
}
2011-07-08 11:18:54 +02:00
/**
* Update an intervention
*
* @param User $user Object user that make creation
* @param int $notrigger Disable all triggers
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2008-06-21 01:01:02 +02:00
*/
public function update($user, $notrigger = 0)
2008-06-21 01:01:02 +02:00
{
global $conf;
2021-02-25 23:00:32 +01:00
if (!is_numeric($this->duration)) {
$this->duration = 0;
}
if (!dol_strlen((string) $this->fk_project)) {
2021-02-25 23:00:32 +01:00
$this->fk_project = 0;
}
2022-05-17 12:53:50 +02:00
if (isset($this->ref_client)) {
$this->ref_client = trim($this->ref_client);
}
2008-06-21 01:01:02 +02:00
2021-02-25 23:00:32 +01:00
$error = 0;
2018-08-12 16:29:26 +02:00
$this->db->begin();
2008-06-21 01:01:02 +02:00
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
$sql .= "description = '".$this->db->escape($this->description)."'";
2021-06-09 15:36:47 +02:00
$sql .= ", duree = ".((int) $this->duration);
2022-05-17 12:53:50 +02:00
$sql .= ", ref_client = ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null");
2021-06-09 15:36:47 +02:00
$sql .= ", fk_projet = ".((int) $this->fk_project);
$sql .= ", note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
$sql .= ", note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null");
2021-08-23 19:33:24 +02:00
$sql .= ", fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id);
2014-06-12 11:31:53 +02:00
dol_syslog(get_class($this)."::update", LOG_DEBUG);
2021-02-25 23:00:32 +01:00
if ($this->db->query($sql)) {
if (!$error) {
$result = $this->insertExtraFields();
2021-02-25 23:00:32 +01:00
if ($result < 0) {
2018-08-12 16:29:26 +02:00
$error++;
}
}
2021-02-25 23:00:32 +01:00
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('FICHINTER_MODIFY', $user);
2021-02-25 23:00:32 +01:00
if ($result < 0) {
2023-12-04 12:12:12 +01:00
$error++;
$this->db->rollback();
return -1;
2021-02-25 23:00:32 +01:00
}
// End call triggers
}
$this->db->commit();
return 1;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->error();
$this->db->rollback();
return -1;
2008-06-21 01:01:02 +02:00
}
}
/**
2011-07-08 11:18:54 +02:00
* Fetch a intervention
*
2012-01-08 00:52:07 +01:00
* @param int $rowid Id of intervention
* @param string $ref Ref of intervention
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2008-06-21 01:01:02 +02:00
*/
public function fetch($rowid, $ref = '')
2008-06-21 01:01:02 +02:00
{
NEW intervention signed status update (#30629) * Added confirm_sign, confirm_unsign, sign & unsign actions. Added sign-unsign button. * Updated create & fetch methods with signed_status * Added EN localization * Added intervention signed notification * Added intervention signed auto event. Updated EN localization. Fixed trigger. * Cleaned code * Added signed label to status badge * Cleaned code * Added signed statues dictionary. Added method to get signed status label badge. * Added signed status to intervention list * Added sign localizations * Added sign confirm select. Refactored signed statuses dictionary. * Added method to get localized signed statuses arrray. Refactored code. Added EN localization. * Fixed signed status update * Cleaned code * Updated EN localization * Cleaned code * Changed sign workflow to exclude only drafts * Added signed status change with online sign * Improved signed status workflow * Removed db structure changes * Updated action trigger to FICHINTER_MODIFY * Updated EN localizations * Refactored to use FICHINTER_MODIFY trigger with localized context message. Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Updated EN localizations. * Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Cleaned Ecode. * Fixed undeclared constant * Added contributor details * Updated notification logic to use object context to pass signature status * Refactored to make use of object context for event notification. Cleaned code. * Fixed deprecated method * Cleaned code
2024-08-27 07:01:03 +02:00
$sql = "SELECT f.rowid, f.ref, f.ref_client, f.description, f.fk_soc, f.fk_statut as status, f.signed_status,";
$sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
$sql .= " f.date_valid as datev,";
$sql .= " f.tms as datem,";
2022-10-20 16:41:27 +02:00
$sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.last_main_doc, f.extraparams, fk_contrat, f.entity as entity";
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
if ($ref) {
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
2022-01-03 18:15:19 +01:00
$sql .= " AND f.ref = '".$this->db->escape($ref)."'";
2021-02-25 23:00:32 +01:00
} else {
2022-01-03 18:15:19 +01:00
$sql .= " WHERE f.rowid = ".((int) $rowid);
2021-02-25 23:00:32 +01:00
}
2014-06-12 11:31:53 +02:00
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if ($resql) {
if ($this->db->num_rows($resql)) {
2008-06-21 01:01:02 +02:00
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
2008-06-21 01:01:02 +02:00
$this->ref = $obj->ref;
2022-05-17 12:53:50 +02:00
$this->ref_client = $obj->ref_client;
2008-06-21 01:01:02 +02:00
$this->description = $obj->description;
$this->socid = $obj->fk_soc;
$this->status = $obj->status;
$this->statut = $obj->status; // deprecated
$this->signed_status = $obj->signed_status;
$this->duration = $obj->duree;
2010-01-13 19:51:19 +01:00
$this->datec = $this->db->jdate($obj->datec);
2018-05-10 16:08:45 +02:00
$this->dateo = $this->db->jdate($obj->dateo);
$this->datee = $this->db->jdate($obj->datee);
2015-12-15 11:52:11 +01:00
$this->datet = $this->db->jdate($obj->datet);
2010-01-13 19:51:19 +01:00
$this->datev = $this->db->jdate($obj->datev);
$this->datem = $this->db->jdate($obj->datem);
2019-02-27 15:32:18 +01:00
$this->fk_project = $obj->fk_project;
2008-06-21 01:01:02 +02:00
$this->note_public = $obj->note_public;
$this->note_private = $obj->note_private;
2020-08-18 14:48:38 +02:00
$this->model_pdf = $obj->model_pdf;
2019-02-25 20:35:59 +01:00
$this->fk_contrat = $obj->fk_contrat;
2022-04-14 12:08:06 +02:00
$this->entity = $obj->entity;
2012-03-18 01:25:08 +01:00
$this->user_creation_id = $obj->fk_user_author;
2017-07-25 21:22:22 +02:00
$this->extraparams = is_null($obj->extraparams) ? [] : (array) json_decode($obj->extraparams, true);
2008-06-21 01:01:02 +02:00
2022-10-20 16:41:27 +02:00
$this->last_main_doc = $obj->last_main_doc;
2022-10-20 18:54:45 +02:00
2019-02-10 12:59:09 +01:00
// Retrieve extrafields
2018-02-20 19:38:18 +01:00
$this->fetch_optionals();
/*
* Lines
2018-02-20 19:38:18 +01:00
*/
$result = $this->fetch_lines();
2021-02-25 23:00:32 +01:00
if ($result < 0) {
return -3;
}
2008-06-21 01:01:02 +02:00
$this->db->free($resql);
return 1;
}
2023-01-06 19:24:57 +01:00
return 0;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->lasterror();
2008-06-21 01:01:02 +02:00
return -1;
}
}
/**
2011-07-08 11:18:54 +02:00
* Set status to draft
2011-12-19 17:29:09 +01:00
*
* @param User $user User that set draft
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2008-06-21 01:01:02 +02:00
*/
public function setDraft($user)
2008-06-21 01:01:02 +02:00
{
$error = 0;
// Protection
2021-02-25 23:00:32 +01:00
if ($this->statut <= self::STATUS_DRAFT) {
return 0;
}
dol_syslog(get_class($this)."::setDraft", LOG_DEBUG);
$this->oldcopy = dol_clone($this, 2);
2022-08-22 15:06:09 +02:00
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql .= " SET fk_statut = ".self::STATUS_DRAFT;
2021-08-23 19:33:24 +02:00
$sql .= " WHERE rowid = ".((int) $this->id);
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if ($resql) {
if (!$error) {
// Call trigger
$result = $this->call_trigger('FICHINTER_UNVALIDATE', $user);
2021-02-25 23:00:32 +01:00
if ($result < 0) {
$error++;
}
}
if (!$error) {
$this->statut = self::STATUS_DRAFT;
$this->db->commit();
return 1;
} else {
$this->db->rollback();
return -1;
2008-07-12 14:45:29 +02:00
}
2020-05-21 15:05:19 +02:00
} else {
$this->db->rollback();
$this->error = $this->db->lasterror();
return -1;
}
}
/**
2011-07-08 11:18:54 +02:00
* Validate a intervention
2011-12-19 17:29:09 +01:00
*
* @param User $user User that validate
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
*/
public function setValid($user, $notrigger = 0)
{
2014-08-20 19:03:58 +02:00
global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
2012-01-04 23:56:10 +01:00
$error = 0;
2012-01-04 23:56:10 +01:00
if ($this->status != self::STATUS_VALIDATED) {
$this->db->begin();
2012-07-29 12:54:19 +02:00
$now = dol_now();
// Define new ref
2021-02-25 23:00:32 +01:00
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
$num = $this->getNextNumRef($this->thirdparty);
2020-05-21 15:05:19 +02:00
} else {
$num = $this->ref;
}
$this->newref = dol_sanitizeFileName($num);
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql .= " SET fk_statut = 1";
2021-08-23 19:33:24 +02:00
$sql .= ", ref = '".$this->db->escape($num)."'";
$sql .= ", date_valid = '".$this->db->idate($now)."'";
2022-07-03 12:54:58 +02:00
$sql .= ", fk_user_valid = ".($user->id > 0 ? (int) $user->id : "null");
2021-08-23 19:33:24 +02:00
$sql .= " WHERE rowid = ".((int) $this->id);
$sql .= " AND entity = ".((int) $this->entity);
$sql .= " AND fk_statut = 0";
2014-06-12 11:31:53 +02:00
dol_syslog(get_class($this)."::setValid", LOG_DEBUG);
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if (!$resql) {
dol_print_error($this->db);
$error++;
}
2021-02-25 23:00:32 +01:00
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('FICHINTER_VALIDATE', $user);
2021-02-25 23:00:32 +01:00
if ($result < 0) {
$error++;
}
// End call triggers
}
2021-02-25 23:00:32 +01:00
if (!$error) {
$this->oldref = $this->ref;
// Rename directory if dir was a temporary ref
2021-02-25 23:00:32 +01:00
if (preg_match('/^[\(]?PROV/i', $this->ref)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Now we rename also files into index
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'ficheinter/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'ficheinter/".$this->db->escape($this->ref)."' and entity = ".((int) $this->entity);
$resql = $this->db->query($sql);
if (!$resql) {
2023-12-04 12:12:12 +01:00
$error++;
$this->error = $this->db->lasterror();
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'ficheinter/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filepath = 'ficheinter/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if (!$resql) {
2023-12-04 12:12:12 +01:00
$error++;
$this->error = $this->db->lasterror();
2021-02-25 23:00:32 +01:00
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
$oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num);
$dirsource = $conf->ficheinter->dir_output.'/'.$oldref;
$dirdest = $conf->ficheinter->dir_output.'/'.$newref;
2021-02-25 23:00:32 +01:00
if (!$error && file_exists($dirsource)) {
dol_syslog(get_class($this)."::setValid rename dir ".$dirsource." into ".$dirdest);
2021-02-25 23:00:32 +01:00
if (@rename($dirsource, $dirdest)) {
dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref
$listoffiles = dol_dir_list($conf->ficheinter->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
2021-02-25 23:00:32 +01:00
foreach ($listoffiles as $fileentry) {
$dirsource = $fileentry['name'];
$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
$dirsource = $fileentry['path'].'/'.$dirsource;
$dirdest = $fileentry['path'].'/'.$dirdest;
@rename($dirsource, $dirdest);
}
}
}
}
}
// Set new ref and define current status
2021-02-25 23:00:32 +01:00
if (!$error) {
$this->ref = $num;
$this->status = self::STATUS_VALIDATED;
$this->statut = self::STATUS_VALIDATED; // deprecated
$this->date_validation = $now;
$this->db->commit();
return 1;
2020-05-21 15:05:19 +02:00
} else {
$this->db->rollback();
dol_syslog(get_class($this)."::setValid ".$this->error, LOG_ERR);
return -1;
}
2008-06-21 01:01:02 +02:00
}
2023-01-06 19:24:57 +01:00
return 0;
2008-06-21 01:01:02 +02:00
}
2011-07-02 18:48:31 +02:00
/**
* Close intervention
*
* @param User $user Object user that close
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
*/
public function setClose($user, $notrigger = 0)
{
global $conf;
$error = 0;
if ($this->statut == self::STATUS_CLOSED) {
return 0;
} else {
$this->db->begin();
$now = dol_now();
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element;
$sql .= ' SET fk_statut = ' . self::STATUS_CLOSED . ',';
$sql .= " datet = '" . $this->db->idate($now) . "',";
2023-10-06 15:37:02 +02:00
$sql .= " fk_user_modif = " . ((int) $user->id);
$sql .= " WHERE rowid = " . ((int) $this->id);
$sql .= " AND fk_statut > " . self::STATUS_DRAFT;
$sql .= " AND entity = " . ((int) $conf->entity);
if ($this->db->query($sql)) {
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('FICHINTER_CLOSE', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->statut = self::STATUS_CLOSED;
$this->db->commit();
return 1;
} else {
$this->db->rollback();
return -1;
}
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
}
}
}
/**
* Returns amount based on user thm
*
2017-09-11 14:41:46 +02:00
* @return float Amount
*/
2019-02-25 20:35:59 +01:00
public function getAmount()
2017-09-11 14:41:46 +02:00
{
$amount = 0;
2017-07-25 21:22:22 +02:00
$this->author = new User($this->db);
$this->author->fetch($this->user_creation_id);
2017-07-25 21:22:22 +02:00
$thm = $this->author->thm;
2017-07-25 21:22:22 +02:00
foreach ($this->lines as $line) {
$amount += ($line->duration / 60 / 60 * (float) $thm);
}
2017-07-25 21:22:22 +02:00
return (float) price2num($amount, 'MT');
}
2017-09-11 14:50:00 +02:00
/**
* Create a document onto disk according to template module.
*
* @param string $modele Force model to use ('' to not force)
* @param Translate $outputlangs Object langs to use for output
* @param int<0,1> $hidedetails Hide details of lines
* @param int<0,1> $hidedesc Hide description
* @param int<0,1> $hideref Hide ref
* @param ?array<string,mixed> $moreparams Array to provide more information
* @return int 0 if KO, 1 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
2020-12-13 13:34:21 +01:00
global $conf;
2020-12-13 13:34:21 +01:00
$outputlangs->load("interventions");
if (!dol_strlen($modele)) {
2017-09-11 14:50:00 +02:00
$modele = 'soleil';
2020-12-13 13:34:21 +01:00
if (!empty($this->model_pdf)) {
$modele = $this->model_pdf;
2023-11-27 11:41:05 +01:00
} elseif (getDolGlobalString('FICHEINTER_ADDON_PDF')) {
2024-01-05 04:18:53 +01:00
$modele = getDolGlobalString('FICHEINTER_ADDON_PDF');
}
}
$modelpath = "core/modules/fichinter/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
}
2017-07-25 21:22:22 +02:00
2008-06-21 01:01:02 +02:00
/**
2011-07-08 11:18:54 +02:00
* Returns the label status
2012-01-08 00:52:07 +01:00
*
2011-12-19 17:29:09 +01:00
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label
2008-06-21 01:01:02 +02:00
*/
2019-02-25 20:35:59 +01:00
public function getLibStatut($mode = 0)
2008-06-21 01:01:02 +02:00
{
2020-04-20 02:48:05 +02:00
return $this->LibStatut((isset($this->statut) ? $this->statut : $this->status), $mode);
2008-06-21 01:01:02 +02:00
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2008-06-21 01:01:02 +02:00
/**
2019-10-24 16:10:00 +02:00
* Returns the label of a status
2011-12-19 17:29:09 +01:00
*
2019-10-24 16:10:00 +02:00
* @param int $status Id status
2016-09-19 13:09:50 +02:00
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
2011-12-19 17:29:09 +01:00
* @return string Label
2008-06-21 01:01:02 +02:00
*/
2019-10-24 16:10:00 +02:00
public function LibStatut($status, $mode = 0)
2008-06-21 01:01:02 +02:00
{
// phpcs:enable
NEW intervention signed status update (#30629) * Added confirm_sign, confirm_unsign, sign & unsign actions. Added sign-unsign button. * Updated create & fetch methods with signed_status * Added EN localization * Added intervention signed notification * Added intervention signed auto event. Updated EN localization. Fixed trigger. * Cleaned code * Added signed label to status badge * Cleaned code * Added signed statues dictionary. Added method to get signed status label badge. * Added signed status to intervention list * Added sign localizations * Added sign confirm select. Refactored signed statuses dictionary. * Added method to get localized signed statuses arrray. Refactored code. Added EN localization. * Fixed signed status update * Cleaned code * Updated EN localization * Cleaned code * Changed sign workflow to exclude only drafts * Added signed status change with online sign * Improved signed status workflow * Removed db structure changes * Updated action trigger to FICHINTER_MODIFY * Updated EN localizations * Refactored to use FICHINTER_MODIFY trigger with localized context message. Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Updated EN localizations. * Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Cleaned Ecode. * Fixed undeclared constant * Added contributor details * Updated notification logic to use object context to pass signature status * Refactored to make use of object context for event notification. Cleaned code. * Fixed deprecated method * Cleaned code
2024-08-27 07:01:03 +02:00
global $langs;
2018-04-21 15:46:55 +02:00
// Init/load array of translation of status
2023-01-12 13:02:04 +01:00
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
$langs->load("interventions");
NEW intervention signed status update (#30629) * Added confirm_sign, confirm_unsign, sign & unsign actions. Added sign-unsign button. * Updated create & fetch methods with signed_status * Added EN localization * Added intervention signed notification * Added intervention signed auto event. Updated EN localization. Fixed trigger. * Cleaned code * Added signed label to status badge * Cleaned code * Added signed statues dictionary. Added method to get signed status label badge. * Added signed status to intervention list * Added sign localizations * Added sign confirm select. Refactored signed statuses dictionary. * Added method to get localized signed statuses arrray. Refactored code. Added EN localization. * Fixed signed status update * Cleaned code * Updated EN localization * Cleaned code * Changed sign workflow to exclude only drafts * Added signed status change with online sign * Improved signed status workflow * Removed db structure changes * Updated action trigger to FICHINTER_MODIFY * Updated EN localizations * Refactored to use FICHINTER_MODIFY trigger with localized context message. Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Updated EN localizations. * Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Cleaned Ecode. * Fixed undeclared constant * Added contributor details * Updated notification logic to use object context to pass signature status * Refactored to make use of object context for event notification. Cleaned code. * Fixed deprecated method * Cleaned code
2024-08-27 07:01:03 +02:00
$langs->load("propal");
2018-04-21 15:46:55 +02:00
2023-01-12 13:02:04 +01:00
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated');
$this->labelStatus[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced');
$this->labelStatus[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done');
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated');
$this->labelStatusShort[self::STATUS_BILLED] = $langs->transnoentitiesnoconv('StatusInterInvoiced');
$this->labelStatusShort[self::STATUS_CLOSED] = $langs->transnoentitiesnoconv('Done');
2018-04-21 15:46:55 +02:00
}
2023-01-12 13:02:04 +01:00
$statuscode = 'status'.$status;
if ($status == self::STATUS_BILLED || $status == self::STATUS_CLOSED) {
$statuscode = 'status6';
}
NEW intervention signed status update (#30629) * Added confirm_sign, confirm_unsign, sign & unsign actions. Added sign-unsign button. * Updated create & fetch methods with signed_status * Added EN localization * Added intervention signed notification * Added intervention signed auto event. Updated EN localization. Fixed trigger. * Cleaned code * Added signed label to status badge * Cleaned code * Added signed statues dictionary. Added method to get signed status label badge. * Added signed status to intervention list * Added sign localizations * Added sign confirm select. Refactored signed statuses dictionary. * Added method to get localized signed statuses arrray. Refactored code. Added EN localization. * Fixed signed status update * Cleaned code * Updated EN localization * Cleaned code * Changed sign workflow to exclude only drafts * Added signed status change with online sign * Improved signed status workflow * Removed db structure changes * Updated action trigger to FICHINTER_MODIFY * Updated EN localizations * Refactored to use FICHINTER_MODIFY trigger with localized context message. Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Updated EN localizations. * Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Cleaned Ecode. * Fixed undeclared constant * Added contributor details * Updated notification logic to use object context to pass signature status * Refactored to make use of object context for event notification. Cleaned code. * Fixed deprecated method * Cleaned code
2024-08-27 07:01:03 +02:00
$signed_label = ' (' . $this->getLibSignedStatus() . ')';
$status_label = $this->signed_status ? $this->labelStatus[$status] . $signed_label : $this->labelStatus[$status];
$status_label_short = $this->signed_status ? $this->labelStatusShort[$status] . $signed_label : $this->labelStatusShort[$status];
return dolGetStatus($status_label, $status_label_short, '', $statuscode, $mode);
}
2023-02-08 22:20:46 +01:00
/**
* getTooltipContentArray
* @param array<string,mixed> $params params to construct tooltip data
2023-02-08 22:20:46 +01:00
* @since v18
* @return array{picto?:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string}|array{optimize:string}
2023-02-08 22:20:46 +01:00
*/
public function getTooltipContentArray($params)
{
2024-09-18 15:55:20 +02:00
global $langs;
2023-02-08 22:20:46 +01:00
$langs->load('interventions');
2023-02-08 22:20:46 +01:00
$datas = [];
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("ShowIntervention").'</u>';
2023-02-08 22:20:46 +01:00
if (isset($this->status)) {
$datas['picto'] .= ' '.$this->getLibStatut(5);
}
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
return $datas;
}
/**
* Return clickable name (with picto eventually)
2011-12-19 17:29:09 +01:00
*
* @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
* @param string $option Options
* @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
2023-06-29 11:20:19 +02:00
* @param string $morecss Add more css on link
* @return string String with URL
*/
2023-06-29 11:20:19 +02:00
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $morecss = '')
{
2018-06-04 13:36:38 +02:00
global $conf, $langs, $hookmanager;
2023-06-29 11:20:19 +02:00
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
}
$result = '';
2023-02-08 22:20:46 +01:00
$params = [
'id' => $this->id,
'objecttype' => $this->element,
2023-06-29 11:20:19 +02:00
'option' => $option,
2023-02-08 22:20:46 +01:00
];
$classfortooltip = 'classfortooltip';
$dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$classfortooltip = 'classforajaxtooltip';
2023-04-03 19:51:40 +02:00
$dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"';
$label = '';
} else {
$label = implode($this->getTooltipContentArray($params));
2020-02-24 05:23:34 +01:00
}
$url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id;
2021-02-25 23:00:32 +01:00
if ($option !== 'nolink') {
// Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
2023-09-10 17:41:22 +02:00
if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
2021-02-25 23:00:32 +01:00
$add_save_lastsearch_values = 1;
}
if ($add_save_lastsearch_values) {
$url .= '&save_lastsearch_values=1';
}
}
$linkclose = '';
2021-02-25 23:00:32 +01:00
if (empty($notooltip)) {
2023-11-27 11:41:05 +01:00
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowIntervention");
2025-01-09 02:01:49 +01:00
$linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
}
2025-01-09 02:01:49 +01:00
$linkclose .= ($label ? ' title="'.dolPrintHTMLForAttribute($label).'"' : ' title="tocomplete"');
2023-06-29 11:20:19 +02:00
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
2023-06-29 11:20:19 +02:00
if ($option == 'nolink' || empty($url)) {
$linkstart = '<span';
} else {
$linkstart = '<a href="'.$url.'"';
}
$linkstart .= $linkclose.'>';
2023-06-29 11:20:19 +02:00
if ($option == 'nolink' || empty($url)) {
$linkend = '</span>';
} else {
$linkend = '</a>';
}
$result .= $linkstart;
2021-02-25 23:00:32 +01:00
if ($withpicto) {
2023-06-29 11:20:19 +02:00
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"'), 0, 0, $notooltip ? 0 : 1);
2021-02-25 23:00:32 +01:00
}
2023-06-29 11:20:19 +02:00
2021-02-25 23:00:32 +01:00
if ($withpicto != 2) {
$result .= $this->ref;
}
2023-06-29 11:20:19 +02:00
$result .= $linkend;
global $action;
2020-09-30 15:17:44 +02:00
$hookmanager->initHooks(array('interventiondao'));
$parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
2021-02-25 23:00:32 +01:00
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}
2008-06-21 01:01:02 +02:00
/**
2011-07-08 11:18:54 +02:00
* Returns the next non used reference of intervention
* depending on the module numbering assets within FICHEINTER_ADDON
2011-12-19 17:29:09 +01:00
*
2014-12-20 15:42:03 +01:00
* @param Societe $soc Thirdparty object
2011-12-19 17:29:09 +01:00
* @return string Free reference for intervention
2008-06-21 01:01:02 +02:00
*/
2019-02-25 20:35:59 +01:00
public function getNextNumRef($soc)
2008-06-21 01:01:02 +02:00
{
2009-03-23 20:13:51 +01:00
global $conf, $db, $langs;
2008-06-21 01:01:02 +02:00
$langs->load("interventions");
2023-11-27 11:41:05 +01:00
if (getDolGlobalString('FICHEINTER_ADDON')) {
$mybool = false;
2023-10-15 18:12:03 +02:00
$file = "mod_" . getDolGlobalString('FICHEINTER_ADDON').".php";
$classname = "mod_" . getDolGlobalString('FICHEINTER_ADDON');
// Include file with class
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/fichinter/");
// Load file with numbering class (if found)
$mybool = ((bool) @include_once $dir.$file) || $mybool;
2009-03-23 20:13:51 +01:00
}
Qual: Enable Phan Simplify rule and fix notices (#30537) * Qual: Phan - Enable Simplyfy expression * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Qual: Simplify expression (phan notice) * Update functions2.lib.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-08-07 03:05:02 +02:00
if (!$mybool) {
2024-01-20 09:22:38 +01:00
dol_print_error(null, "Failed to include file ".$file);
return '';
}
2008-06-21 01:01:02 +02:00
$obj = new $classname();
'@phan-var-force ModeleNumRefFicheinter $obj';
2008-06-21 01:01:02 +02:00
$numref = "";
2018-10-27 21:19:19 +02:00
$numref = $obj->getNextValue($soc, $this);
2008-06-21 01:01:02 +02:00
2021-02-25 23:00:32 +01:00
if ($numref != "") {
2008-06-21 01:01:02 +02:00
return $numref;
2020-05-21 15:05:19 +02:00
} else {
dol_print_error($db, "Fichinter::getNextNumRef ".$obj->error);
2008-06-21 01:01:02 +02:00
return "";
}
2020-05-21 15:05:19 +02:00
} else {
$langs->load("errors");
2008-06-21 01:01:02 +02:00
print $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_NotDefined");
return "";
}
}
/**
* Load information on object
2012-01-04 23:56:10 +01:00
*
* @param int $id Id of object
2012-01-08 00:52:07 +01:00
* @return void
2008-06-21 01:01:02 +02:00
*/
2019-02-25 20:35:59 +01:00
public function info($id)
2008-02-24 18:01:48 +01:00
{
2010-01-13 19:51:19 +01:00
$sql = "SELECT f.rowid,";
$sql .= " f.datec,";
$sql .= " f.tms as date_modification,";
$sql .= " f.date_valid as datev,";
$sql .= " f.fk_user_author,";
$sql .= " f.fk_user_modif as fk_user_modification,";
$sql .= " f.fk_user_valid";
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
2021-03-14 11:48:39 +01:00
$sql .= " WHERE f.rowid = ".((int) $id);
2008-06-21 01:01:02 +02:00
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
2008-06-21 01:01:02 +02:00
$this->id = $obj->rowid;
2010-01-13 19:51:19 +01:00
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->date_modification);
2010-01-13 19:51:19 +01:00
$this->date_validation = $this->db->jdate($obj->datev);
2008-06-21 01:01:02 +02:00
$this->user_creation_id = $obj->fk_user_author;
$this->user_validation_id = $obj->fk_user_valid;
$this->user_modification_id = $obj->fk_user_modification;
2008-06-21 01:01:02 +02:00
}
$this->db->free($resql);
2020-05-21 15:05:19 +02:00
} else {
dol_print_error($this->db);
2008-06-21 01:01:02 +02:00
}
}
2008-04-22 01:02:50 +02:00
/**
2011-07-08 11:18:54 +02:00
* Delete intervetnion
2011-12-19 17:29:09 +01:00
*
* @param User $user Object user who delete
* @param int $notrigger Disable trigger
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2008-06-21 01:01:02 +02:00
*/
2023-01-03 13:37:11 +01:00
public function delete(User $user, $notrigger = 0)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
2010-05-04 20:03:45 +02:00
$error = 0;
2008-06-21 01:01:02 +02:00
2008-04-22 01:02:50 +02:00
$this->db->begin();
2011-07-02 18:48:31 +02:00
2021-02-25 23:00:32 +01:00
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('FICHINTER_DELETE', $user);
2021-02-25 23:00:32 +01:00
if ($result < 0) {
2023-12-04 12:12:12 +01:00
$error++;
$this->db->rollback();
return -1;
2021-02-25 23:00:32 +01:00
}
// End call triggers
}
// Delete linked object
2021-02-25 23:00:32 +01:00
if (!$error) {
$res = $this->deleteObjectLinked();
2021-02-25 23:00:32 +01:00
if ($res < 0) {
$error++;
}
}
2011-07-02 18:48:31 +02:00
// Delete linked contacts
2021-02-25 23:00:32 +01:00
if (!$error) {
$res = $this->delete_linked_contact();
2021-02-25 23:00:32 +01:00
if ($res < 0) {
$this->error = 'ErrorFailToDeleteLinkedContact';
$error++;
}
}
2011-07-02 18:48:31 +02:00
2020-11-01 21:52:34 +01:00
if (!$error) {
$main = MAIN_DB_PREFIX.'fichinterdet';
$ef = $main."_extrafields";
2024-10-24 01:26:53 +02:00
$sql = "DELETE FROM ".$this->db->sanitize($ef)." WHERE fk_object IN (SELECT rowid FROM ".$this->db->sanitize($main)." WHERE fk_fichinter = ".((int) $this->id).")";
2020-11-01 21:52:34 +01:00
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if (!$resql) {
$error++;
}
2020-04-23 18:55:36 +02:00
}
2021-02-25 23:00:32 +01:00
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet";
2021-08-23 19:33:24 +02:00
$sql .= " WHERE fk_fichinter = ".((int) $this->id);
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if (!$resql) {
$error++;
}
}
2008-06-21 01:01:02 +02:00
2021-02-25 23:00:32 +01:00
if (!$error) {
// Remove extrafields
$res = $this->deleteExtraFields();
2021-02-25 23:00:32 +01:00
if ($res < 0) {
$error++;
}
}
2021-02-25 23:00:32 +01:00
if (!$error) {
// Delete object
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinter";
2021-08-27 16:33:03 +02:00
$sql .= " WHERE rowid = ".((int) $this->id);
2014-06-12 11:31:53 +02:00
dol_syslog("Fichinter::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if (!$resql) {
$error++;
}
}
2008-06-21 01:01:02 +02:00
2021-02-25 23:00:32 +01:00
if (!$error) {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive
$this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
2020-09-03 12:43:38 +02:00
// Remove directory with files
$fichinterref = dol_sanitizeFileName($this->ref);
2021-02-25 23:00:32 +01:00
if ($conf->ficheinter->dir_output) {
$dir = $conf->ficheinter->dir_output."/".$fichinterref;
$file = $conf->ficheinter->dir_output."/".$fichinterref."/".$fichinterref.".pdf";
2021-02-25 23:00:32 +01:00
if (file_exists($file)) {
dol_delete_preview($this);
2008-06-21 01:01:02 +02:00
2021-02-25 23:00:32 +01:00
if (!dol_delete_file($file, 0, 0, 0, $this)) { // For triggers
2018-09-25 00:39:28 +02:00
$langs->load("errors");
$this->error = $langs->trans("ErrorFailToDeleteFile", $file);
return 0;
}
}
2021-02-25 23:00:32 +01:00
if (file_exists($dir)) {
if (!dol_delete_dir_recursive($dir)) {
2018-09-25 00:39:28 +02:00
$langs->load("errors");
$this->error = $langs->trans("ErrorFailToDeleteDir", $dir);
return 0;
}
2013-05-19 18:28:27 +02:00
}
}
}
2021-02-25 23:00:32 +01:00
if (!$error) {
$this->db->commit();
return 1;
2020-05-21 15:05:19 +02:00
} else {
2008-04-22 01:02:50 +02:00
$this->db->rollback();
return -1;
}
}
2008-06-21 01:01:02 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2008-06-21 01:01:02 +02:00
/**
2025-01-05 13:53:16 +01:00
* Defines a delivery date of the receipt of intervention
2011-12-19 17:29:09 +01:00
*
2025-01-05 13:53:16 +01:00
* @param User $user Object user who define
* @param integer $delivery_date_receipt Date of delivery of receipt
* @return int Return integer <0 if KO, >0 if OK
*/
2025-01-05 13:53:16 +01:00
public function set_date_delivery($user, $delivery_date_receipt)
{
// phpcs:enable
2023-10-15 18:12:03 +02:00
if ($user->hasRight('ficheinter', 'creer')) {
2025-01-05 13:53:16 +01:00
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
$sql .= " SET datei = '".$this->db->idate($delivery_date_receipt)."'";
2021-08-27 16:33:03 +02:00
$sql .= " WHERE rowid = ".((int) $this->id);
$sql .= " AND fk_statut = 0";
2008-06-21 01:01:02 +02:00
2021-02-25 23:00:32 +01:00
if ($this->db->query($sql)) {
2025-01-05 13:53:16 +01:00
$this->date_delivery = $delivery_date_receipt;
$this->delivery_date_receipt = $delivery_date_receipt;
2008-06-21 01:01:02 +02:00
return 1;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->error();
dol_syslog("Fichinter::set_date_delivery Erreur SQL");
2008-06-21 01:01:02 +02:00
return -1;
}
}
2023-01-06 19:24:57 +01:00
return 0;
2008-06-21 01:01:02 +02:00
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2008-06-21 01:01:02 +02:00
/**
2011-07-08 11:18:54 +02:00
* Define the label of the intervention
2011-12-19 17:29:09 +01:00
*
* @param User $user Object user who modify
* @param string $description description
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2008-06-21 01:01:02 +02:00
*/
public function set_description($user, $description)
2008-06-21 01:01:02 +02:00
{
// phpcs:enable
2023-10-15 18:12:03 +02:00
if ($user->hasRight('ficheinter', 'creer')) {
2008-06-21 01:01:02 +02:00
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
$sql .= " SET description = '".$this->db->escape($description)."',";
2024-10-29 02:18:17 +01:00
$sql .= " fk_user_modif = ".((int) $user->id);
2021-08-27 16:33:03 +02:00
$sql .= " WHERE rowid = ".((int) $this->id);
2008-06-21 01:01:02 +02:00
2021-02-25 23:00:32 +01:00
if ($this->db->query($sql)) {
2008-06-21 01:01:02 +02:00
$this->description = $description;
return 1;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->error();
dol_syslog("Fichinter::set_description Erreur SQL");
2008-06-21 01:01:02 +02:00
return -1;
}
}
2023-01-06 19:24:57 +01:00
return 0;
2008-06-21 01:01:02 +02:00
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
2013-08-22 16:49:23 +02:00
* Link intervention to a contract
*
* @param User $user Object user who modify
* @param int $contractid Description
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
*/
public function set_contrat($user, $contractid)
{
// phpcs:enable
2023-10-15 18:12:03 +02:00
if ($user->hasRight('ficheinter', 'creer')) {
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
2020-09-20 02:30:53 +02:00
$sql .= " SET fk_contrat = ".((int) $contractid);
2021-08-27 16:33:03 +02:00
$sql .= " WHERE rowid = ".((int) $this->id);
2021-02-25 23:00:32 +01:00
if ($this->db->query($sql)) {
2013-08-22 16:49:23 +02:00
$this->fk_contrat = $contractid;
return 1;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->error();
return -1;
}
}
2023-01-06 19:24:57 +01:00
2013-08-22 16:49:23 +02:00
return -2;
}
2017-07-25 21:22:22 +02:00
/**
* Load an object from its id and create a new one in database
*
* @param User $user User making the clone
* @param int $socid Id of thirdparty
* @param bool $clone_contacts Clone contacts from origin
* @param bool $clone_notes Clone notes from origin
* @return int New id of clone
*/
public function createFromClone(User $user, $socid = 0, $clone_contacts = false, $clone_notes = false)
{
global $hookmanager, $langs;
$langs->load("errors");
$error = 0;
$this->db->begin();
// get extrafields so they will be clone
2021-02-25 23:00:32 +01:00
foreach ($this->lines as $line) {
$line->fetch_optionals();
2021-02-25 23:00:32 +01:00
}
// Load source object
$objFrom = clone $this;
// Change socid if needed
2021-02-25 23:00:32 +01:00
if (!empty($socid) && $socid != $this->socid) {
$objsoc = new Societe($this->db);
2021-02-25 23:00:32 +01:00
if ($objsoc->fetch($socid) > 0) {
$this->socid = $objsoc->id;
2022-08-31 22:14:20 +02:00
//$this->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
//$this->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$this->fk_project = 0;
$this->fk_delivery_address = 0;
}
// TODO Change product price if multi-prices
}
$this->id = 0;
$this->ref = '';
$this->status = self::STATUS_DRAFT;
$this->statut = self::STATUS_DRAFT; // deprecated
// Clear fields
$this->user_author_id = $user->id;
$this->user_validation_id = 0;
$this->date_creation = '';
$this->date_validation = '';
$this->ref_client = '';
if (!$clone_notes) {
$this->note_private = '';
$this->note_public = '';
}
// Create clone
$this->context['createfromclone'] = 'createfromclone';
$result = $this->create($user);
2021-02-25 23:00:32 +01:00
if ($result < 0) {
$error++;
}
2021-02-25 23:00:32 +01:00
if (!$error) {
// Add lines because it is not included into create function
2021-02-25 23:00:32 +01:00
foreach ($this->lines as $line) {
$this->addline($user, $this->id, $line->desc, $line->datei, $line->duration, $line->array_options);
}
// Hook of thirdparty module
2021-02-25 23:00:32 +01:00
if (is_object($hookmanager)) {
$parameters = array('objFrom' => $objFrom);
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
2021-02-25 23:00:32 +01:00
if ($reshook < 0) {
2023-02-24 16:57:39 +01:00
$this->setErrorsFromObject($hookmanager);
2021-02-25 23:00:32 +01:00
$error++;
}
}
}
//Duplicate contact
if ($clone_contacts) {
foreach (array('internal', 'external') as $source) {
$tab = $objFrom->liste_contact(-1, $source);
if (is_array($tab) && count($tab) > 0) {
foreach ($tab as $contacttoadd) {
$retAddContact = $this->add_contact(
$contacttoadd['id'],
$contacttoadd['code'],
$contacttoadd['source']
);
if ($this->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
$error++;
} elseif ($retAddContact < 0) {
$error++;
}
}
} elseif ($tab < 0) {
$this->error .= $objFrom->error;
$error++;
}
}
}
unset($this->context['createfromclone']);
// End
2021-02-25 23:00:32 +01:00
if (!$error) {
$this->db->commit();
return $this->id;
2020-05-21 15:05:19 +02:00
} else {
$this->db->rollback();
return -1;
}
}
2017-07-25 21:22:22 +02:00
2008-06-21 01:01:02 +02:00
/**
2011-07-08 11:18:54 +02:00
* Adding a line of intervention into data base
2011-12-19 17:29:09 +01:00
*
2013-05-19 18:28:27 +02:00
* @param user $user User that do the action
2011-12-19 17:29:09 +01:00
* @param int $fichinterid Id of intervention
* @param string $desc Line description
* @param int $date_intervention Intervention date
2011-12-19 17:29:09 +01:00
* @param int $duration Intervention duration
* @param array<string,?mixed> $array_options Array option
2011-12-19 17:29:09 +01:00
* @return int >0 if ok, <0 if ko
2008-06-21 01:01:02 +02:00
*/
2023-12-16 11:09:26 +01:00
public function addline($user, $fichinterid, $desc, $date_intervention, $duration, $array_options = [])
2008-06-21 01:01:02 +02:00
{
2014-08-28 14:48:16 +02:00
dol_syslog(get_class($this)."::addline $fichinterid, $desc, $date_intervention, $duration");
if ($this->status == self::STATUS_DRAFT) {
2008-06-21 01:01:02 +02:00
$this->db->begin();
2008-06-21 01:01:02 +02:00
// Insertion ligne
$line = new FichinterLigne($this->db);
2010-12-15 08:12:28 +01:00
$line->fk_fichinter = $fichinterid;
$line->desc = $desc;
2022-09-02 08:53:13 +02:00
$line->date = $date_intervention;
$line->datei = $date_intervention; // For backward compatibility
2010-12-15 08:12:28 +01:00
$line->duration = $duration;
if (is_array($array_options) && count($array_options) > 0) {
$line->array_options = $array_options;
2014-08-26 17:08:03 +02:00
}
$result = $line->insert($user);
2014-08-28 14:48:16 +02:00
2021-02-25 23:00:32 +01:00
if ($result >= 0) {
2008-06-21 01:01:02 +02:00
$this->db->commit();
return 1;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->error();
2008-06-21 01:01:02 +02:00
$this->db->rollback();
return -1;
}
}
2023-01-06 19:24:57 +01:00
return 0;
2008-06-21 01:01:02 +02:00
}
/**
2013-05-19 11:18:45 +02:00
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return int
2008-06-21 01:01:02 +02:00
*/
2019-02-25 20:35:59 +01:00
public function initAsSpecimen()
{
2023-01-03 17:34:51 +01:00
global $langs;
$now = dol_now();
// Initialise parameters
$this->id = 0;
$this->ref = 'SPECIMEN';
2022-05-17 12:53:50 +02:00
$this->ref_client = 'SPECIMEN CLIENT';
$this->specimen = 1;
2010-09-01 16:13:51 +02:00
$this->socid = 1;
$this->datec = $now;
$this->note_private = 'Private note';
$this->note_public = 'SPECIMEN';
$this->duration = 0;
2015-02-03 13:43:37 +01:00
$nbp = 25;
$xnbp = 0;
2021-02-25 23:00:32 +01:00
while ($xnbp < $nbp) {
$line = new FichinterLigne($this->db);
$line->desc = $langs->trans("Description")." ".$xnbp;
2022-09-02 08:53:13 +02:00
$line->date = ($now - 3600 * (1 + $xnbp));
$line->datei = ($now - 3600 * (1 + $xnbp)); // For backward compatibility
$line->duration = 600;
$line->fk_fichinter = 0;
$this->lines[$xnbp] = $line;
$xnbp++;
2011-09-12 20:43:01 +02:00
$this->duration += $line->duration;
2011-09-12 21:34:59 +02:00
}
return 1;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2008-06-21 01:01:02 +02:00
/**
2014-09-04 18:58:33 +02:00
* Load array lines ->lines
2011-12-19 17:29:09 +01:00
*
2023-12-01 19:51:32 +01:00
* @return int Return integer <0 if KO, >0 if OK
2008-06-21 01:01:02 +02:00
*/
public function fetch_lines()
{
// phpcs:enable
2018-02-08 12:41:31 +01:00
$this->lines = array();
2022-03-28 13:50:47 +02:00
$sql = "SELECT rowid, fk_fichinter, description, duree, date, rang";
$sql .= " FROM ".MAIN_DB_PREFIX."fichinterdet";
$sql .= " WHERE fk_fichinter = ".((int) $this->id);
$sql .= " ORDER BY rang ASC, date ASC";
2014-06-12 11:31:53 +02:00
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
2022-03-28 13:50:47 +02:00
$resql = $this->db->query($sql);
2021-02-25 23:00:32 +01:00
if ($resql) {
$num = $this->db->num_rows($resql);
2008-06-21 01:01:02 +02:00
$i = 0;
2021-02-25 23:00:32 +01:00
while ($i < $num) {
$objp = $this->db->fetch_object($resql);
2008-06-21 01:01:02 +02:00
2010-12-15 08:12:28 +01:00
$line = new FichinterLigne($this->db);
$line->id = $objp->rowid;
2019-11-02 14:32:25 +01:00
$line->fk_fichinter = $objp->fk_fichinter;
$line->desc = $objp->description;
$line->duration = $objp->duree;
//For invoicing we calculing hours
$line->qty = round($objp->duree / 3600, 2);
$line->date = $this->db->jdate($objp->date);
2022-09-02 08:53:13 +02:00
$line->datei = $this->db->jdate($objp->date); // For backward compatibility
$line->rang = $objp->rang;
$line->product_type = 1;
2020-10-27 22:57:06 +01:00
$line->fetch_optionals();
2010-12-15 08:12:28 +01:00
$this->lines[$i] = $line;
2008-06-21 01:01:02 +02:00
$i++;
}
$this->db->free($resql);
2010-10-27 16:47:32 +02:00
2008-06-21 01:01:02 +02:00
return 1;
2020-05-21 15:05:19 +02:00
} else {
$this->error = $this->db->error();
2008-06-21 01:01:02 +02:00
return -1;
}
}
/**
* Function used to replace a thirdparty id with another one.
*
2022-12-28 13:27:13 +01:00
* @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
*/
2022-12-28 13:27:13 +01:00
public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
{
$tables = array(
'fichinter'
);
2022-12-28 13:27:13 +01:00
return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
}
2022-05-17 12:53:50 +02:00
/**
* Set customer reference number
*
* @param User $user Object user that modify
* @param string $ref_client Customer reference
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
2023-12-06 15:46:39 +01:00
* @return int Return integer <0 if ko, >0 if ok
2022-05-17 12:53:50 +02:00
*/
public function setRefClient($user, $ref_client, $notrigger = 0)
{
// phpcs:enable
2023-10-15 18:12:03 +02:00
if ($user->hasRight('ficheinter', 'creer')) {
2022-05-17 12:53:50 +02:00
$error = 0;
$this->db->begin();
2024-04-22 18:57:21 +02:00
$this->oldcopy = dol_clone($this, 2);
2022-08-22 15:06:09 +02:00
2022-05-17 12:53:50 +02:00
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ref_client = ".(empty($ref_client) ? 'NULL' : "'".$this->db->escape($ref_client)."'");
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(__METHOD__.' $this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = $this->db->error();
$error++;
}
if (!$error) {
$this->ref_client = $ref_client;
}
if (!$notrigger && empty($error)) {
// Call trigger
$result = $this->call_trigger('FICHINTER_MODIFY', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->db->commit();
return 1;
} else {
foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
}
} else {
return -1;
}
}
2023-01-09 17:52:01 +01:00
/**
* Return clickable link of object (with eventually picto)
2023-01-09 17:52:01 +01:00
*
qual: Method getKanbanView() has parameter $arraydata with no value type specified in iterable type array. (#30712) * Update adherent.class.php * Update adherent_type.class.php * Update availabilities.class.php * Update propal.class.php * Update account.class.php * Update paymentvarious.class.php * Update cashcontrol.class.php * Update localtax.class.php * Update remisecheque.class.php * Update bonprelevement.class.php * Update chargesociales.class.php * Update contact.class.php * Update contrat.class.php * Update commonorder.class.php * Update timespent.class.php * Update don.class.php * Update conferenceorbooth.class.php * Update expedition.class.php * Update expensereport.class.php * Update paymentexpensereport.class.php * Update fichinter.class.php * Update fournisseur.commande.class.php * Update holiday.class.php * Update evaluation.class.php * Update job.class.php * Update position.class.php * Update skill.class.php * Update intracommreport.class.php * Update knowledgerecord.class.php * Update loan.class.php * Update mo.class.php * Update partnership.class.php * Update inventory.class.php * Update entrepot.class.php * Update project.class.php * Update holiday.class.php - fix phan error * Update task.class.php * Update reception.class.php * Update recruitmentcandidature.class.php * Update recruitmentjobposition.class.php * Update paymentsalary.class.php * Update salary.class.php * Update supplier_proposal.class.php * Update ticket.class.php * Update user.class.php * Update usergroup.class.php * Update webportalinvoice.class.php * Update webportalorder.class.php * Update webportalpropal.class.php * Update workstation.class.php * Update facture.class.php
2024-08-22 03:31:04 +02:00
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @param ?array<string,mixed> $arraydata Array of data
qual: Method getKanbanView() has parameter $arraydata with no value type specified in iterable type array. (#30712) * Update adherent.class.php * Update adherent_type.class.php * Update availabilities.class.php * Update propal.class.php * Update account.class.php * Update paymentvarious.class.php * Update cashcontrol.class.php * Update localtax.class.php * Update remisecheque.class.php * Update bonprelevement.class.php * Update chargesociales.class.php * Update contact.class.php * Update contrat.class.php * Update commonorder.class.php * Update timespent.class.php * Update don.class.php * Update conferenceorbooth.class.php * Update expedition.class.php * Update expensereport.class.php * Update paymentexpensereport.class.php * Update fichinter.class.php * Update fournisseur.commande.class.php * Update holiday.class.php * Update evaluation.class.php * Update job.class.php * Update position.class.php * Update skill.class.php * Update intracommreport.class.php * Update knowledgerecord.class.php * Update loan.class.php * Update mo.class.php * Update partnership.class.php * Update inventory.class.php * Update entrepot.class.php * Update project.class.php * Update holiday.class.php - fix phan error * Update task.class.php * Update reception.class.php * Update recruitmentcandidature.class.php * Update recruitmentjobposition.class.php * Update paymentsalary.class.php * Update salary.class.php * Update supplier_proposal.class.php * Update ticket.class.php * Update user.class.php * Update usergroup.class.php * Update webportalinvoice.class.php * Update webportalorder.class.php * Update webportalpropal.class.php * Update workstation.class.php * Update facture.class.php
2024-08-22 03:31:04 +02:00
* @return string HTML Code for Kanban thumb.
2023-01-09 17:52:01 +01:00
*/
2023-01-18 22:27:52 +01:00
public function getKanbanView($option = '', $arraydata = null)
2023-01-09 17:52:01 +01:00
{
global $langs;
2023-03-07 22:04:40 +01:00
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
2023-01-09 17:52:01 +01:00
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= '</span>';
$return .= '<div class="info-box-content">';
2023-05-11 11:03:26 +02:00
$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
2023-10-17 15:43:56 +02:00
if ($selected >= 0) {
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
2023-04-06 12:00:28 +02:00
if (!empty($arraydata['thirdparty'])) {
$tmpthirdparty = $arraydata['thirdparty'];
'@phan-var-force Societe $tmpthirdparty';
2023-04-06 12:00:28 +02:00
$return .= '<br><span class="info-box-label">'.$tmpthirdparty->getNomUrl(1).'</span>';
2023-01-09 17:52:01 +01:00
}
if (property_exists($this, 'duration')) {
$return .= '<br><span class="info-box-label ">'.$langs->trans("Duration").' : '.convertSecondToTime($this->duration, 'allhourmin').'</span>';
}
if (method_exists($this, 'getLibStatut')) {
2023-12-19 11:51:48 +01:00
$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
2023-01-09 17:52:01 +01:00
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
2008-06-21 01:01:02 +02:00
}