forked from Wavyzz/dolibarr
Look and feel v12
This commit is contained in:
@@ -149,7 +149,7 @@ class HookManager
|
||||
$parameters['context'] = join(':', $this->contextarray);
|
||||
//dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
|
||||
|
||||
// Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated because a 'addreplace' hook can also return resPrint and resArray).
|
||||
// Define type of hook ('output' or 'addreplace'). Type 'returnvalue' is deprecated because a 'addreplace' hook can also return resPrint and resArray).
|
||||
$hooktype = 'output';
|
||||
if (in_array(
|
||||
$method,
|
||||
@@ -199,6 +199,7 @@ class HookManager
|
||||
'pdf_getlinetotalwithtax',
|
||||
'paymentsupplierinvoices',
|
||||
'printAddress',
|
||||
'printEmail',
|
||||
'printSearchForm',
|
||||
'printTabsHead',
|
||||
'printObjectLine',
|
||||
|
||||
@@ -3144,7 +3144,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'filter', 'file-code', 'folder', 'folder-open', 'grip', 'grip_title', 'help', 'language', 'list', 'listlight', 'note',
|
||||
'object_action', 'object_account', 'object_barcode', 'object_phoning', 'object_phoning_fax', 'object_email',
|
||||
'object_accounting', 'object_category', 'object_bookmark', 'object_bug', 'object_generic', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
|
||||
'object_cash-register', 'object_company', 'object_contact', 'object_holiday', 'object_hrm', 'object_multicurrency', 'object_payment',
|
||||
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_holiday', 'object_hrm', 'object_multicurrency', 'object_payment',
|
||||
'object_paragraph', 'object_printer', 'object_resource', 'object_rss', 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_other',
|
||||
'off', 'on', 'paiment', 'play', 'playdisabled', 'printer', 'resize', 'stats', 'trip',
|
||||
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
|
||||
@@ -3169,7 +3169,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
|
||||
$arrayconvpictotofa = array(
|
||||
'account'=>'university', 'action'=>'calendar-alt', 'address'=> 'address-book', 'bank_account'=>'university',
|
||||
'company'=>'building', 'contact'=>'address-book',
|
||||
'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase',
|
||||
'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt',
|
||||
'accounting'=>'chart-line', 'category'=>'tag',
|
||||
'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt',
|
||||
@@ -3236,6 +3236,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
// Add CSS
|
||||
$arrayconvpictotomorcess = array(
|
||||
'action'=>'bg-infoxbox-action', 'account'=>'bg-infoxbox-bank_account', 'bank_account'=>'bg-infoxbox-bank_account', 'cash-register'=>'bg-infoxbox-bank_account',
|
||||
'contract'=>'bg-infoxbox-contrat',
|
||||
'multicurrency'=>'bg-infoxbox-bank_account',
|
||||
'check'=>'font-status4',
|
||||
'hrm'=>'bg-infoxbox-adherent', 'group'=>'bg-infoxbox-adherent',
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
|
||||
/**
|
||||
* API class for fichinters
|
||||
* API class for Interventions
|
||||
*
|
||||
* @access protected
|
||||
* @class DolibarrApiAccess {@requires user,external}
|
||||
|
||||
@@ -202,7 +202,7 @@ class Fichinter extends CommonObject
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nb["fichinters"] = $obj->nb;
|
||||
$this->nb["interventions"] = $obj->nb;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
|
||||
@@ -108,7 +108,6 @@ if (!empty($conf->global->MAIN_MOTD))
|
||||
* Hidden for external users
|
||||
*/
|
||||
|
||||
|
||||
$boxstatItems = array();
|
||||
$boxstatFromHook = '';
|
||||
|
||||
@@ -147,7 +146,8 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
!empty($conf->projet->enabled) && $user->rights->projet->lire,
|
||||
!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire,
|
||||
!empty($conf->holiday->enabled) && $user->rights->holiday->read,
|
||||
!empty($conf->don->enabled) && $user->rights->don->lire
|
||||
!empty($conf->don->enabled) && $user->rights->don->lire,
|
||||
!empty($conf->ticket->enabled) && $user->rights->ticket->read
|
||||
);
|
||||
// Class file containing the method load_state_board for each line
|
||||
$includes = array(
|
||||
@@ -170,7 +170,8 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
DOL_DOCUMENT_ROOT."/projet/class/project.class.php",
|
||||
DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php",
|
||||
DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php",
|
||||
DOL_DOCUMENT_ROOT."/don/class/don.class.php"
|
||||
DOL_DOCUMENT_ROOT."/don/class/don.class.php",
|
||||
DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"
|
||||
);
|
||||
// Name class containing the method load_state_board for each line
|
||||
$classes = array('User',
|
||||
@@ -192,7 +193,8 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
'Project',
|
||||
'ExpenseReport',
|
||||
'Holiday',
|
||||
'Don'
|
||||
'Don',
|
||||
'Ticket',
|
||||
);
|
||||
// Cle array returned by the method load_state_board for each line
|
||||
$keys = array('users',
|
||||
@@ -206,15 +208,16 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
'proposals',
|
||||
'orders',
|
||||
'invoices',
|
||||
'Contracts',
|
||||
'fichinters',
|
||||
'contracts',
|
||||
'interventions',
|
||||
'supplier_orders',
|
||||
'supplier_invoices',
|
||||
'askprice',
|
||||
'projects',
|
||||
'expensereports',
|
||||
'holidays',
|
||||
'donations'
|
||||
'donations',
|
||||
'ticket'
|
||||
);
|
||||
// Dashboard Icon lines
|
||||
$icons = array('user',
|
||||
@@ -228,15 +231,16 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
'propal',
|
||||
'order',
|
||||
'bill',
|
||||
'order',
|
||||
'order',
|
||||
'contract',
|
||||
'intervention',
|
||||
'order',
|
||||
'bill',
|
||||
'propal',
|
||||
'projectpub',
|
||||
'trip',
|
||||
'holiday',
|
||||
'generic'
|
||||
'generic',
|
||||
'ticket',
|
||||
);
|
||||
// Translation keyword
|
||||
$titres = array("Users",
|
||||
@@ -258,7 +262,8 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
"Projects",
|
||||
"ExpenseReports",
|
||||
"Holidays",
|
||||
"Donations"
|
||||
"Donations",
|
||||
"Ticket",
|
||||
);
|
||||
// Dashboard Link lines
|
||||
$links = array(
|
||||
@@ -282,7 +287,8 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
DOL_URL_ROOT.'/projet/list.php?mainmenu=project',
|
||||
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
|
||||
DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday',
|
||||
DOL_URL_ROOT.'/don/list.php?leftmenu=donations'
|
||||
DOL_URL_ROOT.'/don/list.php?leftmenu=donations',
|
||||
DOL_URL_ROOT.'/ticket/list.php?leftmenu=ticket'
|
||||
);
|
||||
// Translation lang files
|
||||
$langfile = array(
|
||||
@@ -306,6 +312,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
"trips",
|
||||
"holiday",
|
||||
"donations",
|
||||
"ticket"
|
||||
);
|
||||
|
||||
|
||||
@@ -331,7 +338,6 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
||||
$board = $boardloaded[$classe];
|
||||
}
|
||||
|
||||
|
||||
if (!empty($langfile[$key])) $langs->load($langfile[$key]);
|
||||
$text = $langs->trans($titres[$key]);
|
||||
$boxstatItem .= '<a href="'.$links[$key].'" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
@@ -415,7 +421,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$dashboardlines[$board->element.'_awaiting'] = $board->load_board($user, 'awaiting');
|
||||
}
|
||||
|
||||
// Number of services enabled (delayed)
|
||||
// Number of contract / services enabled (delayed)
|
||||
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
$board = new Contrat($db);
|
||||
@@ -423,6 +429,16 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
// Number of active services (expired)
|
||||
$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
|
||||
}
|
||||
|
||||
// Number of tickets open
|
||||
if (!empty($conf->ticket->enabled) && $user->rights->ticket->read) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
|
||||
$board = new Ticket($db);
|
||||
$dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened");
|
||||
// Number of active services (expired)
|
||||
//$dashboardlines[$board->element.'_active'] = $board->load_board($user, "active");
|
||||
}
|
||||
|
||||
// Number of invoices customers (has paid)
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
@@ -526,13 +542,6 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
'stats' =>
|
||||
array('facture'),
|
||||
),
|
||||
'contrat' =>
|
||||
array(
|
||||
'groupName' => 'Contracts',
|
||||
'globalStatsKey' => 'Contracts',
|
||||
'stats' =>
|
||||
array('contrat_inactive', 'contrat_active'),
|
||||
),
|
||||
'supplier_proposal' =>
|
||||
array(
|
||||
'groupName' => 'SupplierProposals',
|
||||
@@ -554,6 +563,20 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
'stats' =>
|
||||
array('invoice_supplier'),
|
||||
),
|
||||
'contrat' =>
|
||||
array(
|
||||
'groupName' => 'Contracts',
|
||||
'globalStatsKey' => 'Contracts',
|
||||
'stats' =>
|
||||
array('contrat_inactive', 'contrat_active'),
|
||||
),
|
||||
'ticket' =>
|
||||
array(
|
||||
'groupName' => 'Tickets',
|
||||
'globalStatsKey' => 'OpenTickets',
|
||||
'stats' =>
|
||||
array('ticket_opened'),
|
||||
),
|
||||
'bank_account' =>
|
||||
array(
|
||||
'groupName' => 'BankAccount',
|
||||
@@ -587,8 +610,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$parameters = array(
|
||||
'dashboardgroup' => $dashboardgroup
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('addOpenElementsDashboardGroup', $parameters, $object,
|
||||
$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('addOpenElementsDashboardGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook == 0) {
|
||||
$dashboardgroup = array_merge($dashboardgroup, $hookmanager->resArray);
|
||||
}
|
||||
|
||||
@@ -325,7 +325,6 @@ CompanyDeleted=Company "%s" deleted from database.
|
||||
ListOfContacts=List of contacts/addresses
|
||||
ListOfContactsAddresses=List of contacts/addresses
|
||||
ListOfThirdParties=List of Third Parties
|
||||
ShowCompany=Show Third Party
|
||||
ShowContact=Show contact
|
||||
ContactsAllShort=All (No filter)
|
||||
ContactType=Contact type
|
||||
|
||||
@@ -2407,7 +2407,7 @@ class Societe extends CommonObject
|
||||
// By default
|
||||
if (empty($linkstart))
|
||||
{
|
||||
$label .= '<u>'.$langs->trans("ShowCompany").'</u>';
|
||||
$label .= '<u>'.$langs->trans("ThirdParty").'</u>';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/card.php?socid='.$this->id;
|
||||
}
|
||||
|
||||
|
||||
@@ -1148,7 +1148,7 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
if (!empty($arrayfields['s.email']['checked']))
|
||||
{
|
||||
print "<td>".dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18, 0, 1)."</td>\n";
|
||||
print '<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 0, 0, 1)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['s.phone']['checked']))
|
||||
|
||||
@@ -2436,7 +2436,7 @@ class SupplierProposal extends CommonObject
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Charge indicateurs this->nb de tableau de bord
|
||||
* Load indicator this->nb of global stats widget
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
|
||||
@@ -3826,8 +3826,8 @@ div.boximport {
|
||||
|
||||
.fieldrequired { font-weight: bold; color: var(--fieldrequiredcolor); }
|
||||
|
||||
.widthpictotitle { width: 32px; text-align: <?php echo $left; ?>; }
|
||||
span.widthpictotitle { font-size: 2em; };
|
||||
.widthpictotitle { width: 26px; text-align: <?php echo $left; ?>; }
|
||||
span.widthpictotitle { font-size: 1.7em; };
|
||||
|
||||
.dolgraphtitle { margin-top: 6px; margin-bottom: 4px; }
|
||||
.dolgraphtitlecssboxes { /* margin: 0px; */ }
|
||||
|
||||
@@ -77,7 +77,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
max-width: 100%;
|
||||
}
|
||||
.info-box-module .info-box-icon > img {
|
||||
max-width: 50%;
|
||||
max-width: 55%;
|
||||
}
|
||||
|
||||
.info-box-icon-text{
|
||||
@@ -220,11 +220,11 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
|
||||
.bg-infoxbox-order_supplier{
|
||||
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#599caf', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
}
|
||||
.bg-infoxbox-contrat{
|
||||
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#469686', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
.bg-infoxbox-contrat, .bg-infoxbox-ticket{
|
||||
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#46a676', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
}
|
||||
.bg-infoxbox-bank_account{
|
||||
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#c5903e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
}
|
||||
.bg-infoxbox-adherent{
|
||||
<?php echo $prefix; ?>color: <?php print colorAgressiveness('#79633f', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
@@ -258,6 +258,9 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
|
||||
.fa-dol-contrat:before {
|
||||
content: "\f1e6";
|
||||
}
|
||||
.fa-dol-ticket:before {
|
||||
content: "\f3ff";
|
||||
}
|
||||
.fa-dol-bank_account:before {
|
||||
content: "\f19c";
|
||||
}
|
||||
@@ -297,37 +300,6 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
|
||||
color : #b91f1f;
|
||||
}
|
||||
|
||||
/* USING IMAGES FOR WEATHER INTEAD OF FONT AWESOME */
|
||||
/* For other themes just uncomment this part */
|
||||
/*.info-box-weather-level0,
|
||||
.info-box-weather-level1,
|
||||
.info-box-weather-level2,
|
||||
.info-box-weather-level3,
|
||||
.info-box-weather-level4 {
|
||||
background-position: 15px 50%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.info-box-weather .info-box-icon{
|
||||
display: none !important;
|
||||
}
|
||||
.info-box-weather-level0 {
|
||||
background-image: url("img/weather/weather-clear.png");
|
||||
}
|
||||
.info-box-weather-level1 {
|
||||
background-image: url("img/weather/weather-few-clouds.png");
|
||||
}
|
||||
.info-box-weather-level2 {
|
||||
background-image: url("img/weather/weather-clouds.png");
|
||||
}
|
||||
.info-box-weather-level3 {
|
||||
background-image: url("img/weather/weather-many-clouds.png");
|
||||
}
|
||||
.info-box-weather-level4 {
|
||||
background-image: url("img/weather/weather-storm.png");
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
.box-flex-container{
|
||||
display: flex; /* or inline-flex */
|
||||
|
||||
@@ -61,7 +61,7 @@ span.info-box-icon-text { /* hide box text number due to problems */
|
||||
max-width: 100%;
|
||||
}
|
||||
.info-box-module .info-box-icon > img {
|
||||
max-width: 50%;
|
||||
max-width: 55%;
|
||||
}
|
||||
.info-box-content {
|
||||
padding: 5px 10px;
|
||||
@@ -126,11 +126,11 @@ if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENES
|
||||
.bg-infoxbox-order_supplier i.fa{
|
||||
color: <?php print colorAgressiveness('#40b0cf', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
}
|
||||
.bg-infoxbox-contrat i.fa{
|
||||
.bg-infoxbox-contrat i.fa, .bg-infoxbox-ticket i.fa{
|
||||
color: <?php print colorAgressiveness('#20a68a', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
}
|
||||
.bg-infoxbox-bank_account i.fa{
|
||||
color: <?php print colorAgressiveness('#e39c42', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
color: <?php print colorAgressiveness('#b0a53e', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
}
|
||||
.bg-infoxbox-adherent i.fa{
|
||||
color: <?php print colorAgressiveness('#f39c12', $conf->global->THEME_AGRESSIVENESS_RATIO); ?> !important;
|
||||
|
||||
@@ -742,7 +742,9 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
||||
$head = societe_prepare_head($object->thirdparty);
|
||||
|
||||
dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
@@ -790,7 +792,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project');
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->ticket->write)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
|
||||
@@ -2781,6 +2781,122 @@ class Ticket extends CommonObject
|
||||
setEventMessages($langs->trans('ErrorMailRecipientIsEmptyForSendTicketMessage'), null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param int $mode "opened" for askprice to close, "signed" for proposal to invoice
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function load_board($user, $mode)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$this->nbtodo = $this->nbtodolate = 0;
|
||||
$clause = " WHERE";
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.datec as datec";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid)
|
||||
{
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".$user->id;
|
||||
$clause = " AND";
|
||||
}
|
||||
$sql .= $clause." p.entity IN (".getEntity('ticket').")";
|
||||
if ($mode == 'opened') $sql .= " AND p.fk_statut in (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")";
|
||||
if ($user->socid) $sql .= " AND p.fk_soc = ".$user->socid;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$label = $labelShort = '';
|
||||
$status = '';
|
||||
if ($mode == 'opened') {
|
||||
$status = 'openall';
|
||||
//$delay_warning = $conf->ticket->warning_delay;
|
||||
$delay_warning = 0;
|
||||
$label = $langs->trans("MenuListNonClosed");
|
||||
$labelShort = $langs->trans("MenuListNonClosed");
|
||||
}
|
||||
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay = $delay_warning / 60 / 60 / 24;
|
||||
$response->label = $label;
|
||||
$response->labelShort = $labelShort;
|
||||
$response->url = DOL_URL_ROOT.'/ticket/list.php?search_fk_statut[]='.$status;
|
||||
$response->img = img_object('', "ticket");
|
||||
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$response->nbtodo++;
|
||||
if ($mode == 'opened')
|
||||
{
|
||||
$datelimit = $this->db->jdate($obj->datefin);
|
||||
if ($datelimit < ($now - $delay_warning))
|
||||
{
|
||||
//$response->nbtodolate++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load indicator this->nb of global stats widget
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
public function load_state_board()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $user;
|
||||
|
||||
$this->nb = array();
|
||||
$clause = "WHERE";
|
||||
|
||||
$sql = "SELECT count(p.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid)
|
||||
{
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".$user->id;
|
||||
$clause = "AND";
|
||||
}
|
||||
$sql .= " ".$clause." p.entity IN (".getEntity('ticket').")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nb["ticket"] = $obj->nb;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user