Merge branch 'develop' into MissingHook

This commit is contained in:
Laurent Destailleur 2019-06-20 03:04:32 +02:00 committed by GitHub
commit 4308f48cad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 116 additions and 71 deletions

View File

@ -2462,7 +2462,7 @@ class Adherent extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
/**
* Initialise tableau info (tableau des attributs LDAP)
*
* @return array Tableau info des attributs

View File

@ -190,7 +190,7 @@ $head = ticketAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket");
print '<span class="opacitymedium">'.$langs->trans("TicketSetupDictionaries") . '</span> : <a href="' . dol_buildpath('/admin/dict.php', 1) . '" >' . dol_buildpath('/admin/dict.php', 2) . '</a><br>';
print '<span class="opacitymedium">'.$langs->trans("TicketSetupDictionaries") . '</span> : <a href="'.DOL_URL_ROOT.'/admin/dict.php">'.$langs->trans("ClickHereToGoTo", $langs->transnoentitiesnoconv("DictionarySetup")).'</a><br>';
dol_fiche_end();

View File

@ -3444,6 +3444,7 @@ elseif ($id > 0 || ! empty($ref))
elseif($object->type == Facture::TYPE_CREDIT_NOTE) $type_fac = 'CreditNote';
elseif($object->type == Facture::TYPE_DEPOSIT) $type_fac = 'Deposit';
$text = $langs->trans('ConfirmConvertToReduc', strtolower($langs->transnoentities($type_fac)));
$text.='<br>'.$langs->trans('ConfirmConvertToReduc2');
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('ConvertToReduc'), $text, 'confirm_converttoreduc', '', "yes", 2);
}
@ -4746,7 +4747,7 @@ elseif ($id > 0 || ! empty($ref))
}
// For credit note
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercancreate && $object->getSommePaiement() == 0) {
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&amp;action=converttoreduc">' . $langs->trans('ConvertToReduc') . '</a></div>';
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&amp;action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">' . $langs->trans('ConvertToReduc') . '</a></div>';
}
// For deposit invoice
if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > 0 && empty($discount->id))

View File

@ -1075,7 +1075,7 @@ if ($resql)
// Town
if (! empty($arrayfields['s.town']['checked']))
{
print '<td class="nocellnopadd">';
print '<td>';
print $obj->town;
print '</td>';
if (! $i) $totalarray['nbfield']++;
@ -1083,7 +1083,7 @@ if ($resql)
// Zip
if (! empty($arrayfields['s.zip']['checked']))
{
print '<td class="nocellnopadd">';
print '<td>';
print $obj->zip;
print '</td>';
if (! $i) $totalarray['nbfield']++;

View File

@ -229,7 +229,7 @@ class DolGraph
/**
* Set width
*
* @param int $w Width
* @param int|string $w Width (Example: 320 or '100%')
* @return boolean|null True
*/
public function SetWidth($w)

View File

@ -972,7 +972,10 @@ class ExtraFields
$out='';
$keyprefix = $keyprefix.'options_'; // Because we work on extrafields
if (! preg_match('/options_$/', $keyprefix)) // Because we work on extrafields, we add 'options_' to prefix if not already added
{
$keyprefix = $keyprefix.'options_';
}
if (! empty($extrafieldsobjectkey))
{

View File

@ -172,14 +172,21 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
* For example: https://www.abc.mydomain.com/dir/page.html return 'mydomain'
*
* @param string $url Full URL.
* @param int $mode 0=return 'mydomain', 1=return 'mydomain.com'
* @param int $mode 0=return 'mydomain', 1=return 'mydomain.com', 2=return 'abc.mydomain.com'
* @return string Returns domaine name
*/
function getDomainFromURL($url, $mode = 0)
{
$tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s)://
$tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain
$tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)$/', '\1.\2', $tmpdomain); // Remove part www.abc before domain name
if ($mode == 2)
{
$tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)\.([^\.]+)$/', '\1.\2.\3', $tmpdomain); // Remove part 'www.' before 'abc.mydomain.com'
}
else
{
$tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)$/', '\1.\2', $tmpdomain); // Remove part 'www.abc.' before 'mydomain.com'
}
if (empty($mode))
{
$tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...)

View File

@ -99,6 +99,7 @@ class modTicket extends DolibarrModules
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->phpmin = array(5,4); // Minimum version of PHP required by module
$this->langfiles = array("ticket");
// Constants
// List of particular constants to add when module is enabled
// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)

View File

@ -2221,6 +2221,7 @@ else
elseif($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $type_fac = 'CreditNote';
elseif($object->type == FactureFournisseur::TYPE_DEPOSIT) $type_fac = 'Deposit';
$text = $langs->trans('ConfirmConvertToReducSupplier', strtolower($langs->transnoentities($type_fac)));
$text .= '<br>'.$langs->trans('ConfirmConvertToReducSupplier2');
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('ConvertToReduc'), $text, 'confirm_converttoreduc', '', "yes", 2);
}
@ -3107,7 +3108,7 @@ else
}
// For credit note
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() == 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&amp;action=converttoreduc">' . $langs->trans('ConvertToReduc') . '</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&amp;action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReducSupplier2")).'">' . $langs->trans('ConvertToReduc') . '</a></div>';
}
// For deposit invoice
if ($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->paye == 1 && $resteapayer == 0 && $user->rights->fournisseur->facture->creer && empty($discount->id))

View File

@ -291,7 +291,7 @@ Modelcsv_cogilog=Export for Cogilog
Modelcsv_agiris=Export for Agiris
Modelcsv_openconcerto=Export for OpenConcerto (Test)
Modelcsv_configurable=Export CSV Configurable
Modelcsv_FEC=Export FEC (Art. L47 A)
Modelcsv_FEC=Export FEC
Modelcsv_Sage50_Swiss=Export for Sage 50 Switzerland
ChartofaccountsId=Chart of accounts Id
@ -336,7 +336,7 @@ UseMenuToSetBindindManualy=Lines not yet bound, use menu <a href="%s">%s</a> to
## Import
ImportAccountingEntries=Accounting entries
DateExport=Date export
WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manually in the Ledger. If your journalization is up to date, the bookkeeping view is more accurate.
ExpenseReportJournal=Expense Report Journal
InventoryJournal=Inventory Journal

View File

@ -66,8 +66,10 @@ paymentInInvoiceCurrency=in invoices currency
PaidBack=Paid back
DeletePayment=Delete payment
ConfirmDeletePayment=Are you sure you want to delete this payment?
ConfirmConvertToReduc=Do you want to convert this %s into an absolute discount?<br>The amount will be saved among all discounts and could be used as a discount for a current or a future invoice for this customer.
ConfirmConvertToReducSupplier=Do you want to convert this %s into an absolute discount?<br>The amount will be saved among all discounts and could be used as a discount for a current or a future invoice for this vendor.
ConfirmConvertToReduc=Do you want to convert this %s into an absolute discount?
ConfirmConvertToReduc2=The amount will be saved among all discounts and could be used as a discount for a current or a future invoice for this customer.
ConfirmConvertToReducSupplier=Do you want to convert this %s into an absolute discount?
ConfirmConvertToReducSupplier2=The amount will be saved among all discounts and could be used as a discount for a current or a future invoice for this vendor.
SupplierPayments=Vendor payments
ReceivedPayments=Received payments
ReceivedCustomersPayments=Payments received from customers

View File

@ -133,6 +133,7 @@ TicketsIndex=Ticket - home
TicketList=List of tickets
TicketAssignedToMeInfos=This page display ticket list created by or assigned to current user
NoTicketsFound=No ticket found
NoUnreadTicketsFound=No unread ticket found
TicketViewAllTickets=View all tickets
TicketViewNonClosedOnly=View only open tickets
TicketStatByStatus=Tickets by status

View File

@ -56,6 +56,7 @@ $search_barcode=GETPOST("search_barcode", 'alpha');
$search_label=GETPOST("search_label", 'alpha');
$search_type = GETPOST("search_type", 'int');
$search_sale = GETPOST("search_sale", 'int');
$search_vatrate=GETPOST("search_vatrate", 'alpha');
$search_categ = GETPOST("search_categ", 'int');
$search_tosell = GETPOST("search_tosell", 'int');
$search_tobuy = GETPOST("search_tobuy", 'int');
@ -174,7 +175,8 @@ $arrayfields=array(
'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)),
'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))),
'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))),
'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))),
'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))),
'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))),
'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')),
@ -229,6 +231,7 @@ if (empty($reshook))
$search_categ=0;
$search_tosell="";
$search_tobuy="";
$search_vatrate="";
$search_tobatch='';
//$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type.
@ -276,7 +279,7 @@ else
$texte = $langs->trans("ProductsAndServices");
}
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
$sql.= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,';
$sql.= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,';
@ -323,6 +326,7 @@ if ($search_label) $sql .= natural_search('p.label', $search_label);
if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode);
if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($search_tosell);
if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($search_tobuy);
if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate);
if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";
if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL";
@ -341,7 +345,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,";
$sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
$sql.= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,';
$sql.= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units';
@ -421,6 +425,7 @@ if ($resql)
if ($search_label) $param.="&search_label=".urlencode($search_label);
if ($search_tosell != '') $param.="&search_tosell=".urlencode($search_tosell);
if ($search_tobuy != '') $param.="&search_tobuy=".urlencode($search_tobuy);
if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate);
if ($fourn_id > 0) $param.=($fourn_id?"&fourn_id=".$fourn_id:"");
if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):"");
if ($show_childproducts) $param.=($show_childproducts?"&search_show_childproducts=".urlencode($show_childproducts):"");
@ -613,6 +618,13 @@ if ($resql)
print '&nbsp;';
print '</td>';
}
// Sell price
if (! empty($arrayfields['p.tva_tx']['checked']))
{
print '<td class="liste_titre right">';
print '<input class="right flat maxwidth50" placeholder="%" type="text" name="search_vatrate" size="1" value="'.dol_escape_htmltag($search_vatrate).'">';
print '</td>';
}
// WAP
if (! empty($arrayfields['p.pmp']['checked']))
{
@ -715,6 +727,9 @@ if ($resql)
if (! empty($arrayfields['p.numbuyprice']['checked'])) {
print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (! empty($arrayfields['p.tva_tx']['checked'])) {
print_liste_field_titre($arrayfields['p.tva_tx']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
}
if (! empty($arrayfields['p.pmp']['checked'])) {
print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
}
@ -983,6 +998,15 @@ if ($resql)
print '</td>';
}
// Sell Tax Rate
if (! empty($arrayfields['p.tva_tx']['checked']))
{
print '<td class="right">';
print vatrate($obj->tva_tx,true);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// WAP
if (! empty($arrayfields['p.pmp']['checked']))
{

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) - 2013-2016 Jean-François FERRY <hello@librethic.io>
/* Copyright (C) - 2013-2016 Jean-François FERRY <hello@librethic.io>
* Copyright (C) - 2019 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -18,7 +19,7 @@
/**
* \file htdocs/public/ticket/index.php
* \ingroup ticket
* \brief Public file to add and manage ticket
* \brief Public page to add and manage ticket
*/
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
@ -56,21 +57,24 @@ $formticket = new FormTicket($db);
$arrayofjs = array();
$arrayofcss = array('/ticket/css/styles.css.php');
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
print $langs->trans('TicketPublicInterfaceForbidden');
exit;
}
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) {
print '<div class="error">' . $langs->trans('TicketPublicInterfaceForbidden') . '</div>';
} else {
print '<div style="margin: 0 auto; width:60%">';
print '<p style="text-align: center">' . ($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")) . '</p>';
print '<div class="ticketform">';
print '<a href="create_ticket.php" class=""><div class="index_create orange bigrounded">' . dol_escape_htmltag($langs->trans("CreateTicket")) . '</div></a>';
print '<a href="list.php" class=""><div class="index_display blue bigrounded">' . dol_escape_htmltag($langs->trans("ShowListTicketWithTrackId")) . '</div></a>';
print '<a href="view.php" class=""><div class="index_display blue bigrounded">' . dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")) . '</div></a>';
print '<div style="clear:both;"></div>';
print '</div>';
print '</div>';
}
print '<div style="margin: 0 auto; width:60%">';
print '<p style="text-align: center">' . ($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")) . '</p>';
print '<div class="ticketform">';
print '<a href="create_ticket.php" class=""><div class="index_create orange bigrounded">' . dol_escape_htmltag($langs->trans("CreateTicket")) . '</div></a>';
print '<a href="list.php" class=""><div class="index_display blue bigrounded">' . dol_escape_htmltag($langs->trans("ShowListTicketWithTrackId")) . '</div></a>';
print '<a href="view.php" class=""><div class="index_display blue bigrounded">' . dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")) . '</div></a>';
print '<div style="clear:both;"></div>';
print '</div>';
print '</div>';
// End of page
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object);

View File

@ -536,7 +536,7 @@ class Stripe extends CommonObject
//$a = \Stripe\Stripe::getApiKey();
//var_dump($a);var_dump($stripeacc);exit;
dol_syslog("Try to create card dataforcard = ".dol_json_encode($dataforcard));
dol_syslog("Try to create card dataforcard = ".json_encode($dataforcard));
try {
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
$card = $cu->sources->create($dataforcard);

View File

@ -2374,7 +2374,7 @@ class Ticket extends CommonObject
if (file_exists($dir_osencoded)) {
$handle = opendir($dir_osencoded);
if (is_resource($handle)) {
while (($file = readdir($handle)) != false) {
while (($file = readdir($handle)) !== false) {
if (!utf8_check($file)) {
$file = utf8_encode($file);
}

View File

@ -25,6 +25,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/ticket/class/actions_ticket.class.php';
require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticketstats.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
$hookmanager = new HookManager($db);
@ -108,8 +109,8 @@ if (empty($endyear)) {
}
$startyear = $endyear - 1;
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
$HEIGHT = '192';
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '100%' : '80%';
$HEIGHT = '228';
print '<div class="fichecenter"><div class="fichethirdleft">';
@ -126,16 +127,14 @@ $tick = array(
'closed' => 0,
'deleted' => 0,
);
$total = 0;
$sql = "SELECT t.fk_statut, COUNT(t.fk_statut) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')';
$sql .= " AND t.fk_statut IS NOT NULL";
$sql .= " AND date_format(datec,'%Y') = '" . $endyear . "'";
$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')';
$sql .= dolSqlDateFilter('datec', 0, 0, $endyear);
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
}
@ -155,44 +154,41 @@ $result = $db->query($sql);
if ($result) {
while ($objp = $db->fetch_object($result)) {
$found = 0;
if ($objp->fk_statut == 0) {
if ($objp->fk_statut == Ticket::STATUS_NOT_READ) {
$tick['unread'] = $objp->nb;
}
if ($objp->fk_statut == 1) {
if ($objp->fk_statut == Ticket::STATUS_READ) {
$tick['read'] = $objp->nb;
}
if ($objp->fk_statut == 3) {
$tick['answered'] = $objp->nb;
if ($objp->fk_statut == Ticket::STATUS_NEED_MORE_INFO) {
$tick['needmoreinfo'] = $objp->nb;
}
if ($objp->fk_statut == 4) {
if ($objp->fk_statut == Ticket::STATUS_ASSIGNED) {
$tick['assigned'] = $objp->nb;
}
if ($objp->fk_statut == 5) {
if ($objp->fk_statut == Ticket::STATUS_IN_PROGRESS) {
$tick['inprogress'] = $objp->nb;
}
if ($objp->fk_statut == 6) {
if ($objp->fk_statut == Ticket::STATUS_WAITING) {
$tick['waiting'] = $objp->nb;
}
if ($objp->fk_statut == 8) {
if ($objp->fk_statut == Ticket::STATUS_CLOSED) {
$tick['closed'] = $objp->nb;
}
if ($objp->fk_statut == 9) {
$tick['deleted'] = $objp->nb;
if ($objp->fk_statut == Ticket::STATUS_CANCELED) {
$tick['canceled'] = $objp->nb;
}
}
if ((round($tick['unread']) ? 1 : 0) +(round($tick['read']) ? 1 : 0) +(round($tick['answered']) ? 1 : 0) +(round($tick['assigned']) ? 1 : 0) +(round($tick['inprogress']) ? 1 : 0) +(round($tick['waiting']) ? 1 : 0) +(round($tick['closed']) ? 1 : 0) +(round($tick['deleted']) ? 1 : 0) >= 2
) {
$dataseries = array();
$dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread']));
$dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read']));
$dataseries[] = array('label' => $langs->trans("Answered"), 'data' => round($tick['answered']));
$dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned']));
$dataseries[] = array('label' => $langs->trans("InProgress"), 'data' => round($tick['inprogress']));
$dataseries[] = array('label' => $langs->trans("Waiting"), 'data' => round($tick['waiting']));
$dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed']));
$dataseries[] = array('label' => $langs->trans("Deleted"), 'data' => round($tick['deleted']));
}
$dataseries = array();
$dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread']));
$dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read']));
$dataseries[] = array('label' => $langs->trans("NeedMoreInformation"), 'data' => round($tick['needmoreinfo']));
$dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned']));
$dataseries[] = array('label' => $langs->trans("InProgress"), 'data' => round($tick['inprogress']));
$dataseries[] = array('label' => $langs->trans("Waiting"), 'data' => round($tick['waiting']));
$dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed']));
$dataseries[] = array('label' => $langs->trans("Canceled"), 'data' => round($tick['canceled']));
} else {
dol_print_error($db);
}
@ -216,11 +212,17 @@ $stringtoshow .= '</div>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th >' . $langs->trans("Statistics") . ' ' . img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_by_status" class="linkobject"') . '</th></tr>';
print '<tr><td>';
print '<tr><td class="center">';
print $stringtoshow;
// don't display graph if no series
if (! empty($dataseries) && count($dataseries) > 1) {
$data = array();
$totalnb=0;
foreach ($dataseries as $key => $value) {
$totalnb += $value['data'];
}
$data = array();
foreach ($dataseries as $key => $value) {
$data[] = array($value['label'], $value['data']);
}
@ -250,10 +252,9 @@ if (! empty($dataseries) && count($dataseries) > 1) {
//$px1->SetTitle($langs->trans("TicketStatByStatus"));
$px1->draw($filenamenb, $fileurlnb);
print $px1->show();
print $px1->show($totalnb?0:1);
}
}
print $stringtoshow;
print '</td></tr>';
print '</table>';
@ -309,7 +310,7 @@ if ($result) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="5">' . $transRecordedType . '</th>';
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/ticket/list.php">'.$langs->trans("FullList").'</th>';
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/ticket/list.php?search_fk_statut[]='.Ticket::STATUS_NOT_READ.'">'.$langs->trans("FullList").'</th>';
print '</tr>';
if ($num > 0) {
@ -365,7 +366,7 @@ if ($result) {
$db->free();
} else {
print '<tr><td colspan="6" class="opacitymedium">' . $langs->trans('NoTicketsFound') . '</td></tr>';
print '<tr><td colspan="6" class="opacitymedium">' . $langs->trans('NoUnreadTicketsFound') . '</td></tr>';
}
print "</table>";

View File

@ -520,8 +520,8 @@ class User extends CommonObject
* Add a right to the user
*
* @param int $rid Id of permission to add or 0 to add several permissions
* @param string $allmodule Add all permissions of module $allmodule
* @param string $allperms Add all permissions of module $allmodule, subperms $allperms only
* @param string $allmodule Add all permissions of module $allmodule or 'allmodules' to include all modules.
* @param string $allperms Add all permissions of module $allmodule, subperms $allperms only or '' to include all permissions.
* @param int $entity Entity to use
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int > 0 if OK, < 0 if KO