Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/core/class/html.form.class.php
This commit is contained in:
commit
41605ed4a7
@ -90,10 +90,10 @@ class Dolistore
|
||||
// Here we set the option array for the Webservice : we want products resources
|
||||
$opt = array();
|
||||
$opt['resource'] = 'products';
|
||||
$opt2 = array();
|
||||
|
||||
// make a search to limit the id returned.
|
||||
if ($this->search != '') {
|
||||
$opt2 = array();
|
||||
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang;
|
||||
|
||||
// Call
|
||||
@ -109,7 +109,6 @@ class Dolistore
|
||||
}
|
||||
$opt['filter[id]'] = '['.implode('|', $products).']';
|
||||
} elseif ($this->categorie != 0) {
|
||||
$opt2 = array();
|
||||
$opt2['resource'] = 'categories';
|
||||
$opt2['id'] = $this->categorie;
|
||||
// Call
|
||||
|
||||
@ -1292,7 +1292,7 @@ class Form
|
||||
* @param int $socid Id ot third party or 0 for all
|
||||
* @param string $selected Id contact pre-selectionne
|
||||
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
||||
* @param int $showempty 0=no empty value, 1=add an empty value
|
||||
* @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list
|
||||
* @param string $exclude List of contacts id to exclude
|
||||
* @param string $limitto Disable answers that are not id in this array list
|
||||
* @param integer $showfunction Add function into label
|
||||
@ -1316,10 +1316,10 @@ class Form
|
||||
* Return HTML code of the SELECT of list of all contacts (for a third party or all).
|
||||
* This also set the number of contacts found into $this->num
|
||||
*
|
||||
* @param int $socid Id ot third party or 0 for all
|
||||
* @param int $socid Id ot third party or 0 for all or -1 for empty list
|
||||
* @param array|int $selected Array of ID of pre-selected contact id
|
||||
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
||||
* @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit)
|
||||
* @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit), 3=add an empty value only if more than one record into list
|
||||
* @param string $exclude List of contacts id to exclude
|
||||
* @param string $limitto Disable answers that are not id in this array list
|
||||
* @param integer $showfunction Add function into label
|
||||
@ -1351,7 +1351,7 @@ class Form
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX ."socpeople as sp";
|
||||
if ($showsoc > 0) $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX ."societe as s ON s.rowid=sp.fk_soc";
|
||||
$sql.= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
if ($socid > 0) $sql.= " AND sp.fk_soc=".$socid;
|
||||
if ($socid > 0 || $socid == -1) $sql.= " AND sp.fk_soc=".$socid;
|
||||
if (! empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND sp.statut <> 0";
|
||||
$sql.= " ORDER BY sp.lastname ASC";
|
||||
|
||||
@ -1368,7 +1368,7 @@ class Form
|
||||
}
|
||||
|
||||
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
|
||||
if ($showempty == 1 && !$multiple) $out.= '<option value="0"'.(in_array(0,$selected)?' selected':'').'> </option>';
|
||||
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) $out.= '<option value="0"'.(in_array(0,$selected)?' selected':'').'> </option>';
|
||||
if ($showempty == 2) $out.= '<option value="0"'.(in_array(0,$selected)?' selected':'').'>'.$langs->trans("Internal").'</option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
@ -1426,7 +1426,9 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<option value="-1"'.($showempty==2 || $multiple?'':' selected').' disabled>'.$langs->trans($socid?"NoContactDefinedForThirdParty":"NoContactDefined").'</option>';
|
||||
$out.= '<option value="-1"'.(($showempty==2 || $multiple) ? '' : ' selected').' disabled>';
|
||||
$out.= ($socid != -1) ? ($langs->trans($socid?"NoContactDefinedForThirdParty":"NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst');
|
||||
$out.= '</option>';
|
||||
}
|
||||
if ($htmlname != 'none' || $options_only)
|
||||
{
|
||||
@ -6170,6 +6172,7 @@ class Form
|
||||
|
||||
$linktoelem='';
|
||||
$linktoelemlist='';
|
||||
$listofidcompanytoscan='';
|
||||
|
||||
if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
|
||||
|
||||
|
||||
@ -239,9 +239,9 @@ class FormTicket
|
||||
|
||||
// Contact and type
|
||||
print '<tr><td>' . $langs->trans("Contact") . '</td><td>';
|
||||
// If no socid, set to first one (id=1) to avoid full contacts list
|
||||
$selectedCompany = $this->withfromsocid > 0 ? $this->withfromsocid : 1;
|
||||
$nbofcontacts = $form->select_contacts($selectedCompany, $this->withfromcontactid, 'contactid', 0, '', '', 0, 'minwidth200');
|
||||
// If no socid, set to -1 to avoid full contacts list
|
||||
$selectedCompany = ($this->withfromsocid > 0) ? $this->withfromsocid : -1;
|
||||
$nbofcontacts = $form->select_contacts($selectedCompany, $this->withfromcontactid, 'contactid', 3, '', '', 0, 'minwidth200');
|
||||
$formcompany->selectTypeContact($ticketstatic, '', 'type', 'external', '', 0, 'maginleftonly');
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
|
||||
@ -7666,3 +7666,15 @@ function isVisibleToUserType($type_user, &$menuentry, &$listofmodulesforexternal
|
||||
if (! $menuentry['perms']) return 2; // No permissions and user is external
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Round to next multiple.
|
||||
*
|
||||
* @param double $n Number to round up
|
||||
* @param integer $x Multiple. For example 60 to round up to nearest exact minute for a date with seconds.
|
||||
* @return integer Value rounded.
|
||||
*/
|
||||
function roundUpToNextMultiple($n, $x=5)
|
||||
{
|
||||
return (ceil($n)%$x === 0) ? ceil($n) : round(($n+$x/2)/$x)*$x;
|
||||
}
|
||||
|
||||
@ -1,120 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/project/modules_project.php
|
||||
* \ingroup project
|
||||
* \brief File that contain parent class for projects models
|
||||
* and parent class for projects numbering models
|
||||
*/
|
||||
|
||||
/**
|
||||
* Classe mere des modeles de numerotation des references de projets
|
||||
*/
|
||||
abstract class ModeleNumRefTicket
|
||||
{
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* Return if a module can be used or not
|
||||
*
|
||||
* @return boolean true if module can be used
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi la description par defaut du modele de numerotation
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("ticket");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi un exemple de numerotation
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("ticket");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test si les numeros deja en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numerotation de fonctionner.
|
||||
*
|
||||
* @return boolean false si conflit, true si ok
|
||||
*/
|
||||
public function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi prochaine valeur attribuee
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param Project $project Object project
|
||||
* @return string Valeur
|
||||
*/
|
||||
public function getNextValue($objsoc, $project)
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi version du module numerotation
|
||||
*
|
||||
* @return string Valeur
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($this->version == 'development') {
|
||||
return $langs->trans("VersionDevelopment");
|
||||
}
|
||||
|
||||
if ($this->version == 'experimental') {
|
||||
return $langs->trans("VersionExperimental");
|
||||
}
|
||||
|
||||
if ($this->version == 'dolibarr') {
|
||||
return DOL_VERSION;
|
||||
}
|
||||
|
||||
if ($this->version) {
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ if ($permission) {
|
||||
<?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
|
||||
</div>
|
||||
<div class="tagtd maxwidthonsmartphone noborderbottom">
|
||||
<?php $nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid', 0, '', '', 0, 'minwidth100imp'); ?>
|
||||
<?php $nbofcontacts=$form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 0, 'minwidth100imp'); ?>
|
||||
</div>
|
||||
<div class="tagtd maxwidthonsmartphone noborderbottom">
|
||||
<?php
|
||||
|
||||
@ -947,4 +947,4 @@ AssignedTo=Assigned to
|
||||
Deletedraft=Delete draft
|
||||
ConfirmMassDraftDeletion=Draft mass delete confirmation
|
||||
FileSharedViaALink=File shared via a link
|
||||
|
||||
SelectAThirdPartyFirst=Select a third party first...
|
||||
|
||||
@ -198,7 +198,8 @@ TicketMessageMailSignatureLabelAdmin=Signature of response email
|
||||
TicketMessageMailSignatureHelpAdmin=This text will be inserted after the response message.
|
||||
TicketMessageHelp=Only this text will be saved in the message list on ticket card.
|
||||
TicketMessageSubstitutionReplacedByGenericValues=Substitutions variables are replaced by generic values.
|
||||
TicketTimeToRead=Time elapsed before ticket read
|
||||
TimeElapsedSince=Time elapsed since
|
||||
TicketTimeToRead=Time elapsed before read
|
||||
TicketContacts=Contacts ticket
|
||||
TicketDocumentsLinked=Documents linked to ticket
|
||||
ConfirmReOpenTicket=Confirm reopen this ticket ?
|
||||
|
||||
@ -82,6 +82,8 @@ $permissiontoadd = $user->rights->ticket->write;
|
||||
|
||||
$actionobject = new ActionsTicket($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -364,26 +366,23 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
|
||||
// Creation date
|
||||
print '<tr><td>' . $langs->trans("DateCreation") . '</td><td>';
|
||||
print dol_print_date($object->datec, 'dayhour');
|
||||
print ' - '.$langs->trans("TimeElapsedSince").': '.'<i>'.convertSecondToTime(roundUpToNextMultiple($now - $object->datec, 60)).'</i>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Read date
|
||||
print '<tr><td>' . $langs->trans("TicketReadOn") . '</td><td>';
|
||||
if (!empty($object->date_read)) {
|
||||
print '<tr><td>' . $langs->trans("TicketReadOn") . '</td><td>';
|
||||
print dol_print_date($object->date_read, 'dayhour');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>' . $langs->trans("TicketTimeToRead") . '</td><td>';
|
||||
print '<strong>' . convertSecondToTime($object->date_read - $object->datec) . '</strong>';
|
||||
print '</td></tr>';
|
||||
print dol_print_date($object->date_read, 'dayhour');
|
||||
print ' - '.$langs->trans("TicketTimeToRead").': <i>'.convertSecondToTime(roundUpToNextMultiple($object->date_read - $object->datec, 60)).'</i>';
|
||||
print ' - '.$langs->trans("TimeElapsedSince").': '.'<i>'.convertSecondToTime(roundUpToNextMultiple($now - $object->date_read, 60)).'</i>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Close date
|
||||
print '<tr><td>' . $langs->trans("TicketCloseOn") . '</td><td>';
|
||||
if (!empty($object->date_close)) {
|
||||
print '<tr><td>' . $langs->trans("TicketCloseOn") . '</td><td>';
|
||||
print dol_print_date($object->date_close, 'dayhour');
|
||||
print '</td></tr>';
|
||||
print dol_print_date($object->date_close, 'dayhour');
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Thirdparty
|
||||
@ -453,25 +452,28 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Timing (Duration sum of linked fichinter
|
||||
$object->fetchObjectLinked();
|
||||
$num = count($object->linkedObjects);
|
||||
$timing = 0;
|
||||
if ($num) {
|
||||
foreach ($object->linkedObjects as $objecttype => $objects) {
|
||||
if ($objecttype = "fichinter") {
|
||||
foreach ($objects as $fichinter) {
|
||||
$timing += $fichinter->duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<tr><td valign="top">';
|
||||
// Timing (Duration sum of linked fichinter)
|
||||
if ($conf->fichinter->enabled)
|
||||
{
|
||||
$object->fetchObjectLinked();
|
||||
$num = count($object->linkedObjects);
|
||||
$timing = 0;
|
||||
if ($num) {
|
||||
foreach ($object->linkedObjects as $objecttype => $objects) {
|
||||
if ($objecttype = "fichinter") {
|
||||
foreach ($objects as $fichinter) {
|
||||
$timing += $fichinter->duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<tr><td valign="top">';
|
||||
|
||||
print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1);
|
||||
print '</td><td>';
|
||||
print convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
|
||||
print '</td></tr>';
|
||||
print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1);
|
||||
print '</td><td>';
|
||||
print convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user