Merge branch '5.0' of https://github.com/Dolibarr/dolibarr into 5.0
This commit is contained in:
commit
ec5b304634
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -374,19 +374,25 @@ jQuery(document).ready(function() {
|
|||||||
print '<input id="fillmanually" type="radio" '.((! GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode")=='fillmanually')?'checked ':'').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueManually").' ';
|
print '<input id="fillmanually" type="radio" '.((! GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode")=='fillmanually')?'checked ':'').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueManually").' ';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromproduct')?'checked ':'').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
if (! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire))
|
||||||
print '<br>';
|
{
|
||||||
print '<div class="showforproductselector">';
|
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromproduct')?'checked ':'').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
||||||
$form->select_produits(GETPOST('productid'), 'productid', '');
|
print '<br>';
|
||||||
print ' <input type="submit" id="submitproduct" name="submitproduct" class="button" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
print '<div class="showforproductselector">';
|
||||||
print '</div>';
|
$form->select_produits(GETPOST('productid'), 'productid', '');
|
||||||
|
print ' <input type="submit" id="submitproduct" name="submitproduct" class="button" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromthirdparty')?'checked ':'').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
|
if (! empty($user->rights->societe->lire))
|
||||||
print '<br>';
|
{
|
||||||
print '<div class="showforthirdpartyselector">';
|
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromthirdparty')?'checked ':'').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
|
||||||
print $form->select_company(GETPOST('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
|
print '<br>';
|
||||||
print ' <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
print '<div class="showforthirdpartyselector">';
|
||||||
print '</div>';
|
print $form->select_company(GETPOST('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
|
||||||
|
print ' <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ class box_produits extends ModeleBoxes
|
|||||||
*/
|
*/
|
||||||
function loadBox($max=5)
|
function loadBox($max=5)
|
||||||
{
|
{
|
||||||
global $user, $langs, $db, $conf;
|
global $user, $langs, $db, $conf, $hookmanager;
|
||||||
|
|
||||||
$this->max=$max;
|
$this->max=$max;
|
||||||
|
|
||||||
@ -69,6 +69,13 @@ class box_produits extends ModeleBoxes
|
|||||||
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
|
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
|
||||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||||
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
||||||
|
// Add where from hooks
|
||||||
|
if (is_object($hookmanager))
|
||||||
|
{
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
}
|
||||||
$sql.= $db->order('p.datec', 'DESC');
|
$sql.= $db->order('p.datec', 'DESC');
|
||||||
$sql.= $db->plimit($max, 0);
|
$sql.= $db->plimit($max, 0);
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
|||||||
*/
|
*/
|
||||||
function loadBox($max=5)
|
function loadBox($max=5)
|
||||||
{
|
{
|
||||||
global $user, $langs, $db, $conf;
|
global $user, $langs, $db, $conf, $hookmanager;
|
||||||
|
|
||||||
$this->max=$max;
|
$this->max=$max;
|
||||||
|
|
||||||
@ -74,7 +74,14 @@ class box_produits_alerte_stock extends ModeleBoxes
|
|||||||
$sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
|
$sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
|
||||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||||
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
||||||
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, p.entity";
|
// Add where from hooks
|
||||||
|
if (is_object($hookmanager))
|
||||||
|
{
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, p.entity";
|
||||||
$sql.= " HAVING SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") < p.seuil_stock_alerte";
|
$sql.= " HAVING SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") < p.seuil_stock_alerte";
|
||||||
$sql.= $db->order('p.seuil_stock_alerte', 'DESC');
|
$sql.= $db->order('p.seuil_stock_alerte', 'DESC');
|
||||||
$sql.= $db->plimit($max, 0);
|
$sql.= $db->plimit($max, 0);
|
||||||
|
|||||||
@ -1284,7 +1284,7 @@ abstract class CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load properties id_previous and id_next
|
* Load properties id_previous and id_next
|
||||||
*
|
*
|
||||||
* @param string $filter Optional filter
|
* @param string $filter Optional filter. Example: " AND (t.field1 = 'aa' OR t.field2 = 'bb')"
|
||||||
* @param int $fieldid Name of field to use for the select MAX and MIN
|
* @param int $fieldid Name of field to use for the select MAX and MIN
|
||||||
* @param int $nodbprefix Do not include DB prefix to forge table name
|
* @param int $nodbprefix Do not include DB prefix to forge table name
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
@ -1310,11 +1310,15 @@ abstract class CommonObject
|
|||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
||||||
$sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
$sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
||||||
if (! empty($filter)) $sql.=" AND ".$filter;
|
if (! empty($filter))
|
||||||
|
{
|
||||||
|
if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility
|
||||||
|
$sql.=$filter;
|
||||||
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
||||||
|
|
||||||
//print $sql."<br>";
|
//print $filter.' '.$sql."<br>";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -121,7 +121,7 @@ class HookManager
|
|||||||
* All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller.
|
* All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller.
|
||||||
* $this->error or this->errors are also defined by class called by this function if error.
|
* $this->error or this->errors are also defined by class called by this function if error.
|
||||||
*/
|
*/
|
||||||
function executeHooks($method, $parameters=false, &$object='', &$action='')
|
function executeHooks($method, $parameters=array(), &$object='', &$action='')
|
||||||
{
|
{
|
||||||
if (! is_array($this->hooks) || empty($this->hooks)) return '';
|
if (! is_array($this->hooks) || empty($this->hooks)) return '';
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ class HookManager
|
|||||||
// Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
|
// Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO. this should be done into the method of hook by returning nothing
|
// TODO. this test should be done into the method of hook by returning nothing
|
||||||
if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue;
|
if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue;
|
||||||
|
|
||||||
//dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
|
//dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
|
||||||
@ -237,7 +237,7 @@ class HookManager
|
|||||||
|
|
||||||
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||||
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
|
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
|
||||||
// TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string. we must use $actionclassinstance->resprints to return a string
|
// TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string
|
||||||
if (! is_array($resaction) && ! is_numeric($resaction))
|
if (! is_array($resaction) && ! is_numeric($resaction))
|
||||||
{
|
{
|
||||||
dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
|
dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
|
||||||
|
|||||||
@ -5683,7 +5683,7 @@ class Form
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a HTML area with the reference of object and a navigation bar for a business object
|
* Return a HTML area with the reference of object and a navigation bar for a business object
|
||||||
* To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria.
|
* Note: To add a particular filter on select, you can have $object->next_prev_filter set to add SQL criterias.
|
||||||
*
|
*
|
||||||
* @param object $object Object to show.
|
* @param object $object Object to show.
|
||||||
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link.
|
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link.
|
||||||
@ -5701,12 +5701,20 @@ class Form
|
|||||||
*/
|
*/
|
||||||
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='')
|
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='')
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf,$hookmanager;
|
||||||
|
|
||||||
$ret='';
|
$ret='';
|
||||||
if (empty($fieldid)) $fieldid='rowid';
|
if (empty($fieldid)) $fieldid='rowid';
|
||||||
if (empty($fieldref)) $fieldref='ref';
|
if (empty($fieldref)) $fieldref='ref';
|
||||||
|
|
||||||
|
// Add where from hooks
|
||||||
|
if (is_object($hookmanager))
|
||||||
|
{
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
$object->next_prev_filter.=$hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
|
//print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam";
|
||||||
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
|
$object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix);
|
||||||
|
|
||||||
|
|||||||
@ -67,9 +67,14 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
|||||||
$path=preg_replace('/([\\/]+)$/i','',$path);
|
$path=preg_replace('/([\\/]+)$/i','',$path);
|
||||||
$newpath=dol_osencode($path);
|
$newpath=dol_osencode($path);
|
||||||
|
|
||||||
if (! $nohook)
|
$reshook = 0;
|
||||||
|
$file_list = array();
|
||||||
|
|
||||||
|
if (is_object($hookmanager) && ! $nohook)
|
||||||
{
|
{
|
||||||
$hookmanager->initHooks(array('fileslib'));
|
$hookmanager->resArray=array();
|
||||||
|
|
||||||
|
$hookmanager->initHooks(array('fileslib'));
|
||||||
|
|
||||||
$parameters=array(
|
$parameters=array(
|
||||||
'path' => $newpath,
|
'path' => $newpath,
|
||||||
@ -202,6 +207,10 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
|||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_object($hookmanager) && is_array($hookmanager->resArray)) $file_list = array_merge($file_list, $hookmanager->resArray);
|
||||||
|
|
||||||
|
return $file_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -972,7 +972,8 @@ function dol_get_fiche_end($notab=0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show tab footer of a card
|
* Show tab footer of a card.
|
||||||
|
* Note: $object->next_prev_filter can be set to restrict select to find next or previous record by $form->showrefnav.
|
||||||
*
|
*
|
||||||
* @param object $object Object to show
|
* @param object $object Object to show
|
||||||
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link
|
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link
|
||||||
|
|||||||
@ -434,6 +434,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $
|
|||||||
dol_mkdir($dirthumb);
|
dol_mkdir($dirthumb);
|
||||||
|
|
||||||
// Initialisation des variables selon l'extension de l'image
|
// Initialisation des variables selon l'extension de l'image
|
||||||
|
$img=null;
|
||||||
switch($infoImg[2])
|
switch($infoImg[2])
|
||||||
{
|
{
|
||||||
case IMAGETYPE_GIF: // 1
|
case IMAGETYPE_GIF: // 1
|
||||||
|
|||||||
@ -4017,7 +4017,7 @@ class Product extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function load_state_board()
|
function load_state_board()
|
||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user, $hookmanager;
|
||||||
|
|
||||||
$this->nb=array();
|
$this->nb=array();
|
||||||
|
|
||||||
@ -4025,6 +4025,13 @@ class Product extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= ' WHERE p.entity IN ('.getEntity($this->element, 1).')';
|
$sql.= ' WHERE p.entity IN ('.getEntity($this->element, 1).')';
|
||||||
$sql.= " AND p.fk_product_type <> 1";
|
$sql.= " AND p.fk_product_type <> 1";
|
||||||
|
// Add where from hooks
|
||||||
|
if (is_object($hookmanager))
|
||||||
|
{
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class Service extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function load_state_board()
|
function load_state_board()
|
||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user, $hookmanager;
|
||||||
|
|
||||||
$this->nb=array();
|
$this->nb=array();
|
||||||
|
|
||||||
@ -64,6 +64,13 @@ class Service extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
||||||
$sql.= " AND p.fk_product_type = 1";
|
$sql.= " AND p.fk_product_type = 1";
|
||||||
|
// Add where from hooks
|
||||||
|
if (is_object($hookmanager))
|
||||||
|
{
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -42,6 +42,9 @@ else $result=restrictedArea($user,'produit|service');
|
|||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("stocks");
|
$langs->load("stocks");
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
||||||
|
$hookmanager->initHooks(array('productindex'));
|
||||||
|
|
||||||
$product_static = new Product($db);
|
$product_static = new Product($db);
|
||||||
|
|
||||||
|
|
||||||
@ -116,6 +119,10 @@ $prodser[0][0]=$prodser[0][1]=$prodser[1][0]=$prodser[1][1]=0;
|
|||||||
$sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy";
|
$sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= ' WHERE p.entity IN ('.getEntity($product_static->element, 1).')';
|
$sql.= ' WHERE p.entity IN ('.getEntity($product_static->element, 1).')';
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
|
$sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
while ($objp = $db->fetch_object($result))
|
while ($objp = $db->fetch_object($result))
|
||||||
@ -246,6 +253,10 @@ $sql.= " p.tms as datem";
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= " WHERE p.entity IN (".getEntity($product_static->element, 1).")";
|
$sql.= " WHERE p.entity IN (".getEntity($product_static->element, 1).")";
|
||||||
if ($type != '') $sql.= " AND p.fk_product_type = ".$type;
|
if ($type != '') $sql.= " AND p.fk_product_type = ".$type;
|
||||||
|
// Add where from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql.= $db->order("p.tms","DESC");
|
$sql.= $db->order("p.tms","DESC");
|
||||||
$sql.= $db->plimit($max,0);
|
$sql.= $db->plimit($max,0);
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,7 @@ $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'productser
|
|||||||
if ((string) $type == '1') { $contextpage='servicelist'; if ($search_type=='') $search_type='1'; }
|
if ((string) $type == '1') { $contextpage='servicelist'; if ($search_type=='') $search_type='1'; }
|
||||||
if ((string) $type == '0') { $contextpage='productlist'; if ($search_type=='') $search_type='0'; }
|
if ((string) $type == '0') { $contextpage='productlist'; if ($search_type=='') $search_type='0'; }
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
|
||||||
$hookmanager->initHooks(array($contextpage));
|
$hookmanager->initHooks(array($contextpage));
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user