Debug v15
This commit is contained in:
parent
cc72418ab9
commit
423a4ea104
@ -4263,10 +4263,10 @@ class Facture extends CommonInvoice
|
||||
|
||||
$clause = " WHERE";
|
||||
|
||||
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut, f.total_ht";
|
||||
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin, f.fk_statut, f.total_ht";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = " AND";
|
||||
}
|
||||
@ -4304,6 +4304,7 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
return $response;
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
|
||||
@ -2300,4 +2300,78 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
*
|
||||
* @param User $user Objet user
|
||||
* @param string $mode Mode 'direct_debit' or 'credit_transfer'
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
*/
|
||||
public function load_board($user, $mode)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
if ($user->socid) {
|
||||
return -1; // protection pour eviter appel par utilisateur externe
|
||||
}
|
||||
|
||||
/*
|
||||
if ($mode == 'direct_debit') {
|
||||
$sql = "SELECT b.rowid, f.datedue as datefin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('facture').")";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
} else {
|
||||
$sql = "SELECT b.rowid, f.datedue as datefin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('facture_fourn').")";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$langs->load("banks");
|
||||
$now = dol_now();
|
||||
|
||||
$response = new WorkboardResponse();
|
||||
if ($mode == 'direct_debit') {
|
||||
$response->warning_delay = $conf->prelevement->warning_delay / 60 / 60 / 24;
|
||||
$response->label = $langs->trans("PendingDirectDebitToComplete");
|
||||
$response->labelShort = $langs->trans("PendingDirectDebitToCompleteShort");
|
||||
$response->url = DOL_URL_ROOT.'/compta/prelevement/index.php?leftmenu=checks&mainmenu=bank';
|
||||
} else {
|
||||
$response->warning_delay = $conf->paymentbybanktransfer->warning_delay / 60 / 60 / 24;
|
||||
$response->label = $langs->trans("PendingCreditTransferToComplete");
|
||||
$response->labelShort = $langs->trans("PendingCreditTransferToCompleteShort");
|
||||
$response->url = DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php?leftmenu=checks&mainmenu=bank';
|
||||
}
|
||||
$response->img = img_object('', "payment");
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$response->nbtodo++;
|
||||
|
||||
if ($this->db->jdate($obj->datefin) < ($now - $conf->withdraw->warning_delay)) {
|
||||
$response->nbtodolate++;
|
||||
}
|
||||
}
|
||||
|
||||
$response->nbtodo = 0;
|
||||
$response->nbtodolate = 0;
|
||||
// Return workboard only if quantity is not 0
|
||||
if ($response->nbtodo) {
|
||||
return $response;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->error();
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3008,10 +3008,10 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
$clause = " WHERE";
|
||||
|
||||
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.fk_statut, c.date_livraison as delivery_date";
|
||||
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.fk_statut, c.date_livraison as delivery_date, c.total_ht";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = " AND";
|
||||
}
|
||||
@ -3043,12 +3043,13 @@ class CommandeFournisseur extends CommonOrder
|
||||
}
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$response->nbtodo++;
|
||||
|
||||
$commandestatic->delivery_date = $this->db->jdate($obj->delivery_date);
|
||||
$commandestatic->date_commande = $this->db->jdate($obj->date_commande);
|
||||
$commandestatic->statut = $obj->fk_statut;
|
||||
|
||||
$response->nbtodo++;
|
||||
$response->total += $obj->total_ht;
|
||||
|
||||
if ($commandestatic->hasDelay()) {
|
||||
$response->nbtodolate++;
|
||||
}
|
||||
|
||||
@ -2418,20 +2418,21 @@ class FactureFournisseur extends CommonInvoice
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
$sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut';
|
||||
$clause = " WHERE";
|
||||
|
||||
$sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut, ff.total_ht';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as ff';
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ff.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = " AND";
|
||||
}
|
||||
$sql .= ' WHERE ff.paye=0';
|
||||
$sql .= $clause.' ff.paye=0';
|
||||
$sql .= ' AND ff.fk_statut = '.self::STATUS_VALIDATED;
|
||||
$sql .= " AND ff.entity = ".$conf->entity;
|
||||
if ($user->socid) {
|
||||
$sql .= ' AND ff.fk_soc = '.((int) $user->socid);
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -2449,16 +2450,18 @@ class FactureFournisseur extends CommonInvoice
|
||||
$facturestatic = new FactureFournisseur($this->db);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$response->nbtodo++;
|
||||
|
||||
$facturestatic->date_echeance = $this->db->jdate($obj->datefin);
|
||||
$facturestatic->statut = $obj->fk_statut;
|
||||
|
||||
$response->nbtodo++;
|
||||
$response->total += $obj->total_ht;
|
||||
|
||||
if ($facturestatic->hasDelay()) {
|
||||
$response->nbtodolate++;
|
||||
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?search_option=late&mainmenu=billing&leftmenu=suppliers_bills';
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
return $response;
|
||||
} else {
|
||||
|
||||
@ -252,11 +252,24 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Number of cheque to send
|
||||
if (!empty($conf->banque->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_BANK) && $user->rights->banque->lire && !$user->socid && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
$board = new RemiseCheque($db);
|
||||
$dashboardlines[$board->element] = $board->load_board($user);
|
||||
if (!empty($conf->banque->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_BANK) && $user->rights->banque->lire && !$user->socid) {
|
||||
if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
$board = new RemiseCheque($db);
|
||||
$dashboardlines[$board->element] = $board->load_board($user);
|
||||
}
|
||||
if (!empty($conf->prelevement->enabled)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||
$board = new BonPrelevement($db);
|
||||
$dashboardlines[$board->element.'_direct_debit'] = $board->load_board($user, 'direct_debit');
|
||||
}
|
||||
if (!empty($conf->paymentbybanktransfer->enabled)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||
$board = new BonPrelevement($db);
|
||||
$dashboardlines[$board->element.'_credit_transfer'] = $board->load_board($user, 'credit_transfer');
|
||||
}
|
||||
}
|
||||
|
||||
// Number of foundation members
|
||||
@ -375,7 +388,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
array(
|
||||
'groupName' => 'BankAccount',
|
||||
'stats' =>
|
||||
array('bank_account', 'chequereceipt'),
|
||||
array('bank_account', 'chequereceipt', 'widthdraw_direct_debit', 'widthdraw_credit_transfer'),
|
||||
),
|
||||
'member' =>
|
||||
array(
|
||||
@ -414,7 +427,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$totallate = $totaltodo = 0;
|
||||
|
||||
//Remove any invalid response
|
||||
//load_board can return an integer if failed or WorkboardResponse if OK
|
||||
//load_board can return an integer if failed, or WorkboardResponse if OK
|
||||
$valid_dashboardlines = array();
|
||||
foreach ($dashboardlines as $workboardid => $tmp) {
|
||||
if ($tmp instanceof WorkboardResponse) {
|
||||
@ -477,6 +490,8 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
|
||||
foreach ($dashboardgroup as $groupKey => $groupElement) {
|
||||
$boards = array();
|
||||
|
||||
// Scan $groupElement and save the one with 'stats' that lust be used for Open object dashboard
|
||||
if (empty($conf->global->MAIN_DISABLE_NEW_OPENED_DASH_BOARD)) {
|
||||
foreach ($groupElement['stats'] as $infoKey) {
|
||||
if (!empty($valid_dashboardlines[$infoKey])) {
|
||||
@ -492,7 +507,6 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
}
|
||||
$groupName = $langs->trans($groupElement['groupName']);
|
||||
$groupKeyLowerCase = strtolower($groupKey);
|
||||
$nbTotalForGroup = 0;
|
||||
|
||||
// global stats
|
||||
$globalStatsKey = false;
|
||||
@ -513,7 +527,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
}
|
||||
$groupElement['globalStats']['text'] = $langs->trans('Total').' : '.$langs->trans($titres[$keyIndex]).' ('.$groupElement['globalStats']['total'].')';
|
||||
$groupElement['globalStats']['total'] = $nbTotal;
|
||||
$groupElement['globalStats']['link'] = $links[$keyIndex];
|
||||
//$groupElement['globalStats']['link'] = $links[$keyIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -565,7 +579,17 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$nbtodClass = 'opacitymedium';
|
||||
}
|
||||
|
||||
$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text info-box-text-a">'.$infoName.'<span class="classfortooltip'.($nbtodClass ? ' '.$nbtodClass : '').'" title="'.$board->label.'" >'.$board->nbtodo.'</span>';
|
||||
// Forge the line to show into the open object box
|
||||
$labeltoshow = $board->label.' ('.$board->nbtodo.')';
|
||||
if ($board->total > 0) {
|
||||
$labeltoshow .= ' - '.price($board->total, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
}
|
||||
$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text info-box-text-a">'.$infoName.'<span class="classfortooltip'.($nbtodClass ? ' '.$nbtodClass : '').'" title="'.$labeltoshow.'" >';
|
||||
$openedDashBoard .= $board->nbtodo;
|
||||
if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
|
||||
$openedDashBoard .= ' : '.price($board->total, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
}
|
||||
$openedDashBoard .= '</span>';
|
||||
if ($textLate) {
|
||||
if ($board->url_late) {
|
||||
$openedDashBoard .= '</a>';
|
||||
@ -576,10 +600,6 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$openedDashBoard .= $textLate;
|
||||
}
|
||||
$openedDashBoard .= '</a>'."\n";
|
||||
|
||||
if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
|
||||
$openedDashBoard .= '<a href="'.$board->url.'" class="info-box-text">'.$langs->trans('Total').' '.price($board->total).'</a>';
|
||||
}
|
||||
$openedDashBoard .= '</div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user