# -- # Responsibility.t - Responsiblity tests # Copyright (C) 2014 OTRS AG, http://otrs.com/ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (AGPL). If you # did not receive this file, see http://www.gnu.org/licenses/agpl.txt. # -- # Autor: Rodrigo Gonçalves # Data.: 04/08/2014 - versão inicial # # # alter table service_form add fixed_values text; # # use strict; use warnings; use vars (qw($Self)); my $schema = ' "service": { "type": "string", "required": "true" }, "DF_unidade": { "type": "string", "enum": [ DF_unidade_values ], "required": "true" }, "DF_local": { "type": "string", "required": "true" }, "DF_telefone": { "type": "string", "required": "true" }, "type": { "type": "string", "enum": [ OTRS_type_values ], "required": "true" } CF_SCHEMA , "subject": { "type": "string", "required": "true" }, "description": { "type": "string", "required": "true" }, "attachment": { "type": "string", "format": "uri" }, "Action": { "type": "string", "default": "NewTicketWizard" }, "Subaction": { "type": "string", "default": "CreateTicket" } '; my $key = '("DF_telefone"[^}]+})'; my $replace = '"DF_telefone {' . "\n" . '"type": "string"' . "\n}"; $schema =~ s/$key/$replace/; print STDOUT $schema . "\n\n\n\n"; my $form = ' "DF_unidade": { "type": "select", "label": "Unidade:", "optionLabels": [ DF_unidade_labels ] }, "DF_local": { "type": "text", "label": "Local:" }, "DF_telefone": { "type": "text", "label": "Telefone:", "control_width": 100 }, "type": { "type": "select", "label": "Motivo:", "optionLabels": [ OTRS_type_labels ] }, "service": { "type": "hidden" } CF_FORM, "subject": { "type": "text", "label": "Assunto:", "size": 80 }, "description": { "type": "textarea", "label": "Descrição:", "cols": 80 }, "attachment": { "type": "file", "label": "Anexo:", "helper": "Anexe um arquivo se necessário." }, "Action": { "type": "hidden" }, "Subaction": { "type": "hidden" } '; $key = '("DF_telefone"[^}]+})'; $replace = '"DF_telefone": {' . "\n" . '"type": "hidden"' . "\n}"; $form =~ s/$key/$replace/; print STDOUT $form ; 1;