diff --git a/htdocs/langs/de_DE/website.lang b/htdocs/langs/de_DE/website.lang index 7585718458bbc..8059aff918652 100644 --- a/htdocs/langs/de_DE/website.lang +++ b/htdocs/langs/de_DE/website.lang @@ -191,6 +191,33 @@ WebPortalPartnerShipCardAccessHelp=Zugriff auf den Partnerschaftsdatensatz (vers WEBPORTAL_PROPAL_LIST_ACCESS=Zugriff auf die Angebote ermöglichen WEBPORTAL_ORDER_LIST_ACCESS=Zugriff auf die Bestellungen aktivieren WEBPORTAL_INVOICE_LIST_ACCESS=Zugriff auf die Rechnungen aktivieren +WEBPORTAL_FICHEINTER_LIST_ACCESS=Zugriff auf Einsatzberichte aktivieren +WEBPORTAL_TICKET_LIST_ACCESS=Zugriff auf Tickets aktivieren +WebPortalFicheinterListMenu=Einsatzberichte +WebPortalFicheinterListTitle=Einsatzberichte +WebPortalFicheinterListDesc=Hier finden Sie alle Ihre Einsatzberichte +WebPortalFicheinterListNothing=Keine Einsatzberichte gefunden +WebPortalTicketListMenu=Tickets +WebPortalTicketListTitle=Tickets +WebPortalTicketListDesc=Hier finden Sie alle Ihre Tickets +WebPortalTicketListNothing=Keine Tickets gefunden +WebPortalTicketConsultation=Einsicht +WebPortalTicketConsultationLink=Ansehen +WebPortalTicketConsultationTooltipNotPublic=Das Ticket wurde nicht über die öffentliche Oberfläche erstellt. +WebPortalTicketNotAssigned=Nicht zugewiesen +StatusInterInDraft=Entwurf +StatusInterInValidated=Validiert +StatusInterInClosed=Abgeschlossen +WebPortalInterSignedStatusNotSigned=Nicht unterzeichnet +WebPortalInterSignedStatusSignedInternal=Intern unterzeichnet +WebPortalInterSignedStatusSignedThirdParty=Vom Dritten unterzeichnet +WebPortalInterSignedStatusSignedThirdPartyOnline=Vom Dritten online unterzeichnet +WebPortalInterSignedStatusSignedAllParties=Von allen Parteien unterzeichnet +WebPortalInterSignedDone=Unterzeichnet +WebPortalInterDateCreation=Erstellungsdatum +WebPortalInterDateStart=Startdatum +WebPortalInterDateEnd=Enddatum +WebPortalInterDateClose=Abschlussdatum WEBPORTAL_USER_LOGGED=Einen anonymen Benutzer wählen WebPortalUserLoggedHelp=Dieser Benutzer wird verwendet, um Daten in Karten zu aktualisieren. WebPortalHomeTitle=Willkommen diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 380c7538b1ce6..aee39fbb539b7 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -191,6 +191,33 @@ WebPortalPartnerShipCardAccessHelp=Enable access to the partnership record (Hidd WEBPORTAL_PROPAL_LIST_ACCESS=Enable access to the proposals WEBPORTAL_ORDER_LIST_ACCESS=Enable access to the orders WEBPORTAL_INVOICE_LIST_ACCESS=Enable access to the invoices +WEBPORTAL_FICHEINTER_LIST_ACCESS=Enable access to interventions +WEBPORTAL_TICKET_LIST_ACCESS=Enable access to tickets +WebPortalFicheinterListMenu=Interventions +WebPortalFicheinterListTitle=Interventions +WebPortalFicheinterListDesc=You will find here all your interventions +WebPortalFicheinterListNothing=Interventions not found +WebPortalTicketListMenu=Tickets +WebPortalTicketListTitle=Tickets +WebPortalTicketListDesc=You will find here all your tickets +WebPortalTicketListNothing=Tickets not found +WebPortalTicketConsultation=Consultation +WebPortalTicketConsultationLink=View +WebPortalTicketConsultationTooltipNotPublic=The ticket was not created from the public interface. +WebPortalTicketNotAssigned=Not assigned +StatusInterInDraft=Draft +StatusInterInValidated=Validated +StatusInterInClosed=Closed +WebPortalInterSignedStatusNotSigned=Not signed +WebPortalInterSignedStatusSignedInternal=Signed internally +WebPortalInterSignedStatusSignedThirdParty=Signed by third party +WebPortalInterSignedStatusSignedThirdPartyOnline=Signed by third party online +WebPortalInterSignedStatusSignedAllParties=Signed by all parties +WebPortalInterSignedDone=Signed +WebPortalInterDateCreation=Creation date +WebPortalInterDateStart=Start date +WebPortalInterDateEnd=End date +WebPortalInterDateClose=Closing date WEBPORTAL_USER_LOGGED=Select an anonymous user WebPortalUserLoggedHelp=This user is used to update cards WebPortalHomeTitle=Welcome diff --git a/htdocs/langs/es_ES/website.lang b/htdocs/langs/es_ES/website.lang index 972368828d183..8e95b8967458a 100644 --- a/htdocs/langs/es_ES/website.lang +++ b/htdocs/langs/es_ES/website.lang @@ -191,6 +191,33 @@ WebPortalPartnerShipCardAccessHelp=Habilitar el acceso al registro de sociedad ( WEBPORTAL_PROPAL_LIST_ACCESS=Habilitar el acceso a los presupuestos WEBPORTAL_ORDER_LIST_ACCESS=Habilitar el acceso a los pedidos WEBPORTAL_INVOICE_LIST_ACCESS=Habilitar el acceso a las facturas +WEBPORTAL_FICHEINTER_LIST_ACCESS=Activar el acceso a las intervenciones +WEBPORTAL_TICKET_LIST_ACCESS=Activar el acceso a los tickets +WebPortalFicheinterListMenu=Intervenciones +WebPortalFicheinterListTitle=Intervenciones +WebPortalFicheinterListDesc=Aquí encontrará todas sus intervenciones +WebPortalFicheinterListNothing=No se encontraron intervenciones +WebPortalTicketListMenu=Tickets +WebPortalTicketListTitle=Tickets +WebPortalTicketListDesc=Aquí encontrará todos sus tickets +WebPortalTicketListNothing=No se encontraron tickets +WebPortalTicketConsultation=Consulta +WebPortalTicketConsultationLink=Consultar +WebPortalTicketConsultationTooltipNotPublic=El ticket no se creó desde la interfaz pública. +WebPortalTicketNotAssigned=No asignado +StatusInterInDraft=Borrador +StatusInterInValidated=Validada +StatusInterInClosed=Cerrada +WebPortalInterSignedStatusNotSigned=No firmada +WebPortalInterSignedStatusSignedInternal=Firmada internamente +WebPortalInterSignedStatusSignedThirdParty=Firmada por el tercero +WebPortalInterSignedStatusSignedThirdPartyOnline=Firmada por el tercero en línea +WebPortalInterSignedStatusSignedAllParties=Firmada por todas las partes +WebPortalInterSignedDone=Firmada +WebPortalInterDateCreation=Fecha de creación +WebPortalInterDateStart=Fecha de inicio +WebPortalInterDateEnd=Fecha de fin +WebPortalInterDateClose=Fecha de cierre WEBPORTAL_USER_LOGGED=Seleccione un usuario anónimo WebPortalUserLoggedHelp=Este usuario se utiliza para actualizar tarjetas. WebPortalHomeTitle=Bienvenido diff --git a/htdocs/langs/fr_FR/website.lang b/htdocs/langs/fr_FR/website.lang index 8c64f30319b88..f0adf6d78e6d5 100644 --- a/htdocs/langs/fr_FR/website.lang +++ b/htdocs/langs/fr_FR/website.lang @@ -191,6 +191,33 @@ WebPortalPartnerShipCardAccessHelp=Autoriser l'accès à l'enregistrement des pa WEBPORTAL_PROPAL_LIST_ACCESS=Autoriser l'accès aux devis WEBPORTAL_ORDER_LIST_ACCESS=Autoriser l'accès aux commandes WEBPORTAL_INVOICE_LIST_ACCESS=Autoriser l'accès aux factures +WEBPORTAL_FICHEINTER_LIST_ACCESS=Activer l'accès aux fiches d'intervention +WEBPORTAL_TICKET_LIST_ACCESS=Activer l'accès aux tickets +WebPortalFicheinterListMenu=Interventions +WebPortalFicheinterListTitle=Interventions +WebPortalFicheinterListDesc=Vous trouverez ici toutes vos fiches d'intervention +WebPortalFicheinterListNothing=Aucune fiche d'intervention trouvée +WebPortalTicketListMenu=Tickets +WebPortalTicketListTitle=Tickets +WebPortalTicketListDesc=Vous trouverez ici tous vos tickets +WebPortalTicketListNothing=Aucun ticket trouvé +WebPortalTicketConsultation=Consultation +WebPortalTicketConsultationLink=Consulter +WebPortalTicketConsultationTooltipNotPublic=Le ticket n’a pas été créé à partir de l'interface publique. +WebPortalTicketNotAssigned=Non assigné +StatusInterInDraft=Brouillon +StatusInterInValidated=Validée +StatusInterInClosed=Clôturée +WebPortalInterSignedStatusNotSigned=Non signée +WebPortalInterSignedStatusSignedInternal=Signé en interne +WebPortalInterSignedStatusSignedThirdParty=Signé par le tiers +WebPortalInterSignedStatusSignedThirdPartyOnline=Signé par le tiers en ligne +WebPortalInterSignedStatusSignedAllParties=Signé par toutes les parties +WebPortalInterSignedDone=Signée +WebPortalInterDateCreation=Date de création +WebPortalInterDateStart=Date de début +WebPortalInterDateEnd=Date de fin +WebPortalInterDateClose=Date de clôture WEBPORTAL_USER_LOGGED=Sélectionnez un utilisateur anonyme WebPortalUserLoggedHelp=Cet utilisateur est utilisé pour mettre à jour les fiches. WebPortalHomeTitle=Bienvenue diff --git a/htdocs/langs/it_IT/website.lang b/htdocs/langs/it_IT/website.lang index cd88029a422e8..4d767e0192551 100644 --- a/htdocs/langs/it_IT/website.lang +++ b/htdocs/langs/it_IT/website.lang @@ -191,6 +191,33 @@ WebPortalPartnerShipCardAccessHelp=Abilita l'accesso al record della partnership WEBPORTAL_PROPAL_LIST_ACCESS=Abilita l'accesso a Proposte WEBPORTAL_ORDER_LIST_ACCESS=Abilita l'accesso agli ordini WEBPORTAL_INVOICE_LIST_ACCESS=Abilita l'accesso a fatture +WEBPORTAL_FICHEINTER_LIST_ACCESS=Abilita l'accesso agli interventi +WEBPORTAL_TICKET_LIST_ACCESS=Abilita l'accesso ai ticket +WebPortalFicheinterListMenu=Interventi +WebPortalFicheinterListTitle=Interventi +WebPortalFicheinterListDesc=Qui trovi tutti i tuoi interventi +WebPortalFicheinterListNothing=Nessun intervento trovato +WebPortalTicketListMenu=Ticket +WebPortalTicketListTitle=Ticket +WebPortalTicketListDesc=Qui trovi tutti i tuoi ticket +WebPortalTicketListNothing=Nessun ticket trovato +WebPortalTicketConsultation=Consultazione +WebPortalTicketConsultationLink=Consulta +WebPortalTicketConsultationTooltipNotPublic=Il ticket non è stato creato dall'interfaccia pubblica. +WebPortalTicketNotAssigned=Non assegnato +StatusInterInDraft=Bozza +StatusInterInValidated=Convalidata +StatusInterInClosed=Chiusa +WebPortalInterSignedStatusNotSigned=Non firmata +WebPortalInterSignedStatusSignedInternal=Firmata internamente +WebPortalInterSignedStatusSignedThirdParty=Firmata dal terzo +WebPortalInterSignedStatusSignedThirdPartyOnline=Firmata dal terzo online +WebPortalInterSignedStatusSignedAllParties=Firmata da tutte le parti +WebPortalInterSignedDone=Firmata +WebPortalInterDateCreation=Data di creazione +WebPortalInterDateStart=Data di inizio +WebPortalInterDateEnd=Data di fine +WebPortalInterDateClose=Data di chiusura WEBPORTAL_USER_LOGGED=Seleziona un utente anonimo WebPortalUserLoggedHelp=Questo utente viene utilizzato per aggiornare le carte WebPortalHomeTitle=Benvenuto diff --git a/htdocs/public/webportal/tpl/list-filters.tpl.php b/htdocs/public/webportal/tpl/list-filters.tpl.php index c0af0abc84093..cf989b0d220f5 100644 --- a/htdocs/public/webportal/tpl/list-filters.tpl.php +++ b/htdocs/public/webportal/tpl/list-filters.tpl.php @@ -62,4 +62,12 @@ + + arrayfields) && !empty($formList->arrayfields['consultation_link']['checked'])) { ?> + + + + diff --git a/htdocs/public/webportal/tpl/list-lines.tpl.php b/htdocs/public/webportal/tpl/list-lines.tpl.php index 82d8ffa600fe9..3bc3c815669dd 100644 --- a/htdocs/public/webportal/tpl/list-lines.tpl.php +++ b/htdocs/public/webportal/tpl/list-lines.tpl.php @@ -78,6 +78,16 @@ $formList->setTotalValue('signature_link', [], $record, $i, $totalarray) ?> + + arrayfields) && !empty($formList->arrayfields['consultation_link']['checked'])) { ?> + + printValue('consultation_link', [], $record, $i, $totalarray); + $formList->setTotalValue('consultation_link', [], $record, $i, $totalarray) ?> + + + ">trans((string) $formList->arrayfields[$alias . $key]['label']) ?> nbColumn++; - } + } } // Hook fields @@ -72,4 +72,12 @@ trans((string) $formList->arrayfields['signature_link']['label']) ?> nbColumn++; } ?> + + arrayfields) && !empty($formList->arrayfields['consultation_link']['checked'])) { ?> + trans((string) $formList->arrayfields['consultation_link']['label']) ?> + nbColumn++; + } ?> + diff --git a/htdocs/public/webportal/tpl/menu.tpl.php b/htdocs/public/webportal/tpl/menu.tpl.php index a0e6f497aaa29..4317a77ac39b2 100644 --- a/htdocs/public/webportal/tpl/menu.tpl.php +++ b/htdocs/public/webportal/tpl/menu.tpl.php @@ -62,6 +62,26 @@ 'group' => 'administrative' // group identifier for the group if necessary ); } + // menu interventions + if (isModEnabled('intervention') && getDolGlobalInt('WEBPORTAL_FICHEINTER_LIST_ACCESS')) { + $navMenu['ficheinter_list'] = array( + 'id' => 'ficheinter_list', + 'rank' => 35, + 'url' => $context->getControllerUrl('ficheinterlist'), + 'name' => $langs->trans('WebPortalFicheinterListMenu'), + 'group' => 'administrative' + ); + } + // menu tickets + if (isModEnabled('ticket') && getDolGlobalInt('WEBPORTAL_TICKET_LIST_ACCESS')) { + $navMenu['ticket_list'] = array( + 'id' => 'ticket_list', + 'rank' => 36, + 'url' => $context->getControllerUrl('ticketlist'), + 'name' => $langs->trans('WebPortalTicketListMenu'), + 'group' => 'administrative' + ); + } // menu documents (GED) if (getDolGlobalInt('WEBPORTAL_DOCUMENT_LIST_ACCESS')) { $navMenu['document_list'] = array( diff --git a/htdocs/webportal/admin/setup.php b/htdocs/webportal/admin/setup.php index f844d97a08e69..27bdba9e7c8fb 100644 --- a/htdocs/webportal/admin/setup.php +++ b/htdocs/webportal/admin/setup.php @@ -115,10 +115,15 @@ } // Enable access for the intervention -if (isModEnabled('ficheinter')) { +if (isModEnabled('intervention')) { $formSetup->newItem('WEBPORTAL_FICHEINTER_LIST_ACCESS')->setAsYesNo(); } +// Enable access for the tickets +if (isModEnabled('ticket')) { + $formSetup->newItem('WEBPORTAL_TICKET_LIST_ACCESS')->setAsYesNo(); +} + // Enable access for the partnership record if (isModEnabled('partnership')) { $access_list = array( diff --git a/htdocs/webportal/class/context.class.php b/htdocs/webportal/class/context.class.php index 4f6efaff8dbf8..1474afd02ef05 100644 --- a/htdocs/webportal/class/context.class.php +++ b/htdocs/webportal/class/context.class.php @@ -253,6 +253,8 @@ public function initController($init_theme = true) $this->addControllerDefinition('propallist', $defaultControllersPath . 'propallist.controller.class.php', 'PropalListController'); $this->addControllerDefinition('orderlist', $defaultControllersPath . 'orderlist.controller.class.php', 'OrderListController'); $this->addControllerDefinition('invoicelist', $defaultControllersPath . 'invoicelist.controller.class.php', 'InvoiceListController'); + $this->addControllerDefinition('ficheinterlist', $defaultControllersPath . 'ficheinterlist.controller.class.php', 'FicheinterListController'); + $this->addControllerDefinition('ticketlist', $defaultControllersPath . 'ticketlist.controller.class.php', 'TicketListController'); $this->addControllerDefinition('membercard', $defaultControllersPath . 'membercard.controller.class.php', 'MemberCardController'); $this->addControllerDefinition('partnershipcard', $defaultControllersPath . 'partnershipcard.controller.class.php', 'PartnershipCardController'); //** below the addition of DocumentListController adding files by third party attached documents diff --git a/htdocs/webportal/class/html.formlistwebportal.class.php b/htdocs/webportal/class/html.formlistwebportal.class.php index 0458022ce8f7e..d4950a39e55b8 100644 --- a/htdocs/webportal/class/html.formlistwebportal.class.php +++ b/htdocs/webportal/class/html.formlistwebportal.class.php @@ -277,8 +277,8 @@ public function setArrayFields() } } $this->arrayfields['remain_to_pay'] = array('type' => 'price', 'label' => 'RemainderToPay', 'checked' => 1, 'enabled' => $this->element == 'invoice' && isModEnabled('invoice'), 'visible' => 1, 'position' => 10000, 'help' => '',); - $this->arrayfields['download_link'] = array('type' => '', 'label' => 'File', 'checked' => 1, 'enabled' => ($this->element == 'propal' && isModEnabled('propal')) || ($this->element == 'order' && isModEnabled('order')) || ($this->element == 'invoice' && isModEnabled('invoice')), 'visible' => 1, 'position' => 10001, 'help' => '',); - $this->arrayfields['signature_link'] = array('type' => '', 'label' => 'Signature', 'checked' => 1, 'enabled' => $this->element == 'propal' && isModEnabled('propal') && getDolGlobalString("PROPOSAL_ALLOW_ONLINESIGN") != 0, 'visible' => 1, 'position' => 10002, 'help' => '',); + $this->arrayfields['download_link'] = array('type' => '', 'label' => 'File', 'checked' => 1, 'enabled' => ($this->element == 'propal' && isModEnabled('propal')) || ($this->element == 'order' && isModEnabled('order')) || ($this->element == 'invoice' && isModEnabled('invoice')) || ($this->element == 'ficheinter' && isModEnabled('intervention')), 'visible' => 1, 'position' => 10001, 'help' => '',); + $this->arrayfields['signature_link'] = array('type' => '', 'label' => 'Signature', 'checked' => 1, 'enabled' => ($this->element == 'propal' && isModEnabled('propal') && getDolGlobalString("PROPOSAL_ALLOW_ONLINESIGN") != 0) || ($this->element == 'ficheinter' && isModEnabled('intervention')), 'visible' => 1, 'position' => 10002, 'help' => '',); $this->controller->listSetArrayFields(); } @@ -654,7 +654,7 @@ public function setVarsFromFetchObj(&$record) */ public function printValue($field_key, $field_spec, &$record, $i, &$totalarray) { - global $conf; + global $conf, $langs; $out = ''; if (is_object($this->object)) { @@ -679,8 +679,15 @@ public function printValue($field_key, $field_spec, &$record, $i, &$totalarray) $filedir = $conf->{$element}->multidir_output[$this->object->entity] . '/' . dol_sanitizeFileName($this->object->ref); $out = $this->form->getDocumentsLink($element, $filename, $filedir); } elseif ($field_key == 'signature_link') { - if ($this->object->fk_statut == Propal::STATUS_VALIDATED) { + if ($this->element == 'propal' && $this->object->fk_statut == Propal::STATUS_VALIDATED) { $out = $this->form->getSignatureLink('proposal', $this->object); + } elseif ($this->element == 'ficheinter') { + $signedStatus = (int) ($this->object->signed_status ?? 0); + if ($this->object->fk_statut == Fichinter::STATUS_CLOSED || in_array($signedStatus, array(2, 3, 9), true)) { + $out = $langs->trans('WebPortalInterSignedDone'); + } else { + $out = $this->form->getSignatureLink('fichinter', $this->object); + } } } else { $out = $this->form->showOutputFieldForObject($this->object, $field_spec, $field_key, $this->object->$field_key, ''); diff --git a/htdocs/webportal/class/webportalficheinter.class.php b/htdocs/webportal/class/webportalficheinter.class.php new file mode 100644 index 0000000000000..2b8ebc64b0523 --- /dev/null +++ b/htdocs/webportal/class/webportalficheinter.class.php @@ -0,0 +1,81 @@ + + * + * 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 + * along with this program. If not, see . + */ + +/** + * \file htdocs/webportal/class/webportalficheinter.class.php + * \ingroup webportal + * \brief This file is a class file for WebPortalFicheinter + */ + +require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; + +/** + * Class for WebPortalFicheinter + */ +class WebPortalFicheinter extends Fichinter +{ + /** + * @var string ID of module. + */ + public $module = 'webportal'; + + /** + * Status list (short label) + */ + const STATUS_SIGN_NOT_SIGNED = 11; + const STATUS_SIGN_SIGNED_INTERNAL = 12; + const STATUS_SIGN_SIGNED_THIRDPARTY = 13; + const STATUS_SIGN_SIGNED_THIRDPARTY_ONLINE = 14; + const STATUS_SIGN_SIGNED_ALL_PARTIES = 15; + + const ARRAY_STATUS_LABEL = array( + '-1' => '', + self::STATUS_DRAFT => 'StatusInterInDraft', + self::STATUS_VALIDATED => 'StatusInterInValidated', + self::STATUS_BILLED => 'StatusInterInvoiced', + self::STATUS_CLOSED => 'StatusInterInClosed', + self::STATUS_SIGN_NOT_SIGNED => 'WebPortalInterSignedStatusNotSigned', + self::STATUS_SIGN_SIGNED_INTERNAL => 'WebPortalInterSignedStatusSignedInternal', + self::STATUS_SIGN_SIGNED_THIRDPARTY => 'WebPortalInterSignedStatusSignedThirdParty', + self::STATUS_SIGN_SIGNED_THIRDPARTY_ONLINE => 'WebPortalInterSignedStatusSignedThirdPartyOnline', + self::STATUS_SIGN_SIGNED_ALL_PARTIES => 'WebPortalInterSignedStatusSignedAllParties', + ); + + public $fields = array( + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 10), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20), + 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 2, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 25), + 'fk_soc' => array('type' => 'integer', 'label' => 'ThirdParty', 'enabled' => 1, 'visible' => -2, 'position' => 40), + 'datec' => array('type' => 'datetime', 'label' => 'WebPortalInterDateCreation', 'enabled' => 1, 'visible' => 2, 'position' => 60), + 'dateo' => array('type' => 'date', 'label' => 'WebPortalInterDateStart', 'enabled' => 1, 'visible' => 2, 'position' => 61), + 'datee' => array('type' => 'date', 'label' => 'WebPortalInterDateEnd', 'enabled' => 1, 'visible' => 2, 'position' => 62), + 'datet' => array('type' => 'date', 'label' => 'WebPortalInterDateClose', 'enabled' => 1, 'visible' => 2, 'position' => 63), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => 2, 'position' => 80), + 'fk_statut' => array('type' => 'smallint(6)', 'label' => 'Status', 'enabled' => 1, 'visible' => 2, 'position' => 500, 'arrayofkeyval' => self::ARRAY_STATUS_LABEL), + ); + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) + { + $this->db = $db; + $this->isextrafieldmanaged = 0; + } +} diff --git a/htdocs/webportal/class/webportalticket.class.php b/htdocs/webportal/class/webportalticket.class.php new file mode 100644 index 0000000000000..688c1ebae6791 --- /dev/null +++ b/htdocs/webportal/class/webportalticket.class.php @@ -0,0 +1,62 @@ + + * + * 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 + * along with this program. If not, see . + */ + +/** + * \file htdocs/webportal/class/webportalticket.class.php + * \ingroup webportal + * \brief This file is a class file for WebPortalTicket + */ + +require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php'; + +/** + * Class for WebPortalTicket + */ +class WebPortalTicket extends Ticket +{ + /** + * @var string ID of module. + */ + public $module = 'webportal'; + + public $fields = array( + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => 0, 'position' => 1, 'notnull' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'visible' => -2, 'enabled' => 1, 'position' => 5, 'notnull' => 1), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'visible' => 2, 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'showoncombobox' => 1), + 'subject' => array('type' => 'varchar(255)', 'label' => 'Subject', 'visible' => 2, 'enabled' => 1, 'position' => 20, 'notnull' => -1), + 'track_id' => array('type' => 'varchar(255)', 'label' => 'TicketTrackId', 'visible' => -2, 'enabled' => 1, 'position' => 30, 'notnull' => -1), + 'origin_email' => array('type' => 'mail', 'label' => 'OriginEmail', 'visible' => -2, 'enabled' => 1, 'position' => 35, 'notnull' => -1), + 'fk_user_create' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Author', 'visible' => -2, 'enabled' => 1, 'position' => 40, 'notnull' => 1), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'visible' => 2, 'enabled' => 1, 'position' => 500, 'notnull' => 1), + 'fk_user_assign' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'AssignedTo', 'visible' => 2, 'enabled' => 1, 'position' => 507, 'notnull' => 1), + 'fk_statut' => array('type' => 'integer', 'label' => 'Status', 'visible' => 2, 'enabled' => 1, 'position' => 600, 'notnull' => 1, 'arrayofkeyval' => array(0 => 'Unread', 1 => 'Read', 2 => 'Assigned', 3 => 'InProgress', 5 => 'NeedMoreInformation', 7 => 'OnHold', 8 => 'SolvedClosed', 9 => 'Deleted')), + ); + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) + { + parent::__construct($db); + + if (!getDolGlobalString('TICKET_INCLUDE_SUSPENDED_STATUS')) { + unset($this->fields['fk_statut']['arrayofkeyval'][self::STATUS_WAITING]); + } + } +} diff --git a/htdocs/webportal/controllers/ficheinterlist.controller.class.php b/htdocs/webportal/controllers/ficheinterlist.controller.class.php new file mode 100644 index 0000000000000..9b4ee999b9351 --- /dev/null +++ b/htdocs/webportal/controllers/ficheinterlist.controller.class.php @@ -0,0 +1,172 @@ + + * + * 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 + * along with this program. If not, see . + */ + +/** + * \file htdocs/webportal/controllers/ficheinterlist.controller.class.php + * \ingroup webportal + * \brief This file is a controller for intervention list + */ + +require_once DOL_DOCUMENT_ROOT . '/webportal/class/html.formlistwebportal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/webportal/controllers/abstractlist.controller.class.php'; + +/** + * Class for FicheinterListController + */ +class FicheinterListController extends AbstractListController +{ + /** + * Check current access to controller + * + * @return bool + */ + public function checkAccess() + { + $this->accessRight = isModEnabled('intervention') && getDolGlobalInt('WEBPORTAL_FICHEINTER_LIST_ACCESS'); + + return parent::checkAccess(); + } + + /** + * Action method is called before html output + * can be used to manage security and change context + * + * @return int Return integer < 0 on error, > 0 on success + */ + public function action() + { + global $langs; + + $context = Context::getInstance(); + if (!$context->controllerInstance->checkAccess()) { + return -1; + } + + $langs->loadLangs(array('fichinter', 'companies', 'products')); + + $context->title = $langs->trans('WebPortalFicheinterListTitle'); + $context->desc = $langs->trans('WebPortalFicheinterListDesc'); + $context->menu_active[] = 'ficheinter_list'; + + $this->formList = new FormListWebPortal($this->db); + $this->formList->init($this, 'ficheinter'); + + $hookRes = $this->hookDoAction(); + if (empty($hookRes)) { + $this->formList->doActions(); + } + + $sqlBody = " AND t.fk_soc = ".((int) $context->logged_thirdparty->id); + $sqlBody .= " AND t.fk_statut <> 0"; + + $searchStatus = (string) ($this->formList->search['fk_statut'] ?? ''); + if ($searchStatus !== '') { + $searchSignedStatus = 0; + if ((int) $searchStatus === WebPortalFicheinter::STATUS_SIGN_NOT_SIGNED) { + $searchSignedStatus = 0; + } + if ((int) $searchStatus === WebPortalFicheinter::STATUS_SIGN_SIGNED_INTERNAL) { + $searchSignedStatus = 1; + } + if ((int) $searchStatus === WebPortalFicheinter::STATUS_SIGN_SIGNED_THIRDPARTY) { + $searchSignedStatus = 2; + } + if ((int) $searchStatus === WebPortalFicheinter::STATUS_SIGN_SIGNED_THIRDPARTY_ONLINE) { + $searchSignedStatus = 3; + } + if ((int) $searchStatus === WebPortalFicheinter::STATUS_SIGN_SIGNED_ALL_PARTIES) { + $searchSignedStatus = 9; + } + + if ((int) $searchStatus >= WebPortalFicheinter::STATUS_SIGN_NOT_SIGNED && (int) $searchStatus <= WebPortalFicheinter::STATUS_SIGN_SIGNED_ALL_PARTIES) { + $this->formList->search['fk_statut'] = ''; + $sqlBody .= " AND t.fk_statut = ".((int) WebPortalFicheinter::STATUS_VALIDATED); + if ($searchSignedStatus === 0) { + $sqlBody .= " AND (t.signed_status IS NULL OR t.signed_status = 0)"; + } else { + $sqlBody .= " AND t.signed_status = ".((int) $searchSignedStatus); + } + } + } + + $this->formList->setSqlRequest('', $sqlBody); + + $this->formList->loadRecords(); + $this->formList->setParams(); + $this->formList->setColumnsVisibility(); + + return 1; + } + + + /** + * Set array fields for intervention list + * + * @return void + */ + public function listSetArrayFields() + { + $this->formList->arrayfields['download_link']['label'] = 'PDF'; + } + + /** + * Called before print value for list + * + * @param string $field_key Field key + * @param array $field_spec Field specification + * @param stdClass $record Contain data of object from database + * @return string HTML input + */ + public function listPrintValueBefore($field_key, $field_spec, &$record) + { + if ($field_key === 'fk_statut') { + $this->formList->object->status = (int) ($record->fk_statut ?? 0); + $this->formList->object->statut = (int) ($record->fk_statut ?? 0); + $this->formList->object->signed_status = (int) ($record->signed_status ?? 0); + return $this->formList->object->getLibStatut(5); + } + + return ''; + } + + /** + * Display + * + * @return void + */ + public function display() + { + $context = Context::getInstance(); + if (!$context->controllerInstance->checkAccess()) { + $this->display404(); + return; + } + + $this->loadTemplate('header'); + $this->loadTemplate('menu'); + $this->loadTemplate('hero-header-banner'); + + $hookRes = $this->hookPrintPageView(); + if (empty($hookRes)) { + print '
'; + $this->loadTemplate('list'); + print '
'; + } + + $this->loadTemplate('footer'); + } +} diff --git a/htdocs/webportal/controllers/ticketlist.controller.class.php b/htdocs/webportal/controllers/ticketlist.controller.class.php new file mode 100644 index 0000000000000..45297b2885b3d --- /dev/null +++ b/htdocs/webportal/controllers/ticketlist.controller.class.php @@ -0,0 +1,189 @@ + + * + * 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 + * along with this program. If not, see . + */ + +/** + * \file htdocs/webportal/controllers/ticketlist.controller.class.php + * \ingroup webportal + * \brief This file is a controller for ticket list + */ + +require_once DOL_DOCUMENT_ROOT . '/webportal/class/html.formlistwebportal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/webportal/controllers/abstractlist.controller.class.php'; +require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; + +/** + * Class for TicketListController + */ +class TicketListController extends AbstractListController +{ + /** + * @var array + */ + public $userStaticCache = array(); + + /** + * Check current access to controller + * + * @return bool + */ + public function checkAccess() + { + $this->accessRight = isModEnabled('ticket') && getDolGlobalInt('WEBPORTAL_TICKET_LIST_ACCESS'); + + return parent::checkAccess(); + } + + /** + * Action method is called before html output + * can be used to manage security and change context + * + * @return int Return integer < 0 on error, > 0 on success + */ + public function action() + { + global $langs; + + $context = Context::getInstance(); + if (!$context->controllerInstance->checkAccess()) { + return -1; + } + + $langs->loadLangs(array('ticket', 'companies', 'products')); + + $context->title = $langs->trans('WebPortalTicketListTitle'); + $context->desc = $langs->trans('WebPortalTicketListDesc'); + $context->menu_active[] = 'ticket_list'; + + $this->formList = new FormListWebPortal($this->db); + $this->formList->init($this, 'ticket'); + + $hookRes = $this->hookDoAction(); + if (empty($hookRes)) { + $this->formList->doActions(); + } + + $sqlBody = " AND t.fk_soc = ".((int) $context->logged_thirdparty->id); + $sqlBody .= " AND t.fk_statut <> 9"; + $this->formList->setSqlRequest('', $sqlBody); + + $this->formList->loadRecords(); + $this->formList->setParams(); + $this->formList->setColumnsVisibility(); + + return 1; + } + + + /** + * Set array fields for ticket list + * + * @return void + */ + public function listSetArrayFields() + { + $this->formList->arrayfields['consultation_link'] = array( + 'type' => '', + 'label' => 'WebPortalTicketConsultation', + 'checked' => 1, + 'enabled' => isModEnabled('ticket'), + 'visible' => 1, + 'position' => 10003, + 'help' => '', + ); + } + + /** + * Called before print value for list + * + * @param string $field_key Field key + * @param array $field_spec Field specification + * @param stdClass $record Contain data of object from database + * @return string HTML input + */ + public function listPrintValueBefore($field_key, $field_spec, &$record) + { + global $langs; + + if ($field_key === 'fk_statut') { + $this->formList->object->status = (int) ($record->fk_statut ?? 0); + $this->formList->object->fk_statut = (int) ($record->fk_statut ?? 0); + return $this->formList->object->getLibStatut(5); + } + + if ($field_key === 'fk_user_assign') { + $idUserAssign = (int) ($record->fk_user_assign ?? 0); + if ($idUserAssign <= 0) { + return $langs->trans('WebPortalTicketNotAssigned'); + } + + if (!isset($this->userStaticCache[$idUserAssign])) { + $userStatic = new User($this->db); + $userStatic->fetch($idUserAssign); + $this->userStaticCache[$idUserAssign] = $userStatic; + } + + if (!empty($this->userStaticCache[$idUserAssign]->id)) { + return $this->userStaticCache[$idUserAssign]->getFullName($langs); + } + + return $langs->trans('Unknown'); + } + + if ($field_key === 'consultation_link') { + $baseurl = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/'); + $baseurl = rtrim($baseurl, '/').'/'; + if ((int) ($record->fk_user_create ?? 0) <= 0 && !empty($record->track_id)) { + $url = $baseurl.'view.php?track_id='.urlencode((string) $record->track_id); + if (!empty($record->origin_email)) { + $url .= '&email='.urlencode((string) $record->origin_email); + } + return ''.$langs->trans('WebPortalTicketConsultationLink').''; + } + + return img_object($langs->trans('WebPortalTicketConsultationTooltipNotPublic'), 'info', 'class="classfortooltip"'); + } + + return ''; + } + + /** + * Display + * + * @return void + */ + public function display() + { + $context = Context::getInstance(); + if (!$context->controllerInstance->checkAccess()) { + $this->display404(); + return; + } + + $this->loadTemplate('header'); + $this->loadTemplate('menu'); + $this->loadTemplate('hero-header-banner'); + + $hookRes = $this->hookPrintPageView(); + if (empty($hookRes)) { + print '
'; + $this->loadTemplate('list'); + print '
'; + } + + $this->loadTemplate('footer'); + } +}