Merge pull request #8637 from hregis/develop_ticket

Fix: dolibarrize
This commit is contained in:
Laurent Destailleur
2018-04-20 01:22:19 +02:00
committed by GitHub
7 changed files with 43 additions and 40 deletions

View File

@@ -3923,23 +3923,26 @@ abstract class CommonObject
$var = true;
$i = 0;
foreach ($this->lines as $line)
if (! empty($this->lines))
{
if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
foreach ($this->lines as $line)
{
if (empty($line->fk_parent_line))
if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
{
$parameters=array('line'=>$line,'var'=>$var,'i'=>$i);
$action='';
$hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($line->fk_parent_line))
{
$parameters=array('line'=>$line,'var'=>$var,'i'=>$i);
$action='';
$hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
}
}
else
{
$this->printOriginLine($line, $var, $restrictlist);
}
}
else
{
$this->printOriginLine($line, $var, $restrictlist);
}
$i++;
$i++;
}
}
}

View File

@@ -150,7 +150,7 @@ class FormTicketsup
}
print '<input type="hidden" name="fk_user_create" value="' . $this->fk_user_create . '">';
print '<div class="">';
dol_fiche_head('');
print '<table class="tableticket centpercent">';
@@ -183,7 +183,7 @@ class FormTicketsup
print '<tr><td class="titlefield">' . $langs->trans("ThirdParty") . '</td><td>';
$events = array();
$events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events);
print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events, 0, 'minwidth200');
print '</td></tr>';
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) {
$htmlname = 'socid';
@@ -443,7 +443,7 @@ class FormTicketsup
$ticketstat->loadCacheTypesTickets();
print '<select id="select' . $htmlname . '" class="flat select_tickettype'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
print '<select id="select' . $htmlname . '" class="flat minwidth200'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
if ($empty) {
print '<option value="">&nbsp;</option>';
}
@@ -543,7 +543,7 @@ class FormTicketsup
$ticketstat->loadCacheCategoriesTickets();
print '<select id="select' . $htmlname . '" class="flat select_ticketcategory'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
print '<select id="select' . $htmlname . '" class="flat minwidth150'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
if ($empty) {
print '<option value="">&nbsp;</option>';
}
@@ -612,7 +612,7 @@ class FormTicketsup
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print ajax_combobox('select'.$htmlname);
print ajax_combobox('select'.$htmlname,'',0,0,'off');
}
/**
@@ -644,7 +644,7 @@ class FormTicketsup
$ticketstat->loadCacheSeveritiesTickets();
print '<select id="select' . $htmlname . '" class="flat select_ticketseverity'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
print '<select id="select' . $htmlname . '" class="flat minwidth150'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
if ($empty) {
print '<option value="">&nbsp;</option>';
}
@@ -864,7 +864,7 @@ class FormTicketsup
// Destinataires
print '<tr class="email_line"><td>' . $langs->trans('MailRecipients') . '</td><td colspan="2">';
$ticketstat = new Ticketsup($this->db);
$res = $ticketstat->fetch('', $this->track_id);
$res = $ticketstat->fetch('', '', $this->track_id);
if ($res) {
// Retrieve email of all contacts (internal and external)
$contacts = $ticketstat->getInfosTicketInternalContact();
@@ -887,7 +887,7 @@ class FormTicketsup
$ticketstat->socid = $ticketstat->fk_soc;
$ticketstat->fetch_thirdparty();
if (!in_array($ticketstat->thirdparty->email, $sendto)) {
if (is_array($ticketstat->thirdparty->email) && !in_array($ticketstat->thirdparty->email, $sendto)) {
$sendto[] = $ticketstat->thirdparty->email . '(' . $langs->trans('Customer') . ')';
}
}

View File

@@ -93,9 +93,7 @@ if (GETPOST('addfile') && !GETPOST('add_ticket')) {
// Remove file
if (GETPOST('removedfile') && !GETPOST('add_ticket')) {
////$res = $object->fetch('','',GETPOST('track_id'));
////if($res > 0)
////{
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
// Set tmp directory
@@ -103,9 +101,8 @@ if (GETPOST('removedfile') && !GETPOST('add_ticket')) {
$upload_dir_tmp = $vardir . '/temp';
// TODO Delete only files that was uploaded from email form
dol_remove_file_process($_POST['removedfile'], 0);
dol_remove_file_process($_POST['removedfile'], 0, 0);
$action = 'create_ticket';
////}
}
if ($action == 'create_ticket' && GETPOST('add_ticket')) {
$error = 0;

View File

@@ -274,9 +274,7 @@ if ($action == "view_ticketlist")
$limit = $conf->liste_limit;
$page = GETPOST("page", 'int');
if ($page == -1) {
$page = 0;
}
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;

View File

@@ -134,7 +134,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be inc
$userstat = new User($db);
$form = new Form($db);
$formticket = new FormTicketsup($db);
$formproject = new FormProjets($db);
if (! empty($conf->projet->enabled)) {
$formproject = new FormProjets($db);
}
if ($action == 'view' || $action == 'add_message' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen'
|| $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')
@@ -631,15 +634,15 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print '<div class="tagtd">';
print dol_print_phone($tab[$i]['phone'], '', '', '', AC_TEL).'<br>';
print dol_print_phone($tab[$i]['phone'], '', '', '', 'AC_TEL').'<br>';
if (! empty($tab[$i]['phone_perso'])) {
//print img_picto($langs->trans('PhonePerso'),'object_phoning.png','',0,0,0).' ';
print '<br>'.dol_print_phone($tab[$i]['phone_perso'], '', '', '', AC_TEL).'<br>';
print '<br>'.dol_print_phone($tab[$i]['phone_perso'], '', '', '', 'AC_TEL').'<br>';
}
if (! empty($tab[$i]['phone_mobile'])) {
//print img_picto($langs->trans('PhoneMobile'),'object_phoning.png','',0,0,0).' ';
print dol_print_phone($tab[$i]['phone_mobile'], '', '', '', AC_TEL).'<br>';
print dol_print_phone($tab[$i]['phone_mobile'], '', '', '', 'AC_TEL').'<br>';
}
print '</div>';

View File

@@ -1639,7 +1639,7 @@ class Ticketsup extends CommonObject
{
global $langs;
if (count($this->cache_logs_ticket)) {
if (is_array($this->cache_logs_ticket) && count($this->cache_logs_ticket)) {
return 0;
}
// Cache deja charge
@@ -1751,7 +1751,7 @@ class Ticketsup extends CommonObject
{
global $langs;
if (count($this->cache_msgs_ticket)) {
if (is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) {
return 0;
}
// Cache deja charge

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2018 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@@ -580,12 +581,13 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
{
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
if (! empty($extrafields->attributes[$object->table_element]['computed'])) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
{
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
}
}
// Loop on record
// --------------------------------------------------------------------
$i=0;