Merge remote-tracking branch 'upstream/develop' into codesyntax

This commit is contained in:
Frédéric FRANCE 2021-01-17 20:21:05 +01:00
commit f71d803da8
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
17 changed files with 472 additions and 300 deletions

View File

@ -372,26 +372,26 @@ if ($result)
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"'.($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSell').'</td>';
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"'.($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSell').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellDesc');
print "</td></tr>\n";
if ($mysoc->isInEEC())
{
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellIntra').'</td>';
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellIntra').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
print "</td></tr>\n";
}
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellExport').'</td>';
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellExport').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellExportDesc');
print "</td></tr>\n";
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuy').'</td>';
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuy').'</td>';
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
if ($mysoc->isInEEC())
{
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyIntra').'</td>';
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyIntra').'</td>';
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
}
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyExport').'</td>';
print '<tr class="oddeven"><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyExport').'</td>';
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
print "</table>\n";

View File

@ -315,6 +315,7 @@ class BookKeeping extends CommonObject
$objnum = $this->db->fetch_object($resqlnum);
$this->piece_num = $objnum->piece_num;
}
dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG);
if (empty($this->piece_num)) {
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
@ -327,8 +328,8 @@ class BookKeeping extends CommonObject
$objnum = $this->db->fetch_object($resqlnum);
$this->piece_num = $objnum->maxpiecenum;
}
dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG);
}
dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG);
if (empty($this->piece_num)) {
$this->piece_num = 1;
}
@ -383,7 +384,6 @@ class BookKeeping extends CommonObject
$sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity);
$sql .= ")";
dol_syslog(get_class($this).":: create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);

View File

@ -176,7 +176,8 @@ print '<script type="text/javascript">
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.tobuy, p.tosell,";
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
$sql .= " aa.rowid as fk_compte, aa.account_number, aa.label, aa.labelshort,";
$sql .= " fd.situation_percent,";
$sql .= " co.code as country_code, co.label as country,";
@ -326,7 +327,7 @@ if ($result) {
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
print '<td class="liste_titre center"><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 center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
@ -377,6 +378,11 @@ if ($result) {
$productstatic->id = $objp->product_id;
$productstatic->label = $objp->product_label;
$productstatic->type = $objp->line_type;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
$productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
$productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
$accountingaccountstatic->rowid = $objp->fk_compte;
$accountingaccountstatic->label = $objp->label;
@ -424,11 +430,12 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>';
print '<td class="center">';
print '<td>';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit();
print '</a></td>';
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>';
print '</tr>';

View File

@ -178,7 +178,8 @@ print '<script type="text/javascript">
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
$sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
$sql .= " aa.label, aa.labelshort, aa.account_number,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,";
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,";
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
$sql .= " co.code as country_code, co.label as country,";
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur";
$parameters = array();
@ -376,6 +377,11 @@ if ($result) {
$productstatic->id = $objp->product_id;
$productstatic->label = $objp->product_label;
$productstatic->type = $objp->line_type;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy;
$accountingaccountstatic->rowid = $objp->fk_compte;
$accountingaccountstatic->label = $objp->label;

View File

@ -30,6 +30,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';

View File

@ -128,7 +128,9 @@ if ($action == 'add')
if (!$error)
{
$mesgs = $langs->trans("TransferFromToDone", '<a href="bankentries_list.php?id='.$accountfrom->id.'&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc">'.$accountfrom->label."</a>", '<a href="bankentries_list.php?id='.$accountto->id.'">'.$accountto->label."</a>", $amount, $langs->transnoentities("Currency".$conf->currency));
$mesgs = $langs->trans("TransferFromToDone", '{s1}', '{s2}', $amount, $langs->transnoentitiesnoconv("Currency".$conf->currency));
$mesgs = str_replace('{s1}', '<a href="bankentries_list.php?id='.$accountfrom->id.'&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc">'.$accountfrom->label.'</a>', $mesgs);
$mesgs = str_replace('{s2}', '<a href="bankentries_list.php?id='.$accountto->id.'">'.$accountto->label.'</a>', $mesgs);
setEventMessages($mesgs, null, 'mesgs');
$db->commit();
} else {

View File

@ -275,7 +275,6 @@ if ($search_dfyear > 0 && $search_op2df)
else $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
}
$sql .= $db->order($sortfield, $sortorder);
//print $sql;
$totalnboflines = 0;
$result = $db->query($sql);

View File

@ -0,0 +1,333 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/boxes/box_dolibarr_state_board.php
* \ingroup
* \brief Module Dolibarr state base
*/
include_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php';
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
/**
* Class to manage the box to show last thirdparties
*/
class box_dolibarr_state_board extends ModeleBoxes
{
public $boxcode = "dolibarrstatebox";
public $boximg = "box_user";
public $boxlabel = "BoxDolibarrStateBoard";
public $depends = array("user");
/**
* @var DoliDB Database handler.
*/
public $db;
public $enabled = 1;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param = '')
{
global $conf, $user;
$this->db = $db;
// disable box for such cases
if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled = 0; // disabled by this option
$this->hidden = !($user->rights->societe->lire && empty($user->socid));
}
/**
* Load data for box to show them later
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->load("boxes");
$this->max = $max;
$this->info_box_head = array('text' => $langs->trans("DolibarrStateBoard"));
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
{
$hookmanager = new HookManager($this->db);
$hookmanager->initHooks(array('index'));
$boxstatItems = array();
$boxstatFromHook = '';
$boxstatFromHook = $hookmanager->resPrint;
$boxstat = '';
$keys = array(
'users',
'members',
'expensereports',
'holidays',
'customers',
'prospects',
'suppliers',
'contacts',
'products',
'services',
'projects',
'proposals',
'orders',
'invoices',
'donations',
'supplier_proposals',
'supplier_orders',
'supplier_invoices',
'contracts',
'interventions',
'ticket'
);
$conditions = array(
'users' => $user->rights->user->user->lire,
'members' => !empty($conf->adherent->enabled) && $user->rights->adherent->lire,
'customers' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
'prospects' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
'suppliers' => !empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
'contacts' => !empty($conf->societe->enabled) && $user->rights->societe->contact->lire,
'products' => !empty($conf->product->enabled) && $user->rights->produit->lire,
'services' => !empty($conf->service->enabled) && $user->rights->service->lire,
'proposals' => !empty($conf->propal->enabled) && $user->rights->propale->lire,
'orders' => !empty($conf->commande->enabled) && $user->rights->commande->lire,
'invoices' => !empty($conf->facture->enabled) && $user->rights->facture->lire,
'donations' => !empty($conf->don->enabled) && $user->rights->don->lire,
'contracts' => !empty($conf->contrat->enabled) && $user->rights->contrat->lire,
'interventions' => !empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire,
'supplier_orders' => !empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
'supplier_invoices' => !empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
'supplier_proposals' => !empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
'projects' => !empty($conf->projet->enabled) && $user->rights->projet->lire,
'expensereports' => !empty($conf->expensereport->enabled) && $user->rights->expensereport->lire,
'holidays' => !empty($conf->holiday->enabled) && $user->rights->holiday->read,
'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read
);
$classes = array(
'users' => 'User',
'members' => 'Adherent',
'customers' => 'Client',
'prospects' => 'Client',
'suppliers' => 'Fournisseur',
'contacts' => 'Contact',
'products' => 'Product',
'services' => 'ProductService',
'proposals' => 'Propal',
'orders' => 'Commande',
'invoices' => 'Facture',
'donations' => 'Don',
'contracts' => 'Contrat',
'interventions' => 'Fichinter',
'supplier_orders' => 'CommandeFournisseur',
'supplier_invoices' => 'FactureFournisseur',
'supplier_proposals' => 'SupplierProposal',
'projects' => 'Project',
'expensereports' => 'ExpenseReport',
'holidays' => 'Holiday',
'ticket' => 'Ticket',
);
$includes = array(
'users' => DOL_DOCUMENT_ROOT . "/user/class/user.class.php",
'members' => DOL_DOCUMENT_ROOT . "/adherents/class/adherent.class.php",
'customers' => DOL_DOCUMENT_ROOT . "/societe/class/client.class.php",
'prospects' => DOL_DOCUMENT_ROOT . "/societe/class/client.class.php",
'suppliers' => DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.class.php",
'contacts' => DOL_DOCUMENT_ROOT . "/contact/class/contact.class.php",
'products' => DOL_DOCUMENT_ROOT . "/product/class/product.class.php",
'services' => DOL_DOCUMENT_ROOT . "/product/class/product.class.php",
'proposals' => DOL_DOCUMENT_ROOT . "/comm/propal/class/propal.class.php",
'orders' => DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php",
'invoices' => DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php",
'donations' => DOL_DOCUMENT_ROOT . "/don/class/don.class.php",
'contracts' => DOL_DOCUMENT_ROOT . "/contrat/class/contrat.class.php",
'interventions' => DOL_DOCUMENT_ROOT . "/fichinter/class/fichinter.class.php",
'supplier_orders' => DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.commande.class.php",
'supplier_invoices' => DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.facture.class.php",
'supplier_proposals' => DOL_DOCUMENT_ROOT . "/supplier_proposal/class/supplier_proposal.class.php",
'projects' => DOL_DOCUMENT_ROOT . "/projet/class/project.class.php",
'expensereports' => DOL_DOCUMENT_ROOT . "/expensereport/class/expensereport.class.php",
'holidays' => DOL_DOCUMENT_ROOT . "/holiday/class/holiday.class.php",
'ticket' => DOL_DOCUMENT_ROOT . "/ticket/class/ticket.class.php"
);
$links = array(
'users' => DOL_URL_ROOT . '/user/list.php',
'members' => DOL_URL_ROOT . '/adherents/list.php?statut=1&mainmenu=members',
'customers' => DOL_URL_ROOT . '/societe/list.php?type=c&mainmenu=companies',
'prospects' => DOL_URL_ROOT . '/societe/list.php?type=p&mainmenu=companies',
'suppliers' => DOL_URL_ROOT . '/societe/list.php?type=f&mainmenu=companies',
'contacts' => DOL_URL_ROOT . '/contact/list.php?mainmenu=companies',
'products' => DOL_URL_ROOT . '/product/list.php?type=0&mainmenu=products',
'services' => DOL_URL_ROOT . '/product/list.php?type=1&mainmenu=products',
'proposals' => DOL_URL_ROOT . '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals',
'orders' => DOL_URL_ROOT . '/commande/list.php?mainmenu=commercial&leftmenu=orders',
'invoices' => DOL_URL_ROOT . '/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills',
'donations' => DOL_URL_ROOT . '/don/list.php?leftmenu=donations',
'contracts' => DOL_URL_ROOT . '/contrat/list.php?mainmenu=commercial&leftmenu=contracts',
'interventions' => DOL_URL_ROOT . '/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter',
'supplier_orders' => DOL_URL_ROOT . '/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers',
'supplier_invoices' => DOL_URL_ROOT . '/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills',
'supplier_proposals' => DOL_URL_ROOT . '/supplier_proposal/list.php?mainmenu=commercial&leftmenu=',
'projects' => DOL_URL_ROOT . '/projet/list.php?mainmenu=project',
'expensereports' => DOL_URL_ROOT . '/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
'holidays' => DOL_URL_ROOT . '/holiday/list.php?mainmenu=hrm&leftmenu=holiday',
'ticket' => DOL_URL_ROOT . '/ticket/list.php?leftmenu=ticket'
);
$titres = array(
'users' => "Users",
'members' => "Members",
'customers' => "ThirdPartyCustomersStats",
'prospects' => "ThirdPartyProspectsStats",
'suppliers' => "Suppliers",
'contacts' => "Contacts",
'products' => "Products",
'services' => "Services",
'proposals' => "CommercialProposalsShort",
'orders' => "CustomersOrders",
'invoices' => "BillsCustomers",
'donations' => "Donations",
'contracts' => "Contracts",
'interventions' => "Interventions",
'supplier_orders' => "SuppliersOrders",
'supplier_invoices' => "SuppliersInvoices",
'supplier_proposals' => "SupplierProposalShort",
'projects' => "Projects",
'expensereports' => "ExpenseReports",
'holidays' => "Holidays",
'ticket' => "Ticket",
);
$langfile = array(
'customers' => "companies",
'contacts' => "companies",
'services' => "products",
'proposals' => "propal",
'invoices' => "bills",
'supplier_orders' => "orders",
'supplier_invoices' => "bills",
'supplier_proposals' => 'supplier_proposal',
'expensereports' => "trips",
'holidays' => "holiday",
);
$boardloaded = array();
foreach ($keys as $val)
{
if ($conditions[$val])
{
$boxstatItem = '';
$class = $classes[$val];
// Search in cache if load_state_board is already realized
$classkeyforcache = $class;
if ($classkeyforcache == 'ProductService') $classkeyforcache = 'Product'; // ProductService use same load_state_board than Product
if (!isset($boardloaded[$classkeyforcache]) || !is_object($boardloaded[$classkeyforcache]))
{
include_once $includes[$val]; // Loading a class cost around 1Mb
$board = new $class($this->db);
$board->load_state_board();
$boardloaded[$class] = $board;
} else {
$board = $boardloaded[$classkeyforcache];
}
$langs->load(empty($langfile[$val]) ? $val : $langfile[$val]);
$text = $langs->trans($titres[$val]);
$boxstatItem .= '<a href="' . $links[$val] . '" class="boxstatsindicator thumbstat nobold nounderline">';
$boxstatItem .= '<div class="boxstats">';
$boxstatItem .= '<span class="boxstatstext" title="' . dol_escape_htmltag($text) . '">' . $text . '</span><br>';
$boxstatItem .= '<span class="boxstatsindicator">' . img_object("", $board->picto, 'class="inline-block"') . ' ' . ($board->nb[$val] ? $board->nb[$val] : 0) . '</span>';
$boxstatItem .= '</div>';
$boxstatItem .= '</a>';
$boxstatItems[$val] = $boxstatItem;
}
}
if (!empty($boxstatFromHook) || !empty($boxstatItems))
{
$boxstat .= $boxstatFromHook;
if (is_array($boxstatItems) && count($boxstatItems) > 0)
{
$boxstat .= implode('', $boxstatItems);
}
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '</td></tr>';
$boxstat .= '</table>';
$this->info_box_contents[0][0] = array(
'td' => '',
'textnoformat' => $boxstat
);
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover center"',
'maxlength' => 500,
'text' => ($this->db->error() . ' sql=' . $sql)
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -1028,13 +1028,12 @@ class ExtraFields
// search filter on a date extrafield shows two inputs to select a date range
$prefill = array(
'start' => isset($value['start']) ? $value['start'] : '',
'end' => isset($value['end']) ? $value['end'] : '');
'end' => isset($value['end']) ? $value['end'] : ''
);
$out = '<div ' . ($moreparam ? $moreparam : '') . '><div class="nowrap">'
. $langs->trans('From') . ' '
. $form->selectDate($prefill['start'], $keyprefix . $key . $keysuffix . '_start', 0, 0, 1)
. $form->selectDate($prefill['start'], $keyprefix.$key.$keysuffix.'_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"))
. '</div><div class="nowrap">'
. $langs->trans('to') . ' '
. $form->selectDate($prefill['end'], $keyprefix . $key . $keysuffix . '_end', 0, 0, 1)
. $form->selectDate($prefill['end'], $keyprefix.$key.$keysuffix.'_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"))
. '</div></div>';
} else {
// TODO Must also support $moreparam

View File

@ -1949,7 +1949,7 @@ class Form
* @param string $nooutput No print, return the output into a string
* @return void|string
*/
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array(), $nooutput = 0)
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array(), $nooutput = 0)
{
// phpcs:enable
global $langs, $conf;
@ -4495,10 +4495,15 @@ class Form
if (inputok.length>0) {
$.each(inputok, function(i, inputname) {
var more = "";
if ($("#" + inputname).attr("type") == "checkbox") { more = ":checked"; }
if ($("#" + inputname).attr("type") == "radio") { more = ":checked"; }
var inputvalue = $("#" + inputname + more).val();
var inputvalue;
if ($("input[name=\'" + inputname + "\']").attr("type") == "radio") {
inputvalue = $("input[name=\'" + inputname + "\']").val();
} else {
if ($("#" + inputname).attr("type") == "checkbox") { more = ":checked"; }
inputvalue = $("#" + inputname + more).val();
}
if (typeof inputvalue == "undefined") { inputvalue=""; }
console.log("check inputname="+inputname+" inputvalue="+inputvalue);
options += "&" + inputname + "=" + encodeURIComponent(inputvalue);
});
}
@ -5760,7 +5765,7 @@ class Form
$retstring .= '<div class="nowrap inline-block divfordateinput">';
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ($placeholder ? ' placeholder="'.$placeholder.'"' : '');
$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');
$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= '>';

View File

@ -78,7 +78,8 @@ class modUser extends DolibarrModules
// Boxes
$this->boxes = array(
0=>array('file'=>'box_lastlogin.php', 'enabledbydefaulton'=>'Home'),
1=>array('file'=>'box_birthdays.php', 'enabledbydefaulton'=>'Home')
1=>array('file'=>'box_birthdays.php', 'enabledbydefaulton'=>'Home'),
2=>array('file'=>'box_dolibarr_state_board.php', 'enabledbydefaulton'=>'Home')
);
// Permissions

View File

@ -26,11 +26,13 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($
if (is_numeric($crit)) {
$sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'";
} elseif (is_array($crit)) {
$sql .= ' AND (' . $extrafieldsobjectprefix.$tmpkey
.' BETWEEN "'
. $db->idate($crit['start'])
. '" AND "'
. $db->idate($crit['end']) . '")';
if ($crit['start'] !== '' && $crit['end'] !== '') {
$sql .= ' AND ('.$extrafieldsobjectprefix.$tmpkey." BETWEEN '". $db->idate($crit['start']). "' AND '".$db->idate($crit['end']) . "')";
} elseif ($crit['start'] !== '') {
$sql .= ' AND ('.$extrafieldsobjectprefix.$tmpkey." >= '". $db->idate($crit['start'])."')";
} elseif ($crit['end'] !== '') {
$sql .= ' AND ('.$extrafieldsobjectprefix.$tmpkey." <= '". $db->idate($crit['end'])."')";
}
}
} elseif (in_array($typ, array('boolean')))
{

View File

@ -1075,11 +1075,83 @@ class ProductFournisseur extends Product
$result = '';
$label = '<u>'.$langs->trans("SupplierRef").'</u>';
$label .= '<br>';
$label .= '<b>'.$langs->trans('Product').':</b> '.$this->product_ref;
if (!empty($this->entity)) {
$tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80);
if ($this->nbphoto > 0) {
$label .= '<div class="photointooltip">';
$label .= $tmpphoto;
$label .= '</div><div style="clear: both;"></div>';
}
}
if ($this->type == Product::TYPE_PRODUCT) {
$label .= img_picto('', 'product').' <u class="paddingrightonly">'.$langs->trans("Product").'</u>';
} elseif ($this->type == Product::TYPE_SERVICE) {
$label .= img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>';
}
if (isset($this->status) && isset($this->status_buy)) {
$label .= ' '.$this->getLibStatut(5, 0);
$label .= ' '.$this->getLibStatut(5, 1);
}
if (!empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('ProductRef').':</b> '.($this->ref ? $this->ref : $this->product_ref);
}
if (!empty($this->label)) {
$label .= '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label;
}
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_supplier;
if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
if (!empty($conf->productbatch->enabled)) {
$langs->load("productbatch");
$label .= "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2);
}
}
if (!empty($conf->barcode->enabled)) {
$label .= '<br><b>'.$langs->trans('BarCode').':</b> '.$this->barcode;
}
if ($this->type == Product::TYPE_PRODUCT)
{
if ($this->weight) {
$label .= "<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units);
}
$labelsize = "";
if ($this->length) {
$labelsize .= ($labelsize ? " - " : "")."<b>".$langs->trans("Length").'</b>: '.$this->length.' '.measuringUnitString(0, 'size', $this->length_units);
}
if ($this->width) {
$labelsize .= ($labelsize ? " - " : "")."<b>".$langs->trans("Width").'</b>: '.$this->width.' '.measuringUnitString(0, 'size', $this->width_units);
}
if ($this->height) {
$labelsize .= ($labelsize ? " - " : "")."<b>".$langs->trans("Height").'</b>: '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units);
}
if ($labelsize) $label .= "<br>".$labelsize;
$labelsurfacevolume = "";
if ($this->surface) {
$labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Surface").'</b>: '.$this->surface.' '.measuringUnitString(0, 'surface', $this->surface_units);
}
if ($this->volume) {
$labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units);
}
if ($labelsurfacevolume) $label .= "<br>".$labelsurfacevolume;
}
if (!empty($conf->accounting->enabled) && $this->status) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= '<br><b>'.$langs->trans('ProductAccountancySellCode').':</b> '.length_accountg($this->accountancy_code_sell);
$label .= '<br><b>'.$langs->trans('ProductAccountancySellIntraCode').':</b> '.length_accountg($this->accountancy_code_sell_intra);
$label .= '<br><b>'.$langs->trans('ProductAccountancySellExportCode').':</b> '.length_accountg($this->accountancy_code_sell_export);
}
if (!empty($conf->accounting->enabled) && $this->status_buy) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= '<br><b>'.$langs->trans('ProductAccountancyBuyCode').':</b> '.length_accountg($this->accountancy_code_buy);
$label .= '<br><b>'.$langs->trans('ProductAccountancyBuyIntraCode').':</b> '.length_accountg($this->accountancy_code_buy_intra);
$label .= '<br><b>'.$langs->trans('ProductAccountancyBuyExportCode').':</b> '.length_accountg($this->accountancy_code_buy_export);
}
$logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id, 'pfpl.datec', 'DESC'); // set sort order here
if (is_array($logPrices) && count($logPrices) > 0) {
$label .= '<br><br>';

View File

@ -112,219 +112,6 @@ $boxstatFromHook = '';
// Load translation files required by page
$langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts'));
// Load global statistics of objects
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
{
$object = new stdClass();
$parameters = array();
$action = '';
$reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$boxstatFromHook = $hookmanager->resPrint;
if (empty($reshook))
{
// Cle array returned by the method load_state_board for each line
$keys = array(
'users',
'members',
'expensereports',
'holidays',
'customers',
'prospects',
'suppliers',
'contacts',
'products',
'services',
'projects',
'proposals',
'orders',
'invoices',
'donations',
'supplier_proposals',
'supplier_orders',
'supplier_invoices',
'contracts',
'interventions',
'ticket'
);
// Condition to be checked for each display line dashboard
$conditions = array(
'users' => $user->rights->user->user->lire,
'members' => !empty($conf->adherent->enabled) && $user->rights->adherent->lire,
'customers' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
'prospects' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
'suppliers' => !empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
'contacts' => !empty($conf->societe->enabled) && $user->rights->societe->contact->lire,
'products' => !empty($conf->product->enabled) && $user->rights->produit->lire,
'services' => !empty($conf->service->enabled) && $user->rights->service->lire,
'proposals' => !empty($conf->propal->enabled) && $user->rights->propale->lire,
'orders' => !empty($conf->commande->enabled) && $user->rights->commande->lire,
'invoices' => !empty($conf->facture->enabled) && $user->rights->facture->lire,
'donations' => !empty($conf->don->enabled) && $user->rights->don->lire,
'contracts' => !empty($conf->contrat->enabled) && $user->rights->contrat->lire,
'interventions' => !empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire,
'supplier_orders' => !empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
'supplier_invoices' => !empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
'supplier_proposals' => !empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
'projects' => !empty($conf->projet->enabled) && $user->rights->projet->lire,
'expensereports' => !empty($conf->expensereport->enabled) && $user->rights->expensereport->lire,
'holidays' => !empty($conf->holiday->enabled) && $user->rights->holiday->read,
'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read
);
// Class file containing the method load_state_board for each line
$includes = array(
'users' => DOL_DOCUMENT_ROOT."/user/class/user.class.php",
'members' => DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
'customers' => DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
'prospects' => DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
'suppliers' => DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php",
'contacts' => DOL_DOCUMENT_ROOT."/contact/class/contact.class.php",
'products' => DOL_DOCUMENT_ROOT."/product/class/product.class.php",
'services' => DOL_DOCUMENT_ROOT."/product/class/product.class.php",
'proposals' => DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php",
'orders' => DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
'invoices' => DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
'donations' => DOL_DOCUMENT_ROOT."/don/class/don.class.php",
'contracts' => DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
'interventions' => DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php",
'supplier_orders' => DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
'supplier_invoices' => DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
'supplier_proposals' => DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
'projects' => DOL_DOCUMENT_ROOT."/projet/class/project.class.php",
'expensereports' => DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php",
'holidays' => DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php",
'ticket' => DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"
);
// Name class containing the method load_state_board for each line
$classes = array(
'users' => 'User',
'members' => 'Adherent',
'customers' => 'Client',
'prospects' => 'Client',
'suppliers' => 'Fournisseur',
'contacts' => 'Contact',
'products' => 'Product',
'services' => 'ProductService',
'proposals' => 'Propal',
'orders' => 'Commande',
'invoices' => 'Facture',
'donations' => 'Don',
'contracts' => 'Contrat',
'interventions' => 'Fichinter',
'supplier_orders' => 'CommandeFournisseur',
'supplier_invoices' => 'FactureFournisseur',
'supplier_proposals' => 'SupplierProposal',
'projects' => 'Project',
'expensereports' => 'ExpenseReport',
'holidays' => 'Holiday',
'ticket' => 'Ticket',
);
// Translation keyword
$titres = array(
'users' => "Users",
'members' => "Members",
'customers' => "ThirdPartyCustomersStats",
'prospects' => "ThirdPartyProspectsStats",
'suppliers' => "Suppliers",
'contacts' => "Contacts",
'products' => "Products",
'services' => "Services",
'proposals' => "CommercialProposalsShort",
'orders' => "CustomersOrders",
'invoices' => "BillsCustomers",
'donations' => "Donations",
'contracts' => "Contracts",
'interventions' => "Interventions",
'supplier_orders' => "SuppliersOrders",
'supplier_invoices' => "SuppliersInvoices",
'supplier_proposals' => "SupplierProposalShort",
'projects' => "Projects",
'expensereports' => "ExpenseReports",
'holidays' => "Holidays",
'ticket' => "Ticket",
);
// Dashboard Link lines
$links = array(
'users' => DOL_URL_ROOT.'/user/list.php',
'members' => DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members',
'customers' => DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies',
'prospects' => DOL_URL_ROOT.'/societe/list.php?type=p&mainmenu=companies',
'suppliers' => DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies',
'contacts' => DOL_URL_ROOT.'/contact/list.php?mainmenu=companies',
'products' => DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products',
'services' => DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products',
'proposals' => DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals',
'orders' => DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial&leftmenu=orders',
'invoices' => DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills',
'donations' => DOL_URL_ROOT.'/don/list.php?leftmenu=donations',
'contracts' => DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts',
'interventions' => DOL_URL_ROOT.'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter',
'supplier_orders' => DOL_URL_ROOT.'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers',
'supplier_invoices' => DOL_URL_ROOT.'/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills',
'supplier_proposals' => DOL_URL_ROOT.'/supplier_proposal/list.php?mainmenu=commercial&leftmenu=',
'projects' => DOL_URL_ROOT.'/projet/list.php?mainmenu=project',
'expensereports' => DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
'holidays' => DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday',
'ticket' => DOL_URL_ROOT.'/ticket/list.php?leftmenu=ticket'
);
// Translation lang files
$langfile = array(
'customers' => "companies",
'contacts' => "companies",
'services' => "products",
'proposals' => "propal",
'invoices' => "bills",
'supplier_orders' => "orders",
'supplier_invoices' => "bills",
'supplier_proposals' => 'supplier_proposal',
'expensereports' => "trips",
'holidays' => "holiday",
);
// Loop and displays each line of table
$boardloaded = array();
foreach ($keys as $val)
{
if ($conditions[$val])
{
$boxstatItem = '';
$class = $classes[$val];
// Search in cache if load_state_board is already realized
$classkeyforcache = $class;
if ($classkeyforcache == 'ProductService') $classkeyforcache = 'Product'; // ProductService use same load_state_board than Product
if (!isset($boardloaded[$classkeyforcache]) || !is_object($boardloaded[$classkeyforcache]))
{
include_once $includes[$val]; // Loading a class cost around 1Mb
$board = new $class($db);
$board->load_state_board();
$boardloaded[$class] = $board;
} else {
$board = $boardloaded[$classkeyforcache];
}
$langs->load(empty($langfile[$val]) ? $val : $langfile[$val]);
$text = $langs->trans($titres[$val]);
$boxstatItem .= '<a href="'.$links[$val].'" class="boxstatsindicator thumbstat nobold nounderline">';
$boxstatItem .= '<div class="boxstats">';
$boxstatItem .= '<span class="boxstatstext" title="'.dol_escape_htmltag($text).'">'.$text.'</span><br>';
$boxstatItem .= '<span class="boxstatsindicator">'.img_object("", $board->picto, 'class="inline-block"').' '.(!empty($board->nb[$val]) ? $board->nb[$val] : 0).'</span>';
$boxstatItem .= '</div>';
$boxstatItem .= '</a>';
$boxstatItems[$val] = $boxstatItem;
}
}
}
}
// Dolibarr Working Board with weather
if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
@ -901,54 +688,8 @@ $boxlist .= $resultboxes['boxlista'];
$boxlist .= '</div>';
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
{
// Remove allready present info in new dash board
if (!empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD) && is_array($boxstatItems) && count($boxstatItems) > 0) {
foreach ($boxstatItems as $boxstatItemKey => $boxstatItemHtml) {
if (in_array($boxstatItemKey, $globalStatInTopOpenedDashBoard)) {
unset($boxstatItems[$boxstatItemKey]);
}
}
}
if (!empty($boxstatFromHook) || !empty($boxstatItems)) {
$boxstat = '<!-- Database statistics -->'."\n";
$boxstat .= '<div class="box">';
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover widgetstats" width="100%">';
$boxstat .= '<tr class="liste_titre box_titre">';
$boxstat .= '<td>';
$boxstat .= '<div class="inline-block valignmiddle">'.$langs->trans("DolibarrStateBoard").'</div>';
$boxstat .= '</td>';
$boxstat .= '</tr>';
$boxstat .= '<tr class="nobottom nohover"><td class="tdboxstats nohover flexcontainer">';
$boxstat .= $boxstatFromHook;
if (is_array($boxstatItems) && count($boxstatItems) > 0)
{
$boxstat .= implode('', $boxstatItems);
}
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '<a class="boxstatsindicator thumbstat nobold nounderline"><div class="boxstatsempty"></div></a>';
$boxstat .= '</td></tr>';
$boxstat .= '</table>';
$boxstat .= '</div>';
}
}
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
$boxlist .= $boxstat;
$boxlist .= $resultboxes['boxlistb'];
$boxlist .= '</div>';

View File

@ -47,6 +47,10 @@ ALTER TABLE llx_bank_account ADD COLUMN ics_transfer varchar(32) NULL;
ALTER TABLE llx_facture MODIFY COLUMN date_valid DATETIME NULL DEFAULT NULL;
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_dolibarr_state_board.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_dolibarr_state_board.php' AND entity = 1);
ALTER TABLE llx_website ADD COLUMN lastaccess datetime NULL;
ALTER TABLE llx_website ADD COLUMN pageviews_month BIGINT UNSIGNED DEFAULT 0;
ALTER TABLE llx_website ADD COLUMN pageviews_total BIGINT UNSIGNED DEFAULT 0;
@ -100,3 +104,4 @@ ALTER TABLE llx_propal ADD INDEX idx_propal_fk_warehouse(fk_warehouse);
ALTER TABLE llx_product_customer_price ADD COLUMN ref_customer varchar(30);
ALTER TABLE llx_product_customer_price_log ADD COLUMN ref_customer varchar(30);

View File

@ -16,7 +16,7 @@
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2020 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
*
@ -1311,12 +1311,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// Accountancy_code_buy
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
print '<td>';
if ($type == 0)
{
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT);
} else {
$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
}
if ($type == 0) {
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT);
} else {
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT);
}
print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, '');
print '</td></tr>';

View File

@ -252,7 +252,7 @@ if (empty($reshook))
'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php',
'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php',
'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php',
'Livraison' => '/delivery/class/delivery.class.php',
'Delivery' => '/delivery/class/delivery.class.php',
'Product' => '/product/class/product.class.php',
'Project' => '/projet/class/project.class.php',
'Ticket' => '/ticket/class/ticket.class.php',