Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2019-12-17 03:10:02 +01:00
commit c37deeeb78
14 changed files with 660 additions and 659 deletions

View File

@ -26,15 +26,15 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta","bills","other","accountancy","trips","productbatch")); $langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch"));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -47,12 +47,12 @@ $search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'alpha'); $search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha');
$search_day=GETPOST("search_day", "int"); $search_day = GETPOST("search_day", "int");
$search_month=GETPOST("search_month", "int"); $search_month = GETPOST("search_month", "int");
$search_year=GETPOST("search_year", "int"); $search_year = GETPOST("search_year", "int");
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha'); $sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int'); $page = GETPOST('page', 'int');
@ -60,9 +60,9 @@ if (empty($page) || $page < 0) $page = 0;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
$offset = $limit * $page; $offset = $limit * $page;
if (! $sortfield) if (!$sortfield)
$sortfield = "erd.date, erd.rowid"; $sortfield = "erd.date, erd.rowid";
if (! $sortorder) { if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
} }
@ -71,7 +71,7 @@ if (! $sortorder) {
// Security check // Security check
if ($user->socid > 0) if ($user->socid > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->bind->write) if (!$user->rights->accounting->bind->write)
accessforbidden(); accessforbidden();
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
@ -98,27 +98,27 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
if (is_array($changeaccount) && count($changeaccount) > 0) { if (is_array($changeaccount) && count($changeaccount) > 0) {
$error = 0; $error = 0;
if (! (GETPOST('account_parent', 'int') >= 0)) if (!(GETPOST('account_parent', 'int') >= 0))
{ {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
} }
if (! $error) if (!$error)
{ {
$db->begin(); $db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql1 .= " SET erd.fk_code_ventilation=" . (GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); $sql1 .= " SET erd.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
$sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')'; $sql1 .= ' WHERE erd.rowid IN ('.implode(',', $changeaccount).')';
dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1); dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= '.$sql1);
$resql1 = $db->query($sql1); $resql1 = $db->query($sql1);
if (! $resql1) { if (!$resql1) {
$error ++; $error++;
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} }
if (! $error) { if (!$error) {
$db->commit(); $db->commit();
setEventMessages($langs->trans('Save'), null, 'mesgs'); setEventMessages($langs->trans('Save'), null, 'mesgs');
} else { } else {
@ -138,7 +138,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
llxHeader('', $langs->trans("ExpenseReportsVentilation") . ' - ' . $langs->trans("Dispatched")); llxHeader('', $langs->trans("ExpenseReportsVentilation").' - '.$langs->trans("Dispatched"));
print '<script type="text/javascript"> print '<script type="text/javascript">
$(function () { $(function () {
@ -164,10 +164,10 @@ $sql = "SELECT er.ref, er.rowid as erid,";
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,"; $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,";
$sql .= " aa.label, aa.account_number,"; $sql .= " aa.label, aa.account_number,";
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label"; $sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " , ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " , " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " , ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
$sql .= " WHERE er.rowid = erd.fk_expensereport and er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <> 0 "; $sql .= " WHERE er.rowid = erd.fk_expensereport and er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <> 0 ";
$sql .= " AND aa.rowid = erd.fk_code_ventilation"; $sql .= " AND aa.rowid = erd.fk_code_ventilation";
if (strlen(trim($search_expensereport))) { if (strlen(trim($search_expensereport))) {
@ -188,8 +188,8 @@ if (strlen(trim($search_account))) {
if (strlen(trim($search_vat))) { if (strlen(trim($search_vat))) {
$sql .= natural_search("erd.tva_tx", price2num($search_vat), 1); $sql .= natural_search("erd.tva_tx", price2num($search_vat), 1);
} }
$sql.=dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year); $sql .= dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year);
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
@ -215,19 +215,19 @@ if ($result) {
$num_lines = $db->num_rows($result); $num_lines = $db->num_rows($result);
$i = 0; $i = 0;
$param=''; $param = '';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_expensereport) $param .= "&search_expensereport=" . urlencode($search_expensereport); if ($search_expensereport) $param .= "&search_expensereport=".urlencode($search_expensereport);
if ($search_label) $param .= "&search_label=" . urlencode($search_label); if ($search_label) $param .= "&search_label=".urlencode($search_label);
if ($search_desc) $param .= "&search_desc=" . urlencode($search_desc); if ($search_desc) $param .= "&search_desc=".urlencode($search_desc);
if ($search_account) $param .= "&search_account=" . urlencode($search_account); if ($search_account) $param .= "&search_account=".urlencode($search_account);
if ($search_vat) $param .= "&search_vat=" . urlencode($search_vat); if ($search_vat) $param .= "&search_vat=".urlencode($search_vat);
if ($search_day) $param .= '&search_day='.urlencode($search_day); if ($search_day) $param .= '&search_day='.urlencode($search_day);
if ($search_month) $param .= '&search_month='.urlencode($search_month); if ($search_month) $param .= '&search_month='.urlencode($search_month);
if ($search_year) $param .= '&search_year='.urlencode($search_year); if ($search_year) $param .= '&search_year='.urlencode($search_year);
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n"; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
print '<input type="hidden" name="action" value="ventil">'; print '<input type="hidden" name="action" value="ventil">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -238,33 +238,33 @@ if ($result) {
print_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); print_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneExpenseReport") . '</span><br>'; print '<span class="opacitymedium">'.$langs->trans("DescVentilDoneExpenseReport").'</span><br>';
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>'; print '<br><div class="inline-block divButAction">'.$langs->trans("ChangeAccount").'<br>';
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '" /></div>'; print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("ChangeBinding").'" /></div>';
$moreforfilter = ''; $moreforfilter = '';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>'; print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">'; if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">';
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">'; print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">';
$formother->select_year($search_year, 'search_year', 1, 20, 5); $formother->select_year($search_year, 'search_year', 1, 20, 5);
print '</td>'; print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>'; print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>'; print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre right"></td>'; print '<td class="liste_titre right"></td>';
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
$searchpicto=$form->showFilterButtons(); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -279,29 +279,29 @@ if ($result) {
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre(''); print_liste_field_titre('');
$checkpicto=$form->showCheckAddButtons(); $checkpicto = $form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$expensereport_static = new ExpenseReport($db); $expensereport_static = new ExpenseReport($db);
while ( $i < min($num_lines, $limit) ) { while ($i < min($num_lines, $limit)) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label; $codeCompta = length_accountg($objp->account_number).' - '.$objp->label;
$expensereport_static->ref = $objp->ref; $expensereport_static->ref = $objp->ref;
$expensereport_static->id = $objp->erid; $expensereport_static->id = $objp->erid;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>' . $objp->rowid . '</td>'; print '<td>'.$objp->rowid.'</td>';
// Ref Invoice // Ref Invoice
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>'; print '<td>'.$expensereport_static->getNomUrl(1).'</td>';
print '<td class="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>'; print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>';
print '<td class="tdoverflow">' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '</td>'; print '<td class="tdoverflow">'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).'</td>';
print '<td>'; print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
@ -309,20 +309,20 @@ if ($result) {
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
print '</td>'; print '</td>';
print '<td class="nowrap right">' . price($objp->total_ht) . '</td>'; print '<td class="nowrap right">'.price($objp->total_ht).'</td>';
print '<td class="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>'; print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
print '<td>' . $codeCompta . '</td>'; print '<td>'.$codeCompta.'</td>';
print '<td class="left"><a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')). '">'; print '<td class="left"><a href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>'; print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>';
print "</tr>"; print "</tr>";
$i ++; $i++;
} }
print "</table>"; print "</table>";

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr> /* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014-2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2014-2019 Frederic France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -431,7 +431,7 @@ class box_activity extends ModeleBoxes
$line++; $line++;
$j++; $j++;
} }
if ($num==0) { if (count($data)==0) {
$this->info_box_contents[$line][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'class="center"', 'td' => 'class="center"',
'text'=>$langs->trans("NoRecordedInvoices"), 'text'=>$langs->trans("NoRecordedInvoices"),

View File

@ -24,7 +24,7 @@
* \ingroup Accountancy (Double entries) * \ingroup Accountancy (Double entries)
* \brief File of class with all html predefined components * \brief File of class with all html predefined components
*/ */
require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
/** /**
@ -43,7 +43,7 @@ class FormAccounting extends Form
/** /**
* @var string Error code (or message) * @var string Error code (or message)
*/ */
public $error=''; public $error = '';
/** /**
* Constructor * Constructor
@ -73,26 +73,26 @@ class FormAccounting extends Form
public function select_journal($selectid, $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = 'maxwidth300 maxwidthonsmartphone', $usecache = '', $disabledajaxcombo = 0) public function select_journal($selectid, $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = 'maxwidth300 maxwidthonsmartphone', $usecache = '', $disabledajaxcombo = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf, $langs;
$out = ''; $out = '';
$options = array(); $options = array();
if ($usecache && ! empty($this->options_cache[$usecache])) if ($usecache && !empty($this->options_cache[$usecache]))
{ {
$options = $this->options_cache[$usecache]; $options = $this->options_cache[$usecache];
$selected=$selectid; $selected = $selectid;
} }
else else
{ {
$sql = "SELECT rowid, code, label, nature, entity, active"; $sql = "SELECT rowid, code, label, nature, entity, active";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_journal"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_journal";
$sql.= " WHERE active = 1"; $sql .= " WHERE active = 1";
$sql.= " AND entity = ".$conf->entity; $sql .= " AND entity = ".$conf->entity;
if ($nature && is_numeric($nature)) $sql .= " AND nature = ".$nature; if ($nature && is_numeric($nature)) $sql .= " AND nature = ".$nature;
$sql.= " ORDER BY code"; $sql .= " ORDER BY code";
dol_syslog(get_class($this) . "::select_journal", LOG_DEBUG); dol_syslog(get_class($this)."::select_journal", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
@ -105,7 +105,7 @@ class FormAccounting extends Form
$langs->load('accountancy'); $langs->load('accountancy');
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$label = $obj->code . ' - ' . $langs->trans($obj->label); $label = $obj->code.' - '.$langs->trans($obj->label);
$select_value_in = $obj->rowid; $select_value_in = $obj->rowid;
$select_value_out = $obj->rowid; $select_value_out = $obj->rowid;
@ -133,7 +133,7 @@ class FormAccounting extends Form
} }
} }
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, ($disabledajaxcombo?0:1)); $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, ($disabledajaxcombo ? 0 : 1));
return $out; return $out;
} }
@ -154,7 +154,7 @@ class FormAccounting extends Form
public function select_accounting_category($selected = '', $htmlname = 'account_category', $useempty = 0, $maxlen = 0, $help = 1, $allcountries = 0) public function select_accounting_category($selected = '', $htmlname = 'account_category', $useempty = 0, $maxlen = 0, $help = 1, $allcountries = 0)
{ {
// phpcs:enable // phpcs:enable
global $db,$langs,$user,$mysoc; global $db, $langs, $user, $mysoc;
if (empty($mysoc->country_id) && empty($mysoc->country_code) && empty($allcountries)) if (empty($mysoc->country_id) && empty($mysoc->country_code) && empty($allcountries))
{ {
@ -162,28 +162,28 @@ class FormAccounting extends Form
exit; exit;
} }
if (! empty($mysoc->country_id)) if (!empty($mysoc->country_id))
{ {
$sql = "SELECT c.rowid, c.label as type, c.range_account"; $sql = "SELECT c.rowid, c.label as type, c.range_account";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql.= " WHERE c.active = 1"; $sql .= " WHERE c.active = 1";
$sql.= " AND c.category_type = 0"; $sql .= " AND c.category_type = 0";
if (empty($allcountries)) $sql.= " AND c.fk_country = ".$mysoc->country_id; if (empty($allcountries)) $sql .= " AND c.fk_country = ".$mysoc->country_id;
$sql.= " ORDER BY c.label ASC"; $sql .= " ORDER BY c.label ASC";
} }
else else
{ {
$sql = "SELECT c.rowid, c.label as type, c.range_account"; $sql = "SELECT c.rowid, c.label as type, c.range_account";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co"; $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
$sql.= " WHERE c.active = 1"; $sql .= " WHERE c.active = 1";
$sql.= " AND c.category_type = 0"; $sql .= " AND c.category_type = 0";
$sql.= " AND c.fk_country = co.rowid"; $sql .= " AND c.fk_country = co.rowid";
if (empty($allcountries)) $sql.= " AND co.code = '".$mysoc->country_code."'"; if (empty($allcountries)) $sql .= " AND co.code = '".$mysoc->country_code."'";
$sql.= " ORDER BY c.label ASC"; $sql .= " ORDER BY c.label ASC";
} }
dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG); dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
$resql=$db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
@ -192,7 +192,7 @@ class FormAccounting extends Form
$out = '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.'">'; $out = '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.'">';
$i = 0; $i = 0;
if ($useempty) $out.= '<option value="0">&nbsp;</option>'; if ($useempty) $out .= '<option value="0">&nbsp;</option>';
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -233,17 +233,17 @@ class FormAccounting extends Form
// phpcs:enable // phpcs:enable
$options = array(); $options = array();
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; $sql = 'SELECT DISTINCT import_key from '.MAIN_DB_PREFIX.'accounting_bookkeeping';
$sql .= " WHERE entity IN (".getEntity('accountancy').")"; $sql .= " WHERE entity IN (".getEntity('accountancy').")";
$sql .= ' ORDER BY import_key DESC'; $sql .= ' ORDER BY import_key DESC';
dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG); dol_syslog(get_class($this)."::select_bookkeeping_importkey", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this) . "::select_bookkeeping_importkey " . $this->error, LOG_ERR); dol_syslog(get_class($this)."::select_bookkeeping_importkey ".$this->error, LOG_ERR);
return - 1; return -1;
} }
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
@ -272,7 +272,7 @@ class FormAccounting extends Form
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$out = ''; $out = '';
@ -283,36 +283,36 @@ class FormAccounting extends Form
$options['0'] = '--- '.$langs->trans("None").' ---'; $options['0'] = '--- '.$langs->trans("None").' ---';
} }
if ($usecache && ! empty($this->options_cache[$usecache])) if ($usecache && !empty($this->options_cache[$usecache]))
{ {
$options = $options + $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0 $options = $options + $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0
$selected=$selectid; $selected = $selectid;
} }
else else
{ {
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT) ? 50 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT) ? 50 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT;
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version"; $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity=".$conf->entity; $sql .= " AND aa.entity=".$conf->entity;
$sql .= " ORDER BY aa.account_number"; $sql .= " ORDER BY aa.account_number";
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG); dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR); dol_syslog(get_class($this)."::select_account ".$this->error, LOG_ERR);
return -1; return -1;
} }
$selected = 0; $selected = 0;
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$label = length_accountg($obj->account_number) . ' - ' . $obj->label; $label = length_accountg($obj->account_number).' - '.$obj->label;
$label = dol_trunc($label, $trunclength); $label = dol_trunc($label, $trunclength);
$select_value_in = $obj->rowid; $select_value_in = $obj->rowid;
@ -367,7 +367,7 @@ class FormAccounting extends Form
// Auxiliary customer account // Auxiliary customer account
$sql = "SELECT DISTINCT code_compta, nom "; $sql = "SELECT DISTINCT code_compta, nom ";
$sql .= " FROM ".MAIN_DB_PREFIX."societe"; $sql .= " FROM ".MAIN_DB_PREFIX."societe";
$sql .= " WHERE entity IN (" . getEntity('societe') . ")"; $sql .= " WHERE entity IN (".getEntity('societe').")";
$sql .= " ORDER BY code_compta"; $sql .= " ORDER BY code_compta";
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
@ -388,7 +388,7 @@ class FormAccounting extends Form
// Auxiliary supplier account // Auxiliary supplier account
$sql = "SELECT DISTINCT code_compta_fournisseur, nom "; $sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
$sql .= " FROM ".MAIN_DB_PREFIX."societe"; $sql .= " FROM ".MAIN_DB_PREFIX."societe";
$sql .= " WHERE entity IN (" . getEntity('societe') . ")"; $sql .= " WHERE entity IN (".getEntity('societe').")";
$sql .= " ORDER BY code_compta_fournisseur"; $sql .= " ORDER BY code_compta_fournisseur";
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -408,7 +408,7 @@ class FormAccounting extends Form
// Auxiliary user account // Auxiliary user account
$sql = "SELECT DISTINCT accountancy_code, lastname, firstname "; $sql = "SELECT DISTINCT accountancy_code, lastname, firstname ";
$sql .= " FROM ".MAIN_DB_PREFIX."user"; $sql .= " FROM ".MAIN_DB_PREFIX."user";
$sql .= " WHERE entity IN (" . getEntity('user') . ")"; $sql .= " WHERE entity IN (".getEntity('user').")";
$sql .= " ORDER BY accountancy_code"; $sql .= " ORDER BY accountancy_code";
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseom.com> /* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseom.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -384,7 +384,7 @@ class ActionsDatapolicy
* @param Object $object Object * @param Object $object Object
* @param string $action Actions * @param string $action Actions
* @param HookManager $hookmanager Hook manager * @param HookManager $hookmanager Hook manager
* @return void * @return int
*/ */
public function printCommonFooter($parameters, &$object, &$action, $hookmanager) public function printCommonFooter($parameters, &$object, &$action, $hookmanager)
{ {

View File

@ -58,15 +58,15 @@ $extrafields->fetch_name_optionals_label($object->table_element);
*/ */
// Add file in email form // Add file in email form
if (GETPOST('addfile', 'alpha') && ! GETPOST('add', 'alpha')) { if (GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) {
////$res = $object->fetch('','',GETPOST('track_id')); ////$res = $object->fetch('','',GETPOST('track_id'));
////if($res > 0) ////if($res > 0)
////{ ////{
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp directory TODO Use a dedicated directory for temp mails files // Set tmp directory TODO Use a dedicated directory for temp mails files
$vardir = $conf->ticket->dir_output; $vardir = $conf->ticket->dir_output;
$upload_dir_tmp = $vardir . '/temp'; $upload_dir_tmp = $vardir.'/temp';
if (!dol_is_dir($upload_dir_tmp)) { if (!dol_is_dir($upload_dir_tmp)) {
dol_mkdir($upload_dir_tmp); dol_mkdir($upload_dir_tmp);
} }
@ -77,11 +77,11 @@ if (GETPOST('addfile', 'alpha') && ! GETPOST('add', 'alpha')) {
// Remove file // Remove file
if (GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha')) { if (GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha')) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp directory // Set tmp directory
$vardir = $conf->ticket->dir_output . '/'; $vardir = $conf->ticket->dir_output.'/';
$upload_dir_tmp = $vardir . '/temp'; $upload_dir_tmp = $vardir.'/temp';
// TODO Delete only files that was uploaded from email form // TODO Delete only files that was uploaded from email form
dol_remove_file_process($_POST['removedfile'], 0, 0); dol_remove_file_process($_POST['removedfile'], 0, 0);
@ -156,7 +156,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
$user = new User($db); $user = new User($db);
} }
$object->context['disableticketemail']=1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later $object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later
$id = $object->create($user); $id = $object->create($user);
if ($id <= 0) { if ($id <= 0) {
@ -172,7 +172,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
} }
} }
if (! $error) if (!$error)
{ {
$object->db->commit(); $object->db->commit();
$action = "infos_success"; $action = "infos_success";
@ -182,13 +182,13 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
$action = 'create_ticket'; $action = 'create_ticket';
} }
if (! $error) if (!$error)
{ {
$res = $object->fetch($id); $res = $object->fetch($id);
if ($res) { if ($res) {
// Create form object // Create form object
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
// Init to avoid errors // Init to avoid errors
@ -203,20 +203,20 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
// Send email to customer // Send email to customer
$subject = '[' . $conf->global->MAIN_INFO_SOCIETE_NOM . '] ' . $langs->transnoentities('TicketNewEmailSubject'); $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject');
$message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')) . "\n\n"; $message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n";
$message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket') . "\n"; $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n";
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE . '/' : dol_buildpath('/public/ticket/view.php', 2)) . '?track_id=' . $object->track_id; $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
$infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', '<a href="' . $url_public_ticket . '">' . $object->track_id . '</a>') . "\n"; $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', '<a href="'.$url_public_ticket.'">'.$object->track_id.'</a>')."\n";
$infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl') . "\n\n"; $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n";
$message .= dol_nl2br($infos_new_ticket); $message .= dol_nl2br($infos_new_ticket);
$message .= $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->transnoentities('TicketMessageMailSignatureText'); $message .= $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->transnoentities('TicketMessageMailSignatureText');
$sendto = GETPOST('email', 'alpha'); $sendto = GETPOST('email', 'alpha');
$from = $conf->global->MAIN_INFO_SOCIETE_NOM . '<' . $conf->global->TICKET_NOTIFICATION_EMAIL_FROM . '>'; $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
$replyto = $from; $replyto = $from;
$sendtocc = ''; $sendtocc = '';
$deliveryreceipt = 0; $deliveryreceipt = 0;
@ -227,7 +227,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
} }
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
if ($mailfile->error || $mailfile->errors) { if ($mailfile->error || $mailfile->errors) {
setEventMessages($mailfile->error, $mailfile->errors, 'errors'); setEventMessages($mailfile->error, $mailfile->errors, 'errors');
@ -245,17 +245,17 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
if ($sendto) if ($sendto)
{ {
$subject = '[' . $conf->global->MAIN_INFO_SOCIETE_NOM . '] ' . $langs->transnoentities('TicketNewEmailSubjectAdmin'); $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin');
$message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id) . "\n\n"; $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n";
$message_admin .= '<ul><li>' . $langs->trans('Title') . ' : ' . $object->subject . '</li>'; $message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
$message_admin .= '<li>' . $langs->trans('Type') . ' : ' . $object->type_label . '</li>'; $message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
$message_admin .= '<li>' . $langs->trans('Category') . ' : ' . $object->category_label . '</li>'; $message_admin .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
$message_admin .= '<li>' . $langs->trans('Severity') . ' : ' . $object->severity_label . '</li>'; $message_admin .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
$message_admin .= '<li>' . $langs->trans('From') . ' : ' . $object->origin_email . '</li>'; $message_admin .= '<li>'.$langs->trans('From').' : '.$object->origin_email.'</li>';
if (is_array($extrafields->attributes[$object->table_element]['label'])) if (is_array($extrafields->attributes[$object->table_element]['label']))
{ {
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
$enabled = 1; $enabled = 1;
if ($qualified && isset($extrafields->attributes[$object->table_element]['list'][$key])) if ($qualified && isset($extrafields->attributes[$object->table_element]['list'][$key]))
@ -268,18 +268,18 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
$perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1); $perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1);
} }
$qualified=true; $qualified = true;
if (empty($enabled) || $enabled == 2) $qualified = false; if (empty($enabled) || $enabled == 2) $qualified = false;
if (empty($perms)) $qualified = false; if (empty($perms)) $qualified = false;
if ($qualified) $message_admin .= '<li>' . $langs->trans($key) . ' : ' . $value . '</li>'; if ($qualified) $message_admin .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
} }
} }
$message_admin .= '</ul>'; $message_admin .= '</ul>';
$message_admin .= '<p>' . $langs->trans('Message') . ' : <br>' . $object->message . '</p>'; $message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
$message_admin .= '<p><a href="' . dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id . '">' . $langs->trans('SeeThisTicketIntomanagementInterface') . '</a></p>'; $message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
$from = $conf->global->MAIN_INFO_SOCIETE_NOM . '<' . $conf->global->TICKET_NOTIFICATION_EMAIL_FROM . '>'; $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
$replyto = $from; $replyto = $from;
$message_admin = dol_nl2br($message_admin); $message_admin = dol_nl2br($message_admin);
@ -288,7 +288,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
} }
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
if ($mailfile->error || $mailfile->errors) { if ($mailfile->error || $mailfile->errors) {
setEventMessages($mailfile->error, $mailfile->errors, 'errors'); setEventMessages($mailfile->error, $mailfile->errors, 'errors');
@ -302,19 +302,19 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
} }
// Copy files into ticket directory // Copy files into ticket directory
$destdir = $conf->ticket->dir_output . '/' . $object->track_id; $destdir = $conf->ticket->dir_output.'/'.$object->track_id;
if (! dol_is_dir($destdir)) { if (!dol_is_dir($destdir)) {
dol_mkdir($destdir); dol_mkdir($destdir);
} }
foreach ($filename as $i => $val) { foreach ($filename as $i => $val) {
dol_move($filepath[$i], $destdir . '/' . $filename[$i], 0, 1); dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1);
$formmail->remove_attached_files($i); $formmail->remove_attached_files($i);
} }
//setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); //setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs');
// Make a redirect to avoid to have ticket submitted twice if we make back // Make a redirect to avoid to have ticket submitted twice if we make back
setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>' . $object->track_id . '</strong>'), null, 'warnings'); setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '<strong>'.$object->track_id.'</strong>'), null, 'warnings');
setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings'); setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings');
header("Location: index.php"); header("Location: index.php");
exit; exit;
@ -335,7 +335,7 @@ $formticket = new FormTicket($db);
if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)
{ {
print '<div class="error">' . $langs->trans('TicketPublicInterfaceForbidden') . '</div>'; print '<div class="error">'.$langs->trans('TicketPublicInterfaceForbidden').'</div>';
$db->close(); $db->close();
exit(); exit();
} }
@ -371,7 +371,7 @@ if ($action != "infos_success") {
print '<div>'; print '<div>';
} }
else { else {
print '<div class="info marginleftonly marginrightonly">' . $langs->trans('TicketPublicInfoCreateTicket') . '</div>'; print '<div class="info marginleftonly marginrightonly">'.$langs->trans('TicketPublicInfoCreateTicket').'</div>';
$formticket->showForm(); $formticket->showForm();
} }
} }

View File

@ -25,7 +25,7 @@
*/ */
// Put here all includes required by your class file // Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
@ -76,7 +76,7 @@ class SocieteAccount extends CommonObject
/** /**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/ */
public $fields=array( public $fields = array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'default'=>1), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'default'=>1),
'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Key account',), 'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Key account',),
@ -97,7 +97,7 @@ class SocieteAccount extends CommonObject
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,), 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-2, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-2, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'default'=>1, 'arrayofkeyval'=>array('1'=>'Active','0'=>'Disabled')), 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'default'=>1, 'arrayofkeyval'=>array('1'=>'Active', '0'=>'Disabled')),
); );
/** /**
@ -199,7 +199,7 @@ class SocieteAccount extends CommonObject
$this->db = $db; $this->db = $db;
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0; if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0;
} }
/** /**
@ -275,7 +275,7 @@ class SocieteAccount extends CommonObject
public function fetch($id, $ref = null) public function fetch($id, $ref = null)
{ {
$result = $this->fetchCommon($id, $ref); $result = $this->fetchCommon($id, $ref);
if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
return $result; return $result;
} }
@ -286,11 +286,11 @@ class SocieteAccount extends CommonObject
*/ */
public function fetchLines() public function fetchLines()
{ {
$this->lines=array(); $this->lines = array();
// Load lines with object societeAccountLine // Load lines with object societeAccountLine
return count($this->lines)?1:0; return count($this->lines) ? 1 : 0;
} }
/** /**
@ -306,15 +306,15 @@ class SocieteAccount extends CommonObject
public function getCustomerAccount($id, $site, $status = 0, $site_account = '') public function getCustomerAccount($id, $site, $status = 0, $site_account = '')
{ {
$sql = "SELECT sa.key_account as key_account, sa.entity"; $sql = "SELECT sa.key_account as key_account, sa.entity";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe_account as sa"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_account as sa";
$sql .= " WHERE sa.fk_soc = " . $id; $sql .= " WHERE sa.fk_soc = ".$id;
$sql .= " AND sa.entity IN (".getEntity('societe').")"; $sql .= " AND sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.site = '".$this->db->escape($site)."' AND sa.status = ".((int) $status); $sql .= " AND sa.site = '".$this->db->escape($site)."' AND sa.status = ".((int) $status);
$sql .= " AND sa.key_account IS NOT NULL AND sa.key_account <> ''"; $sql .= " AND sa.key_account IS NOT NULL AND sa.key_account <> ''";
$sql .= " AND (sa.site_account = '' OR sa.site_account IS NULL OR sa.site_account = '".$this->db->escape($site_account)."')"; $sql .= " AND (sa.site_account = '' OR sa.site_account IS NULL OR sa.site_account = '".$this->db->escape($site_account)."')";
$sql .= " ORDER BY sa.site_account DESC"; // To get the entry with a site_account defined in priority $sql .= " ORDER BY sa.site_account DESC"; // To get the entry with a site_account defined in priority
dol_syslog(get_class($this) . "::getCustomerAccount Try to find the first system customer id for ".$site." of thirdparty id=".$id." (exemple: cus_.... for stripe)", LOG_DEBUG); dol_syslog(get_class($this)."::getCustomerAccount Try to find the first system customer id for ".$site." of thirdparty id=".$id." (exemple: cus_.... for stripe)", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
@ -344,13 +344,13 @@ class SocieteAccount extends CommonObject
$socid = 0; $socid = 0;
$sql = "SELECT sa.fk_soc as fk_soc, sa.key_account, sa.entity"; $sql = "SELECT sa.fk_soc as fk_soc, sa.key_account, sa.entity";
$sql.= " FROM " . MAIN_DB_PREFIX . "societe_account as sa"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_account as sa";
$sql.= " WHERE sa.key_account = '".$this->db->escape($id)."'"; $sql .= " WHERE sa.key_account = '".$this->db->escape($id)."'";
$sql.= " AND sa.entity IN (".getEntity('societe').")"; $sql .= " AND sa.entity IN (".getEntity('societe').")";
$sql.= " AND sa.site = '".$this->db->escape($site)."' AND sa.status = ".((int) $status); $sql .= " AND sa.site = '".$this->db->escape($site)."' AND sa.status = ".((int) $status);
$sql.= " AND sa.fk_soc > 0"; $sql .= " AND sa.fk_soc > 0";
dol_syslog(get_class($this) . "::getCustomerAccount Try to find the first thirdparty id for ".$site." for external id=".$id, LOG_DEBUG); dol_syslog(get_class($this)."::getCustomerAccount Try to find the first thirdparty id for ".$site." for external id=".$id, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
@ -402,16 +402,16 @@ class SocieteAccount extends CommonObject
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager; global $menumanager;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
$result = ''; $result = '';
$companylink = ''; $companylink = '';
$this->ref = $this->login; $this->ref = $this->login;
$label = '<u>' . $langs->trans("SocieteAccount") . '</u>'; $label = '<u>'.$langs->trans("SocieteAccount").'</u>';
$label.= '<br>'; $label .= '<br>';
$label.= '<b>' . $langs->trans('Login') . ':</b> ' . $this->ref; $label .= '<b>'.$langs->trans('Login').':</b> '.$this->ref;
//$label.= '<b>' . $langs->trans('WebSite') . ':</b> ' . $this->ref; //$label.= '<b>' . $langs->trans('WebSite') . ':</b> ' . $this->ref;
$url = dol_buildpath('/website/websiteaccount_card.php', 1).'?id='.$this->id; $url = dol_buildpath('/website/websiteaccount_card.php', 1).'?id='.$this->id;
@ -419,31 +419,31 @@ class SocieteAccount extends CommonObject
if ($option != 'nolink') if ($option != 'nolink')
{ {
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
} }
$linkclose=''; $linkclose = '';
if (empty($notooltip)) if (empty($notooltip))
{ {
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$label=$langs->trans("ShowsocieteAccount"); $label = $langs->trans("ShowsocieteAccount");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} }
else $linkclose = ($morecss?' class="'.$morecss.'"':''); else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
$linkstart = '<a href="'.$url.'"'; $linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>'; $linkstart .= $linkclose.'>';
$linkend='</a>'; $linkend = '</a>';
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto != 2) $result.= $this->ref; if ($withpicto != 2) $result .= $this->ref;
$result .= $linkend; $result .= $linkend;
return $result; return $result;
@ -475,7 +475,7 @@ class SocieteAccount extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
$prefix=''; $prefix = '';
if ($status == 1) return $langs->trans('Enabled'); if ($status == 1) return $langs->trans('Enabled');
elseif ($status == 0) return $langs->trans('Disabled'); elseif ($status == 0) return $langs->trans('Disabled');
} }
@ -520,10 +520,10 @@ class SocieteAccount extends CommonObject
public function info($id) public function info($id)
{ {
$sql = 'SELECT rowid, date_creation as datec, tms as datem,'; $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
$sql.= ' fk_user_creat, fk_user_modif'; $sql .= ' fk_user_creat, fk_user_modif';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
$sql.= ' WHERE t.rowid = '.$id; $sql .= ' WHERE t.rowid = '.$id;
$result=$this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
if ($this->db->num_rows($result)) if ($this->db->num_rows($result))

View File

@ -1,5 +1,5 @@
<?php <?php
if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
/* /*
Badge style is based on boostrap framework Badge style is based on boostrap framework
@ -178,7 +178,7 @@ a.badge-dark:focus, a.badge-dark:hover {
* STATUS BADGES * STATUS BADGES
*/ */
<?php <?php
for ($i = 0; $i <= 9; $i++){ for ($i = 0; $i <= 9; $i++) {
/* Default Status */ /* Default Status */
_createStatusBadgeCss($i, '', "STATUS".$i); _createStatusBadgeCss($i, '', "STATUS".$i);
@ -200,15 +200,15 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL
global ${$statusVarNamePrefix.'badgeStatus'.$statusName}, ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName}; global ${$statusVarNamePrefix.'badgeStatus'.$statusName}, ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName};
if(!empty(${$statusVarNamePrefix.'badgeStatus'.$statusName})) { if (!empty(${$statusVarNamePrefix.'badgeStatus'.$statusName})) {
print "\n/* " . strtoupper($commentLabel) . " */\n"; print "\n/* ".strtoupper($commentLabel)." */\n";
$thisBadgeBackgroundColor = $thisBadgeBorderColor = ${$statusVarNamePrefix . 'badgeStatus' . $statusName}; $thisBadgeBackgroundColor = $thisBadgeBorderColor = ${$statusVarNamePrefix.'badgeStatus'.$statusName};
$TBadgeBorderOnly = array(0, 3, 5, 7); $TBadgeBorderOnly = array(0, 3, 5, 7);
$thisBadgeTextColor = colorIsLight(${$statusVarNamePrefix . 'badgeStatus' . $statusName}) ? '#212529' : '#ffffff'; $thisBadgeTextColor = colorIsLight(${$statusVarNamePrefix.'badgeStatus'.$statusName}) ? '#212529' : '#ffffff';
if (!empty(${$statusVarNamePrefix . 'badgeStatus_textColor' . $statusName})) { if (!empty(${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName})) {
$thisBadgeTextColor = ${$statusVarNamePrefix . 'badgeStatus_textColor' . $statusName}; $thisBadgeTextColor = ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName};
} }
if (in_array($statusName, $TBadgeBorderOnly)) { if (in_array($statusName, $TBadgeBorderOnly)) {
@ -219,28 +219,28 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL
if (in_array($statusName, array(0, 5, 9))) $thisBadgeTextColor = '#999999'; if (in_array($statusName, array(0, 5, 9))) $thisBadgeTextColor = '#999999';
if (in_array($statusName, array(6))) $thisBadgeTextColor = '#777777'; if (in_array($statusName, array(6))) $thisBadgeTextColor = '#777777';
print $cssPrefix . ".badge-status" . $statusName . " {\n"; print $cssPrefix.".badge-status".$statusName." {\n";
print " color: " . $thisBadgeTextColor . " !important;\n"; print " color: ".$thisBadgeTextColor." !important;\n";
if (in_array($statusName, $TBadgeBorderOnly)) { if (in_array($statusName, $TBadgeBorderOnly)) {
print " border-color: " . $thisBadgeBorderColor . ";\n"; print " border-color: ".$thisBadgeBorderColor.";\n";
} }
print " background-color: " . $thisBadgeBackgroundColor . ";\n"; print " background-color: ".$thisBadgeBackgroundColor.";\n";
print "}\n"; print "}\n";
print $cssPrefix . ".font-status" . $statusName . " {\n"; print $cssPrefix.".font-status".$statusName." {\n";
print " color: " . $thisBadgeBackgroundColor . " !important;\n"; print " color: ".$thisBadgeBackgroundColor." !important;\n";
print "}\n"; print "}\n";
print $cssPrefix . ".badge-status" . $statusName . ".focus, " . $cssPrefix . ".badge-status" . $statusName . ":focus {\n"; print $cssPrefix.".badge-status".$statusName.".focus, ".$cssPrefix.".badge-status".$statusName.":focus {\n";
print " outline: 0;\n"; print " outline: 0;\n";
print " box-shadow: 0 0 0 0.2rem " . colorHexToRgb($thisBadgeBackgroundColor, 0.5) . ";\n"; print " box-shadow: 0 0 0 0.2rem ".colorHexToRgb($thisBadgeBackgroundColor, 0.5).";\n";
print "}\n"; print "}\n";
print $cssPrefix . ".badge-status" . $statusName . ":focus, " . $cssPrefix . ".badge-status" . $statusName . ":hover {\n"; print $cssPrefix.".badge-status".$statusName.":focus, ".$cssPrefix.".badge-status".$statusName.":hover {\n";
print " color: " . $thisBadgeTextColor . " !important;\n"; print " color: ".$thisBadgeTextColor." !important;\n";
//print " background-color: " . colorDarker($thisBadgeBackgroundColor, 10) . ";\n"; //print " background-color: " . colorDarker($thisBadgeBackgroundColor, 10) . ";\n";
if (in_array($statusName, $TBadgeBorderOnly)) { if (in_array($statusName, $TBadgeBorderOnly)) {
print " border-color: " . colorDarker($thisBadgeBorderColor, 10) . ";\n"; print " border-color: ".colorDarker($thisBadgeBorderColor, 10).";\n";
} }
print "}\n"; print "}\n";
} }

View File

@ -1,5 +1,5 @@
<?php <?php
if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
/* <style type="text/css" > */ /* <style type="text/css" > */
/* /*
Badge style is based on boostrap framework Badge style is based on boostrap framework
@ -166,7 +166,7 @@ a.badge-dark:focus, a.badge-dark:hover {
/* /*
* STATUS BADGES * STATUS BADGES
*/ */
<?php for ($i = 0; $i <= 9; $i++){ <?php for ($i = 0; $i <= 9; $i++) {
/* Default Status */ /* Default Status */
_createStatusBadgeCss($i, '', "STATUS".$i); _createStatusBadgeCss($i, '', "STATUS".$i);
@ -188,16 +188,16 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL
global ${$statusVarNamePrefix.'badgeStatus'.$statusName}, ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName}; global ${$statusVarNamePrefix.'badgeStatus'.$statusName}, ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName};
if(!empty(${$statusVarNamePrefix.'badgeStatus'.$statusName})) { if (!empty(${$statusVarNamePrefix.'badgeStatus'.$statusName})) {
print "\n/* " . strtoupper($commentLabel) . " */\n"; print "\n/* ".strtoupper($commentLabel)." */\n";
$thisBadgeBackgroundColor = $thisBadgeBorderColor = ${$statusVarNamePrefix . 'badgeStatus' . $statusName}; $thisBadgeBackgroundColor = $thisBadgeBorderColor = ${$statusVarNamePrefix.'badgeStatus'.$statusName};
$TBadgeBorderOnly = array(0, 3, 5, 7); $TBadgeBorderOnly = array(0, 3, 5, 7);
$thisBadgeTextColor = colorIsLight(${$statusVarNamePrefix . 'badgeStatus' . $statusName}) ? '#212529' : '#ffffff'; $thisBadgeTextColor = colorIsLight(${$statusVarNamePrefix.'badgeStatus'.$statusName}) ? '#212529' : '#ffffff';
if (!empty(${$statusVarNamePrefix . 'badgeStatus_textColor' . $statusName})) { if (!empty(${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName})) {
$thisBadgeTextColor = ${$statusVarNamePrefix . 'badgeStatus_textColor' . $statusName}; $thisBadgeTextColor = ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName};
} }
if (in_array($statusName, $TBadgeBorderOnly)) { if (in_array($statusName, $TBadgeBorderOnly)) {
@ -208,28 +208,28 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL
if (in_array($statusName, array(0, 5, 9))) $thisBadgeTextColor = '#999999'; if (in_array($statusName, array(0, 5, 9))) $thisBadgeTextColor = '#999999';
if (in_array($statusName, array(6))) $thisBadgeTextColor = '#777777'; if (in_array($statusName, array(6))) $thisBadgeTextColor = '#777777';
print $cssPrefix . ".badge-status" . $statusName . " {\n"; print $cssPrefix.".badge-status".$statusName." {\n";
print " color: " . $thisBadgeTextColor . " !important;\n"; print " color: ".$thisBadgeTextColor." !important;\n";
if (in_array($statusName, $TBadgeBorderOnly)) { if (in_array($statusName, $TBadgeBorderOnly)) {
print " border-color: " . $thisBadgeBorderColor . ";\n"; print " border-color: ".$thisBadgeBorderColor.";\n";
} }
print " background-color: " . $thisBadgeBackgroundColor . ";\n"; print " background-color: ".$thisBadgeBackgroundColor.";\n";
print "}\n"; print "}\n";
print $cssPrefix . ".font-status" . $statusName . " {\n"; print $cssPrefix.".font-status".$statusName." {\n";
print " color: " . $thisBadgeBackgroundColor . " !important;\n"; print " color: ".$thisBadgeBackgroundColor." !important;\n";
print "}\n"; print "}\n";
print $cssPrefix . ".badge-status" . $statusName . ".focus, " . $cssPrefix . ".badge-status" . $statusName . ":focus {\n"; print $cssPrefix.".badge-status".$statusName.".focus, ".$cssPrefix.".badge-status".$statusName.":focus {\n";
print " outline: 0;\n"; print " outline: 0;\n";
print " box-shadow: 0 0 0 0.2rem " . colorHexToRgb($thisBadgeBackgroundColor, 0.5) . ";\n"; print " box-shadow: 0 0 0 0.2rem ".colorHexToRgb($thisBadgeBackgroundColor, 0.5).";\n";
print "}\n"; print "}\n";
print $cssPrefix . ".badge-status" . $statusName . ":focus, " . $cssPrefix . ".badge-status" . $statusName . ":hover {\n"; print $cssPrefix.".badge-status".$statusName.":focus, ".$cssPrefix.".badge-status".$statusName.":hover {\n";
print " color: " . $thisBadgeTextColor . " !important;\n"; print " color: ".$thisBadgeTextColor." !important;\n";
print " background-color: " . colorDarker($thisBadgeBackgroundColor, 10) . ";\n"; print " background-color: ".colorDarker($thisBadgeBackgroundColor, 10).";\n";
if (in_array($statusName, $TBadgeBorderOnly)) { if (in_array($statusName, $TBadgeBorderOnly)) {
print " border-color: " . colorDarker($thisBadgeBorderColor, 10) . ";\n"; print " border-color: ".colorDarker($thisBadgeBorderColor, 10).";\n";
} }
print "}\n"; print "}\n";
} }

View File

@ -291,6 +291,7 @@ class Tickets extends DolibarrApi
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0;
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$ticket_static = new Ticket($db); $ticket_static = new Ticket($db);