diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 4f87131c145d6..6ca2430157555 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -45,7 +45,7 @@ $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php $label = GETPOST('label', 'alpha'); -$scandir = GETPOST('scandir', 'alpha'); +$scandir = GETPOST('scan_dir', 'alpha'); $type = 'ticket'; $error = 0; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index d87123a97c946..fe38f2fd650c3 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -501,7 +501,7 @@ public function get_substitutionarray_other($outputlangs) * Define array with couple substitution key => substitution value * Note that vars into substitutions array are formatted. * - * @param Object $object Main object to use as data source + * @param CommonObject $object Main object to use as data source * @param Translate $outputlangs Lang object to use for output * @param string $array_key Name of the key for return array * @return array Array of substitution @@ -515,6 +515,7 @@ public function get_substitutionarray_object($object, $outputlangs, $array_key = $already_payed_all = 0; if ($object->element == 'facture') { + /** @var Facture $object */ $invoice_source = new Facture($this->db); if ($object->fk_facture_source > 0) { $invoice_source->fetch($object->fk_facture_source); @@ -528,7 +529,7 @@ public function get_substitutionarray_object($object, $outputlangs, $array_key = $date = (isset($object->element) && $object->element == 'contrat' && isset($object->date_contrat)) ? $object->date_contrat : (isset($object->date) ? $object->date : null); if (get_class($object) == 'CommandeFournisseur') { - /* @var $object CommandeFournisseur*/ + /** @var CommandeFournisseur $object*/ $object->date_validation = $object->date_valid; $object->date_commande = $object->date; } @@ -703,7 +704,7 @@ public function get_substitutionarray_object($object, $outputlangs, $array_key = * Define array with couple substitution key => substitution value * Note that vars into substitutions array are formatted. * - * @param Object $line Object line + * @param CommonObjectLine $line Object line * @param Translate $outputlangs Lang object to use for output * @param int $linenumber The number of the line for the substitution of "object_line_pos" * @return array Return a substitution array @@ -927,8 +928,6 @@ public function get_substitutionarray_each_var_object(&$object, $outputlangs, $r } } - //var_dump($array_other); - return $array_other; } diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index c4539befe3f34..260022ef63ab3 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -376,7 +376,7 @@ public function init($options = '') //ODT template $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/tickets/template_ticket.odt'; $dirodt = DOL_DATA_ROOT.'/doctemplates/tickets'; - $dest = $dirodt.'/template_order.odt'; + $dest = $dirodt.'/template_ticket.odt'; if (file_exists($src) && !file_exists($dest)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -394,8 +394,10 @@ public function init($options = '') array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110121, 'ticket', 'internal', 'CONTRIBUTOR', 'Intervenant', 1);", "ignoreerror" => 1), array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110122, 'ticket', 'external', 'SUPPORTCLI', 'Contact client suivi incident', 1);", "ignoreerror" => 1), array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110123, 'ticket', 'external', 'CONTRIBUTOR', 'Intervenant', 1);", "ignoreerror" => 1), + // remove old settings "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'TICKET_ADDON_PDF_ODT_PATH' AND type = 'ticket' AND entity = ".((int) $conf->entity), - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('TICKET_ADDON_PDF_ODT_PATH','ticket',".((int) $conf->entity).")" + // activate default odt templates + array("sql" =>"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, libelle, entity, description) VALUES('generic_ticket_odt','ticket','ODT templates',".((int) $conf->entity).",'TICKET_ADDON_PDF_ODT_PATH');", "ignoreerror" =>1), ); return $this->_init($sql, $options); diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 6904febfe28cb..f7d5c828d6a04 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -322,7 +322,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails } // Make substitutions into odt - $array_user = $this->get_substitutionarray_user($object, $outputlangs); + $array_user = $this->get_substitutionarray_user($user, $outputlangs); $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs); $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); $array_other = $this->get_substitutionarray_other($outputlangs); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 8c8441d14153f..7dfa3e69baf54 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -31,6 +31,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -707,7 +708,6 @@ // Actions to build doc include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - //var_dump($action);exit; // Actions to send emails $triggersendname = 'TICKET_SENTBYMAIL'; @@ -729,6 +729,7 @@ $userstat = new User($db); $form = new Form($db); +$formfile = new FormFile($db); $formticket = new FormTicket($db); if (isModEnabled('project')) { $formproject = new FormProjets($db); @@ -811,8 +812,7 @@ print $form->buttonsSaveCancel(); print ''; */ -} elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'abandon' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'categories' || $action == 'reopen' - || $action== 'edit_contrat' || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') { +} elseif (empty($action) || in_array($action, ['builddoc', 'view', 'addlink', 'dellink', 'presend', 'presend_addmessage', 'close', 'abandon', 'delete', 'editcustomer', 'progression', 'categories', 'reopen', 'edit_contrat', 'editsubject', 'edit_extras', 'update_extras', 'edit_extrafields', 'set_extrafields', 'classify', 'sel_contract', 'edit_message_init', 'set_status', 'dellink'])) { if ($res > 0) { // or for unauthorized internals users if (!$user->socid && (getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY') && $object->fk_user_assign != $user->id) && !$user->hasRight('ticket', 'manage')) { @@ -1613,6 +1613,16 @@ if ($action != 'presend' && $action != 'presend_addmessage' && $action != 'add_message') { print '